30 lines · plain
1// RUN: %check_clang_tidy -std=c99 %s bugprone-suspicious-semicolon %t -- -- -fno-objc-arc -fobjc-abi-version=12 3// This test ensures check_clang_tidy.py allows disabling Objective-C ARC and4// 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 test8// could change behavior based on the default Objective-C runtime for9// 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-arc13#endif14 15#ifdef __OBJC2__16#error Objective-C 2.0 unexpectedly enabled even with -fobjc-abi-version=117#endif18 19@interface Foo20- (int)shouldDoStuff;21- (void)nop;22@end23 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