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

Andrey Karlov via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 1 03:45:10 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
----------------
negativ wrote:

Anyway, i consider moving this kind of check to `clang\unittests\Analysis\FlowSensitive\UncheckedOptionalAccessModelTest.cpp`

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


More information about the cfe-commits mailing list