Fix a misunderstanding of the standard associative containers

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5565 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-02-14 05:34:36 +00:00
parent 1a1a85d514
commit a3183be835
2 changed files with 4 additions and 14 deletions

View File

@ -77,15 +77,10 @@ bool DTE::run(Module &M) {
for (SymbolTable::VarMap::iterator PI = Plane.begin(); PI != Plane.end();) for (SymbolTable::VarMap::iterator PI = Plane.begin(); PI != Plane.end();)
// If this entry should be unconditionally removed, or if we detect that // If this entry should be unconditionally removed, or if we detect that
// the type is not used, remove it. // the type is not used, remove it.
//
if (ShouldNukeSymtabEntry(*PI) || if (ShouldNukeSymtabEntry(*PI) ||
!UsedTypes.count(cast<Type>(PI->second))) { !UsedTypes.count(cast<Type>(PI->second))) {
#if MAP_IS_NOT_BRAINDEAD SymbolTable::VarMap::iterator PJ = PI++;
PI = Plane.erase(PI); // STD C++ Map should support this! Plane.erase(PJ);
#else
Plane.erase(PI); // Alas, GCC 2.95.3 doesn't *SIGH*
PI = Plane.begin();
#endif
++NumKilled; ++NumKilled;
Changed = true; Changed = true;
} else { } else {

View File

@ -261,13 +261,8 @@ public:
++I; // This analysis is preserved, leave it in the available set... ++I; // This analysis is preserved, leave it in the available set...
else { else {
if (!dynamic_cast<ImmutablePass*>(I->second)) { if (!dynamic_cast<ImmutablePass*>(I->second)) {
#if MAP_DOESNT_HAVE_BROKEN_ERASE_MEMBER std::map<AnalysisID, Pass*>::iterator J = I++;
I = CurrentAnalyses.erase(I); // Analysis not preserved! CurrentAnalyses.erase(J); // Analysis not preserved!
#else
// GCC 2.95.3 STL doesn't have correct erase member!
CurrentAnalyses.erase(I);
I = CurrentAnalyses.begin();
#endif
} else { } else {
++I; ++I;
} }