Fix a misunderstanding of the standard associative containers
authorChris Lattner <sabre@nondot.org>
Fri, 14 Feb 2003 05:34:36 +0000 (05:34 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 14 Feb 2003 05:34:36 +0000 (05:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5565 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/DeadTypeElimination.cpp
lib/VMCore/PassManagerT.h

index 2ea9ac2a56ab599005e96e49d11913e5499df5f5..cfd0c39569e11b9bf4d5b450d0e8d07131e2777b 100644 (file)
@@ -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<Type>(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 {
index 53ce19f2e1f1fd15e402b68e6c29b7805a9617c2..315d9d67e4d8a9a9aaa03d5aa1216b9abc66f7ff 100644 (file)
@@ -261,13 +261,8 @@ public:
             ++I; // This analysis is preserved, leave it in the available set...
           else {
             if (!dynamic_cast<ImmutablePass*>(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<AnalysisID, Pass*>::iterator J = I++;
+              CurrentAnalyses.erase(J);   // Analysis not preserved!
             } else {
               ++I;
             }