brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · d1c9b3c Raw
40 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -fblocks -fcxx-exceptions -fobjc-exceptions -verify -Wfunction-effects %s2 3#pragma clang diagnostic ignored "-Wperf-constraint-implies-noexcept"4 5// Objective-C6@interface OCClass7- (void)method;8@end9 10void nb1(OCClass *oc) [[clang::nonblocking]] {11	[oc method]; // expected-warning {{function with 'nonblocking' attribute must not access ObjC methods or properties}}12}13void nb2(OCClass *oc) {14	[oc method]; // expected-note {{function cannot be inferred 'nonblocking' because it accesses an ObjC method or property}}15}16void nb3(OCClass *oc) [[clang::nonblocking]] {17	nb2(oc); // expected-warning {{function with 'nonblocking' attribute must not call non-'nonblocking' function 'nb2'}}18}19 20void nb4() [[clang::nonblocking]] {21	@try {22		@throw @"foo"; // expected-warning {{function with 'nonblocking' attribute must not throw or catch exceptions}}23	}24	@catch (...) { // expected-warning {{function with 'nonblocking' attribute must not throw or catch exceptions}}25	}26	@finally { // expected-warning {{function with 'nonblocking' attribute must not throw or catch exceptions}}27	}28}29 30@class Lock;31extern Lock *someLock;32 33void nb5() [[clang::nonblocking]] {34	@autoreleasepool { // expected-warning {{function with 'nonblocking' attribute must not access ObjC methods or properties}}35	}36 37	@synchronized(someLock) { // expected-warning {{function with 'nonblocking' attribute must not access ObjC methods or properties}}38	}39}40