[clang] [clang:static-analyzer] fix: allow construction of atomic pointers from nullptr. (PR #190131)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 8 10:09:46 PDT 2026


================
@@ -346,11 +346,12 @@ class SValBuilder {
   /// \param type pointer type.
   loc::ConcreteInt makeNullWithType(QualType type) {
     // We cannot use the `isAnyPointerType()`.
-    assert((type->isPointerType() || type->isObjCObjectPointerType() ||
-            type->isBlockPointerType() || type->isNullPtrType() ||
-            type->isReferenceType()) &&
+    assert((type->isObjCObjectPointerType() || Loc::isLocType(type)) &&
            "makeNullWithType must use pointer type");
 
+    type =
+        type->isAtomicType() ? type->getAs<AtomicType>()->getValueType() : type;
----------------
steakhal wrote:

Aaaa, -.- I feel so bad. Yes, you are doing the exactly right thing!
So sorry for this confusion on my end!

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


More information about the cfe-commits mailing list