[PATCH] D107668: [OpenMP]Fix PR50336: Remove temporary files in the offload bundler tool

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 6 14:23:29 PDT 2021


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, ye-luo, JonChesterfield.
Herald added subscribers: guansong, yaxunl.
jhuber6 requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107668

Files:
  clang/lib/Driver/ToolChains/Clang.cpp


Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -7720,8 +7720,11 @@
         assert(CurTC == nullptr && "Expected one dependence!");
         CurTC = TC;
       });
+      UB += C.addTempFile(
+          C.getArgs().MakeArgString(CurTC->getInputFilename(Inputs[I])));
+    } else {
+      UB += CurTC->getInputFilename(Inputs[I]);
     }
-    UB += CurTC->getInputFilename(Inputs[I]);
   }
   CmdArgs.push_back(TCArgs.MakeArgString(UB));
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107668.364885.patch
Type: text/x-patch
Size: 592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210806/bc6f8026/attachment.bin>


More information about the cfe-commits mailing list