summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGBlocks.cpp2
-rw-r--r--clang/lib/CodeGen/CGObjC.cpp3
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp11
-rw-r--r--clang/lib/CodeGen/CodeGenModule.h8
4 files changed, 16 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index 7a8cd0d822f..27b60a01e9e 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/lib/CodeGen/CGBlocks.cpp
@@ -670,6 +670,8 @@ CodeGenFunction::GenerateBlockFunction(const BlockExpr *BExpr,
Name,
&CGM.getModule());
+ CGM.SetInternalFunctionAttributes(BD, Fn, FI);
+
StartFunction(BD, ResultType, Fn, Args,
BExpr->getBody()->getLocEnd());
CurFuncDecl = OuterFuncDecl;
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 4423217c7dd..808add74f76 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -109,7 +109,8 @@ void CodeGenFunction::StartObjCMethod(const ObjCMethodDecl *OMD,
FunctionArgList Args;
llvm::Function *Fn = CGM.getObjCRuntime().GenerateMethod(OMD, CD);
- CGM.SetMethodAttributes(OMD, Fn);
+ const CGFunctionInfo &FI = CGM.getTypes().getFunctionInfo(OMD);
+ CGM.SetInternalFunctionAttributes(OMD, Fn, FI);
Args.push_back(std::make_pair(OMD->getSelfDecl(),
OMD->getSelfDecl()->getType()));
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index d1d67a11b8a..7cb5e43cb59 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -340,14 +340,15 @@ void CodeGenModule::SetCommonAttributes(const Decl *D,
GV->setSection(SA->getName());
}
-void CodeGenModule::SetMethodAttributes(const ObjCMethodDecl *MD,
- llvm::Function *F) {
- SetLLVMFunctionAttributes(MD, getTypes().getFunctionInfo(MD), F);
- SetLLVMFunctionAttributesForDefinition(MD, F);
+void CodeGenModule::SetInternalFunctionAttributes(const Decl *D,
+ llvm::Function *F,
+ const CGFunctionInfo &FI) {
+ SetLLVMFunctionAttributes(D, FI, F);
+ SetLLVMFunctionAttributesForDefinition(D, F);
F->setLinkage(llvm::Function::InternalLinkage);
- SetCommonAttributes(MD, F);
+ SetCommonAttributes(D, F);
}
void CodeGenModule::SetFunctionAttributes(const FunctionDecl *FD,
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index 17a9a9f907e..469c637e2df 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -303,8 +303,12 @@ public:
void ErrorUnsupported(const Decl *D, const char *Type,
bool OmitOnError=false);
- void SetMethodAttributes(const ObjCMethodDecl *MD,
- llvm::Function *F);
+ /// SetInternalFunctionAttributes - Set the attributes on the LLVM
+ /// function for the given decl and function info. This applies
+ /// attributes necessary for handling the ABI as well as user
+ /// specified attributes like section.
+ void SetInternalFunctionAttributes(const Decl *D, llvm::Function *F,
+ const CGFunctionInfo &FI);
/// SetLLVMFunctionAttributes - Set the LLVM function attributes
/// (sext, zext, etc).
OpenPOWER on IntegriCloud