[clang] [analyzer] Fix StdVariantChecker crash on std::get with a non-ptr arg (PR #210167)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 19 02:19:41 PDT 2026


================
@@ -226,8 +226,11 @@ class StdVariantChecker : public Checker<eval::Call, check::RegionChanges> {
     if (ArgSVal.isUnknown())
       return false;
 
-    const auto &ArgType =
-        ArgSVal.getType(C.getASTContext())->getPointeeType().getTypePtr();
+    QualType SValType = ArgSVal.getType(C.getASTContext());
+    if (SValType.isNull() || !SValType->isPointerType())
+      return false;
----------------
steakhal wrote:

I wonder why didn't we use `Call.getArgExpr(0)->getType()` in the first place? We jump a lot of hoops to get this.

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


More information about the cfe-commits mailing list