File tree 3 files changed +27
-7
lines changed 3 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -3487,6 +3487,18 @@ class Analyzer {
3487
3487
return Proceed;
3488
3488
}
3489
3489
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
+
3490
3502
bool VisitObjCMessageExpr (ObjCMessageExpr *Msg) {
3491
3503
diagnoseLanguageConstruct (FunctionEffect::FE_ExcludeObjCMessageSend,
3492
3504
DiagnosticID::CallsObjC, Msg->getBeginLoc ());
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -fsyntax-only -fblocks -fcxx-exceptions -verify %s
2
2
// 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.
4
4
5
5
// This diagnostic is re-enabled and exercised in isolation later in this file.
6
6
#pragma clang diagnostic ignored "-Wperf-constraint-implies-noexcept"
9
9
10
10
void nl1 () [[clang::nonblocking]]
11
11
{
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}}
13
14
}
14
15
15
16
void 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
2
2
3
3
#pragma clang diagnostic ignored "-Wperf-constraint-implies-noexcept"
4
4
@@ -7,13 +7,20 @@ @interface OCClass
7
7
- (void )method ;
8
8
@end
9
9
10
- void nl14 (OCClass *oc) [[clang::nonblocking]] {
10
+ void nb1 (OCClass *oc) [[clang::nonblocking]] {
11
11
[oc method ]; // expected-warning {{'nonblocking' function must not access an ObjC method or property}}
12
12
}
13
- void nl15 (OCClass *oc) {
13
+ void nb2 (OCClass *oc) {
14
14
[oc method ]; // expected-note {{function cannot be inferred 'nonblocking' because it accesses an ObjC method or property}}
15
15
}
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 '}}
18
18
}
19
19
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