[llvm] [nfc]Make InstrProfSymtab non-copyable and non-movable (PR #86882)
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 27 18:24:54 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;
----------------
minglotus-6 wrote:
> Can this be const too?
It seems `readCoverageMappingData` and its callees only call`InstrProfSymtab::getFuncName`, which could be made `const`. A couple of places need to be updated for the const reference in this line to compile. I'll just keep it `non const` as it currently is..
> nit: Also prefer just ProfileNames, IMO the Ref suffix is unnecessary.
Sure! I renamed input parameter to `ProfileNamesPtr` and rename the reference to `ProfileNames`.
https://github.com/llvm/llvm-project/pull/86882
More information about the llvm-commits
mailing list