[llvm] r271048 - Don't iterate endlessly if an error occurs.
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Fri May 27 14:25:05 PDT 2016
Author: majnemer
Date: Fri May 27 16:25:05 2016
New Revision: 271048
URL: http://llvm.org/viewvc/llvm-project?rev=271048&view=rev
Log:
Don't iterate endlessly if an error occurs.
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/StreamArray.h
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/StreamArray.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/StreamArray.h?rev=271048&r1=271047&r2=271048&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/StreamArray.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/StreamArray.h Fri May 27 16:25:05 2016
@@ -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;
}
More information about the llvm-commits
mailing list