reverting r252916 to investigate test failure

llvm-svn: 252921
This commit is contained in:
Nathan Slingerland
2015-11-12 18:39:26 +00:00
parent 7aefb5b623
commit 911ced6bf3
11 changed files with 28 additions and 97 deletions

View File

@@ -222,22 +222,6 @@ std::error_code SampleProfileReaderText::read() {
return sampleprof_error::success;
}
bool SampleProfileReaderText::hasFormat(const MemoryBuffer &Buffer) {
bool result = false;
// Check that the first non-comment line is a valid function header.
line_iterator LineIt(Buffer, /*SkipBlanks=*/true, '#');
if (!LineIt.is_at_eof()) {
if ((*LineIt)[0] != ' ') {
uint64_t NumSamples, NumHeadSamples;
StringRef FName;
result = ParseHead(*LineIt, FName, NumSamples, NumHeadSamples);
}
}
return result;
}
template <typename T> ErrorOr<T> SampleProfileReaderBinary::readNumber() {
unsigned NumBytesRead = 0;
std::error_code EC;
@@ -701,10 +685,8 @@ SampleProfileReader::create(StringRef Filename, LLVMContext &C) {
Reader.reset(new SampleProfileReaderBinary(std::move(Buffer), C));
else if (SampleProfileReaderGCC::hasFormat(*Buffer))
Reader.reset(new SampleProfileReaderGCC(std::move(Buffer), C));
else if (SampleProfileReaderText::hasFormat(*Buffer))
Reader.reset(new SampleProfileReaderText(std::move(Buffer), C));
else
return sampleprof_error::unrecognized_format;
Reader.reset(new SampleProfileReaderText(std::move(Buffer), C));
if (std::error_code EC = Reader->readHeader())
return EC;