[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / clang-tools-extra / test / clang-tidy / infrastructure / objc-no-arc-or-properties.m
blob596e8737ddca51e43488e57e20a351f81cfcba2f
1 // RUN: %check_clang_tidy -std=c99 %s bugprone-suspicious-semicolon %t -- -- -fno-objc-arc -fobjc-abi-version=1
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.)
11 #if __has_feature(objc_arc)
12 #error Objective-C ARC unexpectedly enabled even with -fno-objc-arc
13 #endif
15 #ifdef __OBJC2__
16 #error Objective-C 2.0 unexpectedly enabled even with -fobjc-abi-version=1
17 #endif
19 @interface Foo
20 - (int)shouldDoStuff;
21 - (void)nop;
22 @end
24 void fail(Foo *f)
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];