[clang] [clang-tools-extra] [clang]: Propagate `*noreturn` attributes in `CFG` (PR #146355)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 7 12:01:38 PDT 2025


================
@@ -141,6 +141,42 @@ void nullable_value_after_swap(BloombergLP::bdlb::NullableValue<int> &opt1, Bloo
   }
 }
 
+void assertion_handler_imp() __attribute__((analyzer_noreturn));
+
+void assertion_handler() {
+    do {
+       assertion_handler_imp();
+    } while(0);
+}
+
+void function_calling_analyzer_noreturn(const bsl::optional<int>& opt)
+{
+  if (!opt) {
+      assertion_handler();
+  }
+
+  *opt; // no-warning
----------------
5chmidti wrote:

clang-tidy tests require an exact match of diagnostics, so too many or too few diagnostics will fail the test

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


More information about the cfe-commits mailing list