summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/lit/SymbolFile/PDB/enums-layout.test67
-rw-r--r--lldb/lit/SymbolFile/PDB/type-quals.test48
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp23
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h4
-rw-r--r--lldb/tools/lldb-test/lldb-test.cpp4
5 files changed, 86 insertions, 60 deletions
diff --git a/lldb/lit/SymbolFile/PDB/enums-layout.test b/lldb/lit/SymbolFile/PDB/enums-layout.test
index 879fdd3fd95..79efb259663 100644
--- a/lldb/lit/SymbolFile/PDB/enums-layout.test
+++ b/lldb/lit/SymbolFile/PDB/enums-layout.test
@@ -1,44 +1,45 @@
REQUIRES: system-windows, msvc
RUN: %build --compiler=msvc --arch=32 --nodefaultlib --output=%T/SimpleTypesTest.cpp.enums.exe %S/Inputs/SimpleTypesTest.cpp
-RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck %s
+RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM %s
+RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_CONST %s
+RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_EMPTY %s
+RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_UCHAR %s
+RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_CLASS %s
+RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_STRUCT %s
; FIXME: PDB does not have information about scoped enumeration (Enum class) so the
; compiler type used is the same as the one for unscoped enumeration.
-CHECK: Module [[CU:.*]]
-CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor ([[CU]])
-CHECK: Type{{.*}} , name = "Enum", size = 4, decl = simpletypestest.cpp:19, compiler_type = {{.*}} enum Enum {
-CHECK-NEXT: RED,
-CHECK-NEXT: GREEN,
-CHECK-NEXT: BLUE
-CHECK-NEXT:}
+ENUM: Type{{.*}} , name = "Enum", size = 4, decl = simpletypestest.cpp:19, compiler_type = {{.*}} enum Enum {
+ENUM_NEXT: RED,
+ENUM_NEXT: GREEN,
+ENUM_NEXT: BLUE
+ENUM_NEXT:}
-CHECK: Type{{.*}} , name = "EnumConst", size = 4, decl = simpletypestest.cpp:22, compiler_type = {{.*}} enum EnumConst {
-CHECK-NEXT: LOW,
-CHECK-NEXT: NORMAL,
-CHECK-NEXT: HIGH
-CHECK-NEXT:}
+ENUM_CONST: Type{{.*}} , name = "EnumConst", size = 4, decl = simpletypestest.cpp:22, compiler_type = {{.*}} enum EnumConst {
+ENUM_CONST-NEXT: LOW,
+ENUM_CONST-NEXT: NORMAL,
+ENUM_CONST-NEXT: HIGH
+ENUM_CONST-NEXT:}
-CHECK: Type{{.*}} , name = "EnumEmpty", size = 4, decl = simpletypestest.cpp:25, compiler_type = {{.*}} enum EnumEmpty {
-CHECK-NEXT:}
+ENUM_EMPTY: Type{{.*}} , name = "EnumEmpty", size = 4, decl = simpletypestest.cpp:25, compiler_type = {{.*}} enum EnumEmpty {
+ENUM_EMPTY-NEXT:}
-CHECK: Type{{.*}} , name = "EnumUChar", size = 1, decl = simpletypestest.cpp:28, compiler_type = {{.*}} enum EnumUChar {
-CHECK-NEXT: ON,
-CHECK-NEXT: OFF,
-CHECK-NEXT: AUTO
-CHECK-NEXT:}
+ENUM_UCHAR: Type{{.*}} , name = "EnumUChar", size = 1, decl = simpletypestest.cpp:28, compiler_type = {{.*}} enum EnumUChar {
+ENUM_UCHAR-NEXT: ON,
+ENUM_UCHAR-NEXT: OFF,
+ENUM_UCHAR-NEXT: AUTO
+ENUM_UCHAR-NEXT:}
; Note that `enum EnumClass` is tested instead of `enum class EnumClass`
-CHECK: Type{{.*}} , name = "EnumClass", size = 4, decl = simpletypestest.cpp:32, compiler_type = {{.*}} enum EnumClass {
-CHECK-NEXT: YES,
-CHECK-NEXT: NO,
-CHECK-NEXT: DEFAULT
-CHECK-NEXT:}
-
-CHECK: Type{{.*}} , name = "EnumStruct", size = 4, decl = simpletypestest.cpp:35, compiler_type = {{.*}} enum EnumStruct {
-CHECK-NEXT: red,
-CHECK-NEXT: blue,
-CHECK-NEXT: black
-CHECK-NEXT:}
-
-CHECK-DAG: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\SimpleTypesTest.cpp'
+ENUM_CLASS: Type{{.*}} , name = "EnumClass", size = 4, decl = simpletypestest.cpp:32, compiler_type = {{.*}} enum EnumClass {
+ENUM_CLASS-NEXT: YES,
+ENUM_CLASS-NEXT: NO,
+ENUM_CLASS-NEXT: DEFAULT
+ENUM_CLASS-NEXT:}
+
+ENUM_STRUCT: Type{{.*}} , name = "EnumStruct", size = 4, decl = simpletypestest.cpp:35, compiler_type = {{.*}} enum EnumStruct {
+ENUM_STRUCT-NEXT: red,
+ENUM_STRUCT-NEXT: blue,
+ENUM_STRUCT-NEXT: black
+ENUM_STRUCT-NEXT:}
diff --git a/lldb/lit/SymbolFile/PDB/type-quals.test b/lldb/lit/SymbolFile/PDB/type-quals.test
index 6ee2f794754..8d93991a700 100644
--- a/lldb/lit/SymbolFile/PDB/type-quals.test
+++ b/lldb/lit/SymbolFile/PDB/type-quals.test
@@ -5,35 +5,35 @@ RUN: lldb-test symbols %T/TypeQualsTest.cpp.exe | FileCheck %s
CHECK: Module [[MOD:.*]]
CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor ([[MOD]])
-CHECK: Type{{.*}} , name = "const int", size = 4, compiler_type = {{.*}} const int
-CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *
-CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int **const
-CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const
-CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const *
-CHECK: Type{{.*}} , name = "Func1", {{.*}}, compiler_type = {{.*}} void (const int *, const int *, const int **const, const int *const *)
-
-CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} volatile int *
-CHECK: Type{{.*}} , name = "Func2", {{.*}}, compiler_type = {{.*}} void (volatile int *, volatile int *)
-
-CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int *
-CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int *&
-CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int &
-CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int &
-CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int &&
-CHECK: Type{{.*}} , name = "Func3", {{.*}}, compiler_type = {{.*}} void (int *&, int &, const int &, int &&)
+CHECK-DAG: Type{{.*}} , name = "const int", size = 4, compiler_type = {{.*}} const int
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int **const
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const *
+CHECK-DAG: Type{{.*}} , name = "Func1", {{.*}}, compiler_type = {{.*}} void (const int *, const int *, const int **const, const int *const *)
+
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} volatile int *
+CHECK-DAG: Type{{.*}} , name = "Func2", {{.*}}, compiler_type = {{.*}} void (volatile int *, volatile int *)
+
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int *
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int *&
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int &&
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int &
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int &
+CHECK-DAG: Type{{.*}} , name = "Func3", {{.*}}, compiler_type = {{.*}} void (int *&, int &, const int &, int &&)
// FIXME: __unaligned is not supported.
-CHECK: Type{{.*}} , name = "Func4", {{.*}}, compiler_type = {{.*}} void (int *, int *)
+CHECK-DAG: Type{{.*}} , name = "Func4", {{.*}}, compiler_type = {{.*}} void (int *, int *)
-CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int *__restrict
-CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int &__restrict
-CHECK: Type{{.*}} , name = "Func5", {{.*}}, compiler_type = {{.*}} void (int, int *__restrict, int &__restrict)
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int *__restrict
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int &__restrict
+CHECK-DAG: Type{{.*}} , name = "Func5", {{.*}}, compiler_type = {{.*}} void (int, int *__restrict, int &__restrict)
-CHECK: Type{{.*}} , name = "Func6", {{.*}}, compiler_type = {{.*}} void (const volatile int *__restrict)
+CHECK-DAG: Type{{.*}} , name = "Func6", {{.*}}, compiler_type = {{.*}} void (const volatile int *__restrict)
-CHECK: Type{{.*}} , size = 400, compiler_type = {{.*}} volatile int *[100]
-CHECK: Type{{.*}} , size = 4000, compiler_type = {{.*}} volatile int *[10][100]
+CHECK-DAG: Type{{.*}} , size = 400, compiler_type = {{.*}} volatile int *[100]
+CHECK-DAG: Type{{.*}} , size = 4000, compiler_type = {{.*}} volatile int *[10][100]
-CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} long *__restrict
+CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} long *__restrict
CHECK-DAG: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\TypeQualsTest.cpp'
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index 62bd73fc882..824b7a033ef 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -314,6 +314,16 @@ lldb_private::Function *SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc(
func_type_uid, mangled, func_type, func_range);
sc.comp_unit->AddFunction(func_sp);
+
+ TypeSystem *type_system = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
+ if (!type_system)
+ return nullptr;
+ ClangASTContext *clang_type_system =
+ llvm::dyn_cast_or_null<ClangASTContext>(type_system);
+ if (!clang_type_system)
+ return nullptr;
+ clang_type_system->GetPDBParser()->GetDeclForSymbol(pdb_func);
+
return func_sp.get();
}
@@ -1035,6 +1045,9 @@ SymbolFilePDB::ParseVariables(const lldb_private::SymbolContext &sc,
if (variable_list)
variable_list->AddVariableIfUnique(var_sp);
++num_added;
+ PDBASTParser *ast = GetPDBAstParser();
+ if (ast)
+ ast->GetDeclForSymbol(*pdb_data);
}
}
}
@@ -1623,6 +1636,16 @@ SymbolFilePDB::GetTypeSystemForLanguage(lldb::LanguageType language) {
return type_system;
}
+PDBASTParser *SymbolFilePDB::GetPDBAstParser() {
+ auto type_system = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
+ auto clang_type_system = llvm::dyn_cast_or_null<ClangASTContext>(type_system);
+ if (!clang_type_system)
+ return nullptr;
+
+ return clang_type_system->GetPDBParser();
+}
+
+
lldb_private::CompilerDeclContext SymbolFilePDB::FindNamespace(
const lldb_private::SymbolContext &sc,
const lldb_private::ConstString &name,
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
index e4ca3b6fd24..33c1007de48 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -20,6 +20,8 @@
#include "llvm/DebugInfo/PDB/PDB.h"
#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
+class PDBASTParser;
+
class SymbolFilePDB : public lldb_private::SymbolFile {
public:
//------------------------------------------------------------------
@@ -224,6 +226,8 @@ private:
void GetCompileUnitIndex(const llvm::pdb::PDBSymbolCompiland &pdb_compiland,
uint32_t &index);
+ PDBASTParser *GetPDBAstParser();
+
std::unique_ptr<llvm::pdb::PDBSymbolCompiland>
GetPDBCompilandByUID(uint32_t uid);
diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp
index 62abc42979d..4e2ab504c2d 100644
--- a/lldb/tools/lldb-test/lldb-test.cpp
+++ b/lldb/tools/lldb-test/lldb-test.cpp
@@ -518,6 +518,7 @@ Error opts::symbols::dumpModule(lldb_private::Module &Module) {
Error opts::symbols::dumpAST(lldb_private::Module &Module) {
SymbolVendor &plugin = *Module.GetSymbolVendor();
+ Module.ParseAllDebugSymbols();
auto symfile = plugin.GetSymbolFile();
if (!symfile)
@@ -536,9 +537,6 @@ Error opts::symbols::dumpAST(lldb_private::Module &Module) {
if (!tu)
return make_string_error("Can't retrieve translation unit declaration.");
- symfile->ParseDeclsForContext(CompilerDeclContext(
- clang_ast_ctx, static_cast<clang::DeclContext *>(tu)));
-
tu->print(outs());
return Error::success();
OpenPOWER on IntegriCloud