Skip to content

Commit 589e898

Browse files
committed
Resolve build issue and address PR comments.
1 parent a375975 commit 589e898

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

llvm/include/llvm/Object/OffloadBundle.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,8 @@ struct OffloadBundleEntry {
7575
uint64_t Size = 0u;
7676
uint64_t IDLength = 0u;
7777
std::string ID;
78-
OffloadBundleEntry(uint64_t O, uint64_t S, uint64_t I, std::string T)
79-
: Offset(O), Size(S), IDLength(I) {
80-
ID.reserve(T.size());
81-
ID = T;
82-
}
78+
OffloadBundleEntry(uint64_t O, uint64_t S, uint64_t I, StringRef T)
79+
: Offset(O), Size(S), IDLength(I), ID(T.str()) {}
8380
void dumpInfo(raw_ostream &OS) {
8481
OS << "Offset = " << Offset << ", Size = " << Size
8582
<< ", ID Length = " << IDLength << ", ID = " << ID << "\n";
@@ -96,8 +93,8 @@ class OffloadBundleFatBin {
9693
uint64_t Size = 0u;
9794
StringRef FileName;
9895
uint64_t NumberOfEntries;
99-
SmallVector<OffloadBundleEntry> Entries;
10096
bool Decompressed;
97+
SmallVector<OffloadBundleEntry> Entries;
10198

10299
public:
103100
std::unique_ptr<MemoryBuffer> DecompressedBuffer;
@@ -128,7 +125,7 @@ class OffloadBundleFatBin {
128125

129126
OffloadBundleFatBin(MemoryBufferRef Source, StringRef File,
130127
bool Decompress = false)
131-
: FileName(File), Decompressed(Decompress), NumberOfEntries(0),
128+
: FileName(File), NumberOfEntries(0), Decompressed(Decompress),
132129
Entries(SmallVector<OffloadBundleEntry>()) {
133130
if (Decompress)
134131
DecompressedBuffer =

llvm/lib/Object/OffloadBundle.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Error extractOffloadBundle(MemoryBufferRef Contents, uint64_t SectionOffset,
6262
return createFileError(FileName, EC);
6363

6464
Expected<std::unique_ptr<MemoryBuffer>> DecompressedBufferOrErr =
65-
CompressedOffloadBundle::decompress(**CodeOrErr, &nulls());
65+
CompressedOffloadBundle::decompress(**CodeOrErr, nullptr);
6666
if (!DecompressedBufferOrErr)
6767
return createStringError(
6868
inconvertibleErrorCode(),
@@ -137,8 +137,7 @@ Error OffloadBundleFatBin::readEntries(StringRef Buffer,
137137
return errorCodeToError(object_error::parse_failed);
138138

139139
auto Entry = std::make_unique<OffloadBundleEntry>(
140-
EntryOffset + SectionOffset, EntrySize, EntryIDSize,
141-
std::move(EntryID.str()));
140+
EntryOffset + SectionOffset, EntrySize, EntryIDSize, EntryID);
142141

143142
Entries.push_back(*Entry);
144143
}

0 commit comments

Comments
 (0)