forked from OSchip/llvm-project
[clang] - Simplify tools::SplitDebugName.
This should be NFC change. SplitDebugName recently started to accept the `Output` that can be used to simplify the logic a bit, also it seems that code in SplitDebugName that uses OPT_fdebug_compilation_dir is simply dead. Differential revision: https://reviews.llvm.org/D54576 llvm-svn: 347035
This commit is contained in:
parent
bac7d9735a
commit
9982e3b944
|
@ -3936,7 +3936,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
const char *SplitDWARFOut;
|
||||
if (SplitDWARF) {
|
||||
CmdArgs.push_back("-split-dwarf-file");
|
||||
SplitDWARFOut = SplitDebugName(Args, Input, Output);
|
||||
SplitDWARFOut = SplitDebugName(Args, Output);
|
||||
CmdArgs.push_back(SplitDWARFOut);
|
||||
}
|
||||
|
||||
|
@ -5902,7 +5902,7 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
if ((getDebugFissionKind(D, Args, A) == DwarfFissionKind::Split) &&
|
||||
(T.isOSLinux() || T.isOSFuchsia())) {
|
||||
CmdArgs.push_back("-split-dwarf-file");
|
||||
CmdArgs.push_back(SplitDebugName(Args, Input, Output));
|
||||
CmdArgs.push_back(SplitDebugName(Args, Output));
|
||||
}
|
||||
|
||||
assert(Input.isFilename() && "Invalid input.");
|
||||
|
|
|
@ -808,26 +808,15 @@ bool tools::areOptimizationsEnabled(const ArgList &Args) {
|
|||
return false;
|
||||
}
|
||||
|
||||
const char *tools::SplitDebugName(const ArgList &Args, const InputInfo &Input,
|
||||
const char *tools::SplitDebugName(const ArgList &Args,
|
||||
const InputInfo &Output) {
|
||||
if (Arg *A = Args.getLastArg(options::OPT_gsplit_dwarf_EQ))
|
||||
if (StringRef(A->getValue()) == "single")
|
||||
return Args.MakeArgString(Output.getFilename());
|
||||
|
||||
Arg *FinalOutput = Args.getLastArg(options::OPT_o);
|
||||
if (FinalOutput && Args.hasArg(options::OPT_c)) {
|
||||
SmallString<128> T(FinalOutput->getValue());
|
||||
llvm::sys::path::replace_extension(T, "dwo");
|
||||
return Args.MakeArgString(T);
|
||||
} else {
|
||||
// Use the compilation dir.
|
||||
SmallString<128> T(
|
||||
Args.getLastArgValue(options::OPT_fdebug_compilation_dir));
|
||||
SmallString<128> F(llvm::sys::path::stem(Input.getBaseInput()));
|
||||
llvm::sys::path::replace_extension(F, "dwo");
|
||||
T += F;
|
||||
return Args.MakeArgString(F);
|
||||
}
|
||||
SmallString<128> T(Output.getFilename());
|
||||
llvm::sys::path::replace_extension(T, "dwo");
|
||||
return Args.MakeArgString(T);
|
||||
}
|
||||
|
||||
void tools::SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T,
|
||||
|
|
|
@ -63,7 +63,7 @@ void AddHIPLinkerScript(const ToolChain &TC, Compilation &C,
|
|||
const Tool &T);
|
||||
|
||||
const char *SplitDebugName(const llvm::opt::ArgList &Args,
|
||||
const InputInfo &Input, const InputInfo &Output);
|
||||
const InputInfo &Output);
|
||||
|
||||
void SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T,
|
||||
const JobAction &JA, const llvm::opt::ArgList &Args,
|
||||
|
|
|
@ -817,7 +817,7 @@ void tools::gnutools::Assembler::ConstructJob(Compilation &C,
|
|||
if (Args.hasArg(options::OPT_gsplit_dwarf) &&
|
||||
getToolChain().getTriple().isOSLinux())
|
||||
SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
|
||||
SplitDebugName(Args, Inputs[0], Output));
|
||||
SplitDebugName(Args, Output));
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -54,7 +54,7 @@ void tools::MinGW::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
if (Args.hasArg(options::OPT_gsplit_dwarf))
|
||||
SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
|
||||
SplitDebugName(Args, Inputs[0], Output));
|
||||
SplitDebugName(Args, Output));
|
||||
}
|
||||
|
||||
void tools::MinGW::Linker::AddLibGCC(const ArgList &Args,
|
||||
|
|
Loading…
Reference in New Issue