[clang] [analyzer] Variant checker bindings (PR #87886)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 8 09:10:47 PDT 2024
================
@@ -231,16 +265,22 @@ class StdVariantChecker : public Checker<eval::Call, check::RegionChanges> {
// Get the mem region of the argument std::variant and look up the type
// information that we know about it.
const MemRegion *ArgMemRegion = Call.getArgSVal(0).getAsRegion();
- const QualType *StoredType = State->get<VariantHeldTypeMap>(ArgMemRegion);
- if (!StoredType)
+ const SVal *StoredSVal = State->get<VariantHeldMap>(ArgMemRegion);
+ if (!StoredSVal)
+ return false;
+
+ QualType RefStoredType = StoredSVal->getType(C.getASTContext());
+
+ if (RefStoredType->getPointeeType().isNull())
return false;
+ QualType StoredType = RefStoredType->getPointeeType();
----------------
NagyDonat wrote:
```suggestion
QualType StoredType = RefStoredType->getPointeeType();
if (StoredType.isNull())
return false;
```
https://github.com/llvm/llvm-project/pull/87886
More information about the cfe-commits
mailing list