[clang] [clang] Respect [[gnu::error]] on functions passed to [[gnu::cleanup]] (PR #152082)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 5 09:11:55 PDT 2025
================
@@ -624,8 +624,15 @@ namespace {
CallArgList Args;
Args.add(RValue::get(Arg),
CGF.getContext().getPointerType(Var.getType()));
- auto Callee = CGCallee::forDirect(CleanupFn);
- CGF.EmitCall(FnInfo, Callee, ReturnValueSlot(), Args);
+ bool HasCleanupAttr = Var.hasAttr<CleanupAttr>();
+ GlobalDecl GD = HasCleanupAttr
+ ? (Var.getAttr<CleanupAttr>()->getFunctionDecl())
+ : GlobalDecl();
+ SourceLocation Loc = HasCleanupAttr ? Var.getAttr<CleanupAttr>()->getLoc()
----------------
efriedma-quic wrote:
Instead of redoing all this computation to get the SourceLocation, can we save it as a member of CallCleanupFunction?
https://github.com/llvm/llvm-project/pull/152082
More information about the cfe-commits
mailing list