From 4e2b922131ae617cb8738d1871e9d918c44bdb69 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 13 Jun 2014 02:24:39 +0000 Subject: Remove 'using std::errro_code' from lib. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210871 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ProfileData/InstrProfReader.cpp | 41 ++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'lib/ProfileData') diff --git a/lib/ProfileData/InstrProfReader.cpp b/lib/ProfileData/InstrProfReader.cpp index 8d3ec5d2a3..c7809b8b8c 100644 --- a/lib/ProfileData/InstrProfReader.cpp +++ b/lib/ProfileData/InstrProfReader.cpp @@ -20,11 +20,10 @@ #include using namespace llvm; -using std::error_code; -static error_code setupMemoryBuffer(std::string Path, - std::unique_ptr &Buffer) { - if (error_code EC = MemoryBuffer::getFileOrSTDIN(Path, Buffer)) +static std::error_code +setupMemoryBuffer(std::string Path, std::unique_ptr &Buffer) { + if (std::error_code EC = MemoryBuffer::getFileOrSTDIN(Path, Buffer)) return EC; // Sanity check the file. @@ -33,15 +32,16 @@ static error_code setupMemoryBuffer(std::string Path, return instrprof_error::success; } -static error_code initializeReader(InstrProfReader &Reader) { +static std::error_code initializeReader(InstrProfReader &Reader) { return Reader.readHeader(); } -error_code InstrProfReader::create(std::string Path, - std::unique_ptr &Result) { +std::error_code +InstrProfReader::create(std::string Path, + std::unique_ptr &Result) { // Set up the buffer to read. std::unique_ptr Buffer; - if (error_code EC = setupMemoryBuffer(Path, Buffer)) + if (std::error_code EC = setupMemoryBuffer(Path, Buffer)) return EC; // Create the reader. @@ -58,11 +58,11 @@ error_code InstrProfReader::create(std::string Path, return initializeReader(*Result); } -error_code IndexedInstrProfReader::create( +std::error_code IndexedInstrProfReader::create( std::string Path, std::unique_ptr &Result) { // Set up the buffer to read. std::unique_ptr Buffer; - if (error_code EC = setupMemoryBuffer(Path, Buffer)) + if (std::error_code EC = setupMemoryBuffer(Path, Buffer)) return EC; // Create the reader. @@ -79,7 +79,7 @@ void InstrProfIterator::Increment() { *this = InstrProfIterator(); } -error_code TextInstrProfReader::readNextRecord(InstrProfRecord &Record) { +std::error_code TextInstrProfReader::readNextRecord(InstrProfRecord &Record) { // Skip empty lines. while (!Line.is_at_end() && Line->empty()) ++Line; @@ -162,7 +162,7 @@ bool RawInstrProfReader::hasFormat(const MemoryBuffer &DataBuffer) { } template -error_code RawInstrProfReader::readHeader() { +std::error_code RawInstrProfReader::readHeader() { if (!hasFormat(*DataBuffer)) return error(instrprof_error::bad_magic); if (DataBuffer->getBufferSize() < sizeof(RawHeader)) @@ -174,7 +174,8 @@ error_code RawInstrProfReader::readHeader() { } template -error_code RawInstrProfReader::readNextHeader(const char *CurrentPos) { +std::error_code +RawInstrProfReader::readNextHeader(const char *CurrentPos) { const char *End = DataBuffer->getBufferEnd(); // Skip zero padding between profiles. while (CurrentPos != End && *CurrentPos == 0) @@ -201,7 +202,8 @@ static uint64_t getRawVersion() { } template -error_code RawInstrProfReader::readHeader(const RawHeader &Header) { +std::error_code +RawInstrProfReader::readHeader(const RawHeader &Header) { if (swap(Header.Version) != getRawVersion()) return error(instrprof_error::unsupported_version); @@ -230,10 +232,10 @@ error_code RawInstrProfReader::readHeader(const RawHeader &Header) { } template -error_code +std::error_code RawInstrProfReader::readNextRecord(InstrProfRecord &Record) { if (Data == DataEnd) - if (error_code EC = readNextHeader(ProfileEnd)) + if (std::error_code EC = readNextHeader(ProfileEnd)) return EC; // Get the raw data. @@ -287,7 +289,7 @@ bool IndexedInstrProfReader::hasFormat(const MemoryBuffer &DataBuffer) { return Magic == IndexedInstrProf::Magic; } -error_code IndexedInstrProfReader::readHeader() { +std::error_code IndexedInstrProfReader::readHeader() { const unsigned char *Start = (const unsigned char *)DataBuffer->getBufferStart(); const unsigned char *Cur = Start; @@ -325,7 +327,7 @@ error_code IndexedInstrProfReader::readHeader() { return success(); } -error_code IndexedInstrProfReader::getFunctionCounts( +std::error_code IndexedInstrProfReader::getFunctionCounts( StringRef FuncName, uint64_t &FuncHash, std::vector &Counts) { const auto &Iter = Index->find(FuncName); if (Iter == Index->end()) @@ -340,7 +342,8 @@ error_code IndexedInstrProfReader::getFunctionCounts( return success(); } -error_code IndexedInstrProfReader::readNextRecord(InstrProfRecord &Record) { +std::error_code +IndexedInstrProfReader::readNextRecord(InstrProfRecord &Record) { // Are we out of records? if (RecordIterator == Index->data_end()) return error(instrprof_error::eof); -- cgit v1.2.3