Move FunctionType conversion into CGCall.cpp:
- Added CodeGenTypes::GetFunctionType, taking a CGFunctionInfo.
- Updated Obj-C runtimes to use this instead of rolling the
llvm::FunctionType by hand.
- Killed CodeGenTypes::{ConvertReturnType, DecodeArgumentTypes}.
Add ABIArgInfo class to encapsulate ABI decision of how to lower types
to LLVM.
- Will move to target sometime soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56047 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index e5acc50..c086357 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -212,18 +212,18 @@
}
}
-void CodeGenModule::SetFunctionParamAttrs(const CGFunctionInfo &Info,
+void CodeGenModule::SetFunctionParamAttrs(const Decl *D,
+ const CGFunctionInfo &Info,
llvm::Function *F) {
ParamAttrListType ParamAttrList;
- ConstructParamAttrList(Info.getDecl(),
- Info.argtypes_begin(), Info.argtypes_end(),
+ ConstructParamAttrList(D, Info.argtypes_begin(), Info.argtypes_end(),
ParamAttrList);
F->setParamAttrs(llvm::PAListPtr::get(ParamAttrList.begin(),
ParamAttrList.size()));
// Set the appropriate calling convention for the Function.
- if (Info.getDecl()->getAttr<FastCallAttr>())
+ if (D->getAttr<FastCallAttr>())
F->setCallingConv(llvm::CallingConv::Fast);
}
@@ -245,19 +245,20 @@
void CodeGenModule::SetMethodAttributes(const ObjCMethodDecl *MD,
llvm::Function *F) {
- SetFunctionParamAttrs(CGFunctionInfo(MD, Context), F);
+ SetFunctionParamAttrs(MD, CGFunctionInfo(MD, Context), F);
SetFunctionAttributesForDefinition(MD, F);
}
void CodeGenModule::SetFunctionAttributes(const FunctionDecl *FD,
llvm::Function *F) {
- SetFunctionParamAttrs(CGFunctionInfo(FD), F);
-
+ SetFunctionParamAttrs(FD, CGFunctionInfo(FD), F);
+
SetGlobalValueAttributes(FD, FD->getStorageClass() == FunctionDecl::Static,
FD->isInline(), F, false);
}
+
void CodeGenModule::EmitAliases() {
for (unsigned i = 0, e = Aliases.size(); i != e; ++i) {
const FunctionDecl *D = Aliases[i];