================
@@ -542,6 +558,29 @@ class TrivialFunctionAnalysisVisitor
});
}
+ bool HasTrivialDestructor(const VarDecl *VD) {
+ return WithCachedResult(VD, [&]() {
+ auto QT = VD->getType();
+ if (QT.isPODType(VD->getASTContext()))
+ return true;
+ auto *Type = QT.getTypePtrOrNull();
+ if (!Type)
+ return false;
+ if (isa<LValueReferenceType>(Type))
+ return true; // T& does not run its destructor.
+ if (auto *RT = dyn_cast<RValueReferenceType>(Type)) {
+ // For T&&, we evaluate the destructor of T.
+ auto *T = RT->getPointeeType().getTypePtrOrNull();
+ return T && CanTriviallyDestruct(T);
+ }
----------------
steakhal wrote:
I think I don't understand this. A reference is a reference regardless if it's
an lvalue or rvalue reference.
So why are these different?
https://github.com/llvm/llvm-project/pull/181576
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits