Author: Marco Elver
Date: 2026-01-31T18:16:55+01:00
New Revision: 40fdf5e33a8db328bee9fd73f03ad8ec8394a922

URL: 
https://github.com/llvm/llvm-project/commit/40fdf5e33a8db328bee9fd73f03ad8ec8394a922
DIFF: 
https://github.com/llvm/llvm-project/commit/40fdf5e33a8db328bee9fd73f03ad8ec8394a922.diff

LOG: Thread Safety Analysis: Add more complex cleanup attribute test (#179049)

Test that cleanup attribute is handled correctly in the presence of a
unary operator before scope end.

NFC.

Added: 
    

Modified: 
    clang/test/Sema/warn-thread-safety-analysis.c

Removed: 
    


################################################################################
diff  --git a/clang/test/Sema/warn-thread-safety-analysis.c 
b/clang/test/Sema/warn-thread-safety-analysis.c
index 53594609e902d..69ec109e1523c 100644
--- a/clang/test/Sema/warn-thread-safety-analysis.c
+++ b/clang/test/Sema/warn-thread-safety-analysis.c
@@ -192,6 +192,12 @@ int main(void) {
     struct Mutex* const __attribute__((unused, cleanup(unlock_scope))) scope = 
&mu1;
     mutex_exclusive_lock(&mu1);  // With basic alias analysis lock through mu1 
also works.
   }
+  {
+    int i = 0;
+    mutex_exclusive_lock(&mu1);
+    struct Mutex* const __attribute__((unused, cleanup(unlock_scope))) scope = 
&mu1;
+    i++;
+  }
   // Cleanup through cast alias pointer in a for-loop; a variant of this 
pattern
   // appears in the Linux kernel for generic scoped guard macros.
   for (int i = (mutex_exclusive_lock(foo_.mu_), 0),


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to