Fix this code to avoid decrementing an iterator past the beginning
authorDan Gohman <gohman@apple.com>
Wed, 28 Jul 2010 17:15:36 +0000 (17:15 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 28 Jul 2010 17:15:36 +0000 (17:15 +0000)
of a std::vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109597 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PIC16/PIC16.h

index cee55f4f260fe3c67324cac7d58fa208be76e5fa..08bb3e6f055b62092e11001da755bbcc44876a01 100644 (file)
@@ -58,13 +58,10 @@ namespace PIC16CC {
     ESNames() {}
     public:
     ~ESNames() {
-      std::vector<char*>::iterator it = stk.end();
-      it--;
-      while(stk.end() != stk.begin())
+      while (!stk.empty())
         {
-        char* p = *it;
+        char* p = stk.back();
         delete [] p;
-        it--;
         stk.pop_back();
         }
     }