[lldb][NFC] Remove ClangASTContext::GetUniqueNamespaceDeclaration overload
authorRaphael Isemann <teemperor@gmail.com>
Wed, 20 Nov 2019 10:36:15 +0000 (11:36 +0100)
committerRaphael Isemann <teemperor@gmail.com>
Wed, 20 Nov 2019 11:02:38 +0000 (12:02 +0100)
This overload is only used in one place and having static overloads for
all methods that only do an additional clang::ASTContext -> ClangASTContext
conversion is just not sustainable.

lldb/include/lldb/Symbol/ClangASTContext.h
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Symbol/ClangASTContext.cpp

index 9538dec..53580c0 100644 (file)
@@ -344,11 +344,6 @@ public:
   GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx,
                                 bool is_inline = false);
 
-  static clang::NamespaceDecl *
-  GetUniqueNamespaceDeclaration(clang::ASTContext *ast, const char *name,
-                                clang::DeclContext *decl_ctx,
-                                bool is_inline = false);
-
   // Function Types
 
   clang::FunctionDecl *
index 35a50c8..bbc0312 100644 (file)
@@ -1101,13 +1101,15 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
                                    : CompilerDeclContext();
 
       if (frame_decl_context) {
-        ClangASTContext *ast = llvm::dyn_cast_or_null<ClangASTContext>(
+        ClangASTContext *frame_ast = llvm::dyn_cast_or_null<ClangASTContext>(
             frame_decl_context.GetTypeSystem());
 
-        if (ast) {
+        ClangASTContext *map_ast =
+            ClangASTContext::GetASTContext(m_ast_context);
+        if (frame_ast && map_ast) {
           clang::NamespaceDecl *namespace_decl =
-              ClangASTContext::GetUniqueNamespaceDeclaration(
-                  m_ast_context, name.GetCString(), nullptr);
+              map_ast->GetUniqueNamespaceDeclaration(name.GetCString(),
+                                                     nullptr);
           if (namespace_decl) {
             context.AddNamedDecl(namespace_decl);
             clang::DeclContext *clang_decl_ctx =
index 290ad93..cf1dfea 100644 (file)
@@ -1861,16 +1861,6 @@ NamespaceDecl *ClangASTContext::GetUniqueNamespaceDeclaration(
   return namespace_decl;
 }
 
-NamespaceDecl *ClangASTContext::GetUniqueNamespaceDeclaration(
-    clang::ASTContext *ast, const char *name, clang::DeclContext *decl_ctx,
-    bool is_inline) {
-  ClangASTContext *ast_ctx = ClangASTContext::GetASTContext(ast);
-  if (ast_ctx == nullptr)
-    return nullptr;
-
-  return ast_ctx->GetUniqueNamespaceDeclaration(name, decl_ctx, is_inline);
-}
-
 clang::BlockDecl *
 ClangASTContext::CreateBlockDeclaration(clang::DeclContext *ctx) {
   if (ctx != nullptr) {