File: codeview-types.test

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,436 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (95 lines) | stat: -rw-r--r-- 2,582 bytes parent folder | download | duplicates (23)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// This tests that we can deserialize and reserialize every known type record.
// If you need to update the object file, enable the RUNX line below using MSVC
// from VS 2012. Newer versions of MSVC emit tons of internal types for
// attributes that pollute the test output. When Clang fully supports all these
// type records, we can regenerate the test using it instead.

// RUNX: cl -GR- -Z7 -c -TP %s -Fo%S/Inputs/codeview-types.obj
// RUN: llvm-readobj --codeview %S/Inputs/codeview-types.obj | FileCheck %s
// RUN: llvm-readobj --codeview-merged-types %S/Inputs/codeview-types.obj | FileCheck %s

// TYPE_RECORD
// CHECK-DAG: {{^ *Pointer (.*) {$}}
// CHECK-DAG: {{^ *Modifier (.*) {$}}
// CHECK-DAG: {{^ *Procedure (.*) {$}}
// CHECK-DAG: {{^ *MemberFunction (.*) {$}}
// CHECK-DAG: {{^ *ArgList (.*) {$}}
// CHECK-DAG: {{^ *Array (.*) {$}}
// CHECK-DAG: {{^ *Class (.*) {$}}
// CHECK-DAG: {{^ *Union (.*) {$}}
// CHECK-DAG: {{^ *Enum (.*) {$}}
// CHECK-DAG: {{^ *VFTable (.*) {$}}
// CHECK-DAG: {{^ *VFTableShape (.*) {$}}
// CHECK-DAG: {{^ *FuncId (.*) {$}}
// CHECK-DAG: {{^ *MemberFuncId (.*) {$}}
// CHECK-DAG: {{^ *BuildInfo (.*) {$}}
// CHECK-DAG: {{^ *StringId (.*) {$}}
// CHECK-DAG: {{^ *UdtSourceLine (.*) {$}}
// CHECK-DAG: {{^ *MethodOverloadList (.*) {$}}
// No TypeServer2, since that is used with /Zi

// MEMBER_RECORD
// CHECK-DAG: {{^ *BaseClass {$}}
// CHECK-DAG: {{^ *VirtualBaseClass {$}}
// CHECK-DAG: {{^ *VFPtr {$}}
// CHECK-DAG: {{^ *StaticDataMember {$}}
// CHECK-DAG: {{^ *OverloadedMethod {$}}
// CHECK-DAG: {{^ *DataMember {$}}
// CHECK-DAG: {{^ *NestedType {$}}
// CHECK-DAG: {{^ *OneMethod {$}}
// CHECK-DAG: {{^ *Enumerator {$}}

#if !defined(__clang__) && _MSC_VER >= 1800
#error "use clang or MSVC 2012 to regenerate the test"
#endif

struct VBaseA;
void FriendFunc();

class Class {
public:
  const Class *DataMember;
private:
  static int StaticDataMember;
protected:
  virtual void MemberFunction();
public:
  struct Nested;
  friend ::VBaseA;
  friend void FriendFunc() { }
  void OverloadedMethod();
  void OverloadedMethod(int);
};

enum Enum {
  E1 = 0,
  E2 = 1
};

int array[4] = {1, 2, 3, 4};

struct Class::Nested {};

struct ClassWithBase : Class {
  virtual void MemberFunction();
  virtual void NewVirtual();
};
struct VBaseA { int x; };
struct VBaseB : virtual VBaseA { int x; };
struct VBaseC : virtual VBaseA { int x; };
struct VBaseD : VBaseB, VBaseC { int x; };

union Union {
  float f;
  int i;
};

void UseAllTypes() {
  Class a;
  Class::Nested b;
  ClassWithBase c;
  VBaseD d;
  Union e;
  Enum f;
  FriendFunc();
}