mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 14:10:41 +00:00
[ProfileData] Report errors from InstrProfSymtab::create
InstrProfSymtab::create can fail with instrprof_error::malformed, but this error is silently dropped. Propagate the error up to the caller so we fail early. Eventually, I'd like to transition ProfileData over to the new Error class so we can't ignore hard failures like this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267055 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bf8e161bd9
commit
089f755c04
@ -196,7 +196,7 @@ public:
|
||||
}
|
||||
|
||||
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 {
|
||||
|
@ -297,8 +297,11 @@ RawInstrProfReader<IntPtrT>::readNextHeader(const char *CurrentPos) {
|
||||
}
|
||||
|
||||
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)
|
||||
@ -306,6 +309,7 @@ void RawInstrProfReader<IntPtrT>::createSymtab(InstrProfSymtab &Symtab) {
|
||||
Symtab.mapAddress(FPtr, I->NameRef);
|
||||
}
|
||||
Symtab.finalizeSymtab();
|
||||
return success();
|
||||
}
|
||||
|
||||
template <class IntPtrT>
|
||||
@ -345,7 +349,9 @@ RawInstrProfReader<IntPtrT>::readHeader(const RawInstrProf::Header &Header) {
|
||||
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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user