InstrProf: Remove a function that just returns its argument (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236664 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Justin Bogner 2015-05-06 23:15:55 +00:00
parent 0f04f3b213
commit 63134e79e6
2 changed files with 20 additions and 26 deletions

View File

@ -80,12 +80,6 @@ class RawCoverageReader {
protected: protected:
StringRef Data; 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) {} RawCoverageReader(StringRef Data) : Data(Data) {}
std::error_code readULEB128(uint64_t &Result); std::error_code readULEB128(uint64_t &Result);

View File

@ -36,13 +36,13 @@ void CoverageMappingIterator::increment() {
std::error_code RawCoverageReader::readULEB128(uint64_t &Result) { std::error_code RawCoverageReader::readULEB128(uint64_t &Result) {
if (Data.size() < 1) if (Data.size() < 1)
return error(instrprof_error::truncated); return instrprof_error::truncated;
unsigned N = 0; unsigned N = 0;
Result = decodeULEB128(reinterpret_cast<const uint8_t *>(Data.data()), &N); Result = decodeULEB128(reinterpret_cast<const uint8_t *>(Data.data()), &N);
if (N > Data.size()) if (N > Data.size())
return error(instrprof_error::malformed); return instrprof_error::malformed;
Data = Data.substr(N); Data = Data.substr(N);
return success(); return std::error_code();
} }
std::error_code RawCoverageReader::readIntMax(uint64_t &Result, std::error_code RawCoverageReader::readIntMax(uint64_t &Result,
@ -50,8 +50,8 @@ std::error_code RawCoverageReader::readIntMax(uint64_t &Result,
if (auto Err = readULEB128(Result)) if (auto Err = readULEB128(Result))
return Err; return Err;
if (Result >= MaxPlus1) if (Result >= MaxPlus1)
return error(instrprof_error::malformed); return instrprof_error::malformed;
return success(); return std::error_code();
} }
std::error_code RawCoverageReader::readSize(uint64_t &Result) { std::error_code RawCoverageReader::readSize(uint64_t &Result) {
@ -59,8 +59,8 @@ std::error_code RawCoverageReader::readSize(uint64_t &Result) {
return Err; return Err;
// Sanity check the number. // Sanity check the number.
if (Result > Data.size()) if (Result > Data.size())
return error(instrprof_error::malformed); return instrprof_error::malformed;
return success(); return std::error_code();
} }
std::error_code RawCoverageReader::readString(StringRef &Result) { std::error_code RawCoverageReader::readString(StringRef &Result) {
@ -69,7 +69,7 @@ std::error_code RawCoverageReader::readString(StringRef &Result) {
return Err; return Err;
Result = Data.substr(0, Length); Result = Data.substr(0, Length);
Data = Data.substr(Length); Data = Data.substr(Length);
return success(); return std::error_code();
} }
std::error_code RawCoverageFilenamesReader::read() { std::error_code RawCoverageFilenamesReader::read() {
@ -82,7 +82,7 @@ std::error_code RawCoverageFilenamesReader::read() {
return Err; return Err;
Filenames.push_back(Filename); Filenames.push_back(Filename);
} }
return success(); return std::error_code();
} }
std::error_code RawCoverageMappingReader::decodeCounter(unsigned Value, std::error_code RawCoverageMappingReader::decodeCounter(unsigned Value,
@ -91,10 +91,10 @@ std::error_code RawCoverageMappingReader::decodeCounter(unsigned Value,
switch (Tag) { switch (Tag) {
case Counter::Zero: case Counter::Zero:
C = Counter::getZero(); C = Counter::getZero();
return success(); return std::error_code();
case Counter::CounterValueReference: case Counter::CounterValueReference:
C = Counter::getCounter(Value >> Counter::EncodingTagBits); C = Counter::getCounter(Value >> Counter::EncodingTagBits);
return success(); return std::error_code();
default: default:
break; break;
} }
@ -104,15 +104,15 @@ std::error_code RawCoverageMappingReader::decodeCounter(unsigned Value,
case CounterExpression::Add: { case CounterExpression::Add: {
auto ID = Value >> Counter::EncodingTagBits; auto ID = Value >> Counter::EncodingTagBits;
if (ID >= Expressions.size()) if (ID >= Expressions.size())
return error(instrprof_error::malformed); return instrprof_error::malformed;
Expressions[ID].Kind = CounterExpression::ExprKind(Tag); Expressions[ID].Kind = CounterExpression::ExprKind(Tag);
C = Counter::getExpression(ID); C = Counter::getExpression(ID);
break; break;
} }
default: default:
return error(instrprof_error::malformed); return instrprof_error::malformed;
} }
return success(); return std::error_code();
} }
std::error_code RawCoverageMappingReader::readCounter(Counter &C) { std::error_code RawCoverageMappingReader::readCounter(Counter &C) {
@ -122,7 +122,7 @@ std::error_code RawCoverageMappingReader::readCounter(Counter &C) {
return Err; return Err;
if (auto Err = decodeCounter(EncodedCounter, C)) if (auto Err = decodeCounter(EncodedCounter, C))
return Err; return Err;
return success(); return std::error_code();
} }
static const unsigned EncodingExpansionRegionBit = 1 static const unsigned EncodingExpansionRegionBit = 1
@ -159,7 +159,7 @@ std::error_code RawCoverageMappingReader::readMappingRegionsSubArray(
ExpandedFileID = EncodedCounterAndRegion >> ExpandedFileID = EncodedCounterAndRegion >>
Counter::EncodingCounterTagAndExpansionRegionTagBits; Counter::EncodingCounterTagAndExpansionRegionTagBits;
if (ExpandedFileID >= NumFileIDs) if (ExpandedFileID >= NumFileIDs)
return error(instrprof_error::malformed); return instrprof_error::malformed;
} else { } else {
switch (EncodedCounterAndRegion >> switch (EncodedCounterAndRegion >>
Counter::EncodingCounterTagAndExpansionRegionTagBits) { Counter::EncodingCounterTagAndExpansionRegionTagBits) {
@ -170,7 +170,7 @@ std::error_code RawCoverageMappingReader::readMappingRegionsSubArray(
Kind = CounterMappingRegion::SkippedRegion; Kind = CounterMappingRegion::SkippedRegion;
break; break;
default: default:
return error(instrprof_error::malformed); return instrprof_error::malformed;
} }
} }
} }
@ -183,7 +183,7 @@ std::error_code RawCoverageMappingReader::readMappingRegionsSubArray(
if (auto Err = readULEB128(ColumnStart)) if (auto Err = readULEB128(ColumnStart))
return Err; return Err;
if (ColumnStart > std::numeric_limits<unsigned>::max()) 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())) if (auto Err = readIntMax(NumLines, std::numeric_limits<unsigned>::max()))
return Err; return Err;
if (auto Err = readIntMax(ColumnEnd, std::numeric_limits<unsigned>::max())) if (auto Err = readIntMax(ColumnEnd, std::numeric_limits<unsigned>::max()))
@ -217,7 +217,7 @@ std::error_code RawCoverageMappingReader::readMappingRegionsSubArray(
C, InferredFileID, ExpandedFileID, LineStart, ColumnStart, C, InferredFileID, ExpandedFileID, LineStart, ColumnStart,
LineStart + NumLines, ColumnEnd, Kind)); LineStart + NumLines, ColumnEnd, Kind));
} }
return success(); return std::error_code();
} }
std::error_code RawCoverageMappingReader::read() { std::error_code RawCoverageMappingReader::read() {
@ -286,7 +286,7 @@ std::error_code RawCoverageMappingReader::read() {
} }
} }
return success(); return std::error_code();
} }
namespace { namespace {