mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:29:58 +00:00
[ProfileData] Propagate an error from InstrProfSymtab
CovMapFuncReader::get should propagate up errors from InstrProfSymtab. This is part of a series of patches to transition ProfileData over to the stricter Error/Expected interface. llvm-svn: 268428
This commit is contained in:
parent
84e14ec542
commit
313c6484e5
@ -316,7 +316,7 @@ struct CovMapFuncRecordReader {
|
||||
const char *End) = 0;
|
||||
virtual ~CovMapFuncRecordReader() {}
|
||||
template <class IntPtrT, support::endianness Endian>
|
||||
static std::unique_ptr<CovMapFuncRecordReader>
|
||||
static ErrorOr<std::unique_ptr<CovMapFuncRecordReader>>
|
||||
get(coverage::CovMapVersion Version, InstrProfSymtab &P,
|
||||
std::vector<BinaryCoverageReader::ProfileMappingRecord> &R,
|
||||
std::vector<StringRef> &F);
|
||||
@ -417,7 +417,7 @@ public:
|
||||
} // end anonymous namespace
|
||||
|
||||
template <class IntPtrT, support::endianness Endian>
|
||||
std::unique_ptr<CovMapFuncRecordReader> CovMapFuncRecordReader::get(
|
||||
ErrorOr<std::unique_ptr<CovMapFuncRecordReader>> CovMapFuncRecordReader::get(
|
||||
coverage::CovMapVersion Version, InstrProfSymtab &P,
|
||||
std::vector<BinaryCoverageReader::ProfileMappingRecord> &R,
|
||||
std::vector<StringRef> &F) {
|
||||
@ -428,7 +428,8 @@ std::unique_ptr<CovMapFuncRecordReader> CovMapFuncRecordReader::get(
|
||||
CovMapVersion::Version1, IntPtrT, Endian>>(P, R, F);
|
||||
case CovMapVersion::Version2:
|
||||
// Decompress the name data.
|
||||
P.create(P.getNameData());
|
||||
if (auto EC = P.create(P.getNameData()))
|
||||
return EC;
|
||||
return llvm::make_unique<VersionedCovMapFuncRecordReader<
|
||||
CovMapVersion::Version2, IntPtrT, Endian>>(P, R, F);
|
||||
}
|
||||
@ -447,9 +448,12 @@ static std::error_code readCoverageMappingData(
|
||||
CovMapVersion Version = (CovMapVersion)CovHeader->getVersion<Endian>();
|
||||
if (Version > coverage::CovMapVersion::CurrentVersion)
|
||||
return coveragemap_error::unsupported_version;
|
||||
std::unique_ptr<CovMapFuncRecordReader> Reader =
|
||||
ErrorOr<std::unique_ptr<CovMapFuncRecordReader>> ReaderErrorOr =
|
||||
CovMapFuncRecordReader::get<T, Endian>(Version, ProfileNames, Records,
|
||||
Filenames);
|
||||
if (auto EC = ReaderErrorOr.getError())
|
||||
return EC;
|
||||
auto Reader = std::move(ReaderErrorOr.get());
|
||||
for (const char *Buf = Data.data(), *End = Buf + Data.size(); Buf < End;) {
|
||||
if (std::error_code EC = Reader->readFunctionRecords(Buf, End))
|
||||
return EC;
|
||||
|
Loading…
Reference in New Issue
Block a user