forked from OSchip/llvm-project
parent
a81b3256a4
commit
a1b54fdbe1
|
@ -210,10 +210,14 @@ static bool canDevirtualizeMemberFunctionCalls(const Expr *Base) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// We can always devirtualize calls on temporaries.
|
||||
// We can always devirtualize calls on temporary object expressions.
|
||||
if (isa<CXXTemporaryObjectExpr>(Base))
|
||||
return true;
|
||||
|
||||
// And calls on bound temporaries.
|
||||
if (isa<CXXBindTemporaryExpr>(Base))
|
||||
return true;
|
||||
|
||||
// Check if this is a call expr that returns a record type.
|
||||
if (const CallExpr *CE = dyn_cast<CallExpr>(Base))
|
||||
return CE->getCallReturnType()->isRecordType();
|
||||
|
|
|
@ -29,3 +29,19 @@ void f(A a, A *ap, A& ar) {
|
|||
// CHECK: call void @_ZN1A1fEv
|
||||
a.h().f();
|
||||
}
|
||||
|
||||
struct B {
|
||||
virtual void f();
|
||||
~B();
|
||||
|
||||
B h();
|
||||
};
|
||||
|
||||
|
||||
void f() {
|
||||
// CHECK: call void @_ZN1B1fEv
|
||||
B().f();
|
||||
|
||||
// CHECK: call void @_ZN1B1fEv
|
||||
B().h().f();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue