[clang] [analyzer] Model GCC 'cleanup' attribute function calls (PR #221110)
Arseniy Zaostrovnykh via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 11 02:46:27 PDT 2026
================
@@ -1239,6 +1245,60 @@ class CXXDeallocatorCall : public AnyFunctionCall {
}
};
+/// Represents an implicit call to a cleanup function, triggered by a
+/// `__attribute__((cleanup(f)))` variable going out of scope.
+///
+/// The call has no syntactic representation: like \c CXXDestructorCall it is
+/// Decl-origin, and its single argument, the address of the annotated
+/// variable, is not written in the source.
+class CleanupFunctionCall : public AnyFunctionCall {
----------------
necto wrote:
Sure, "result" of a "cleanup" is not very clear. I'm just worried that it might lead to another surprise and another crash. I remember fixing a crash related to `getResultType` for a non-void function missing a `return`.
To make it more prominent, let's at least have a test case in the file with all checkers that would have a non-void cleanup function
https://github.com/llvm/llvm-project/pull/221110
More information about the cfe-commits
mailing list