[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / SemaCXX / template-multiple-attr-propagation.cpp
blob8e7f4570bad4e822a335012a8954ab535981c82a
1 // RUN: %clang_cc1 %s -Wthread-safety-analysis -verify -fexceptions
2 // expected-no-diagnostics
4 class Mutex {
5 public:
6 void Lock() __attribute__((exclusive_lock_function()));
7 void Unlock() __attribute__((unlock_function()));
8 };
10 class A {
11 public:
12 Mutex mu1, mu2;
14 void foo() __attribute__((exclusive_locks_required(mu1))) __attribute__((exclusive_locks_required(mu2))) {}
16 template <class T>
17 void bar() __attribute__((exclusive_locks_required(mu1))) __attribute__((exclusive_locks_required(mu2))) {
18 foo();
22 void f() {
23 A a;
24 a.mu1.Lock();
25 a.mu2.Lock();
26 a.bar<int>();
27 a.mu2.Unlock();
28 a.mu1.Unlock();