evaluateAsBooleanConditionNoCache(S) might update the map and invalidate the iterator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153406
91177308-0d34-0410-b5e6-
96231b3b80d8
CachedBoolEvals.insert(std::make_pair(S, TryResult()));
if (!Inserted)
return I->second; // already in map;
-
- return (I->second = evaluateAsBooleanConditionNoCache(S));
+
+ // Retrieve result at first, or the map might be updated.
+ TryResult Result = evaluateAsBooleanConditionNoCache(S);
+ CachedBoolEvals[S] = Result; // update or insert
+ return Result;
}
}