Skip to content

Commit 1c393cd

Browse files
author
git apple-llvm automerger
committed
Merge commit '098d901bd1be' from llvm.org/master into apple/master
2 parents 4f6b19b + 098d901 commit 1c393cd

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,6 +2017,10 @@ def ggdb2 : Flag<["-"], "ggdb2">, Group<ggdbN_Group>;
20172017
def ggdb3 : Flag<["-"], "ggdb3">, Group<ggdbN_Group>;
20182018
def glldb : Flag<["-"], "glldb">, Group<gTune_Group>;
20192019
def gsce : Flag<["-"], "gsce">, Group<gTune_Group>;
2020+
// Equivalent to our default dwarf version. Forces usual dwarf emission when
2021+
// CodeView is enabled.
2022+
def gdwarf : Flag<["-"], "gdwarf">, Group<g_Group>,
2023+
HelpText<"Generate source-level debug information with the default dwarf version">;
20202024
def gdwarf_2 : Flag<["-"], "gdwarf-2">, Group<g_Group>,
20212025
HelpText<"Generate source-level debug information with dwarf version 2">;
20222026
def gdwarf_3 : Flag<["-"], "gdwarf-3">, Group<g_Group>,
@@ -2034,10 +2038,6 @@ def gcodeview_ghash : Flag<["-"], "gcodeview-ghash">,
20342038
Flags<[CC1Option, CoreOption]>;
20352039
def gno_codeview_ghash : Flag<["-"], "gno-codeview-ghash">, Flags<[CoreOption]>;
20362040

2037-
// Equivalent to our default dwarf version. Forces usual dwarf emission when
2038-
// CodeView is enabled.
2039-
def gdwarf : Flag<["-"], "gdwarf">, Alias<gdwarf_4>, Flags<[CoreOption]>;
2040-
20412041
def gfull : Flag<["-"], "gfull">, Group<g_Group>;
20422042
def gused : Flag<["-"], "gused">, Group<g_Group>;
20432043
def gstabs : Joined<["-"], "gstabs">, Group<g_Group>, Flags<[Unsupported]>;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3199,9 +3199,9 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
31993199
}
32003200

32013201
// If a -gdwarf argument appeared, remember it.
3202-
const Arg *GDwarfN =
3203-
Args.getLastArg(options::OPT_gdwarf_2, options::OPT_gdwarf_3,
3204-
options::OPT_gdwarf_4, options::OPT_gdwarf_5);
3202+
const Arg *GDwarfN = Args.getLastArg(
3203+
options::OPT_gdwarf_2, options::OPT_gdwarf_3, options::OPT_gdwarf_4,
3204+
options::OPT_gdwarf_5, options::OPT_gdwarf);
32053205
bool EmitDwarf = false;
32063206
if (GDwarfN) {
32073207
if (checkDebugInfoOption(GDwarfN, Args, D, TC))
@@ -3232,6 +3232,7 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
32323232
if (EmitDwarf) {
32333233
// Start with the platform default DWARF version
32343234
DWARFVersion = TC.GetDefaultDwarfVersion();
3235+
assert(DWARFVersion && "toolchain default DWARF version must be nonzero");
32353236

32363237
// Override with a user-specified DWARF version
32373238
if (GDwarfN)

clang/test/CodeGen/dwarf-version.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// RUN: %clang -target powerpc-unknown-openbsd -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER2
1515
// RUN: %clang -target powerpc-unknown-freebsd -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER2
1616
// RUN: %clang -target i386-pc-solaris -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER2
17+
// RUN: %clang -target i386-pc-solaris -gdwarf -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER2
1718

1819
// Check which debug info formats we use on Windows. By default, in an MSVC
1920
// environment, we should use codeview. You can enable dwarf, which implicitly

0 commit comments

Comments
 (0)