diff options
author | Greg Clayton <gclayton@apple.com> | 2015-08-18 22:32:36 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2015-08-18 22:32:36 +0000 |
commit | 6dc8d583b9656f2d28dd58bd4347c92caf793168 (patch) | |
tree | 2709ee07dc227b4782f5769fc4c1b54b1414c7dc /lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp | |
parent | 7b1c497862dfce03f96356c28a96ea2f2a9500ec (diff) | |
download | bcm5719-llvm-6dc8d583b9656f2d28dd58bd4347c92caf793168.tar.gz bcm5719-llvm-6dc8d583b9656f2d28dd58bd4347c92caf793168.zip |
More abstraction to get almost all clang specific DWARF parsing code into ClangASTContext.
llvm-svn: 245376
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp')
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp | 85 |
1 files changed, 18 insertions, 67 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 7c7706f12e1..e2ab962a948 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -24,7 +24,6 @@ #endif #include "lldb/Core/Timer.h" -#include "lldb/Symbol/ClangExternalASTSourceCallbacks.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/ObjectFile.h" @@ -298,15 +297,9 @@ SymbolFileDWARFDebugMap::~SymbolFileDWARFDebugMap() void SymbolFileDWARFDebugMap::InitializeObject() { - // Install our external AST source callbacks so we can complete Clang types. - llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> ast_source_ap ( - new ClangExternalASTSourceCallbacks (SymbolFileDWARFDebugMap::CompleteTagDecl, - SymbolFileDWARFDebugMap::CompleteObjCInterfaceDecl, - NULL, - SymbolFileDWARFDebugMap::LayoutRecordType, - this)); - - GetClangASTContext().SetExternalSource (ast_source_ap); + // Set the symbol file to this file. This allows the clang ASTContext to complete + // types using this symbol file when it needs to complete classes and structures. + GetClangASTContext().SetSymbolFile(this); } void @@ -788,10 +781,22 @@ SymbolFileDWARFDebugMap::ResolveTypeUID(lldb::user_id_t type_uid) } bool -SymbolFileDWARFDebugMap::ResolveClangOpaqueTypeDefinition (CompilerType& clang_type) +SymbolFileDWARFDebugMap::CompleteType (CompilerType& clang_type) { - // We have a struct/union/class/enum that needs to be fully resolved. - return false; + bool success = false; + if (clang_type) + { + ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { + if (oso_dwarf->HasForwardDeclForClangType (clang_type)) + { + oso_dwarf->CompleteType (clang_type); + success = true; + return true; + } + return false; + }); + } + return success; } uint32_t @@ -1428,60 +1433,6 @@ SymbolFileDWARFDebugMap::SetCompileUnit (SymbolFileDWARF *oso_dwarf, const CompU } } - -void -SymbolFileDWARFDebugMap::CompleteTagDecl (void *baton, clang::TagDecl *decl) -{ - SymbolFileDWARFDebugMap *symbol_file_dwarf = (SymbolFileDWARFDebugMap *)baton; - CompilerType clang_type = symbol_file_dwarf->GetClangASTContext().GetTypeForDecl (decl); - if (clang_type) - { - symbol_file_dwarf->ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { - if (oso_dwarf->HasForwardDeclForClangType (clang_type)) - { - oso_dwarf->ResolveClangOpaqueTypeDefinition (clang_type); - return true; - } - return false; - }); - } -} - -void -SymbolFileDWARFDebugMap::CompleteObjCInterfaceDecl (void *baton, clang::ObjCInterfaceDecl *decl) -{ - SymbolFileDWARFDebugMap *symbol_file_dwarf = (SymbolFileDWARFDebugMap *)baton; - CompilerType clang_type = symbol_file_dwarf->GetClangASTContext().GetTypeForDecl (decl); - if (clang_type) - { - symbol_file_dwarf->ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { - if (oso_dwarf->HasForwardDeclForClangType (clang_type)) - { - oso_dwarf->ResolveClangOpaqueTypeDefinition (clang_type); - return true; - } - return false; - }); - } -} - -bool -SymbolFileDWARFDebugMap::LayoutRecordType(void *baton, const clang::RecordDecl *record_decl, uint64_t &size, - uint64_t &alignment, - llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets, - llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets, - llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &vbase_offsets) -{ - SymbolFileDWARFDebugMap *symbol_file_dwarf = (SymbolFileDWARFDebugMap *)baton; - bool laid_out = false; - symbol_file_dwarf->ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { - return (laid_out = SymbolFileDWARF::LayoutRecordType (oso_dwarf, record_decl, size, alignment, field_offsets, base_offsets, vbase_offsets)); - }); - return laid_out; -} - - - clang::DeclContext* SymbolFileDWARFDebugMap::GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid) { |