[PATCH] D63713: Add error handling to the DataExtractor class
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 01:53:20 PDT 2019
labath marked 12 inline comments as done.
labath added inline comments.
================
Comment at: include/llvm/Support/DataExtractor.h:437
+ void skip(Cursor &C, uint32_t Length) const;
+ bool eof(const Cursor &C) const { return Data.size() == C.Offset; }
----------------
probinson wrote:
> So eof() intentionally ignores the error state? (Just making sure the contract is understood.)
Yes, that's analogous to std::iostream, where `eof()` tests the `eofbit` and `operator bool` checks the `failbit` (we don't have a `badbit` because there's no way to get a hard read error when reading from memory).
================
Comment at: unittests/Support/DataExtractorTest.cpp:10
#include "llvm/Support/DataExtractor.h"
+#include "llvm/Testing/Support/Error.h"
#include "gtest/gtest.h"
----------------
probinson wrote:
> The Error is part of the DataExtractor interface, you should not need to #include this here.
This is the testing support header which defines stuff that makes things like `EXPECT_THAT_ERROR(..., Succeeded())` work.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63713/new/
https://reviews.llvm.org/D63713
More information about the llvm-commits
mailing list