[llvm] r194857 - [PM] Fix an iterator problem spotted by the MSVC debug iterators and
Chandler Carruth
chandlerc at gmail.com
Fri Nov 15 13:56:45 PST 2013
Author: chandlerc
Date: Fri Nov 15 15:56:44 2013
New Revision: 194857
URL: http://llvm.org/viewvc/llvm-project?rev=194857&view=rev
Log:
[PM] Fix an iterator problem spotted by the MSVC debug iterators and
AaronBallman. Thanks for the excellent review.
Modified:
llvm/trunk/lib/IR/PassManager.cpp
Modified: llvm/trunk/lib/IR/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/PassManager.cpp?rev=194857&r1=194856&r2=194857&view=diff
==============================================================================
--- llvm/trunk/lib/IR/PassManager.cpp (original)
+++ llvm/trunk/lib/IR/PassManager.cpp Fri Nov 15 15:56:44 2013
@@ -47,11 +47,12 @@ void AnalysisManager::invalidateAll(Func
FunctionAnalysisResultListT &ResultsList = FunctionAnalysisResultLists[F];
for (FunctionAnalysisResultListT::iterator I = ResultsList.begin(),
E = ResultsList.end();
- I != E; ++I)
+ I != E;)
if (I->second->invalidate(F)) {
- FunctionAnalysisResultListT::iterator Old = I--;
- InvalidatedPassIDs.push_back(Old->first);
- ResultsList.erase(Old);
+ InvalidatedPassIDs.push_back(I->first);
+ I = ResultsList.erase(I);
+ } else {
+ ++I;
}
while (!InvalidatedPassIDs.empty())
FunctionAnalysisResults.erase(
@@ -80,11 +81,12 @@ void AnalysisManager::invalidateAll(Modu
FunctionAnalysisResultListT &ResultsList = FI->second;
for (FunctionAnalysisResultListT::iterator I = ResultsList.begin(),
E = ResultsList.end();
- I != E; ++I)
+ I != E;)
if (I->second->invalidate(F)) {
- FunctionAnalysisResultListT::iterator Old = I--;
- InvalidatedPassIDs.push_back(Old->first);
- ResultsList.erase(Old);
+ InvalidatedPassIDs.push_back(I->first);
+ I = ResultsList.erase(I);
+ } else {
+ ++I;
}
while (!InvalidatedPassIDs.empty())
FunctionAnalysisResults.erase(
More information about the llvm-commits
mailing list