================
@@ -0,0 +1,18 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG %s 2>&1 | FileCheck 
%s
+
+void analyzer_stop(void) __attribute__((analyzer_noreturn));
+void real_stop(void) __attribute__((noreturn));
+
+// CHECK-LABEL: void analyzer(
+// CHECK: (ANALYZER NORETURN)]
+// CHECK-NOT: (NORETURN)]
+void analyzer(void) {
+  analyzer_stop();
+}
+
+// CHECK-LABEL: void real(
+// CHECK: (NORETURN)]
+// CHECK-NOT: (ANALYZER NORETURN)]
+void real(void) {
+  real_stop();
+}
----------------
steakhal wrote:

I wonder if you could duplicate this test (not reusing this file, but have a 
dedicated one) for demonstrating the static analyzer behavior:
https://godbolt.org/z/d91KEW7EG

```c++
// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection %s 
-verify

void clang_analyzer_warnIfReached();
void analyzer_stop(void) __attribute__((analyzer_noreturn));
void real_stop(void) __attribute__((noreturn));

void analyzer(void) {
  clang_analyzer_warnIfReached(); //expected-warning {{REACHABLE}}
  analyzer_stop();
  clang_analyzer_warnIfReached(); // no-warning
}

void real(void) {
  clang_analyzer_warnIfReached(); //expected-warning {{REACHABLE}}
  real_stop();
  clang_analyzer_warnIfReached(); // no-warning
}
```

https://github.com/llvm/llvm-project/pull/229577
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to