Files
clang-p2996/lldb/lit/SymbolFile/PDB/class-layout.test
Aleksandr Urakov 709426b33a [PDB] Restore AST from PDB symbols
Summary:
This patch adds an implementation of retrieving of declarations and declaration
contexts based on PDB symbols.

PDB has different type symbols for const-qualified types, and this
implementation ensures that only one declaration was created for both const
and non-const types, but creates different compiler types for them.

The implementation also processes the case when there are two symbols
corresponding to a variable. It's possible e.g. for class static variables,
they has one global symbol and one symbol belonging to a class.

PDB has no info about namespaces, so this implementation parses the full symbol
name and tries to figure out if the symbol belongs to namespace or not,
and then creates nested namespaces if necessary.

Reviewers: asmith, zturner, labath

Reviewed By: asmith

Subscribers: aleksandr.urakov, teemperor, lldb-commits, stella.stamenova

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D51162

llvm-svn: 341782
2018-09-10 08:08:43 +00:00

93 lines
3.1 KiB
Plaintext

REQUIRES: windows
RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/ClassLayoutTest.cpp /o %T/ClassLayoutTest.cpp.obj
RUN: link %T/ClassLayoutTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/ClassLayoutTest.cpp.exe
RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck %s
RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=ENUM %s
RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=UNION %s
RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=STRUCT %s
RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=COMPLEX %s
RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=LIST %s
RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=UNNAMED-STRUCT %s
RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=BASE %s
RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=FRIEND %s
RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=CLASS %s
CHECK: Module [[MOD:.*]]
CHECK: {{^[0-9A-F]+}}: SymbolVendor ([[MOD]])
CHECK: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\ClassLayoutTest.cpp'
ENUM: name = "Enum", size = 4, decl = ClassLayoutTest.cpp:5
ENUM-SAME: enum Enum {
ENUM: RED,
ENUM: GREEN,
ENUM: BLUE
ENUM:}
UNION: name = "Union", size = 4, decl = ClassLayoutTest.cpp:9
UNION-SAME: union Union {
UNION: short Row;
UNION: unsigned short Col;
UNION: int Line : 16;
UNION: long Table;
UNION:}
STRUCT: name = "Struct", size = 64, decl = ClassLayoutTest.cpp:22
STRUCT-SAME: struct Struct {
STRUCT: bool A;
STRUCT: unsigned char UCharVar;
STRUCT: unsigned int UIntVar;
STRUCT: long long LongLongVar;
STRUCT: Enum EnumVar;
STRUCT: int array[10];
STRUCT:}
COMPLEX: name = "Complex", size = 368, decl = ClassLayoutTest.cpp:33
COMPLEX-SAME: struct Complex {
COMPLEX: _List *array[90];
COMPLEX: int x;
COMPLEX: int a;
COMPLEX: float b;
COMPLEX:}
LIST: name = "_List", size = 12, decl = ClassLayoutTest.cpp:45
LIST-SAME: struct _List {
LIST: _List *current;
LIST: _List *previous;
LIST: _List *next;
LIST:}
UNNAMED-STRUCT: name = "UnnamedStruct", size = 4, decl = ClassLayoutTest.cpp:52
UNNAMED-STRUCT-SAME: struct UnnamedStruct {
UNNAMED-STRUCT: int a;
UNNAMED-STRUCT:}
BASE: name = "Base", size = 4, decl = ClassLayoutTest.cpp:59
BASE-SAME: class Base {
BASE: int a;
BASE: Base();
BASE: ~Base();
BASE: int Get();
BASE:}
FRIEND: name = "Friend", size = 1, decl = ClassLayoutTest.cpp:70
FRIEND-SAME: class Friend {
FRIEND: int f();
FRIEND: }
CLASS: name = "Class", size = 88, decl = ClassLayoutTest.cpp:74
CLASS-SAME: class Class : public MemberTest::Base {
CLASS: static int m_static;
CLASS: int m_public;
CLASS: Struct m_struct;
CLASS: Union m_union;
CLASS: int m_private;
CLASS: int m_protected;
CLASS: Class();
CLASS: Class(int);
CLASS: ~Class();
CLASS: static int {{.*}}StaticMemberFunc(int, ...);
CLASS: int Get();
CLASS: int f(MemberTest::Friend);
CLASS: bool operator==(const MemberTest::Class &)
CLASS:}