summaryrefslogtreecommitdiffstats
path: root/lldb/source/Symbol/ClangASTContext.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-12-23 10:05:42 +0100
committerRaphael Isemann <teemperor@gmail.com>2019-12-23 11:02:21 +0100
commitfecb122cca254f565050559b349c8ff309194554 (patch)
tree9dffc6eaa3bdca4cc187b2792554f3f8d3b1f170 /lldb/source/Symbol/ClangASTContext.cpp
parent5dca0596a959217a1c18858a62ed35245a4c42b4 (diff)
downloadbcm5719-llvm-fecb122cca254f565050559b349c8ff309194554.tar.gz
bcm5719-llvm-fecb122cca254f565050559b349c8ff309194554.zip
[lldb][NFC] Simplify ClangASTContext::GetTranslationUnitDecl
These two functions are just calling their equivalent function in ASTContext and implicitly convert the result to a DeclContext* (a parent class of TranslationUnitDecl). This leads to the absurd situation that we had to cast the result of GetTranslationUnitDecl to a TranslationUnitDecl*. The only reason we did this implicit conversion to the parent class was that the void* conversion for the CompilerDeclContext constructor was sound (which otherwise would receive a Decl* pointer when called with a TranslationUnitDecl*). Now that the CompilerDeclContext constructor is type safe we can properly implement these functions by actually returning the right type. Also deletes the static inconvenience method that was not used anywhere.
Diffstat (limited to 'lldb/source/Symbol/ClangASTContext.cpp')
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 58ff82dbeb8..f86e4bcd06a 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -1153,11 +1153,6 @@ CompilerType ClangASTContext::GetCStringType(bool is_const) {
return CompilerType(this, ast.getPointerType(char_type).getAsOpaquePtr());
}
-clang::DeclContext *
-ClangASTContext::GetTranslationUnitDecl(clang::ASTContext *ast) {
- return ast->getTranslationUnitDecl();
-}
-
clang::Decl *ClangASTContext::CopyDecl(ASTContext *dst_ast, ASTContext *src_ast,
clang::Decl *source_decl) {
FileSystemOptions file_system_options;
@@ -1782,8 +1777,7 @@ clang::DeclContext *FindLCABetweenDecls(clang::DeclContext *left,
clang::UsingDirectiveDecl *ClangASTContext::CreateUsingDirectiveDeclaration(
clang::DeclContext *decl_ctx, clang::NamespaceDecl *ns_decl) {
if (decl_ctx != nullptr && ns_decl != nullptr) {
- clang::TranslationUnitDecl *translation_unit =
- (clang::TranslationUnitDecl *)GetTranslationUnitDecl(&getASTContext());
+ auto *translation_unit = getASTContext().getTranslationUnitDecl();
clang::UsingDirectiveDecl *using_decl = clang::UsingDirectiveDecl::Create(
getASTContext(), decl_ctx, clang::SourceLocation(),
clang::SourceLocation(), clang::NestedNameSpecifierLoc(),
OpenPOWER on IntegriCloud