From: Jordan Rose Date: Wed, 20 Feb 2013 00:27:26 +0000 (+0000) Subject: [analyzer] Account for the "interesting values" hash table resizing. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7bfb41538747644d302344963d9247d96814dbb7;p=platform%2Fupstream%2Fllvm.git [analyzer] Account for the "interesting values" hash table resizing. 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. llvm-svn: 175582 --- diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp index f75ab02..4d9a313 100644 --- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -1629,7 +1629,7 @@ RegionStoreManager::getInterestingValues(nonloc::LazyCompoundVal LCV) { 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()); @@ -1638,7 +1638,7 @@ RegionStoreManager::getInterestingValues(nonloc::LazyCompoundVal LCV) { // values to return. const ClusterBindings *Cluster = B.lookup(LazyR->getBaseRegion()); if (!Cluster) - return List; + return (LazyBindingsMap[LCV.getCVData()] = llvm_move(List)); SmallVector Keys; collectSubRegionKeys(Keys, svalBuilder, *Cluster, LazyR, @@ -1661,7 +1661,7 @@ RegionStoreManager::getInterestingValues(nonloc::LazyCompoundVal LCV) { List.push_back(V); } - return List; + return (LazyBindingsMap[LCV.getCVData()] = llvm_move(List)); } NonLoc RegionStoreManager::createLazyBinding(RegionBindingsConstRef B,