From 7c65e990e9f0dafaf9adbc59b766dcc23eaee845 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 14 Apr 2009 08:05:55 +0000 Subject: Refactor how attributes are set on values. - Pull out SetCommonAttributes, which handles the things common to aliases, methods, functions, and variables. - Pull out SetLLVMFunctionAttributesForDefinition, which handles the LLVM attributes which we only want to apply to a definition (like noinline and alwaysinline). - Kill SetGVDeclarationAttributes (inlined into SetFunctionAttributes and specialized). - Kill SetFunctionAttributesForDefinition (inlined into sole caller). - Inline SetGVDefinitionAttributes into SetMethodAttributes and specialize. - Rename SetGVDefinitionAttributes to SetFunctionDefinitionAttributes. This is supposed to be a no functionality change commit, but I may have made a mistake. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69036 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'lib/CodeGen/CodeGenModule.h') diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index 3dada6d1b7..f540a73e76 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -298,6 +298,10 @@ public: const CGFunctionInfo &Info, llvm::Function *F); + /// SetLLVMFunctionAttributesForDefinition - Set the LLVM function attributes + /// which only apply to a function definintion. + void SetLLVMFunctionAttributesForDefinition(const Decl *D, llvm::Function *F); + /// ReturnTypeUsesSret - Return true iff the given type uses 'sret' when used /// as a return type. bool ReturnTypeUsesSret(const CGFunctionInfo &FI); @@ -323,22 +327,17 @@ private: const llvm::PointerType *PTy, const VarDecl *D); - /// SetGVDefinitionAttributes - Set attributes for a global definition. - void SetGVDefinitionAttributes(const Decl *D, - GVALinkage Linkage, - llvm::GlobalValue *GV); - - /// SetGVDeclarationAttributes - Set attributes for a global declaration. - void SetGVDeclarationAttributes(const Decl *D, - llvm::GlobalValue *GV); - - /// SetFunctionAttributesForDefinition - Set function attributes specific to a - /// function definition. + /// SetCommonAttributes - Set attributes which are common to any + /// form of a global definition (alias, Objective-C method, + /// function, global variable). /// - /// \param D - The ObjCMethodDecl or FunctionDecl defining \arg F. - void SetFunctionAttributesForDefinition(const Decl *D, - llvm::Function *F); + /// NOTE: This should only be called for definitions. + void SetCommonAttributes(const Decl *D, llvm::GlobalValue *GV); + /// SetFunctionDefinitionAttributes - Set attributes for a global definition. + void SetFunctionDefinitionAttributes(const FunctionDecl *D, + llvm::GlobalValue *GV); + /// SetFunctionAttributes - Set function attributes for a function /// declaration. void SetFunctionAttributes(const FunctionDecl *FD, -- cgit v1.2.3