[PATCH] D51967: [PDB] Use the raw PDB symbol interface more accurately
Aleksandr Urakov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 14 00:47:29 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342208: [PDB] Use the raw PDB symbol interface more accurately (authored by aleksandr.urakov, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D51967?vs=165231&id=165434#toc
Repository:
rL LLVM
https://reviews.llvm.org/D51967
Files:
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
Index: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
===================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -269,23 +269,49 @@
GetClassOrFunctionParent(const llvm::pdb::PDBSymbol &symbol) {
const IPDBSession &session = symbol.getSession();
const IPDBRawSymbol &raw = symbol.getRawSymbol();
+ auto tag = symbol.getSymTag();
- auto class_parent_id = raw.getClassParentId();
- if (auto class_parent = session.getSymbolById(class_parent_id))
- return class_parent;
-
- auto lexical_parent_id = raw.getLexicalParentId();
- auto lexical_parent = session.getSymbolById(lexical_parent_id);
- if (!lexical_parent)
- return nullptr;
+ // For items that are nested inside of a class, return the class that it is
+ // nested inside of.
+ // Note that only certain items can be nested inside of classes.
+ switch (tag) {
+ case PDB_SymType::Function:
+ case PDB_SymType::Data:
+ case PDB_SymType::UDT:
+ case PDB_SymType::Enum:
+ case PDB_SymType::FunctionSig:
+ case PDB_SymType::Typedef:
+ case PDB_SymType::BaseClass:
+ case PDB_SymType::VTable: {
+ auto class_parent_id = raw.getClassParentId();
+ if (auto class_parent = session.getSymbolById(class_parent_id))
+ return class_parent;
+ }
+ default:
+ break;
+ }
- auto lexical_parent_tag = lexical_parent->getSymTag();
- if (lexical_parent_tag == PDB_SymType::Function)
- return lexical_parent;
- if (lexical_parent_tag == PDB_SymType::Exe)
- return nullptr;
+ // Otherwise, if it is nested inside of a function, return the function.
+ // Note that only certain items can be nested inside of functions.
+ switch (tag) {
+ case PDB_SymType::Block:
+ case PDB_SymType::Data: {
+ auto lexical_parent_id = raw.getLexicalParentId();
+ auto lexical_parent = session.getSymbolById(lexical_parent_id);
+ if (!lexical_parent)
+ return nullptr;
+
+ auto lexical_parent_tag = lexical_parent->getSymTag();
+ if (lexical_parent_tag == PDB_SymType::Function)
+ return lexical_parent;
+ if (lexical_parent_tag == PDB_SymType::Exe)
+ return nullptr;
- return GetClassOrFunctionParent(*lexical_parent);
+ return GetClassOrFunctionParent(*lexical_parent);
+ }
+ default:
+ return nullptr;
+ }
}
static clang::NamedDecl *
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51967.165434.patch
Type: text/x-patch
Size: 2412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180914/30892890/attachment.bin>
More information about the llvm-commits
mailing list