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
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h
index 3dada6d..f540a73 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/lib/CodeGen/CodeGenModule.h
@@ -298,6 +298,10 @@
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 @@
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,