Skip to content

Commit 01d59c0

Browse files
jhuber6jhuber-ornl
authored andcommitted
[OpenMP]Fix PR50336: Remove temporary files in the offload bundler tool
Temporary files created by the offloading device toolchain are not removed after compilation when using a two-step compilation. The offload-bundler uses a different filename for the device binary than the `.o` file present in the Job's input list. This is not listed as a temporary file so it is never removed. This patch explicitly adds the device binary as a temporary file to consume it. This fixes PR50336. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D107668
1 parent b136290 commit 01d59c0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7737,8 +7737,11 @@ void OffloadBundler::ConstructJob(Compilation &C, const JobAction &JA,
77377737
assert(CurTC == nullptr && "Expected one dependence!");
77387738
CurTC = TC;
77397739
});
7740+
UB += C.addTempFile(
7741+
C.getArgs().MakeArgString(CurTC->getInputFilename(Inputs[I])));
7742+
} else {
7743+
UB += CurTC->getInputFilename(Inputs[I]);
77407744
}
7741-
UB += CurTC->getInputFilename(Inputs[I]);
77427745
}
77437746
CmdArgs.push_back(TCArgs.MakeArgString(UB));
77447747

0 commit comments

Comments
 (0)