================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits