summaryrefslogtreecommitdiffstats
path: root/clang/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
commit46288eff24ad0b4826690e598758ccf9e61d144c (patch)
tree510024e9f3834f0955bfb80e70d5eda47992b558 /clang/lib/CodeGen/CodeGenModule.cpp
parent718918b07abcbed9b57e046c4091fc20d8d4cea2 (diff)
downloadbcm5719-llvm-46288eff24ad0b4826690e598758ccf9e61d144c.tar.gz
bcm5719-llvm-46288eff24ad0b4826690e598758ccf9e61d144c.zip
Fix three of the four places where I left breadcrumbs to avoid unnecessary
recomputation. llvm-svn: 127322
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 5aeaf03553b..a758d610f8d 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud