[clang] [Clang] Diagnose additional ObjC statements as function effect violations (PR #112148)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 14 08:04:03 PDT 2024


================
@@ -23,4 +23,17 @@ void nb4() [[clang::nonblocking]] {
 	}
 	@catch (...) { // expected-warning {{function with 'nonblocking' attribute must not throw or catch exceptions}}
 	}
+	@finally { // expected-warning {{function with 'nonblocking' attribute must not throw or catch exceptions}}
+	}
 }
+
+ at class Lock;
+extern Lock *someLock;
+
+void nb5() [[clang::nonblocking]] {
+	@autoreleasepool { // expected-warning {{function with 'nonblocking' attribute must not access ObjC methods or properties}}
+	}
+
+	@synchronized(someLock) { // expected-warning {{function with 'nonblocking' attribute must not access ObjC methods or properties}}
+	}
+}
----------------
Sirraide wrote:

nit: Missing newline

https://github.com/llvm/llvm-project/pull/112148


More information about the cfe-commits mailing list