diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -130,6 +130,7 @@ ``char8_t`` as the character type of ``u8`` literals. This restores the Clang 8 behavior that regressed in Clang 9 and 10. - -print-targets has been added to print the registered targets. +- ``-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 @@ -3697,9 +3697,7 @@ SplitDWARFInlining = false; } - if (const Arg *A = - Args.getLastArg(options::OPT_g_Group, options::OPT_gsplit_dwarf, - options::OPT_gsplit_dwarf_EQ)) { + if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) { DebugInfoKind = codegenoptions::LimitedDebugInfo; // If the last option explicitly specified a debug-info level, use it. @@ -3716,7 +3714,8 @@ SplitDWARFInlining)) DwarfFission = DwarfFissionKind::None; } - } + } else + DwarfFission = DwarfFissionKind::None; // If a debugger tuning argument appeared, remember it. if (const Arg *A = diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c --- a/clang/test/Driver/debug-options.c +++ b/clang/test/Driver/debug-options.c @@ -196,8 +196,8 @@ // RUN: %clang -### -c -gpubnames -gno-gnu-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s // RUN: %clang -### -c -gpubnames -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s // -// RUN: %clang -### -c -gsplit-dwarf %s 2>&1 | FileCheck -check-prefix=GPUB %s -// RUN: %clang -### -c -gsplit-dwarf -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s +// RUN: %clang -### -c -gsplit-dwarf -g %s 2>&1 | FileCheck -check-prefix=GPUB %s +// RUN: %clang -### -c -gsplit-dwarf -g -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s // // RUN: %clang -### -c -fdebug-ranges-base-address %s 2>&1 | FileCheck -check-prefix=RNGBSE %s // RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=NORNGBSE %s diff --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c --- a/clang/test/Driver/fuchsia.c +++ b/clang/test/Driver/fuchsia.c @@ -239,6 +239,6 @@ // CHECK-THINLTO: "-plugin-opt=jobs=8" // RUN: %clang %s -### --target=x86_64-fuchsia \ -// RUN: -gsplit-dwarf -c %s 2>&1 \ +// RUN: -gsplit-dwarf -g -c %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-SPLIT-DWARF // CHECK-SPLIT-DWARF: "-split-dwarf-output" "fuchsia.dwo" 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 @@ -1,61 +1,66 @@ // Check that we split debug output properly // -// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -c -### %s 2> %t +// RUN: %clang -target x86_64-unknown-linux-gnu -g -gsplit-dwarf -c -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-ACTIONS < %t %s // // CHECK-ACTIONS: "-split-dwarf-file" "split-debug.dwo" "-split-dwarf-output" "split-debug.dwo" -// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -c -### %s 2> %t +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -g -c -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-ACTIONS < %t %s -// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=split -c -### %s 2> %t +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=split -g -c -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-ACTIONS < %t %s -// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=single -c -### %s 2> %t +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=single -g -c -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-ACTIONS-SINGLE-SPLIT < %t %s // // CHECK-ACTIONS-SINGLE-SPLIT: "-split-dwarf-file" "split-debug.o" // CHECK-ACTIONS-SINGLE-SPLIT-NOT: "-split-dwarf-output" -// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=single -c -### -o %tfoo.o %s 2> %t +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=single -g -c -### -o %tfoo.o %s 2> %t // RUN: FileCheck -check-prefix=CHECK-SINGLE-SPLIT-FILENAME < %t %s // // CHECK-SINGLE-SPLIT-FILENAME: "-split-dwarf-file" "{{.*}}foo.o" // CHECK-SINGLE-SPLIT-FILENAME-NOT: "-split-dwarf-output" -// RUN: %clang -target x86_64-macosx -gsplit-dwarf -c -### %s 2> %t +/// -gsplit-dwarf requires -g. It is also a no-op on a non-ELF platform. +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -c -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-NO-ACTIONS < %t %s +// RUN: %clang -target x86_64-macosx -gsplit-dwarf -g -c -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-NO-ACTIONS < %t %s // -// CHECK-NO-ACTIONS-NOT: -split-dwarf +// CHECK-NO-ACTIONS-NOT: "-split-dwarf -// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -o Bad.x -### %s 2> %t +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -g -o Bad.x -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-BAD < %t %s // // CHECK-BAD-NOT: "Bad.dwo" -// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -c -### %s 2> %t +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -g -c -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-OPTION < %t %s // -// RUN: %clang -target x86_64-pc-freebsd12 -gsplit-dwarf -c -### %s 2> %t +// RUN: %clang -target x86_64-pc-freebsd12 -gsplit-dwarf -g -c -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-OPTION < %t %s // -// RUN: %clang -target amdgcn-amd-amdhsa -gsplit-dwarf -c -### %s 2> %t +// RUN: %clang -target amdgcn-amd-amdhsa -gsplit-dwarf -g -c -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-OPTION < %t %s // // CHECK-OPTION: "-split-dwarf-file" "split-debug.dwo" "-split-dwarf-output" "split-debug.dwo" -// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -S -### %s 2> %t +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -g -S -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-ASM < %t %s // // CHECK-ASM-NOT: objcopy -// RUN: %clang -target x86_64-unknown-linux-gnu -no-integrated-as -gsplit-dwarf -c -### %s 2> %t +// RUN: %clang -target x86_64-unknown-linux-gnu -no-integrated-as -gsplit-dwarf -g -c -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-IAS < %t %s // // CHECK-IAS: objcopy // RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt -fno-split-dwarf-inlining -S -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-GMLT-WITH-SPLIT < %t %s +// RUN: %clang -target x86_64-unknown-linux-gnu -gmlt -gsplit-dwarf -fno-split-dwarf-inlining -S -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-GMLT-WITH-SPLIT < %t %s // // CHECK-GMLT-WITH-SPLIT: "-debug-info-kind=line-tables-only" // CHECK-GMLT-WITH-SPLIT: "-split-dwarf-file" @@ -70,13 +75,7 @@ // CHECK-NOINLINE-WITHOUT-SPLIT: "-fno-split-dwarf-inlining" // CHECK-NOINLINE-WITHOUT-SPLIT: "-debug-info-kind=limited" -// RUN: %clang -target x86_64-unknown-linux-gnu -gmlt -gsplit-dwarf -fno-split-dwarf-inlining -S -### %s 2> %t -// RUN: FileCheck -check-prefix=CHECK-SPLIT-WITH-GMLT < %t %s -// -// CHECK-SPLIT-WITH-GMLT: "-debug-info-kind=limited" -// CHECK-SPLIT-WITH-GMLT: "-split-dwarf-output" - -// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -fno-split-dwarf-inlining -S -### %s 2> %t +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -g -fno-split-dwarf-inlining -S -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-SPLIT-WITH-NOINL < %t %s // // CHECK-SPLIT-WITH-NOINL: "-debug-info-kind=limited" @@ -89,13 +88,6 @@ // CHECK-GMLT-OVER-SPLIT-NOT: "-split-dwarf-file" // CHECK-GMLT-OVER-SPLIT-NOT: "-split-dwarf-output" -// RUN: %clang -target x86_64-unknown-linux-gnu -gmlt -gsplit-dwarf -S -### %s 2> %t -// RUN: FileCheck -check-prefix=CHECK-SPLIT-OVER-GMLT < %t %s -// -// CHECK-SPLIT-OVER-GMLT: "-debug-info-kind=limited" -// CHECK-SPLIT-OVER-GMLT: "-split-dwarf-file" -// CHECK-SPLIT-OVER-GMLT: "-split-dwarf-output" - // RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -g0 -fno-split-dwarf-inlining -S -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-G0-OVER-SPLIT < %t %s // @@ -107,16 +99,11 @@ // RUN: FileCheck -check-prefix=CHECK-G0-OVER-SPLIT < %t %s // RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=split -g0 -S -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-G0-OVER-SPLIT < %t %s -// -// CHECK-G0-OVER-SPLIT-NOT: "-debug-info-kind -// CHECK-G0-OVER-SPLIT-NOT: "-split-dwarf-file" -// CHECK-G0-OVER-SPLIT-NOT: "-split-dwarf-output" - // RUN: %clang -target x86_64-unknown-linux-gnu -g0 -gsplit-dwarf -S -### %s 2> %t -// RUN: FileCheck -check-prefix=CHECK-SPLIT-OVER-G0 < %t %s +// RUN: FileCheck -check-prefix=CHECK-G0-OVER-SPLIT < %t %s // RUN: %clang -target x86_64-unknown-linux-gnu -g0 -gsplit-dwarf=split -S -### %s 2> %t -// RUN: FileCheck -check-prefix=CHECK-SPLIT-OVER-G0 < %t %s -// -// CHECK-SPLIT-OVER-G0: "-debug-info-kind=limited" -// CHECK-SPLIT-OVER-G0: "-split-dwarf-file" -// CHECK-SPLIT-OVER-G0: "-split-dwarf-output" +// RUN: FileCheck -check-prefix=CHECK-G0-OVER-SPLIT < %t %s + +// CHECK-G0-OVER-SPLIT-NOT: "-debug-info-kind +// CHECK-G0-OVER-SPLIT-NOT: "-split-dwarf-file" +// CHECK-G0-OVER-SPLIT-NOT: "-split-dwarf-output"