1 // RUN: %clang_cc1 -fsyntax-only -fblocks -fcxx-exceptions -fobjc-exceptions -verify -Wfunction-effects %s
3 #pragma clang diagnostic ignored "-Wperf-constraint-implies-noexcept"
10 void nb1(OCClass *oc) [[clang::nonblocking]] {
11 [oc method]; // expected-warning {{function with 'nonblocking' attribute must not access ObjC methods or properties}}
13 void nb2(OCClass *oc) {
14 [oc method]; // expected-note {{function cannot be inferred 'nonblocking' because it accesses an ObjC method or property}}
16 void nb3(OCClass *oc) [[clang::nonblocking]] {
17 nb2(oc); // expected-warning {{function with 'nonblocking' attribute must not call non-'nonblocking' function 'nb2'}}
20 void nb4() [[clang::nonblocking]] {
22 @throw @"foo"; // expected-warning {{function with 'nonblocking' attribute must not throw or catch exceptions}}
24 @catch (...) { // expected-warning {{function with 'nonblocking' attribute must not throw or catch exceptions}}
26 @finally { // expected-warning {{function with 'nonblocking' attribute must not throw or catch exceptions}}
31 extern Lock *someLock;
33 void nb5() [[clang::nonblocking]] {
34 @autoreleasepool { // expected-warning {{function with 'nonblocking' attribute must not access ObjC methods or properties}}
37 @synchronized(someLock) { // expected-warning {{function with 'nonblocking' attribute must not access ObjC methods or properties}}