Author: David Blaikie Date: 2021-09-24T11:18:10-07:00 New Revision: 8ec7d9b8f875368a5f92596332cd05059df6bbd2
URL: https://github.com/llvm/llvm-project/commit/8ec7d9b8f875368a5f92596332cd05059df6bbd2 DIFF: https://github.com/llvm/llvm-project/commit/8ec7d9b8f875368a5f92596332cd05059df6bbd2.diff LOG: DebugInfo: Move the '=' version of -gsimple-template-names to the frontend Based on feedback from Paul Robinson on 38c09ea that the 'mangled' mode is only useful as an LLVM-developer-internal tool in combination with llvm-dwarfdump --verify, so demote that to a frontend-only (not driver) option. The driver support is simply -g{no-,}simple-template-names to switch on simple template names, without the option to use the mangled template name scheme there. Added: Modified: clang/include/clang/Driver/Options.td clang/lib/Frontend/CompilerInvocation.cpp clang/test/Driver/debug-options.c Removed: ################################################################################ diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 28d96b1d08457..f0420702a5cc8 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2970,10 +2970,9 @@ def gno_split_dwarf : Flag<["-"], "gno-split-dwarf">, Group<g_flags_Group>; def gsimple_template_names : Flag<["-"], "gsimple-template-names">, Group<g_flags_Group>; def gsimple_template_names_EQ : Joined<["-"], "gsimple-template-names=">, - Group<g_flags_Group>, HelpText<"Use simple template names in DWARF, or include the full " "template name with a modified prefix for validation">, - Values<"simple,mangled">, Flags<[CC1Option]>; + Values<"simple,mangled">, Flags<[CC1Option, NoDriverOption]>; def gno_simple_template_names : Flag<["-"], "gno-simple-template-names">, Group<g_flags_Group>; def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group<g_flags_Group>, Flags<[CC1Option]>; diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index dc52190cbb377..30a80d38bf205 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1415,9 +1415,8 @@ void CompilerInvocation::GenerateCodeGenArgs( if (TNK != codegenoptions::DebugTemplateNamesKind::Full) { if (TNK == codegenoptions::DebugTemplateNamesKind::Simple) GenerateArg(Args, OPT_gsimple_template_names_EQ, "simple", SA); - if (TNK == codegenoptions::DebugTemplateNamesKind::Mangled) + else if (TNK == codegenoptions::DebugTemplateNamesKind::Mangled) GenerateArg(Args, OPT_gsimple_template_names_EQ, "mangled", SA); - } // ProfileInstrumentUsePath is marshalled automatically, no need to generate // it or PGOUseInstrumentor. @@ -1694,6 +1693,10 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, ? llvm::DICompileUnit::DebugNameTableKind::Default : llvm::DICompileUnit::DebugNameTableKind::None); if (const Arg *A = Args.getLastArg(OPT_gsimple_template_names_EQ)) { + StringRef Value = A->getValue(); + if (Value != "simple" && Value != "mangled") + Diags.Report(diag::err_drv_unsupported_option_argument) + << A->getOption().getName() << A->getValue(); Opts.setDebugSimpleTemplateNames( StringRef(A->getValue()) == "simple" ? codegenoptions::DebugTemplateNamesKind::Simple diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c index 5f652cb49b71b..45a577dc7e7a2 100644 --- a/clang/test/Driver/debug-options.c +++ b/clang/test/Driver/debug-options.c @@ -437,13 +437,9 @@ // NODIRECTORY: "-fno-dwarf-directory-asm" // RUN: %clang -### -target x86_64 -c -g -gsimple-template-names %s 2>&1 | FileCheck --check-prefix=SIMPLE_TEMP_NAMES %s -// RUN: %clang -### -target x86_64 -c -g -gsimple-template-names=simple %s 2>&1 | FileCheck --check-prefix=SIMPLE_TEMP_NAMES %s // SIMPLE_TEMP_NAMES: -gsimple-template-names=simple // SIMPLE_TEMP_NAMES: -debug-forward-template-params -// RUN: %clang -### -target x86_64 -c -g -gsimple-template-names=mangled %s 2>&1 | FileCheck --check-prefix=MANGLED_TEMP_NAMES %s -// MANGLED_TEMP_NAMES: -gsimple-template-names=mangled -// MANGLED_TEMP_NAMES: -debug-forward-template-params +// RUN: not %clang -### -target x86_64 -c -g -gsimple-template-names=mangled %s 2>&1 | FileCheck --check-prefix=MANGLED_TEMP_NAMES %s +// MANGLED_TEMP_NAMES: error: unknown argument: '-gsimple-template-names=mangled' // RUN: %clang -### -target x86_64 -c -g %s 2>&1 | FileCheck --check-prefix=FULL_TEMP_NAMES --implicit-check-not=debug-forward-template-params %s // FULL_TEMP_NAMES-NOT: -gsimple-template-names -// RUN: %clang -### -target x86_64 -c -g -gsimple-template-names=other %s 2>&1 | FileCheck --check-prefix=SIMPLE_TEMP_OTHER %s -// SIMPLE_TEMP_OTHER: error: unsupported argument 'other' to option 'gsimple-template-names=' _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits