Skip to content

Commit

Permalink
InstrProf: Remove a function that just returns its argument (NFC)
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236664 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
bogner committed May 6, 2015
1 parent 0f04f3b commit 63134e7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
6 changes: 0 additions & 6 deletions include/llvm/ProfileData/CoverageMappingReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ class RawCoverageReader {
protected:
StringRef Data;

/// \brief Return the error code.
std::error_code error(std::error_code EC) { return EC; }

/// \brief Clear the current error code and return a successful one.
std::error_code success() { return error(instrprof_error::success); }

RawCoverageReader(StringRef Data) : Data(Data) {}

std::error_code readULEB128(uint64_t &Result);
Expand Down
40 changes: 20 additions & 20 deletions lib/ProfileData/CoverageMappingReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,31 @@ void CoverageMappingIterator::increment() {

std::error_code RawCoverageReader::readULEB128(uint64_t &Result) {
if (Data.size() < 1)
return error(instrprof_error::truncated);
return instrprof_error::truncated;
unsigned N = 0;
Result = decodeULEB128(reinterpret_cast<const uint8_t *>(Data.data()), &N);
if (N > Data.size())
return error(instrprof_error::malformed);
return instrprof_error::malformed;
Data = Data.substr(N);
return success();
return std::error_code();
}

std::error_code RawCoverageReader::readIntMax(uint64_t &Result,
uint64_t MaxPlus1) {
if (auto Err = readULEB128(Result))
return Err;
if (Result >= MaxPlus1)
return error(instrprof_error::malformed);
return success();
return instrprof_error::malformed;
return std::error_code();
}

std::error_code RawCoverageReader::readSize(uint64_t &Result) {
if (auto Err = readULEB128(Result))
return Err;
// Sanity check the number.
if (Result > Data.size())
return error(instrprof_error::malformed);
return success();
return instrprof_error::malformed;
return std::error_code();
}

std::error_code RawCoverageReader::readString(StringRef &Result) {
Expand All @@ -69,7 +69,7 @@ std::error_code RawCoverageReader::readString(StringRef &Result) {
return Err;
Result = Data.substr(0, Length);
Data = Data.substr(Length);
return success();
return std::error_code();
}

std::error_code RawCoverageFilenamesReader::read() {
Expand All @@ -82,7 +82,7 @@ std::error_code RawCoverageFilenamesReader::read() {
return Err;
Filenames.push_back(Filename);
}
return success();
return std::error_code();
}

std::error_code RawCoverageMappingReader::decodeCounter(unsigned Value,
Expand All @@ -91,10 +91,10 @@ std::error_code RawCoverageMappingReader::decodeCounter(unsigned Value,
switch (Tag) {
case Counter::Zero:
C = Counter::getZero();
return success();
return std::error_code();
case Counter::CounterValueReference:
C = Counter::getCounter(Value >> Counter::EncodingTagBits);
return success();
return std::error_code();
default:
break;
}
Expand All @@ -104,15 +104,15 @@ std::error_code RawCoverageMappingReader::decodeCounter(unsigned Value,
case CounterExpression::Add: {
auto ID = Value >> Counter::EncodingTagBits;
if (ID >= Expressions.size())
return error(instrprof_error::malformed);
return instrprof_error::malformed;
Expressions[ID].Kind = CounterExpression::ExprKind(Tag);
C = Counter::getExpression(ID);
break;
}
default:
return error(instrprof_error::malformed);
return instrprof_error::malformed;
}
return success();
return std::error_code();
}

std::error_code RawCoverageMappingReader::readCounter(Counter &C) {
Expand All @@ -122,7 +122,7 @@ std::error_code RawCoverageMappingReader::readCounter(Counter &C) {
return Err;
if (auto Err = decodeCounter(EncodedCounter, C))
return Err;
return success();
return std::error_code();
}

static const unsigned EncodingExpansionRegionBit = 1
Expand Down Expand Up @@ -159,7 +159,7 @@ std::error_code RawCoverageMappingReader::readMappingRegionsSubArray(
ExpandedFileID = EncodedCounterAndRegion >>
Counter::EncodingCounterTagAndExpansionRegionTagBits;
if (ExpandedFileID >= NumFileIDs)
return error(instrprof_error::malformed);
return instrprof_error::malformed;
} else {
switch (EncodedCounterAndRegion >>
Counter::EncodingCounterTagAndExpansionRegionTagBits) {
Expand All @@ -170,7 +170,7 @@ std::error_code RawCoverageMappingReader::readMappingRegionsSubArray(
Kind = CounterMappingRegion::SkippedRegion;
break;
default:
return error(instrprof_error::malformed);
return instrprof_error::malformed;
}
}
}
Expand All @@ -183,7 +183,7 @@ std::error_code RawCoverageMappingReader::readMappingRegionsSubArray(
if (auto Err = readULEB128(ColumnStart))
return Err;
if (ColumnStart > std::numeric_limits<unsigned>::max())
return error(instrprof_error::malformed);
return instrprof_error::malformed;
if (auto Err = readIntMax(NumLines, std::numeric_limits<unsigned>::max()))
return Err;
if (auto Err = readIntMax(ColumnEnd, std::numeric_limits<unsigned>::max()))
Expand Down Expand Up @@ -217,7 +217,7 @@ std::error_code RawCoverageMappingReader::readMappingRegionsSubArray(
C, InferredFileID, ExpandedFileID, LineStart, ColumnStart,
LineStart + NumLines, ColumnEnd, Kind));
}
return success();
return std::error_code();
}

std::error_code RawCoverageMappingReader::read() {
Expand Down Expand Up @@ -286,7 +286,7 @@ std::error_code RawCoverageMappingReader::read() {
}
}

return success();
return std::error_code();
}

namespace {
Expand Down

0 comments on commit 63134e7

Please sign in to comment.