return DwarfFissionKind::None;
}
-static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
+static void renderDebugOptions(const ToolChain &TC, const Driver &D,
const llvm::Triple &T, const ArgList &Args,
- bool EmitCodeView, ArgStringList &CmdArgs,
+ bool EmitCodeView, bool IRInput,
+ ArgStringList &CmdArgs,
codegenoptions::DebugInfoKind &DebugInfoKind,
DwarfFissionKind &DwarfFission) {
if (Args.hasFlag(options::OPT_fdebug_info_for_profiling,
Args.hasFlag(options::OPT_fsplit_dwarf_inlining,
options::OPT_fno_split_dwarf_inlining, false);
- // Normally -gsplit-dwarf is only useful with -gN. For -gsplit-dwarf in the
- // backend phase of a distributed ThinLTO which does object file generation
- // and no IR generation, -gN should not be needed. So allow -gsplit-dwarf with
- // either -gN or -fthinlto-index=.
- if (Args.hasArg(options::OPT_g_Group) ||
- Args.hasArg(options::OPT_fthinlto_index_EQ)) {
+ // Normally -gsplit-dwarf is only useful with -gN. For IR input, Clang does
+ // object file generation and no IR generation, -gN should not be needed. So
+ // allow -gsplit-dwarf with either -gN or IR input.
+ if (IRInput || Args.hasArg(options::OPT_g_Group)) {
Arg *SplitDWARFArg;
DwarfFission = getDebugFissionKind(D, Args, SplitDWARFArg);
if (DwarfFission != DwarfFissionKind::None &&
AddClangCLArgs(Args, InputType, CmdArgs, &DebugInfoKind, &EmitCodeView);
DwarfFissionKind DwarfFission = DwarfFissionKind::None;
- RenderDebugOptions(TC, D, RawTriple, Args, EmitCodeView, CmdArgs,
- DebugInfoKind, DwarfFission);
+ renderDebugOptions(TC, D, RawTriple, Args, EmitCodeView,
+ types::isLLVMIR(InputType), CmdArgs, DebugInfoKind,
+ DwarfFission);
// Add the split debug info name to the command lines here so we
// can propagate it to the backend.
/// ... unless -fthinlto-index= is specified.
// RUN: echo > %t.bc
-// RUN: %clang -### -c -target x86_64 -fthinlto-index=dummy -gsplit-dwarf %t.bc 2>&1 | FileCheck %s --check-prefix=THINLTO
+// RUN: %clang -### -c -target x86_64 -fthinlto-index=dummy -gsplit-dwarf %t.bc 2>&1 | FileCheck %s --check-prefix=IR
+// RUN: %clang -### -c -target x86_64 -gsplit-dwarf -x ir %t.bc 2>&1 | FileCheck %s --check-prefix=IR
-// THINLTO-NOT: "-debug-info-kind=
-// THINLTO: "-ggnu-pubnames"
-// THINLTO-SAME: "-split-dwarf-file" "{{.*}}.dwo" "-split-dwarf-output" "{{.*}}.dwo"
+// IR-NOT: "-debug-info-kind=
+// IR: "-ggnu-pubnames"
+// IR-SAME: "-split-dwarf-file" "{{.*}}.dwo" "-split-dwarf-output" "{{.*}}.dwo"
/// -gno-split-dwarf disables debug fission.
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf -g -gno-split-dwarf %s 2>&1 | FileCheck %s --check-prefix=NOSPLIT