aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-03-09 08:12:35 +0000
committerJohn McCall <rjmccall@apple.com>2011-03-09 08:12:35 +0000
commit1f6f961293da9c2b1c23da2411c1b439a9502ed0 (patch)
tree15587001a0ca0d39cccade392bc51464110a7833 /lib/CodeGen/CodeGenModule.cpp
parent311b442a5050048e7d498e5ed352a9204b9a3c24 (diff)
Fix three of the four places where I left breadcrumbs to avoid unnecessary
recomputation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127322 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 5aeaf03553..a758d610f8 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -1392,10 +1392,12 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old,
void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD) {
const FunctionDecl *D = cast<FunctionDecl>(GD.getDecl());
+ // Compute the function info and LLVM type.
const CGFunctionInfo &FI = getTypes().getFunctionInfo(GD);
-
- // FIXME: re-use FI in this computation!
- const llvm::FunctionType *Ty = getTypes().GetFunctionType(GD);
+ bool variadic = false;
+ if (const FunctionProtoType *fpt = D->getType()->getAs<FunctionProtoType>())
+ variadic = fpt->isVariadic();
+ const llvm::FunctionType *Ty = getTypes().GetFunctionType(FI, variadic, false);
// Get or create the prototype for the function.
llvm::Constant *Entry = GetAddrOfFunction(GD, Ty);