diff options
Diffstat (limited to 'lib/ProfileData/InstrProfReader.cpp')
| -rw-r--r-- | lib/ProfileData/InstrProfReader.cpp | 16 | 
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/ProfileData/InstrProfReader.cpp b/lib/ProfileData/InstrProfReader.cpp index d9f599f400da..1ed1fb8b6f0b 100644 --- a/lib/ProfileData/InstrProfReader.cpp +++ b/lib/ProfileData/InstrProfReader.cpp @@ -200,7 +200,8 @@ TextInstrProfReader::readValueProfileData(InstrProfRecord &Record) {          std::pair<StringRef, StringRef> VD = Line->rsplit(':');          uint64_t TakenCount, Value;          if (ValueKind == IPVK_IndirectCallTarget) { -          Symtab->addFuncName(VD.first); +          if (Error E = Symtab->addFuncName(VD.first)) +            return E;            Value = IndexedInstrProf::ComputeHash(VD.first);          } else {            READ_NUM(VD.first, Value); @@ -232,7 +233,8 @@ Error TextInstrProfReader::readNextRecord(InstrProfRecord &Record) {    // Read the function name.    Record.Name = *Line++; -  Symtab->addFuncName(Record.Name); +  if (Error E = Symtab->addFuncName(Record.Name)) +    return E;    // Read the function hash.    if (Line.is_at_end()) @@ -482,8 +484,8 @@ InstrProfLookupTrait::ComputeHash(StringRef K) {    return IndexedInstrProf::ComputeHash(HashType, K);  } -typedef InstrProfLookupTrait::data_type data_type; -typedef InstrProfLookupTrait::offset_type offset_type; +using data_type = InstrProfLookupTrait::data_type; +using offset_type = InstrProfLookupTrait::offset_type;  bool InstrProfLookupTrait::readValueProfilingData(      const unsigned char *&D, const unsigned char *const End) { @@ -620,7 +622,7 @@ IndexedInstrProfReader::readSummary(IndexedInstrProf::ProfVersion Version,      for (unsigned I = 0; I < SummarySize / sizeof(uint64_t); I++)        Dst[I] = endian::byte_swap<uint64_t, little>(Src[I]); -    llvm::SummaryEntryVector DetailedSummary; +    SummaryEntryVector DetailedSummary;      for (unsigned I = 0; I < SummaryData->NumCutoffEntries; I++) {        const IndexedInstrProf::Summary::Entry &Ent = SummaryData->getEntry(I);        DetailedSummary.emplace_back((uint32_t)Ent.Cutoff, Ent.MinBlockCount, @@ -694,7 +696,9 @@ InstrProfSymtab &IndexedInstrProfReader::getSymtab() {      return *Symtab.get();    std::unique_ptr<InstrProfSymtab> NewSymtab = make_unique<InstrProfSymtab>(); -  Index->populateSymtab(*NewSymtab.get()); +  if (Error E = Index->populateSymtab(*NewSymtab.get())) { +    consumeError(error(InstrProfError::take(std::move(E)))); +  }    Symtab = std::move(NewSymtab);    return *Symtab.get();  | 
