Mercurial > hg > CbC > CbC_llvm
view clang/test/SemaCXX/template-multiple-attr-propagation.cpp @ 222:81f6424ef0e3 llvm-original
LLVM original branch
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 18 Jul 2021 22:10:01 +0900 |
parents | 1d019706d866 |
children |
line wrap: on
line source
// RUN: %clang_cc1 %s -Wthread-safety-analysis -verify -fexceptions // expected-no-diagnostics class Mutex { public: void Lock() __attribute__((exclusive_lock_function())); void Unlock() __attribute__((unlock_function())); }; class A { public: Mutex mu1, mu2; void foo() __attribute__((exclusive_locks_required(mu1))) __attribute__((exclusive_locks_required(mu2))) {} template <class T> void bar() __attribute__((exclusive_locks_required(mu1))) __attribute__((exclusive_locks_required(mu2))) { foo(); } }; void f() { A a; a.mu1.Lock(); a.mu2.Lock(); a.bar<int>(); a.mu2.Unlock(); a.mu1.Unlock(); }