================
@@ -35,3 +35,19 @@ void leak_through_cleanup_frame(void) {
p = malloc(10); // expected-note {{Memory is allocated}}
} // expected-warning {{Potential leak of memory pointed to by 'p'}}
// expected-note@-1 {{Potential leak of memory pointed to by 'p'}}
+
+//===----------------------------------------------------------------------===//
+// With the attribute split across lines, the "Calling ..." note is anchored
+// at the `cleanup` keyword, not at the function name on the next line.
+//===----------------------------------------------------------------------===//
+
+static void multiline_cleanup(int **p) {
+ **p = 1; // expected-warning {{Dereference of null pointer}}
+ // expected-note@-1 {{Dereference of null pointer}}
+}
+
+void null_deref_in_multiline_cleanup_attr(void) {
+ int *p __attribute__((cleanup( // expected-note {{Calling
'multiline_cleanup'}}
+ multiline_cleanup)));
----------------
necto wrote:
```suggestion
int *p __attribute__
((
cleanup( // expected-note {{Calling 'multiline_cleanup'}}
multiline_cleanup)));
```
to make it more precise
https://github.com/llvm/llvm-project/pull/221110
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits