[Lldb-commits] [lldb] 0007f9d - [lldb][NFC] Delete static versions of ClangASTContext::CreateFunctionType

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Sun Dec 29 11:27:48 PST 2019


Author: Raphael Isemann
Date: 2019-12-29T20:27:05+01:00
New Revision: 0007f9da7c0c780e2466759c1e53b1109a54e400

URL: https://github.com/llvm/llvm-project/commit/0007f9da7c0c780e2466759c1e53b1109a54e400
DIFF: https://github.com/llvm/llvm-project/commit/0007f9da7c0c780e2466759c1e53b1109a54e400.diff

LOG: [lldb][NFC] Delete static versions of ClangASTContext::CreateFunctionType

We can always call the member function version of this function.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h
index cb9b89cf3e10..7bc5c5912aaa 100644
--- a/lldb/include/lldb/Symbol/ClangASTContext.h
+++ b/lldb/include/lldb/Symbol/ClangASTContext.h
@@ -315,36 +315,16 @@ class ClangASTContext : public TypeSystem {
                             const CompilerType &function_Type, int storage,
                             bool is_inline);
 
-  static CompilerType CreateFunctionType(clang::ASTContext *ast,
-                                         const CompilerType &result_type,
-                                         const CompilerType *args,
-                                         unsigned num_args, bool is_variadic,
-                                         unsigned type_quals,
-                                         clang::CallingConv cc);
-
-  static CompilerType CreateFunctionType(clang::ASTContext *ast,
-                                         const CompilerType &result_type,
-                                         const CompilerType *args,
-                                         unsigned num_args, bool is_variadic,
-                                         unsigned type_quals) {
-    return ClangASTContext::CreateFunctionType(
-        ast, result_type, args, num_args, is_variadic, type_quals, clang::CC_C);
-  }
-
   CompilerType CreateFunctionType(const CompilerType &result_type,
                                   const CompilerType *args, unsigned num_args,
-                                  bool is_variadic, unsigned type_quals) {
-    return ClangASTContext::CreateFunctionType(
-        &getASTContext(), result_type, args, num_args, is_variadic, type_quals);
-  }
+                                  bool is_variadic, unsigned type_quals,
+                                  clang::CallingConv cc);
 
   CompilerType CreateFunctionType(const CompilerType &result_type,
                                   const CompilerType *args, unsigned num_args,
-                                  bool is_variadic, unsigned type_quals,
-                                  clang::CallingConv cc) {
-    return ClangASTContext::CreateFunctionType(&getASTContext(), result_type,
-                                               args, num_args, is_variadic,
-                                               type_quals, cc);
+                                  bool is_variadic, unsigned type_quals) {
+    return CreateFunctionType(result_type, args, num_args, is_variadic,
+                              type_quals, clang::CC_C);
   }
 
   clang::ParmVarDecl *CreateParameterDeclaration(clang::DeclContext *decl_ctx,

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index ec1f3478df2a..6634824be01f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1955,8 +1955,8 @@ void ClangExpressionDeclMap::AddThisType(NameSearchContext &context,
         m_clang_ast_context->GetBasicType(eBasicTypeVoid);
     CompilerType void_ptr_clang_type = void_clang_type.GetPointerType();
 
-    CompilerType method_type = ClangASTContext::CreateFunctionType(
-        m_ast_context, void_clang_type, &void_ptr_clang_type, 1, false, 0);
+    CompilerType method_type = m_clang_ast_context->CreateFunctionType(
+        void_clang_type, &void_ptr_clang_type, 1, false, 0);
 
     const bool is_virtual = false;
     const bool is_static = false;

diff  --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 5c78e9ff0c98..0664db37a04c 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -1917,13 +1917,11 @@ FunctionDecl *ClangASTContext::CreateFunctionDeclaration(
   return func_decl;
 }
 
-CompilerType ClangASTContext::CreateFunctionType(
-    ASTContext *ast, const CompilerType &result_type, const CompilerType *args,
-    unsigned num_args, bool is_variadic, unsigned type_quals,
-    clang::CallingConv cc) {
-  if (ast == nullptr)
-    return CompilerType(); // invalid AST
-
+CompilerType
+ClangASTContext::CreateFunctionType(const CompilerType &result_type,
+                                    const CompilerType *args, unsigned num_args,
+                                    bool is_variadic, unsigned type_quals,
+                                    clang::CallingConv cc) {
   if (!result_type || !ClangUtil::IsClangType(result_type))
     return CompilerType(); // invalid return type
 
@@ -1954,9 +1952,11 @@ CompilerType ClangASTContext::CreateFunctionType(
   proto_info.TypeQuals = clang::Qualifiers::fromFastMask(type_quals);
   proto_info.RefQualifier = RQ_None;
 
-  return CompilerType(ClangASTContext::GetASTContext(ast),
-                      ast->getFunctionType(ClangUtil::GetQualType(result_type),
-                                           qual_type_args, proto_info).getAsOpaquePtr());
+  return CompilerType(this,
+                      getASTContext()
+                          .getFunctionType(ClangUtil::GetQualType(result_type),
+                                           qual_type_args, proto_info)
+                          .getAsOpaquePtr());
 }
 
 ParmVarDecl *ClangASTContext::CreateParameterDeclaration(


        


More information about the lldb-commits mailing list