RegionStoreManager::getInterestingValues() returns a pointer to a
std::vector that lives inside a DenseMap, which is constructed on demand.
However, constructing one such value can lead to constructing another
value, which will invalidate the reference created earlier.
Fixed by delaying the new entry creation until the function returns.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175582
91177308-0d34-0410-b5e6-
96231b3b80d8
return I->second;
// If we don't have a list of values cached, start constructing it.
- SValListTy &List = LazyBindingsMap[LCV.getCVData()];
+ SValListTy List;
const SubRegion *LazyR = LCV.getRegion();
RegionBindingsRef B = getRegionBindings(LCV.getStore());
// values to return.
const ClusterBindings *Cluster = B.lookup(LazyR->getBaseRegion());
if (!Cluster)
- return List;
+ return (LazyBindingsMap[LCV.getCVData()] = llvm_move(List));
SmallVector<BindingKey, 32> Keys;
collectSubRegionKeys(Keys, svalBuilder, *Cluster, LazyR,
List.push_back(V);
}
- return List;
+ return (LazyBindingsMap[LCV.getCVData()] = llvm_move(List));
}
NonLoc RegionStoreManager::createLazyBinding(RegionBindingsConstRef B,