================
@@ -6730,7 +6731,15 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) {
CXXDestructorDecl *Destructor = IsDecltype ? nullptr : LookupDestructor(RD);
if (Destructor) {
+ bool HadBody = Destructor->doesThisDeclarationHaveABody();
MarkFunctionReferenced(E->getExprLoc(), Destructor);
+ // MarkFunctionReferenced can synthesize an implicit destructor. If that
+ // happens here, there may be no later top-level definition callback for
+ // CodeGen to see, for example for a closure type in a default member
+ // initializer.
+ if (Destructor->isImplicit() && !HadBody &&
+ Destructor->doesThisDeclarationHaveABody())
+ Consumer.HandleTopLevelDecl(DeclGroupRef(Destructor));
----------------
efriedma-quic wrote:
Please don't do this.
We already have infrastructure for delayed emission of inline functions; if
that isn't working correctly, please fix it instead of trying to side-step it.
(Maybe that means we need to hook up delayed emission for destructors where we
currently don't have a body, but might synthesize one later?)
https://github.com/llvm/llvm-project/pull/196597
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits