Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions clang/lib/Driver/ToolChains/HIPUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,20 +340,21 @@ void HIP::constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
void HIP::constructGenerateObjFileFromHIPFatBinary(
Compilation &C, const InputInfo &Output, const InputInfoList &Inputs,
const ArgList &Args, const JobAction &JA, const Tool &T) {
const Driver &D = C.getDriver();
std::string Name = std::string(llvm::sys::path::stem(Output.getFilename()));

// Create Temp Object File Generator,
// Offload Bundled file and Bundled Object file.
// Keep them if save-temps is enabled.
const char *ObjinFile;
const char *BundleFile;
if (C.getDriver().isSaveTempsEnabled()) {
if (D.isSaveTempsEnabled()) {
ObjinFile = C.getArgs().MakeArgString(Name + ".mcin");
BundleFile = C.getArgs().MakeArgString(Name + ".hipfb");
} else {
auto TmpNameMcin = C.getDriver().GetTemporaryPath(Name, "mcin");
auto TmpNameMcin = D.GetTemporaryPath(Name, "mcin");
ObjinFile = C.addTempFile(C.getArgs().MakeArgString(TmpNameMcin));
auto TmpNameFb = C.getDriver().GetTemporaryPath(Name, "hipfb");
auto TmpNameFb = D.GetTemporaryPath(Name, "hipfb");
BundleFile = C.addTempFile(C.getArgs().MakeArgString(TmpNameFb));
}
HIP::constructHIPFatbinCommand(C, JA, BundleFile, Inputs, Args, T);
Expand Down Expand Up @@ -456,7 +457,7 @@ void HIP::constructGenerateObjFileFromHIPFatBinary(
llvm::raw_fd_ostream Objf(ObjinFile, EC, llvm::sys::fs::OF_None);

if (EC) {
C.getDriver().Diag(clang::diag::err_unable_to_make_temp) << EC.message();
D.Diag(clang::diag::err_unable_to_make_temp) << EC.message();
return;
}

Expand All @@ -466,7 +467,7 @@ void HIP::constructGenerateObjFileFromHIPFatBinary(
"-o", Output.getFilename(),
"-x", "assembler",
ObjinFile, "-c"};
const char *Clang = Args.MakeArgString(C.getDriver().ClangExecutable);
C.addCommand(std::make_unique<Command>(JA, T, ResponseFileSupport::None(),
Clang, McArgs, Inputs, Output));
D.getClangProgramPath(), McArgs,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess we don't need to MakeArgString because the lifetime of the Driver is for the whole compilation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is what we do in other parts of the driver as well.

Inputs, Output, D.getPrependArg()));
}
Loading