diff options
author | Daniel Thornburgh <dthorn@google.com> | 2023-04-03 11:15:31 -0700 |
---|---|---|
committer | Daniel Thornburgh <dthorn@google.com> | 2023-04-05 11:25:26 -0700 |
commit | 9812948d22328e6f810c7654b93b063ce97ecfec (patch) | |
tree | 2282e12214e44bd1e68e87943e0d08a5aae0e534 /llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp | |
parent | e289b53f4d9bffd71613d6f91747bf9bda0ae352 (diff) | |
download | llvm-9812948d22328e6f810c7654b93b063ce97ecfec.zip llvm-9812948d22328e6f810c7654b93b063ce97ecfec.tar.gz llvm-9812948d22328e6f810c7654b93b063ce97ecfec.tar.bz2 |
[Object] Refactor build ID parsing into Object lib.
This makes parsing for build IDs in the markup filter slightly more
permissive, in line with fromHex.
It also removes the distinction between missing build ID and empty build
ID; empty build IDs aren't a useful concept, since their purpose is to
uniquely identify a binary. This removes a layer of indirection wherever
build IDs are obtained.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D147485
Diffstat (limited to 'llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp')
-rw-r--r-- | llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp index c83fb04..0573732 100644 --- a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp +++ b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp @@ -955,7 +955,7 @@ static Expected<std::vector<SectionRef>> lookupSections(ObjectFile &OF, static Expected<std::unique_ptr<BinaryCoverageReader>> loadBinaryFormat(std::unique_ptr<Binary> Bin, StringRef Arch, StringRef CompilationDir = "", - std::optional<object::BuildIDRef> *BinaryID = nullptr) { + object::BuildIDRef *BinaryID = nullptr) { std::unique_ptr<ObjectFile> OF; if (auto *Universal = dyn_cast<MachOUniversalBinary>(Bin.get())) { // If we have a universal binary, try to look up the object for the @@ -1151,14 +1151,14 @@ BinaryCoverageReader::create( return std::move(Readers); } - std::optional<object::BuildIDRef> BinaryID; + object::BuildIDRef BinaryID; auto ReaderOrErr = loadBinaryFormat(std::move(Bin), Arch, CompilationDir, BinaryIDs ? &BinaryID : nullptr); if (!ReaderOrErr) return ReaderOrErr.takeError(); Readers.push_back(std::move(ReaderOrErr.get())); - if (BinaryID) - BinaryIDs->push_back(*BinaryID); + if (!BinaryID.empty()) + BinaryIDs->push_back(BinaryID); return std::move(Readers); } |