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();
// 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();
+}