summaryrefslogtreecommitdiffstats
path: root/lldb/source/Symbol/ClangASTContext.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-12-23 13:08:22 +0100
committerRaphael Isemann <teemperor@gmail.com>2019-12-23 13:22:29 +0100
commit40bd809b6d5cfe69ffcb567245bc521b971a80eb (patch)
tree17400f18c67cebef19ecbf58da1f32ef78553587 /lldb/source/Symbol/ClangASTContext.cpp
parent5bd9eee53d124d00885395f6f2d6a8c64deca188 (diff)
downloadbcm5719-llvm-40bd809b6d5cfe69ffcb567245bc521b971a80eb.tar.gz
bcm5719-llvm-40bd809b6d5cfe69ffcb567245bc521b971a80eb.zip
[lldb][NFC] Simplify ClangExternalASTSourceCallbacks
This class is only used by the ClangASTContext so we might as well simplify this whole logic by just passing a ClangASTContext instead of a list of callbacks and a void* pointer. If we ever need this to support other classes then we can define some interface that ClangASTContext implements but for now this isn't needed. I also removed any code for m_callback_find_by_name as this was always a nullptr in LLDB and removed all overriden implementations that just redefined the default no-op implementation that the ExternalASTSource provides. Also removed the assert.h workarounds.
Diffstat (limited to 'lldb/source/Symbol/ClangASTContext.cpp')
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index ae5fe561528..c7ab37998a9 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -729,10 +729,7 @@ void ClangASTContext::CreateASTContext() {
GetASTMap().Insert(m_ast_up.get(), this);
llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> ast_source_up(
- new ClangExternalASTSourceCallbacks(
- ClangASTContext::CompleteTagDecl,
- ClangASTContext::CompleteObjCInterfaceDecl, nullptr,
- ClangASTContext::LayoutRecordType, this));
+ new ClangExternalASTSourceCallbacks(*this));
SetExternalSource(ast_source_up);
}
@@ -8929,9 +8926,8 @@ clang::ClassTemplateDecl *ClangASTContext::ParseClassTemplateDecl(
return nullptr;
}
-void ClangASTContext::CompleteTagDecl(void *baton, clang::TagDecl *decl) {
- ClangASTContext *ast = (ClangASTContext *)baton;
- SymbolFile *sym_file = ast->GetSymbolFile();
+void ClangASTContext::CompleteTagDecl(clang::TagDecl *decl) {
+ SymbolFile *sym_file = GetSymbolFile();
if (sym_file) {
CompilerType clang_type = GetTypeForDecl(decl);
if (clang_type)
@@ -8940,9 +8936,8 @@ void ClangASTContext::CompleteTagDecl(void *baton, clang::TagDecl *decl) {
}
void ClangASTContext::CompleteObjCInterfaceDecl(
- void *baton, clang::ObjCInterfaceDecl *decl) {
- ClangASTContext *ast = (ClangASTContext *)baton;
- SymbolFile *sym_file = ast->GetSymbolFile();
+ clang::ObjCInterfaceDecl *decl) {
+ SymbolFile *sym_file = GetSymbolFile();
if (sym_file) {
CompilerType clang_type = GetTypeForDecl(decl);
if (clang_type)
@@ -8963,19 +8958,18 @@ PDBASTParser *ClangASTContext::GetPDBParser() {
}
bool ClangASTContext::LayoutRecordType(
- void *baton, const clang::RecordDecl *record_decl, uint64_t &bit_size,
+ const clang::RecordDecl *record_decl, uint64_t &bit_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) {
- ClangASTContext *ast = (ClangASTContext *)baton;
lldb_private::ClangASTImporter *importer = nullptr;
- if (ast->m_dwarf_ast_parser_up)
- importer = &ast->m_dwarf_ast_parser_up->GetClangASTImporter();
- if (!importer && ast->m_pdb_ast_parser_up)
- importer = &ast->m_pdb_ast_parser_up->GetClangASTImporter();
+ if (m_dwarf_ast_parser_up)
+ importer = &m_dwarf_ast_parser_up->GetClangASTImporter();
+ if (!importer && m_pdb_ast_parser_up)
+ importer = &m_pdb_ast_parser_up->GetClangASTImporter();
if (!importer)
return false;
OpenPOWER on IntegriCloud