File tree Expand file tree Collapse file tree 3 files changed +27
-7
lines changed Expand file tree Collapse file tree 3 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -3487,6 +3487,18 @@ class Analyzer {
34873487 return Proceed;
34883488 }
34893489
3490+ bool VisitObjCAtThrowStmt (ObjCAtThrowStmt *Throw) {
3491+ diagnoseLanguageConstruct (FunctionEffect::FE_ExcludeThrow,
3492+ DiagnosticID::Throws, Throw->getThrowLoc ());
3493+ return Proceed;
3494+ }
3495+
3496+ bool VisitObjCAtCatchStmt (ObjCAtCatchStmt *Catch) {
3497+ diagnoseLanguageConstruct (FunctionEffect::FE_ExcludeCatch,
3498+ DiagnosticID::Catches, Catch->getAtCatchLoc ());
3499+ return Proceed;
3500+ }
3501+
34903502 bool VisitObjCMessageExpr (ObjCMessageExpr *Msg) {
34913503 diagnoseLanguageConstruct (FunctionEffect::FE_ExcludeObjCMessageSend,
34923504 DiagnosticID::CallsObjC, Msg->getBeginLoc ());
Original file line number Diff line number Diff line change 11// RUN: %clang_cc1 -fsyntax-only -fblocks -fcxx-exceptions -verify %s
22// These are in a separate file because errors (e.g. incompatible attributes) currently prevent
3- // the AnalysisBasedWarnings pass from running at all.
3+ // the FXAnalysis pass from running at all.
44
55// This diagnostic is re-enabled and exercised in isolation later in this file.
66#pragma clang diagnostic ignored "-Wperf-constraint-implies-noexcept"
99
1010void nl1 () [[clang::nonblocking]]
1111{
12- auto * pInt = new int ; // expected-warning {{'nonblocking' function must not allocate or deallocate memory}}
12+ int *pInt = new int ; // expected-warning {{'nonblocking' function must not allocate or deallocate memory}}
13+ delete pInt; // expected-warning {{'nonblocking' function must not allocate or deallocate memory}}
1314}
1415
1516void nl2 () [[clang::nonblocking]]
Original file line number Diff line number Diff line change 1- // RUN: %clang_cc1 -fsyntax-only -fblocks -fcxx-exceptions -verify %s
1+ // RUN: %clang_cc1 -fsyntax-only -fblocks -fcxx-exceptions -fobjc-exceptions - verify %s
22
33#pragma clang diagnostic ignored "-Wperf-constraint-implies-noexcept"
44
@@ -7,13 +7,20 @@ @interface OCClass
77- (void )method ;
88@end
99
10- void nl14 (OCClass *oc) [[clang::nonblocking]] {
10+ void nb1 (OCClass *oc) [[clang::nonblocking]] {
1111 [oc method ]; // expected-warning {{'nonblocking' function must not access an ObjC method or property}}
1212}
13- void nl15 (OCClass *oc) {
13+ void nb2 (OCClass *oc) {
1414 [oc method ]; // expected-note {{function cannot be inferred 'nonblocking' because it accesses an ObjC method or property}}
1515}
16- void nl16 (OCClass *oc) [[clang::nonblocking]] {
17- nl15 (oc); // expected-warning {{'nonblocking' function must not call non-'nonblocking' function 'nl15 '}}
16+ void nb3 (OCClass *oc) [[clang::nonblocking]] {
17+ nb2 (oc); // expected-warning {{'nonblocking' function must not call non-'nonblocking' function 'nb2 '}}
1818}
1919
20+ void nb4 () [[clang::nonblocking]] {
21+ @try {
22+ @throw @" foo" ; // expected-warning {{'nonblocking' function must not throw or catch exceptions}}
23+ }
24+ @catch (...) { // expected-warning {{'nonblocking' function must not throw or catch exceptions}}
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments