llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Marco Elver (melver)

<details>
<summary>Changes</summary>

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

NFC.

---
Full diff: https://github.com/llvm/llvm-project/pull/179049.diff


1 Files Affected:

- (modified) clang/test/Sema/warn-thread-safety-analysis.c (+6) 


``````````diff
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),

``````````

</details>


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

Reply via email to