forked from OSchip/llvm-project
Pass the right type to GetAddrOfFunction when getting functions for the VTable. Fixes PR5021.
llvm-svn: 83395
This commit is contained in:
parent
e66abdc58f
commit
80ef6f1a46
|
@ -891,7 +891,13 @@ public:
|
||||||
++mi)
|
++mi)
|
||||||
if (mi->isVirtual()) {
|
if (mi->isVirtual()) {
|
||||||
const CXXMethodDecl *MD = *mi;
|
const CXXMethodDecl *MD = *mi;
|
||||||
llvm::Constant *m = wrap(CGM.GetAddrOfFunction(MD));
|
const FunctionProtoType *FPT =
|
||||||
|
MD->getType()->getAs<FunctionProtoType>();
|
||||||
|
const llvm::Type *Ty =
|
||||||
|
CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD),
|
||||||
|
FPT->isVariadic());
|
||||||
|
|
||||||
|
llvm::Constant *m = wrap(CGM.GetAddrOfFunction(MD, Ty));
|
||||||
OverrideMethod(MD, m, MorallyVirtual, Offset);
|
OverrideMethod(MD, m, MorallyVirtual, Offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -901,9 +907,15 @@ public:
|
||||||
llvm::Constant *m = 0;
|
llvm::Constant *m = 0;
|
||||||
if (const CXXDestructorDecl *Dtor = dyn_cast<CXXDestructorDecl>(MD))
|
if (const CXXDestructorDecl *Dtor = dyn_cast<CXXDestructorDecl>(MD))
|
||||||
m = wrap(CGM.GetAddrOfCXXDestructor(Dtor, Dtor_Complete));
|
m = wrap(CGM.GetAddrOfCXXDestructor(Dtor, Dtor_Complete));
|
||||||
else
|
else {
|
||||||
m = wrap(CGM.GetAddrOfFunction(MD));
|
const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>();
|
||||||
|
const llvm::Type *Ty =
|
||||||
|
CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD),
|
||||||
|
FPT->isVariadic());
|
||||||
|
|
||||||
|
m = wrap(CGM.GetAddrOfFunction(MD, Ty));
|
||||||
|
}
|
||||||
|
|
||||||
// If we can find a previously allocated slot for this, reuse it.
|
// If we can find a previously allocated slot for this, reuse it.
|
||||||
if (OverrideMethod(MD, m, MorallyVirtual, Offset))
|
if (OverrideMethod(MD, m, MorallyVirtual, Offset))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
// PR5021
|
||||||
|
struct A {
|
||||||
|
virtual void f(char);
|
||||||
|
};
|
||||||
|
|
||||||
|
void f(A *a) {
|
||||||
|
a->f('c');
|
||||||
|
}
|
||||||
|
// PR5021
|
||||||
|
struct A {
|
||||||
|
virtual void f(char);
|
||||||
|
};
|
||||||
|
|
||||||
|
void f(A *a) {
|
||||||
|
a->f('c');
|
||||||
|
}
|
Loading…
Reference in New Issue