OSDN Git Service

Don't iterate endlessly if an error occurs.
authorDavid Majnemer <david.majnemer@gmail.com>
Fri, 27 May 2016 21:25:05 +0000 (21:25 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Fri, 27 May 2016 21:25:05 +0000 (21:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271048 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/DebugInfo/CodeView/StreamArray.h

index caf70db..7e4296c 100644 (file)
@@ -93,12 +93,13 @@ public:
     if (!Array || IterRef.getLength() == 0 || ThisLen == 0)
       return *this;
     IterRef = IterRef.drop_front(ThisLen);
-    if (IterRef.getLength() == 0) {
-      Array = nullptr;
+    if (IterRef.getLength() == 0)
       ThisLen = 0;
-    } else {
+    else
+      // TODO: We should report an error if Extract fails.
       ThisLen = Extract(IterRef, ThisValue);
-    }
+    if (ThisLen == 0)
+      Array = nullptr;
     return *this;
   }