зеркало из https://github.com/microsoft/clang-1.git
We weren't generating correct code for calls to variadic member functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68635 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
4af44129dd
Коммит
e9918d2443
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
// RUN: grep "call void (.struct.C\*, i32, ...)\* @_ZN1C1gEiz" %t | count 1
|
||||
c.g(1, 2, 3);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче