[Lldb-commits] [PATCH] D44164: [SymbolFilePDB] Get line number for PDBSymbolTypeEnum
Aaron Smith via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 6 10:38:08 PST 2018
asmith created this revision.
asmith added reviewers: zturner, lldb-commits, rnk.
Herald added a subscriber: llvm-commits.
Repository:
rL LLVM
https://reviews.llvm.org/D44164
Files:
lit/SymbolFile/PDB/enums-layout.test
source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
Index: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
===================================================================
--- source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -170,14 +170,17 @@
bool GetDeclarationForSymbol(const PDBSymbol &symbol, Declaration &decl) {
auto &raw_sym = symbol.getRawSymbol();
- auto lines_up = symbol.getSession().findLineNumbersByAddress(
- raw_sym.getVirtualAddress(), raw_sym.getLength());
- if (!lines_up)
- return false;
- auto first_line_up = lines_up->getNext();
- if (!first_line_up)
- return false;
-
+ auto first_line_up = raw_sym.getSrcLineOnTypeDefn();
+
+ if (!first_line_up) {
+ auto lines_up = symbol.getSession().findLineNumbersByAddress(
+ raw_sym.getVirtualAddress(), raw_sym.getLength());
+ if (!lines_up)
+ return false;
+ first_line_up = lines_up->getNext();
+ if (!first_line_up)
+ return false;
+ }
uint32_t src_file_id = first_line_up->getSourceFileId();
auto src_file_up = symbol.getSession().getSourceFileById(src_file_id);
if (!src_file_up)
@@ -269,6 +272,7 @@
if (ClangASTContext::StartTagDeclarationDefinition(ast_enum))
ClangASTContext::CompleteTagDeclarationDefinition(ast_enum);
+ GetDeclarationForSymbol(type, decl);
return std::make_shared<lldb_private::Type>(
type.getSymIndexId(), m_ast.GetSymbolFile(), ConstString(name), bytes,
nullptr, LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl,
Index: lit/SymbolFile/PDB/enums-layout.test
===================================================================
--- lit/SymbolFile/PDB/enums-layout.test
+++ lit/SymbolFile/PDB/enums-layout.test
@@ -8,35 +8,35 @@
CHECK: Module [[CU:.*]]
CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor ([[CU]])
-CHECK: Type{{.*}} , name = "Enum", size = 4, compiler_type = {{.*}} enum Enum {
+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:}
-CHECK: Type{{.*}} , name = "EnumConst", size = 4, compiler_type = {{.*}} enum EnumConst {
+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:}
-CHECK: Type{{.*}} , name = "EnumEmpty", size = 4, compiler_type = {{.*}} enum EnumEmpty {
+CHECK: Type{{.*}} , name = "EnumEmpty", size = 4, decl = SimpleTypesTest.cpp:25, compiler_type = {{.*}} enum EnumEmpty {
CHECK-NEXT:}
-CHECK: Type{{.*}} , name = "EnumUChar", size = 1, compiler_type = {{.*}} enum EnumUChar {
+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:}
; Note that `enum EnumClass` is tested instead of `enum class EnumClass`
-CHECK: Type{{.*}} , name = "EnumClass", size = 4, compiler_type = {{.*}} enum 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, compiler_type = {{.*}} enum EnumStruct {
+CHECK: Type{{.*}} , name = "EnumStruct", size = 4, decl = SimpleTypesTest.cpp:35, compiler_type = {{.*}} enum EnumStruct {
CHECK-NEXT: red,
CHECK-NEXT: blue,
CHECK-NEXT: black
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44164.137229.patch
Type: text/x-patch
Size: 3614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180306/5d4dabf8/attachment.bin>
More information about the lldb-commits
mailing list