[llvm] [nfc]Make InstrProfSymtab non-copyable and non-movable (PR #86882)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 27 15:48:05 PDT 2024
================
@@ -894,31 +894,34 @@ static Error readCoverageMappingData(
Expected<std::unique_ptr<BinaryCoverageReader>>
BinaryCoverageReader::createCoverageReaderFromBuffer(
StringRef Coverage, FuncRecordsStorage &&FuncRecords,
- InstrProfSymtab &&ProfileNames, uint8_t BytesInAddress,
+ std::unique_ptr<InstrProfSymtab> ProfileNames, uint8_t BytesInAddress,
llvm::endianness Endian, StringRef CompilationDir) {
- std::unique_ptr<BinaryCoverageReader> Reader(
- new BinaryCoverageReader(std::move(FuncRecords)));
- Reader->ProfileNames = std::move(ProfileNames);
+ if (ProfileNames == nullptr)
+ return make_error<CoverageMapError>(coveragemap_error::malformed,
+ "Caller must provide ProfileNames");
+ std::unique_ptr<BinaryCoverageReader> Reader(new BinaryCoverageReader(
+ std::move(ProfileNames), std::move(FuncRecords)));
+ InstrProfSymtab &ProfileNamesRef = *Reader->ProfileNames;
----------------
snehasish wrote:
Can this be const too?
nit: Also prefer just `ProfileNames`, IMO the `Ref` suffix is unnecessary.
https://github.com/llvm/llvm-project/pull/86882
More information about the llvm-commits
mailing list