summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-12-23 09:05:07 +0100
committerRaphael Isemann <teemperor@gmail.com>2019-12-23 09:56:54 +0100
commit42ec584a8b4e604360b7a4d45a65c570d58b1bf9 (patch)
tree4aad4736fe921fd2e1fdbd916671d736709a4fdc /lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
parent6d5e35e89d73711b494c83d3f8b68582d06a0b53 (diff)
downloadbcm5719-llvm-42ec584a8b4e604360b7a4d45a65c570d58b1bf9.tar.gz
bcm5719-llvm-42ec584a8b4e604360b7a4d45a65c570d58b1bf9.zip
[lldb][NFC] Make CompilerDeclContext construction type safe
The CompilerDeclContext constructor takes a void* pointer which means that all callers of this constructor need to first explicitly convert all pointers to clang::DeclContext*. This causes that we for example can't just pass a TranslationUnitDecl* to the constructor without first casting it to its parent class (as it inherits from both Decl and DeclContext so the void* pointer is actually a Decl*). This patch introduces a utility function in the ClangASTContext which gets rid of the requirement to cast all pointers to clang::DeclContext. Also moves all constructor calls to use this function instead which is NFC (beside the change in DWARFASTParserClangTests.cpp).
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp')
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index b3e06fdd1a5..917ab68af41 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -666,7 +666,7 @@ SymbolFilePDB::GetDeclContextForUID(lldb::user_id_t uid) {
if (!decl_context)
return GetDeclContextContainingUID(uid);
- return CompilerDeclContext(clang_ast_ctx, decl_context);
+ return clang_ast_ctx->CreateDeclContext(decl_context);
}
lldb_private::CompilerDeclContext
@@ -695,7 +695,7 @@ SymbolFilePDB::GetDeclContextContainingUID(lldb::user_id_t uid) {
auto decl_context = pdb->GetDeclContextContainingSymbol(*symbol);
assert(decl_context);
- return CompilerDeclContext(clang_ast_ctx, decl_context);
+ return clang_ast_ctx->CreateDeclContext(decl_context);
}
void SymbolFilePDB::ParseDeclsForContext(
@@ -1703,8 +1703,7 @@ lldb_private::CompilerDeclContext SymbolFilePDB::FindNamespace(
if (!namespace_decl)
return CompilerDeclContext();
- return CompilerDeclContext(clang_type_system,
- static_cast<clang::DeclContext *>(namespace_decl));
+ return clang_type_system->CreateDeclContext(namespace_decl);
}
lldb_private::ConstString SymbolFilePDB::GetPluginName() {
OpenPOWER on IntegriCloud