xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/warn-thread-safety-analysis.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -Wthread-safety-beta -Wno-objc-root-class %s
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel Sambucstruct __attribute__ ((lockable)) Mutex {};
4*0a6a1f1dSLionel Sambuc
5*0a6a1f1dSLionel Sambucstruct Mutex mu1;
6*0a6a1f1dSLionel Sambuc
7*0a6a1f1dSLionel Sambucint Foo_fun1(int i) __attribute__ ((exclusive_locks_required((mu1)))) {
8*0a6a1f1dSLionel Sambuc  return i;
9*0a6a1f1dSLionel Sambuc}
10*0a6a1f1dSLionel Sambuc
11*0a6a1f1dSLionel Sambuc@interface test
12*0a6a1f1dSLionel Sambuc@end
13*0a6a1f1dSLionel Sambuc
14*0a6a1f1dSLionel Sambuc@implementation test
15*0a6a1f1dSLionel Sambuc- (void) PR19541 {
16*0a6a1f1dSLionel Sambuc  Foo_fun1(1); // expected-warning{{calling function 'Foo_fun1' requires holding mutex 'mu1' exclusively}}
17*0a6a1f1dSLionel Sambuc}
18*0a6a1f1dSLionel Sambuc
19*0a6a1f1dSLionel Sambuc@end
20