}
private:
- void createSymtab(InstrProfSymtab &Symtab);
+ std::error_code createSymtab(InstrProfSymtab &Symtab);
std::error_code readNextHeader(const char *CurrentPos);
std::error_code readHeader(const RawInstrProf::Header &Header);
template <class IntT> IntT swap(IntT Int) const {
}
template <class IntPtrT>
-void RawInstrProfReader<IntPtrT>::createSymtab(InstrProfSymtab &Symtab) {
- Symtab.create(StringRef(NamesStart, NamesSize));
+std::error_code
+RawInstrProfReader<IntPtrT>::createSymtab(InstrProfSymtab &Symtab) {
+ std::error_code EC = Symtab.create(StringRef(NamesStart, NamesSize));
+ if (EC)
+ return EC;
for (const RawInstrProf::ProfileData<IntPtrT> *I = Data; I != DataEnd; ++I) {
const IntPtrT FPtr = swap(I->FunctionPointer);
if (!FPtr)
Symtab.mapAddress(FPtr, I->NameRef);
}
Symtab.finalizeSymtab();
+ return success();
}
template <class IntPtrT>
ProfileEnd = Start + ProfileSize;
std::unique_ptr<InstrProfSymtab> NewSymtab = make_unique<InstrProfSymtab>();
- createSymtab(*NewSymtab.get());
+ if (auto EC = createSymtab(*NewSymtab.get()))
+ return EC;
+
Symtab = std::move(NewSymtab);
return success();
}