Author: Raphael Isemann Date: 2020-08-17T12:53:58+02:00 New Revision: cd2139a527f2d829bdde7877c992215f598e927b
URL: https://github.com/llvm/llvm-project/commit/cd2139a527f2d829bdde7877c992215f598e927b DIFF: https://github.com/llvm/llvm-project/commit/cd2139a527f2d829bdde7877c992215f598e927b.diff LOG: [lldb][NFC] Use the proper type for the 'storage' parameter of CreateFunctionDeclaration All the callers pass an enum and we cast the int anyway back to the actual type, so we might as well just use the type for the parameter. Added: Modified: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h lldb/unittests/Symbol/TestTypeSystemClang.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 69c829d21fda..23e052791e19 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -1996,8 +1996,8 @@ TypeSystemClang::GetDeclarationName(const char *name, FunctionDecl *TypeSystemClang::CreateFunctionDeclaration( clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, - const char *name, const CompilerType &function_clang_type, int storage, - bool is_inline) { + const char *name, const CompilerType &function_clang_type, + clang::StorageClass storage, bool is_inline) { FunctionDecl *func_decl = nullptr; ASTContext &ast = getASTContext(); if (!decl_ctx) @@ -2012,7 +2012,7 @@ FunctionDecl *TypeSystemClang::CreateFunctionDeclaration( func_decl->setDeclContext(decl_ctx); func_decl->setDeclName(declarationName); func_decl->setType(ClangUtil::GetQualType(function_clang_type)); - func_decl->setStorageClass(static_cast<clang::StorageClass>(storage)); + func_decl->setStorageClass(storage); func_decl->setInlineSpecified(is_inline); func_decl->setHasWrittenPrototype(hasWrittenPrototype); func_decl->setConstexprKind(isConstexprSpecified ? CSK_constexpr diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 399743a72f76..32736ee2148f 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -414,7 +414,7 @@ class TypeSystemClang : public TypeSystem { CreateFunctionDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, const char *name, const CompilerType &function_Type, - int storage, bool is_inline); + clang::StorageClass storage, bool is_inline); CompilerType CreateFunctionType(const CompilerType &result_type, const CompilerType *args, unsigned num_args, diff --git a/lldb/unittests/Symbol/TestTypeSystemClang.cpp b/lldb/unittests/Symbol/TestTypeSystemClang.cpp index bd7eb14d4533..f43b4f5dc0df 100644 --- a/lldb/unittests/Symbol/TestTypeSystemClang.cpp +++ b/lldb/unittests/Symbol/TestTypeSystemClang.cpp @@ -559,7 +559,8 @@ TEST_F(TestTypeSystemClang, TestFunctionTemplateConstruction) { CompilerType clang_type = m_ast->CreateFunctionType(int_type, nullptr, 0U, false, 0U); FunctionDecl *func = m_ast->CreateFunctionDeclaration( - TU, OptionalClangModuleID(), "foo", clang_type, 0, false); + TU, OptionalClangModuleID(), "foo", clang_type, StorageClass::SC_None, + false); TypeSystemClang::TemplateParameterInfos empty_params; // Create the actual function template. @@ -590,7 +591,8 @@ TEST_F(TestTypeSystemClang, TestFunctionTemplateInRecordConstruction) { // 1. FunctionDecls can't be in a Record (only CXXMethodDecls can). // 2. It is mirroring the behavior of DWARFASTParserClang::ParseSubroutine. FunctionDecl *func = m_ast->CreateFunctionDeclaration( - TU, OptionalClangModuleID(), "foo", clang_type, 0, false); + TU, OptionalClangModuleID(), "foo", clang_type, StorageClass::SC_None, + false); TypeSystemClang::TemplateParameterInfos empty_params; // Create the actual function template. _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits