1// RUN: %check_clang_tidy -std=c99 %s bugprone-suspicious-semicolon %t -- -- -fno-objc-arc -fobjc-abi-version=1
2
3// This test ensures check_clang_tidy.py allows disabling Objective-C ARC and
4// Objective-C 2.0 via passing arguments after -- on the command line.
5//
6// (We could include a test which doesn't pass any arguments after --
7// to check if ARC and ObjC 2.0 are disabled by default, but that test
8// could change behavior based on the default Objective-C runtime for
9// the platform, which would make this test flaky.)
10
11#if __has_feature(objc_arc)
12#error Objective-C ARC unexpectedly enabled even with -fno-objc-arc
13#endif
14
15#ifdef __OBJC2__
16#error Objective-C 2.0 unexpectedly enabled even with -fobjc-abi-version=1
17#endif
18
19@interface Foo
20- (int)shouldDoStuff;
21- (void)nop;
22@end
23
24void fail(Foo *f)
25{
26 if([f shouldDoStuff]); [f nop];
27 // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: potentially unintended semicolon [bugprone-suspicious-semicolon]
28 // CHECK-FIXES: if([f shouldDoStuff]) [f nop];
29}
30

source code of clang-tools-extra/test/clang-tidy/infrastructure/objc-no-arc-or-properties.m