================
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: no-threads
+
+// <mutex>
+
+// GCC doesn't have thread safety attributes
+// UNSUPPORTED: gcc
+
+// ADDITIONAL_COMPILE_FLAGS: -Wthread-safety -Wthread-safety-negative
+
+#include <mutex>
+
+#include "test_macros.h"
+
+std::mutex m;
+int foo __attribute__((guarded_by(m)));
+
+void increment() __attribute__((requires_negative_capability(m))) {
+  m.lock();
+  foo++;
+  m.unlock();
+}
+
+int main(int, char**) {
+  m.lock();
+  // expected-warning@-1 {{acquiring mutex 'm' requires negative capability 
'!m'}}
+  increment();
+  // expected-warning@-1 {{cannot call function 'increment' while mutex 'm' is 
held}}
----------------
AnthonyCalandraGeotab wrote:

After updating the tests, watching CI fail, and asking an AI to look into it, 
it seems to think that these builds are using a particular clang build that 
isn't being built as part of that patch. I don't know if I believe it. I don't 
know much about how LLVM works yet but I don't know why it would be building a 
version of clang that isn't based off this patch.

Any assistance would be appreciated.

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

Reply via email to