[Lldb-commits] [PATCH] D75488: RFC: Preserve the owning module information from DWARF in the synthesized AST

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 2 16:03:26 PST 2020


aprantl created this revision.
aprantl added reviewers: teemperor, shafik, labath.

Types that came from a Clang module are nested in DW_TAG_module tags in DWARF. This patch recreates the Clang module hierarchy in LLDB and sets the owning module information accordingly. My primary motivation is to facilitate looking up per-module APINotes for individual declarations, but this likely also has other applications.

The fact that Clang modules are orthogonal to DeclContexts made the implementation in LLDB challenging. In the end I extended `lldb_private::CompilerDeclContext` to hold a pair of `clang::DeclContext *` and `clang::Module *` and made sure to use CompilerDeclContext everywhere in TypeSystemClang. To save memory for all non-Clang typesystems, the extra data for the owning module ID is hidden in the CompilerDeclContext's opaque pointer: If it isn't a raw clang::DeclContext pointer, it is an index into an array of Module ID + DeclContexts.


https://reviews.llvm.org/D75488

Files:
  clang/include/clang/AST/DeclBase.h
  clang/include/clang/AST/ExternalASTSource.h
  clang/lib/AST/ExternalASTSource.cpp
  clang/lib/Serialization/ASTReader.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
  lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
  lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
  lldb/test/Shell/SymbolFile/DWARF/owning-module.test
  lldb/unittests/Symbol/TestTypeSystemClang.cpp
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  lldb/unittests/TestingSupport/Symbol/ClangTestUtils.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75488.247746.patch
Type: text/x-patch
Size: 101285 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200303/725fe7dd/attachment-0001.bin>


More information about the lldb-commits mailing list