[clang] [NFC][analyzer] Add regression tests from bisection commits to the CSA's test suite (PR #241058)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 02:40:21 PST 2026


================
@@ -120,3 +120,30 @@ void test_constant_p(void *ptr) {
   clang_analyzer_eval(__builtin_constant_p(k - 3) == 1); // expected-warning {{TRUE}}
   clang_analyzer_eval(__builtin_constant_p(ptr == 0)); // expected-warning {{FALSE}}
 }
+
+#ifdef _WIN32
+namespace GH39448 {
+struct A { int someApi(); };
+
+int testAssert(A* a) {
+  __assume(a != nullptr);
+  return a->someApi();
+}
+
+int testAssert2(int* a) {
+  __assume(a != nullptr);
+  return *a;
+}
+
+int testAssert3(A* a) {
+  __assume(a);
+  return a->someApi();
+}
+
+int testAssert4(int* a) {
+  __assume(a);
+  return *a;
----------------
steakhal wrote:

I think part of the deal here is that the assumption gets into the State. I think you should check the pointer using clang_analyzer_eval or _value - depending on if eager assumptions are off or not.

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


More information about the cfe-commits mailing list