diff options
Diffstat (limited to 'llvm/lib/ProfileData/InstrProfReader.cpp')
-rw-r--r-- | llvm/lib/ProfileData/InstrProfReader.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp index 74f3f3270c4c..068922d421f8 100644 --- a/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/llvm/lib/ProfileData/InstrProfReader.cpp @@ -246,7 +246,7 @@ bool TextInstrProfReader::hasFormat(const MemoryBuffer &Buffer) { Error TextInstrProfReader::readHeader() { Symtab.reset(new InstrProfSymtab()); - while (Line->startswith(":")) { + while (Line->starts_with(":")) { StringRef Str = Line->substr(1); if (Str.equals_insensitive("ir")) ProfileKind |= InstrProfKind::IRInstrumentation; @@ -386,7 +386,7 @@ TextInstrProfReader::readValueProfileData(InstrProfRecord &Record) { Error TextInstrProfReader::readNextRecord(NamedInstrProfRecord &Record) { // Skip empty lines and comments. - while (!Line.is_at_end() && (Line->empty() || Line->startswith("#"))) + while (!Line.is_at_end() && (Line->empty() || Line->starts_with("#"))) ++Line; // If we hit EOF while looking for a name, we're done. if (Line.is_at_end()) { @@ -428,7 +428,7 @@ Error TextInstrProfReader::readNextRecord(NamedInstrProfRecord &Record) { } // Bitmap byte information is indicated with special character. - if (Line->startswith("$")) { + if (Line->starts_with("$")) { Record.BitmapBytes.clear(); // Read the number of bitmap bytes. uint64_t NumBitmapBytes; @@ -556,10 +556,6 @@ Error RawInstrProfReader<IntPtrT>::readHeader( "\nPLEASE update this tool to version in the raw profile, or " "regenerate raw profile with expected version.") .str()); - if (useCorrelate() && !Correlator) - return error(instrprof_error::missing_debug_info_for_correlation); - if (!useCorrelate() && Correlator) - return error(instrprof_error::unexpected_debug_info_for_correlation); uint64_t BinaryIdSize = swap(Header.BinaryIdsSize); // Binary id start just after the header if exists. @@ -607,8 +603,9 @@ Error RawInstrProfReader<IntPtrT>::readHeader( if (Correlator) { // These sizes in the raw file are zero because we constructed them in the // Correlator. - assert(DataSize == 0 && NamesSize == 0); - assert(CountersDelta == 0 && NamesDelta == 0); + if (!(DataSize == 0 && NamesSize == 0 && CountersDelta == 0 && + NamesDelta == 0)) + return error(instrprof_error::unexpected_correlation_info); Data = Correlator->getDataPointer(); DataEnd = Data + Correlator->getDataSize(); NamesStart = Correlator->getNamesPointer(); @@ -1017,7 +1014,7 @@ public: std::pair<StringRef, StringRef> Parts = {StringRef(), Name}; while (true) { Parts = Parts.second.split(':'); - if (Parts.first.startswith("_Z")) + if (Parts.first.starts_with("_Z")) return Parts.first; if (Parts.second.empty()) return Name; |