[PATCH] D78797: [Support] Refactor LEB128 decoding into an output iterator

Nicolas Guillemot via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 24 23:15:32 PDT 2020


nlguillemot updated this revision to Diff 260068.
nlguillemot added a comment.

Replaced assignments of `0` with assignments of `ValueT()`, as a more generic way to get a zero value.

  diff
  diff --git a/llvm/include/llvm/Support/LEB128.h b/llvm/include/llvm/Support/LEB128.h
  index c9649365bbd..bb92d664603 100644
  --- a/llvm/include/llvm/Support/LEB128.h
  +++ b/llvm/include/llvm/Support/LEB128.h
  @@ -202,7 +202,7 @@ public:
         : Value(Value), IsSigned(IsSigned), Error(nullptr), Shift(0),
           IsComplete(false) {
       // Initially zero before any decoded bits are written into it.
  -    this->Value = 0;
  +    this->Value = ValueT();
     }
  
     /// Decodes one byte from a stream of LEB128-encoded bytes, and stores the
  @@ -326,7 +326,7 @@ ValueT decodeLEB128(const uint8_t *p, bool IsSigned, unsigned *n = nullptr,
     if (error)
       *error = found_error;
     if (found_error)
  -    return 0;
  +    return ValueT();
     return Value;
   }


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78797/new/

https://reviews.llvm.org/D78797

Files:
  llvm/include/llvm/Support/LEB128.h
  llvm/unittests/Support/LEB128Test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78797.260068.patch
Type: text/x-patch
Size: 7469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200425/27329574/attachment.bin>


More information about the llvm-commits mailing list