Debian Codegraph @

clang-tools-extra/test/clang-tidy/infrastructure/objc-arc-and-properties.m

raw
1 // RUN: %check_clang_tidy %s bugprone-suspicious-semicolon %t
2
3 // This test checks if Objective-C 2.0 (@properties) and
4 // Automatic Reference Counting (ARC) are enabled for .m files
5 // checked via check_clang_tidy.py.
6
7 #if !__has_feature(objc_arc)
8 #error Objective-C ARC not enabled as expected
9 #endif
10
11 @interface Foo
12 @property (nonatomic, assign) int shouldDoStuff;
13 - (void)nop;
14 @end
15
16 void fail(Foo *f)
17 {
18 if(f.shouldDoStuff); [f nop];
19 // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: potentially unintended semicolon [bugprone-suspicious-semicolon]
20 // CHECK-FIXES: if(f.shouldDoStuff) [f nop];
21 }