diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 29b41002cf37..41dfafd9594f 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1507,8 +1507,9 @@ def fconstexpr_steps_EQ : Joined<["-"], "fconstexpr-steps=">, Group; def fexperimental_new_constant_interpreter : Flag<["-"], "fexperimental-new-constant-interpreter">, Group, HelpText<"Enable the experimental new constant interpreter">, Flags<[CC1Option]>, MarshallingInfoFlag>; -def fconstexpr_backtrace_limit_EQ : Joined<["-"], "fconstexpr-backtrace-limit=">, - Group; +def fconstexpr_backtrace_limit_EQ : Joined<["-"], "fconstexpr-backtrace-limit=">, Group, Flags<[CC1Option]>, + HelpText<"Set the maximum number of entries to print in a constexpr evaluation backtrace (0 = no limit)">, + MarshallingInfoInt, "DiagnosticOptions::DefaultConstexprBacktraceLimit">; def fcrash_diagnostics_EQ : Joined<["-"], "fcrash-diagnostics=">, Group, Flags<[NoArgumentUnused, CoreOption]>, HelpText<"Set level of crash diagnostic reporting, (option: off, compiler, all)">; def fcrash_diagnostics : Flag<["-"], "fcrash-diagnostics">, Group, Flags<[NoArgumentUnused, CoreOption]>, @@ -2289,7 +2290,9 @@ def fthin_link_bitcode_EQ : Joined<["-"], "fthin-link-bitcode=">, HelpText<"Write minimized bitcode to for the ThinLTO thin link only">, MarshallingInfoString>; def fmacro_backtrace_limit_EQ : Joined<["-"], "fmacro-backtrace-limit=">, - Group, Flags<[NoXarchOption, CoreOption]>; + Group, Flags<[NoXarchOption, CC1Option, CoreOption]>, + HelpText<"Set the maximum number of entries to print in a macro expansion backtrace (0 = no limit)">, + MarshallingInfoInt, "DiagnosticOptions::DefaultMacroBacktraceLimit">; defm merge_all_constants : BoolFOption<"merge-all-constants", CodeGenOpts<"MergeAllConstants">, DefaultFalse, PosFlag, NegFlag, @@ -2893,7 +2896,9 @@ defm show_source_location : BoolFOption<"show-source-location", defm spell_checking : BoolFOption<"spell-checking", LangOpts<"SpellChecking">, DefaultTrue, NegFlag, PosFlag>; -def fspell_checking_limit_EQ : Joined<["-"], "fspell-checking-limit=">, Group; +def fspell_checking_limit_EQ : Joined<["-"], "fspell-checking-limit=">, Group, Flags<[CC1Option]>, + HelpText<"Set the maximum number of times to perform spell checking on unrecognized identifiers (0 = no limit)">, + MarshallingInfoInt, "DiagnosticOptions::DefaultSpellCheckingLimit">; def fsigned_bitfields : Flag<["-"], "fsigned-bitfields">, Group; defm signed_char : BoolFOption<"signed-char", LangOpts<"CharIsSigned">, DefaultTrue, @@ -2962,10 +2967,13 @@ def fsyntax_only : Flag<["-"], "fsyntax-only">, Flags<[NoXarchOption,CoreOption,CC1Option,FC1Option,FlangOption]>, Group, HelpText<"Run the preprocessor, parser and semantic analysis stages">; def ftabstop_EQ : Joined<["-"], "ftabstop=">, Group; -def ftemplate_depth_EQ : Joined<["-"], "ftemplate-depth=">, Group; -def ftemplate_depth_ : Joined<["-"], "ftemplate-depth-">, Group; -def ftemplate_backtrace_limit_EQ : Joined<["-"], "ftemplate-backtrace-limit=">, - Group; +def ftemplate_depth_EQ : Joined<["-"], "ftemplate-depth=">, Group, Flags<[CC1Option]>, + HelpText<"Set the maximum depth of recursive template instantiation">, + MarshallingInfoInt, "1024">; +def : Joined<["-"], "ftemplate-depth-">, Group, Alias; +def ftemplate_backtrace_limit_EQ : Joined<["-"], "ftemplate-backtrace-limit=">, Group, Flags<[CC1Option]>, + HelpText<"Set the maximum number of entries to print in a template instantiation backtrace (0 = no limit)">, + MarshallingInfoInt, "DiagnosticOptions::DefaultTemplateBacktraceLimit">; def foperator_arrow_depth_EQ : Joined<["-"], "foperator-arrow-depth=">, Group; @@ -5926,18 +5934,6 @@ def ftabstop : Separate<["-"], "ftabstop">, MetaVarName<"">, def ferror_limit : Separate<["-"], "ferror-limit">, MetaVarName<"">, HelpText<"Set the maximum number of errors to emit before stopping (0 = no limit).">, MarshallingInfoInt>; -def fmacro_backtrace_limit : Separate<["-"], "fmacro-backtrace-limit">, MetaVarName<"">, - HelpText<"Set the maximum number of entries to print in a macro expansion backtrace (0 = no limit).">, - MarshallingInfoInt, "DiagnosticOptions::DefaultMacroBacktraceLimit">; -def ftemplate_backtrace_limit : Separate<["-"], "ftemplate-backtrace-limit">, MetaVarName<"">, - HelpText<"Set the maximum number of entries to print in a template instantiation backtrace (0 = no limit).">, - MarshallingInfoInt, "DiagnosticOptions::DefaultTemplateBacktraceLimit">; -def fconstexpr_backtrace_limit : Separate<["-"], "fconstexpr-backtrace-limit">, MetaVarName<"">, - HelpText<"Set the maximum number of entries to print in a constexpr evaluation backtrace (0 = no limit).">, - MarshallingInfoInt, "DiagnosticOptions::DefaultConstexprBacktraceLimit">; -def fspell_checking_limit : Separate<["-"], "fspell-checking-limit">, MetaVarName<"">, - HelpText<"Set the maximum number of times to perform spell checking on unrecognized identifiers (0 = no limit).">, - MarshallingInfoInt, "DiagnosticOptions::DefaultSpellCheckingLimit">; def fcaret_diagnostics_max_lines : Separate<["-"], "fcaret-diagnostics-max-lines">, MetaVarName<"">, HelpText<"Set the maximum number of source lines to show in a caret diagnostic">, @@ -6395,9 +6391,6 @@ def ftype_visibility : Joined<["-"], "ftype-visibility=">, def fapply_global_visibility_to_externs : Flag<["-"], "fapply-global-visibility-to-externs">, HelpText<"Apply global symbol visibility to external declarations without an explicit visibility">, MarshallingInfoFlag>; -def ftemplate_depth : Separate<["-"], "ftemplate-depth">, - HelpText<"Maximum depth of recursive template instantiation">, - MarshallingInfoInt, "1024">; def foperator_arrow_depth : Separate<["-"], "foperator-arrow-depth">, HelpText<"Maximum number of 'operator->'s to call for a member access">, MarshallingInfoInt, "256">; diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 5a7dbe1debc6..a832d32d4309 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -5969,11 +5969,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, addDebugPrefixMapArg(D, TC, Args, CmdArgs); - if (Arg *A = Args.getLastArg(options::OPT_ftemplate_depth_, - options::OPT_ftemplate_depth_EQ)) { - CmdArgs.push_back("-ftemplate-depth"); - CmdArgs.push_back(A->getValue()); - } + Args.AddLastArg(CmdArgs, options::OPT_ftemplate_depth_EQ); if (Arg *A = Args.getLastArg(options::OPT_foperator_arrow_depth_EQ)) { CmdArgs.push_back("-foperator-arrow-depth"); @@ -6054,25 +6050,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, else CmdArgs.push_back("19"); - if (Arg *A = Args.getLastArg(options::OPT_fmacro_backtrace_limit_EQ)) { - CmdArgs.push_back("-fmacro-backtrace-limit"); - CmdArgs.push_back(A->getValue()); - } - - if (Arg *A = Args.getLastArg(options::OPT_ftemplate_backtrace_limit_EQ)) { - CmdArgs.push_back("-ftemplate-backtrace-limit"); - CmdArgs.push_back(A->getValue()); - } - - if (Arg *A = Args.getLastArg(options::OPT_fconstexpr_backtrace_limit_EQ)) { - CmdArgs.push_back("-fconstexpr-backtrace-limit"); - CmdArgs.push_back(A->getValue()); - } - - if (Arg *A = Args.getLastArg(options::OPT_fspell_checking_limit_EQ)) { - CmdArgs.push_back("-fspell-checking-limit"); - CmdArgs.push_back(A->getValue()); - } + Args.AddLastArg(CmdArgs, options::OPT_fconstexpr_backtrace_limit_EQ); + Args.AddLastArg(CmdArgs, options::OPT_fmacro_backtrace_limit_EQ); + Args.AddLastArg(CmdArgs, options::OPT_ftemplate_backtrace_limit_EQ); + Args.AddLastArg(CmdArgs, options::OPT_fspell_checking_limit_EQ); // Pass -fmessage-length=. unsigned MessageLength = 0; diff --git a/clang/test/Misc/macro-backtrace.c b/clang/test/Misc/macro-backtrace.c index 7aeaf21a13d5..ec684889b131 100644 --- a/clang/test/Misc/macro-backtrace.c +++ b/clang/test/Misc/macro-backtrace.c @@ -16,7 +16,7 @@ void f(int *ip, float *fp) { if (M12(ip, fp)) { } - // RUN: %clang_cc1 -fsyntax-only -fmacro-backtrace-limit 5 %s 2>&1 \ + // RUN: %clang_cc1 -fsyntax-only -fmacro-backtrace-limit=5 %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-LIMIT // CHECK-LIMIT: macro-backtrace.c:18:7: warning: comparison of distinct pointer types ('int *' and 'float *') // CHECK-LIMIT: if (M12(ip, fp)) { } diff --git a/clang/test/Misc/reduced-diags-macros-backtrace.cpp b/clang/test/Misc/reduced-diags-macros-backtrace.cpp index 70c4122a1eda..44de6d71c18a 100644 --- a/clang/test/Misc/reduced-diags-macros-backtrace.cpp +++ b/clang/test/Misc/reduced-diags-macros-backtrace.cpp @@ -1,5 +1,5 @@ -// RUN: not %clang_cc1 -fsyntax-only -fmacro-backtrace-limit 0 %s 2>&1 | FileCheck %s --check-prefix=ALL -// RUN: not %clang_cc1 -fsyntax-only -fmacro-backtrace-limit 2 %s 2>&1 | FileCheck %s --check-prefix=SKIP +// RUN: not %clang_cc1 -fsyntax-only -fmacro-backtrace-limit=0 %s 2>&1 | FileCheck %s --check-prefix=ALL +// RUN: not %clang_cc1 -fsyntax-only -fmacro-backtrace-limit=2 %s 2>&1 | FileCheck %s --check-prefix=SKIP #define F(x) x + 1 #define G(x) F(x) + 2 diff --git a/clang/test/SemaCXX/constexpr-backtrace-limit.cpp b/clang/test/SemaCXX/constexpr-backtrace-limit.cpp index 64a26cf29992..61e810c817eb 100644 --- a/clang/test/SemaCXX/constexpr-backtrace-limit.cpp +++ b/clang/test/SemaCXX/constexpr-backtrace-limit.cpp @@ -1,4 +1,4 @@ -// RUN: not %clang_cc1 -std=c++11 -fsyntax-only %s -fconstexpr-backtrace-limit 0 -fconstexpr-depth 4 -fno-caret-diagnostics 2>&1 | FileCheck %s -check-prefix=TEST1 +// RUN: not %clang_cc1 -std=c++11 -fsyntax-only %s -fconstexpr-backtrace-limit=0 -fconstexpr-depth 4 -fno-caret-diagnostics 2>&1 | FileCheck %s -check-prefix=TEST1 // TEST1: constant expression // TEST1-NEXT: exceeded maximum depth of 4 // TEST1-NEXT: in call to 'recurse(2)' @@ -6,21 +6,21 @@ // TEST1-NEXT: in call to 'recurse(4)' // TEST1-NEXT: in call to 'recurse(5)' -// RUN: not %clang_cc1 -std=c++11 -fsyntax-only %s -fconstexpr-backtrace-limit 2 -fconstexpr-depth 4 -fno-caret-diagnostics 2>&1 | FileCheck %s -check-prefix=TEST2 +// RUN: not %clang_cc1 -std=c++11 -fsyntax-only %s -fconstexpr-backtrace-limit=2 -fconstexpr-depth 4 -fno-caret-diagnostics 2>&1 | FileCheck %s -check-prefix=TEST2 // TEST2: constant expression // TEST2-NEXT: exceeded maximum depth of 4 // TEST2-NEXT: in call to 'recurse(2)' // TEST2-NEXT: skipping 2 calls // TEST2-NEXT: in call to 'recurse(5)' -// RUN: not %clang_cc1 -std=c++11 -fsyntax-only %s -fconstexpr-backtrace-limit 2 -fconstexpr-depth 8 -fno-caret-diagnostics 2>&1 | FileCheck %s -check-prefix=TEST3 +// RUN: not %clang_cc1 -std=c++11 -fsyntax-only %s -fconstexpr-backtrace-limit=2 -fconstexpr-depth 8 -fno-caret-diagnostics 2>&1 | FileCheck %s -check-prefix=TEST3 // TEST3: constant expression // TEST3-NEXT: reinterpret_cast // TEST3-NEXT: in call to 'recurse(0)' // TEST3-NEXT: skipping 4 calls // TEST3-NEXT: in call to 'recurse(5)' -// RUN: not %clang_cc1 -std=c++11 -fsyntax-only %s -fconstexpr-backtrace-limit 8 -fconstexpr-depth 8 -fno-caret-diagnostics 2>&1 | FileCheck %s -check-prefix=TEST4 +// RUN: not %clang_cc1 -std=c++11 -fsyntax-only %s -fconstexpr-backtrace-limit=8 -fconstexpr-depth 8 -fno-caret-diagnostics 2>&1 | FileCheck %s -check-prefix=TEST4 // TEST4: constant expression // TEST4-NEXT: reinterpret_cast // TEST4-NEXT: in call to 'recurse(0)' diff --git a/clang/test/SemaCXX/typo-correction.cpp b/clang/test/SemaCXX/typo-correction.cpp index d466d9c49c3a..c262a62f0cb9 100644 --- a/clang/test/SemaCXX/typo-correction.cpp +++ b/clang/test/SemaCXX/typo-correction.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions -fcxx-exceptions %s -// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions -fcxx-exceptions -std=c++20 %s +// RUN: %clang_cc1 -fspell-checking-limit=0 -verify -Wno-c++11-extensions -fcxx-exceptions %s +// RUN: %clang_cc1 -fspell-checking-limit=0 -verify -Wno-c++11-extensions -fcxx-exceptions -std=c++20 %s namespace PR21817{ int a(-rsing[2]); // expected-error {{undeclared identifier 'rsing'; did you mean 'using'?}} diff --git a/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp b/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp index d66e68dc9e9c..3c1789c5aff3 100644 --- a/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp +++ b/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -triple %itanium_abi_triple -std=c++11 -ftemplate-depth 16 -fcxx-exceptions -fexceptions %s +// RUN: %clang_cc1 -fsyntax-only -verify -triple %itanium_abi_triple -std=c++11 -ftemplate-depth=16 -fcxx-exceptions -fexceptions %s // DR1330: an exception specification for a function template is only // instantiated when it is needed. diff --git a/clang/test/SemaTemplate/instantiation-depth-defarg.cpp b/clang/test/SemaTemplate/instantiation-depth-defarg.cpp index 6550987de784..24cd94104291 100644 --- a/clang/test/SemaTemplate/instantiation-depth-defarg.cpp +++ b/clang/test/SemaTemplate/instantiation-depth-defarg.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth 128 -ftemplate-backtrace-limit 4 %s +// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth=128 -ftemplate-backtrace-limit=4 %s template struct S { typedef typename S::type type; diff --git a/clang/test/SemaTemplate/instantiation-depth-default.cpp b/clang/test/SemaTemplate/instantiation-depth-default.cpp index 852621aa89e7..f5835b86b3a3 100644 --- a/clang/test/SemaTemplate/instantiation-depth-default.cpp +++ b/clang/test/SemaTemplate/instantiation-depth-default.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit 2 %s +// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit=2 %s // // FIXME: Disable this test when Clang was built with ASan, because ASan // increases our per-frame stack usage enough that this test no longer fits diff --git a/clang/test/SemaTemplate/instantiation-depth-exception-spec.cpp b/clang/test/SemaTemplate/instantiation-depth-exception-spec.cpp index 3f64811bd108..4464fbb31b38 100644 --- a/clang/test/SemaTemplate/instantiation-depth-exception-spec.cpp +++ b/clang/test/SemaTemplate/instantiation-depth-exception-spec.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -ftemplate-depth 16 -fcxx-exceptions -fexceptions %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -ftemplate-depth=16 -fcxx-exceptions -fexceptions %s template struct X { static int go(int a) noexcept(noexcept(X::go(a))); // \ diff --git a/clang/test/SemaTemplate/instantiation-depth-subst-2.cpp b/clang/test/SemaTemplate/instantiation-depth-subst-2.cpp index c9df093b1f7a..2b519e974a90 100644 --- a/clang/test/SemaTemplate/instantiation-depth-subst-2.cpp +++ b/clang/test/SemaTemplate/instantiation-depth-subst-2.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -verify %s -ftemplate-depth 2 +// RUN: %clang_cc1 -verify %s -ftemplate-depth=2 template struct S { }; template S operator+(T, T); // expected-error {{instantiation exceeded maximum depth}} expected-note 2{{while substituting}} diff --git a/clang/test/SemaTemplate/instantiation-depth-subst.cpp b/clang/test/SemaTemplate/instantiation-depth-subst.cpp index 2a3e422ac7af..062a8ed08bb6 100644 --- a/clang/test/SemaTemplate/instantiation-depth-subst.cpp +++ b/clang/test/SemaTemplate/instantiation-depth-subst.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -verify %s -ftemplate-depth 2 +// RUN: %clang_cc1 -std=c++11 -verify %s -ftemplate-depth=2 // PR9793 template auto f(T t) -> decltype(f(t)); // \ diff --git a/clang/test/SemaTemplate/instantiation-depth.cpp b/clang/test/SemaTemplate/instantiation-depth.cpp index 17f84c170c32..15e2c2ba7c8b 100644 --- a/clang/test/SemaTemplate/instantiation-depth.cpp +++ b/clang/test/SemaTemplate/instantiation-depth.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth 5 -ftemplate-backtrace-limit 4 %s +// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth=5 -ftemplate-backtrace-limit=4 %s // RUN: %clang -fsyntax-only -Xclang -verify -ftemplate-depth-5 -ftemplate-backtrace-limit=4 %s // RUN: %clang -fsyntax-only -Xclang -verify -ftemplate-depth=5 -ftemplate-backtrace-limit=4 %s @@ -16,7 +16,7 @@ void test() { #else -// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth 5 -ftemplate-backtrace-limit 4 -std=c++11 -DNOEXCEPT %s +// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth=5 -ftemplate-backtrace-limit=4 -std=c++11 -DNOEXCEPT %s template struct S { S() noexcept(noexcept(S())); \