[clang] [analyzer] Model GCC 'cleanup' attribute function calls (PR #221110)

via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 9 19:04:16 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 {
----------------
PengZheng wrote:

According to gcc documentation:

> The function must take one parameter, a pointer to a type compatible with the variable. The return value of the function (if any) is ignored. 

I thought such an ignored return type does not worth the trouble of making `getResultType` `virtual`.

https://github.com/llvm/llvm-project/pull/221110


More information about the cfe-commits mailing list