Files
clang-p2996/lldb/lit/SymbolFile/PDB/ast-restore.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

78 lines
2.3 KiB
Plaintext

REQUIRES: windows
RUN: cl /Zi /GS- /c %S/Inputs/AstRestoreTest.cpp /Fo%t.obj
RUN: link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=ENUM %s
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=GLOBAL %s
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=BASE %s
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=CLASS %s
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=INNER %s
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=FOO %s
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=MAIN %s
ENUM: Module: {{.*}}
ENUM: namespace N0 {
ENUM: namespace N1 {
ENUM: namespace {
ENUM: enum Enum {
ENUM: Enum_0,
ENUM: Enum_1,
ENUM: Enum_2,
ENUM: Enum_3
ENUM: };
ENUM: }
ENUM: }
ENUM: }
GLOBAL: Module: {{.*}}
GLOBAL: namespace N0 {
GLOBAL: namespace N1 {
GLOBAL: N0::N1::(anonymous namespace)::Enum Global;
GLOBAL: }
GLOBAL: }
BASE: Module: {{.*}}
BASE: namespace N0 {
BASE: namespace N1 {
BASE: struct Base {
BASE: N0::N1::(anonymous namespace)::Enum m_e;
BASE: };
BASE: }
BASE: }
CLASS: Module: {{.*}}
CLASS: namespace N0 {
CLASS: namespace N1 {
CLASS: class Class : public N0::N1::Base {
CLASS-DAG: const N0::N1::(anonymous namespace)::Enum m_ce;
CLASS-DAG: static int ClassStatic;
CLASS-DAG: N0::N1::Class::Inner m_inner;
CLASS-DAG: {{(inline )?}}Class(N0::N1::(anonymous namespace)::Enum);
CLASS-DAG: static {{(inline )?}}int StaticFunc(const N0::N1::Class &);
CLASS-DAG: {{(inline )?}}int PrivateFunc(const N0::N1::Class::Inner &);
CLASS: };
CLASS: }
CLASS: }
INNER: Module: {{.*}}
INNER: namespace N0 {
INNER: namespace N1 {
INNER: class Class : public N0::N1::Base {
INNER: struct Inner {
INNER: signed char x;
INNER: short y;
INNER: int z;
INNER: };
INNER: };
INNER: }
INNER: }
FOO: Module: {{.*}}
FOO: namespace N0 {
FOO: namespace N1 {
FOO: void foo();
FOO: }
FOO: }
MAIN: Module: {{.*}}
MAIN: int main();