Skip to content

Commit 9392138

Browse files
Address feedback: simplify bindArray & add FIXME
No need to unwrap constants. This is a workaround to not crash -- not a proper fix.
1 parent f5761ec commit 9392138

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

clang/lib/StaticAnalyzer/Core/RegionStore.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2657,16 +2657,18 @@ RegionStoreManager::bindArray(LimitedRegionBindingsConstRef B,
26572657
SVal V = getBinding(B.asStore(), *MRV, R->getValueType());
26582658
return bindAggregate(B, R, V);
26592659
}
2660-
if (llvm::APSInt const *Value = Init.getAsInteger()) {
2661-
auto SafeValue = StateMgr.getBasicVals().getValue(*Value);
2662-
return bindAggregate(B, R, nonloc::ConcreteInt(SafeValue));
2663-
}
2660+
2661+
// FIXME Single value constant should have been handled before this call to
2662+
// bindArray. This is only a hotfix to not crash.
2663+
if (Init.isConstant())
2664+
return bindAggregate(B, R, Init);
26642665

26652666
if (std::optional LCV = Init.getAs<nonloc::LazyCompoundVal>()) {
26662667
if (std::optional NewB = tryBindSmallArray(B, R, AT, *LCV))
26672668
return *NewB;
26682669
return bindAggregate(B, R, Init);
26692670
}
2671+
26702672
if (isa<nonloc::SymbolVal>(Init))
26712673
return bindAggregate(B, R, Init);
26722674

0 commit comments

Comments
 (0)