diff options
author | Vedant Kumar <vsk@apple.com> | 2016-05-19 03:54:45 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2016-05-19 03:54:45 +0000 |
commit | 9152fd17e9a0b2fc8edf41503c026ade1d0d5b1b (patch) | |
tree | ded89a21e5bbd6aa84185c4e53395cb593d615c5 /llvm/unittests/ProfileData/CoverageMappingTest.cpp | |
parent | b784ed36c0cefd3d3289417143deecb6a7b81622 (diff) | |
download | bcm5719-llvm-9152fd17e9a0b2fc8edf41503c026ade1d0d5b1b.tar.gz bcm5719-llvm-9152fd17e9a0b2fc8edf41503c026ade1d0d5b1b.zip |
Retry^3 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"
Transition InstrProf and Coverage over to the stricter Error/Expected
interface.
Changes since the initial commit:
- Fix error message printing in llvm-profdata.
- Check errors in loadTestingFormat() + annotateAllFunctions().
- Defer error handling in InstrProfIterator to InstrProfReader.
- Remove the base ProfError class to work around an MSVC ICE.
Differential Revision: http://reviews.llvm.org/D19901
llvm-svn: 270020
Diffstat (limited to 'llvm/unittests/ProfileData/CoverageMappingTest.cpp')
-rw-r--r-- | llvm/unittests/ProfileData/CoverageMappingTest.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp b/llvm/unittests/ProfileData/CoverageMappingTest.cpp index 81e9cb13233..53b40ebae85 100644 --- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp +++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp @@ -20,11 +20,11 @@ using namespace llvm; using namespace coverage; -static ::testing::AssertionResult NoError(std::error_code EC) { - if (!EC) +static ::testing::AssertionResult NoError(Error E) { + if (!E) return ::testing::AssertionSuccess(); - return ::testing::AssertionFailure() << "error " << EC.value() - << ": " << EC.message(); + return ::testing::AssertionFailure() << "error: " << toString(std::move(E)) + << "\n"; } namespace llvm { @@ -70,14 +70,14 @@ struct CoverageMappingReaderMock : CoverageMappingReader { CoverageMappingReaderMock(ArrayRef<OutputFunctionCoverageData> Functions) : Functions(Functions) {} - std::error_code readNextRecord(CoverageMappingRecord &Record) override { + Error readNextRecord(CoverageMappingRecord &Record) override { if (Functions.empty()) - return coveragemap_error::eof; + return make_error<CoverageMapError>(coveragemap_error::eof); Functions.front().fillCoverageMappingRecord(Record); Functions = Functions.slice(1); - return coveragemap_error::success; + return Error::success(); } }; @@ -190,7 +190,7 @@ struct CoverageMappingTest : ::testing::Test { void readProfCounts() { auto Profile = ProfileWriter.writeBuffer(); auto ReaderOrErr = IndexedInstrProfReader::create(std::move(Profile)); - ASSERT_TRUE(NoError(ReaderOrErr.getError())); + ASSERT_TRUE(NoError(ReaderOrErr.takeError())); ProfileReader = std::move(ReaderOrErr.get()); } @@ -200,7 +200,7 @@ struct CoverageMappingTest : ::testing::Test { CoverageMappingReaderMock CovReader(OutputFunctions); auto CoverageOrErr = CoverageMapping::load(CovReader, *ProfileReader); - ASSERT_TRUE(NoError(CoverageOrErr.getError())); + ASSERT_TRUE(NoError(CoverageOrErr.takeError())); LoadedCoverage = std::move(CoverageOrErr.get()); } }; |