aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CodeGen/CGCXX.cpp11
-rw-r--r--test/CodeGenCXX/member-functions.cpp8
2 files changed, 11 insertions, 8 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index 000a0a9123..217f63a9df 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -142,12 +142,10 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) {
assert(MD->isInstance() &&
"Trying to emit a member call expr on a static method!");
- const CGFunctionInfo &FnInfo = CGM.getTypes().getFunctionInfo(MD);
-
- bool IsVariadic = MD->getType()->getAsFunctionProtoType()->isVariadic();
+ const FunctionProtoType *FPT = MD->getType()->getAsFunctionProtoType();
const llvm::Type *Ty =
- CGM.getTypes().GetFunctionType(FnInfo, IsVariadic);
-
+ CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD),
+ FPT->isVariadic());
llvm::Constant *Callee = CGM.GetAddrOfFunction(MD, Ty);
llvm::Value *BaseValue = 0;
@@ -173,5 +171,6 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) {
Args.push_back(std::make_pair(EmitAnyExprToTemp(*I), I->getType()));
QualType ResultType = MD->getType()->getAsFunctionType()->getResultType();
- return EmitCall(FnInfo, Callee, Args, MD);
+ return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args),
+ Callee, Args, MD);
}
diff --git a/test/CodeGenCXX/member-functions.cpp b/test/CodeGenCXX/member-functions.cpp
index a6fa000319..9cdab0a662 100644
--- a/test/CodeGenCXX/member-functions.cpp
+++ b/test/CodeGenCXX/member-functions.cpp
@@ -1,15 +1,19 @@
// RUN: clang-cc -emit-llvm %s -o %t &&
struct C {
void f();
+ void g(int, ...);
};
// RUN: grep "define void @_ZN1C1fEv" %t | count 1 &&
void C::f() {
}
-// RUN: grep "call void @_ZN1C1fEv" %t | count 1
void f() {
C c;
+// RUN: grep "call void @_ZN1C1fEv" %t | count 1 &&
c.f();
-} \ No newline at end of file
+
+// RUN: grep "call void (.struct.C\*, i32, ...)\* @_ZN1C1gEiz" %t | count 1
+ c.g(1, 2, 3);
+}