Skip to content

Commit c27aae0

Browse files
committed
[Offload] Fix not copying the buffer identifier of offloading files
Summary: This caused an error when copying a file of the same name when multiple architectures needed the file. The buffer identifier which we use for the name in `-save-temps` mode would be empty and create in invalid filename. Copy this correctly now.
1 parent 68efaaa commit c27aae0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/include/llvm/Object/OffloadBinary.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ class OffloadFile : public OwningBinary<OffloadBinary> {
165165
/// Make a deep copy of this offloading file.
166166
OffloadFile copy() const {
167167
std::unique_ptr<MemoryBuffer> Buffer = MemoryBuffer::getMemBufferCopy(
168-
getBinary()->getMemoryBufferRef().getBuffer());
168+
getBinary()->getMemoryBufferRef().getBuffer(),
169+
getBinary()->getMemoryBufferRef().getBufferIdentifier());
169170

170171
// This parsing should never fail because it has already been parsed.
171172
auto NewBinaryOrErr = OffloadBinary::create(*Buffer);

0 commit comments

Comments
 (0)