diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -117,6 +117,7 @@ - Now that `this` pointers are tagged with `nonnull` and `dereferenceable(N)`, `-fno-delete-null-pointer-checks` has gained the power to remove the `nonnull` attribute on `this` for configurations that need it to be nullable. +- ``-gsplit-dwarf`` no longer implies ``-g2``. New Pragmas in Clang -------------------- diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -3750,20 +3750,15 @@ Args.hasFlag(options::OPT_fsplit_dwarf_inlining, options::OPT_fno_split_dwarf_inlining, false); - Args.ClaimAllArgs(options::OPT_g_Group); - - Arg* SplitDWARFArg; - DwarfFission = getDebugFissionKind(D, Args, SplitDWARFArg); - - if (DwarfFission != DwarfFissionKind::None && - !checkDebugInfoOption(SplitDWARFArg, Args, D, TC)) { - DwarfFission = DwarfFissionKind::None; - SplitDWARFInlining = false; - } + if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) { + Arg *SplitDWARFArg; + DwarfFission = getDebugFissionKind(D, Args, SplitDWARFArg); + if (DwarfFission != DwarfFissionKind::None && + !checkDebugInfoOption(SplitDWARFArg, Args, D, TC)) { + DwarfFission = DwarfFissionKind::None; + SplitDWARFInlining = false; + } - if (const Arg *A = - Args.getLastArg(options::OPT_g_Group, options::OPT_gsplit_dwarf, - options::OPT_gsplit_dwarf_EQ)) { DebugInfoKind = codegenoptions::LimitedDebugInfo; // If the last option explicitly specified a debug-info level, use it. @@ -4896,7 +4891,7 @@ if (D.IsCLMode()) AddClangCLArgs(Args, InputType, CmdArgs, &DebugInfoKind, &EmitCodeView); - DwarfFissionKind DwarfFission; + DwarfFissionKind DwarfFission = DwarfFissionKind::None; RenderDebugOptions(TC, D, RawTriple, Args, EmitCodeView, CmdArgs, DebugInfoKind, DwarfFission); diff --git a/clang/test/Driver/split-debug.c b/clang/test/Driver/split-debug.c --- a/clang/test/Driver/split-debug.c +++ b/clang/test/Driver/split-debug.c @@ -20,8 +20,8 @@ // RUN: %clang -### -c -target x86_64-apple-darwin -gsplit-dwarf -g %s 2>&1 | FileCheck %s --check-prefix=NOSPLIT // NOSPLIT-NOT: "-split-dwarf -/// -gsplit-dwarf currently enables debug fission even without -g. -// RUN: %clang -### -c -target x86_64 -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefix=SPLIT +/// -gsplit-dwarf is a no-op if no -g is specified. +// RUN: %clang -### -c -target x86_64 -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefix=G0 /// Test -gsplit-dwarf=single. // RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g %s 2>&1 | FileCheck %s --check-prefix=SINGLE @@ -59,8 +59,8 @@ /// Interaction with -g0. // RUN: %clang -### -c -target x86_64 -gsplit-dwarf -g0 -### %s 2>&1 | FileCheck %s --check-prefix=G0 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g0 %s 2>&1 | FileCheck %s --check-prefix=G0 -// RUN: %clang -### -c -target x86_64 -g0 -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefixes=NOINLINE,SPLIT -// RUN: %clang -### -c -target x86_64 -g0 -gsplit-dwarf=single %s 2>&1 | FileCheck %s --check-prefix=SINGLE +// RUN: %clang -### -c -target x86_64 -g0 -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefixes=G0 +// RUN: %clang -### -c -target x86_64 -g0 -gsplit-dwarf=single %s 2>&1 | FileCheck %s --check-prefix=G0 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g0 -fsplit-dwarf-inlining %s 2>&1 | FileCheck %s --check-prefix=G0 // G0-NOT: "-debug-info-kind= @@ -69,7 +69,7 @@ /// Interaction with -g1 (-gmlt). // RUN: %clang -### -S -target x86_64 -gsplit-dwarf -g1 %s 2>&1 | FileCheck %s --check-prefix=G1_WITH_SPLIT // RUN: %clang -### -S -target x86_64 -gsplit-dwarf -g1 -fno-split-dwarf-inlining %s 2>&1 | FileCheck %s --check-prefix=G1_WITH_SPLIT -// RUN: %clang -### -S -target x86_64 -gmlt -gsplit-dwarf -fno-split-dwarf-inlining %s 2>&1 | FileCheck %s --check-prefix=SPLIT +// RUN: %clang -### -S -target x86_64 -gmlt -gsplit-dwarf -fno-split-dwarf-inlining %s 2>&1 | FileCheck %s --check-prefix=G1_WITH_SPLIT // G1_WITH_SPLIT: "-debug-info-kind=line-tables-only" // G1_WITH_SPLIT: "-split-dwarf-file"