diff options
Diffstat (limited to 'test/tools/llvm-pdbdump')
-rw-r--r-- | test/tools/llvm-pdbdump/Inputs/ClassLayoutTest.cpp | 64 | ||||
-rw-r--r-- | test/tools/llvm-pdbdump/Inputs/ClassLayoutTest.pdb | bin | 0 -> 35840 bytes | |||
-rw-r--r-- | test/tools/llvm-pdbdump/Inputs/FilterTest.cpp | 29 | ||||
-rw-r--r-- | test/tools/llvm-pdbdump/Inputs/FilterTest.pdb | bin | 0 -> 44032 bytes | |||
-rw-r--r-- | test/tools/llvm-pdbdump/class-layout.test | 57 | ||||
-rw-r--r-- | test/tools/llvm-pdbdump/enum-layout.test | 20 | ||||
-rw-r--r-- | test/tools/llvm-pdbdump/lit.local.cfg | 1 | ||||
-rw-r--r-- | test/tools/llvm-pdbdump/regex-filter.test | 75 |
8 files changed, 246 insertions, 0 deletions
diff --git a/test/tools/llvm-pdbdump/Inputs/ClassLayoutTest.cpp b/test/tools/llvm-pdbdump/Inputs/ClassLayoutTest.cpp new file mode 100644 index 0000000..51c1b9b --- /dev/null +++ b/test/tools/llvm-pdbdump/Inputs/ClassLayoutTest.cpp @@ -0,0 +1,64 @@ +// Compile with "cl /c /Zi /GR- ClassLayoutTest.cpp"
+// Link with "link ClassLayoutTest.obj /debug /nodefaultlib /entry:main"
+
+namespace MembersTest {
+ class A {
+ public:
+ typedef int NestedTypedef;
+ enum NestedEnum {
+ NestedEnumValue1
+ };
+
+ void MemberFunc() {}
+
+ private:
+ int IntMemberVar;
+ double DoubleMemberVar;
+ };
+}
+
+namespace GlobalsTest {
+ int IntVar;
+ double DoubleVar;
+
+ typedef int Typedef;
+ enum Enum {
+ Val1
+ } EnumVar;
+ Typedef TypedefVar;
+}
+
+namespace BaseClassTest {
+ class A {};
+ class B : public virtual A {};
+ class C : public virtual A {};
+ class D : protected B, private C {};
+}
+
+namespace UdtKindTest {
+ struct A {};
+ class B {};
+ union C {};
+}
+
+namespace BitFieldTest {
+ struct A {
+ int Bits1 : 1;
+ int Bits2 : 2;
+ int Bits3 : 3;
+ int Bits4 : 4;
+ int Bits22 : 22;
+ int Offset0x04;
+ };
+};
+
+int main(int argc, char **argv) {
+ MembersTest::A v1;
+ v1.MemberFunc();
+ BaseClassTest::D v2;
+ UdtKindTest::A v3;
+ UdtKindTest::B v4;
+ UdtKindTest::C v5;
+ BitFieldTest::A v7;
+ return 0;
+}
diff --git a/test/tools/llvm-pdbdump/Inputs/ClassLayoutTest.pdb b/test/tools/llvm-pdbdump/Inputs/ClassLayoutTest.pdb Binary files differnew file mode 100644 index 0000000..5f5190d --- /dev/null +++ b/test/tools/llvm-pdbdump/Inputs/ClassLayoutTest.pdb diff --git a/test/tools/llvm-pdbdump/Inputs/FilterTest.cpp b/test/tools/llvm-pdbdump/Inputs/FilterTest.cpp new file mode 100644 index 0000000..5f803e6 --- /dev/null +++ b/test/tools/llvm-pdbdump/Inputs/FilterTest.cpp @@ -0,0 +1,29 @@ +// Compile with "cl /c /Zi /GR- FilterTest.cpp"
+// Link with "link FilterTest.obj /debug /nodefaultlib /entry:main"
+
+class FilterTestClass {
+public:
+ typedef int NestedTypedef;
+ enum NestedEnum {
+ NestedEnumValue1
+ };
+
+ void MemberFunc() {}
+
+private:
+ int IntMemberVar;
+ double DoubleMemberVar;
+};
+
+int IntGlobalVar;
+double DoubleGlobalVar;
+typedef int GlobalTypedef;
+enum GlobalEnum {
+ GlobalEnumVal1
+} GlobalEnumVar;
+
+int main(int argc, char **argv) {
+ FilterTestClass TestClass;
+ GlobalTypedef v1;
+ return 0;
+}
diff --git a/test/tools/llvm-pdbdump/Inputs/FilterTest.pdb b/test/tools/llvm-pdbdump/Inputs/FilterTest.pdb Binary files differnew file mode 100644 index 0000000..5f01ec7 --- /dev/null +++ b/test/tools/llvm-pdbdump/Inputs/FilterTest.pdb diff --git a/test/tools/llvm-pdbdump/class-layout.test b/test/tools/llvm-pdbdump/class-layout.test new file mode 100644 index 0000000..c46e62b --- /dev/null +++ b/test/tools/llvm-pdbdump/class-layout.test @@ -0,0 +1,57 @@ +; RUN: llvm-pdbdump -all %p/Inputs/ClassLayoutTest.pdb > %t
+; RUN: FileCheck -input-file=%t %s -check-prefix=GLOBALS_TEST
+; RUN: FileCheck -input-file=%t %s -check-prefix=MEMBERS_TEST
+; RUN: FileCheck -input-file=%t %s -check-prefix=BASE_CLASS_A
+; RUN: FileCheck -input-file=%t %s -check-prefix=BASE_CLASS_B
+; RUN: FileCheck -input-file=%t %s -check-prefix=BASE_CLASS_C
+; RUN: FileCheck -input-file=%t %s -check-prefix=BASE_CLASS_D
+; RUN: FileCheck -input-file=%t %s -check-prefix=UDT_KIND_TEST
+; RUN: FileCheck -input-file=%t %s -check-prefix=BITFIELD_TEST
+
+; GLOBALS_TEST: ---GLOBALS---
+; GLOBALS_TEST-DAG: int GlobalsTest::IntVar
+; GLOBALS_TEST-DAG: double GlobalsTest::DoubleVar
+; GLOBALS_TEST-DAG: GlobalsTest::Enum GlobalsTest::EnumVar
+
+; MEMBERS_TEST: ---TYPES---
+; MEMBERS_TEST: class MembersTest::A {
+; MEMBERS_TEST-DAG: typedef int NestedTypedef
+; MEMBERS_TEST-DAG: enum NestedEnum
+; MEMBERS_TEST: public:
+; MEMBERS_TEST-NEXT: void MemberFunc()
+; MEMBERS_TEST-NEXT: private:
+; MEMBERS_TEST-DAG: int IntMemberVar
+; MEMBERS_TEST-DAG: double DoubleMemberVar
+; MEMBERS_TEST: }
+
+; BASE_CLASS_A: ---TYPES---
+; BASE_CLASS_A: class BaseClassTest::A {}
+
+; BASE_CLASS_B: ---TYPES---
+; BASE_CLASS_B: class BaseClassTest::B
+; BASE_CLASS_B-NEXT: : public virtual BaseClassTest::A {
+
+; BASE_CLASS_C: ---TYPES---
+; BASE_CLASS_C: class BaseClassTest::C
+; BASE_CLASS_C-NEXT: : public virtual BaseClassTest::A {
+
+; BASE_CLASS_D: ---TYPES---
+; BASE_CLASS_D: class BaseClassTest::D
+; BASE_CLASS_D-DAG: protected BaseClassTest::B
+; BASE_CLASS_D-DAG: private BaseClassTest::C
+; BASE_CLASS_D-DAG: protected virtual BaseClassTest::A
+
+; UDT_KIND_TEST: ---TYPES---
+; UDT_KIND_TEST-DAG: union UdtKindTest::C {}
+; UDT_KIND_TEST-DAG: class UdtKindTest::B {}
+; UDT_KIND_TEST-DAG: struct UdtKindTest::A {}
+
+; BITFIELD_TEST: ---TYPES---
+; BITFIELD_TEST: struct BitFieldTest::A {
+; BITFIELD_TEST-NEXT: public:
+; BITFIELD_TEST-NEXT: +0x00 int Bits1 : 1
+; BITFIELD_TEST-NEXT: +0x00 int Bits2 : 2
+; BITFIELD_TEST-NEXT: +0x00 int Bits3 : 3
+; BITFIELD_TEST-NEXT: +0x00 int Bits4 : 4
+; BITFIELD_TEST-NEXT: +0x00 int Bits22 : 22
+; BITFIELD_TEST-NEXT: +0x04 int Offset0x04
diff --git a/test/tools/llvm-pdbdump/enum-layout.test b/test/tools/llvm-pdbdump/enum-layout.test new file mode 100644 index 0000000..c614553 --- /dev/null +++ b/test/tools/llvm-pdbdump/enum-layout.test @@ -0,0 +1,20 @@ +; RUN: llvm-pdbdump -types %p/Inputs/ClassLayoutTest.pdb > %t
+; RUN: FileCheck -input-file=%t %s -check-prefix=GLOBAL_ENUM
+; RUN: FileCheck -input-file=%t %s -check-prefix=MEMBER_ENUM
+
+; GLOBAL_ENUM: ---TYPES---
+; GLOBAL_ENUM: Enums:
+; GLOBAL_ENUM: enum GlobalsTest::Enum {
+; GLOBAL_ENUM-NEXT: Val1 = 0
+; GLOBAL_ENUM-NEXT: }
+
+; MEMBER_ENUM: ---TYPES---
+; MEMBER_ENUM: Classes:
+; MEMBER_ENUM: struct __vc_attributes::threadingAttribute {
+; MEMBER_ENUM-NEXT: enum threading_e {
+; MEMBER_ENUM-NEXT: apartment = 1
+; MEMBER_ENUM-NEXT: single = 2
+; MEMBER_ENUM-NEXT: free = 3
+; MEMBER_ENUM-NEXT: neutral = 4
+; MEMBER_ENUM-NEXT: both = 5
+; MEMBER_ENUM-NEXT: }
diff --git a/test/tools/llvm-pdbdump/lit.local.cfg b/test/tools/llvm-pdbdump/lit.local.cfg new file mode 100644 index 0000000..28a895f --- /dev/null +++ b/test/tools/llvm-pdbdump/lit.local.cfg @@ -0,0 +1 @@ +config.unsupported = not config.have_dia_sdk diff --git a/test/tools/llvm-pdbdump/regex-filter.test b/test/tools/llvm-pdbdump/regex-filter.test new file mode 100644 index 0000000..8b9eca6 --- /dev/null +++ b/test/tools/llvm-pdbdump/regex-filter.test @@ -0,0 +1,75 @@ +; RUN: llvm-pdbdump -symbols -globals -types %p/Inputs/FilterTest.pdb \ +; RUN: | FileCheck --check-prefix=NO_FILTER %s +; RUN: llvm-pdbdump -types -exclude-types="GlobalTypedef|NestedTypedef" \ +; RUN: %p/Inputs/FilterTest.pdb | FileCheck --check-prefix=EXCLUDE_TYPEDEFS %s +; RUN: llvm-pdbdump -types -exclude-types="GlobalEnum|NestedEnum" \ +; RUN: %p/Inputs/FilterTest.pdb | FileCheck --check-prefix=EXCLUDE_ENUMS %s +; RUN: llvm-pdbdump -types -symbols -globals -exclude-symbols="MemberVar|GlobalVar" \ +; RUN: %p/Inputs/FilterTest.pdb | FileCheck --check-prefix=EXCLUDE_VARS %s +; RUN: llvm-pdbdump -types -exclude-types="FilterTestClass" \ +; RUN: %p/Inputs/FilterTest.pdb | FileCheck --check-prefix=EXCLUDE_WHOLE_CLASS %s +; RUN: llvm-pdbdump -symbols -globals -exclude-compilands="FilterTest.obj" \ +; RUN: %p/Inputs/FilterTest.pdb | FileCheck --check-prefix=EXCLUDE_COMPILAND %s + +; NO_FILTER: ---TYPES--- +; NO_FILTER: Enums: +; NO_FILTER: enum GlobalEnum +; NO_FILTER: Typedefs +; NO_FILTER: typedef int GlobalTypedef +; NO_FILTER: Classes: +; NO_FILTER: struct __vc_attributes +; NO_FILTER: class FilterTestClass +; NO_FILTER-DAG: typedef int NestedTypedef +; NO_FILTER-DAG: enum NestedEnum +; NO_FILTER-DAG: int IntMemberVar +; NO_FILTER-DAG: double DoubleMemberVar +; NO_FILTER: ---SYMBOLS--- +; NO_FILTER: Inputs\FilterTest.obj +; NO_FILTER: int __cdecl main(int argc, char** argv) +; NO_FILTER: ---GLOBALS--- +; NO_FILTER-DAG: double DoubleGlobalVar +; NO_FILTER-DAG: int IntGlobalVar +; NO_FILTER-DAG: GlobalEnum GlobalEnumVar + +; EXCLUDE_TYPEDEFS: ---TYPES--- +; EXCLUDE_TYPEDEFS: Enums: +; EXCLUDE_TYPEDEFS: GlobalEnum +; EXCLUDE_TYPEDEFS: Typedefs +; EXCLUDE_TYPEDEFS-NOT: GlobalTypedef +; EXCLUDE_TYPEDEFS: Classes +; EXCLUDE_TYPEDEFS: class FilterTestClass +; EXCLUDE_TYPEDEFS-NOT: NestedTypedef +; EXCLUDE_TYPEDEFS: private: + +; EXCLUDE_ENUMS: ---TYPES--- +; EXCLUDE_ENUMS: Enums: +; EXCLUDE_ENUMS-NOT: GlobalEnum +; EXCLUDE_ENUMS: Typedefs +; EXCLUDE_ENUMS: GlobalTypedef +; EXCLUDE_ENUMS: Classes +; EXCLUDE_ENUMS: class FilterTestClass +; EXCLUDE_ENUMS-NOT: NestedEnum +; EXCLUDE_ENUMS: private: + +; EXCLUDE_VARS: ---TYPES--- +; EXCLUDE_VARS: Classes: +; EXCLUDE_VARS: class FilterTestClass +; EXCLUDE_VARS: private: +; EXCLUDE_VARS-NOT: IntMemberVar +; EXCLUDE_VARS-NOT: DoubleMemberVar +; EXCLUDE_VARS: ---GLOBALS--- +; EXCLUDE_VARS-NOT: DoubleGlobalVar +; EXCLUDE_VARS-NOT: IntGlobalVar + +; EXCLUDE_WHOLE_CLASS: ---TYPES--- +; EXCLUDE_WHOLE_CLASS-NOT: class FilterTestClass +; EXCLUDE_WHOLE_CLASS-NOT: typedef int NestedTypedef +; EXCLUDE_WHOLE_CLASS-NOT: enum NestedEnum +; EXCLUDE_WHOLE_CLASS-NOT: int IntMemberVar +; EXCLUDE_WHOLE_CLASS-NOT: double DoubleMemberVar + +; EXCLUDE_COMPILAND: ---SYMBOLS--- +; EXCLUDE_COMPILAND-NOT: FilterTest.obj +; EXCLUDE_COMPILAND-NOT: __cdecl main +; EXCLUDE_COMPILAND: * Linker * +; EXCLUDE_COMPILAND: ---GLOBALS--- |