From: Chris Lattner Date: Fri, 14 Feb 2003 05:34:36 +0000 (+0000) Subject: Fix a misunderstanding of the standard associative containers X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=a3183be835b09ad0a5bb94fbac6756ff4ba956ed;p=oota-llvm.git 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 --- diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp index 2ea9ac2a56a..cfd0c39569e 100644 --- a/lib/Transforms/IPO/DeadTypeElimination.cpp +++ b/lib/Transforms/IPO/DeadTypeElimination.cpp @@ -77,15 +77,10 @@ bool DTE::run(Module &M) { for (SymbolTable::VarMap::iterator PI = Plane.begin(); PI != Plane.end();) // If this entry should be unconditionally removed, or if we detect that // the type is not used, remove it. - // if (ShouldNukeSymtabEntry(*PI) || !UsedTypes.count(cast(PI->second))) { -#if MAP_IS_NOT_BRAINDEAD - PI = Plane.erase(PI); // STD C++ Map should support this! -#else - Plane.erase(PI); // Alas, GCC 2.95.3 doesn't *SIGH* - PI = Plane.begin(); -#endif + SymbolTable::VarMap::iterator PJ = PI++; + Plane.erase(PJ); ++NumKilled; Changed = true; } else { diff --git a/lib/VMCore/PassManagerT.h b/lib/VMCore/PassManagerT.h index 53ce19f2e1f..315d9d67e4d 100644 --- a/lib/VMCore/PassManagerT.h +++ b/lib/VMCore/PassManagerT.h @@ -261,13 +261,8 @@ public: ++I; // This analysis is preserved, leave it in the available set... else { if (!dynamic_cast(I->second)) { -#if MAP_DOESNT_HAVE_BROKEN_ERASE_MEMBER - I = CurrentAnalyses.erase(I); // Analysis not preserved! -#else - // GCC 2.95.3 STL doesn't have correct erase member! - CurrentAnalyses.erase(I); - I = CurrentAnalyses.begin(); -#endif + std::map::iterator J = I++; + CurrentAnalyses.erase(J); // Analysis not preserved! } else { ++I; }