Skip to content

Commit 0aa4af7

Browse files
committed
[Driver] Change some Separate CC1 options to use the Joined = form
-f{constexpr,macro,template}-backtrace-limit=, -fspell-checking-limit=, -ftemplate-depth=
1 parent b244a4c commit 0aa4af7

13 files changed

+38
-64
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,8 +1507,9 @@ def fconstexpr_steps_EQ : Joined<["-"], "fconstexpr-steps=">, Group<f_Group>;
15071507
def fexperimental_new_constant_interpreter : Flag<["-"], "fexperimental-new-constant-interpreter">, Group<f_Group>,
15081508
HelpText<"Enable the experimental new constant interpreter">, Flags<[CC1Option]>,
15091509
MarshallingInfoFlag<LangOpts<"EnableNewConstInterp">>;
1510-
def fconstexpr_backtrace_limit_EQ : Joined<["-"], "fconstexpr-backtrace-limit=">,
1511-
Group<f_Group>;
1510+
def fconstexpr_backtrace_limit_EQ : Joined<["-"], "fconstexpr-backtrace-limit=">, Group<f_Group>, Flags<[CC1Option]>,
1511+
HelpText<"Set the maximum number of entries to print in a constexpr evaluation backtrace (0 = no limit)">,
1512+
MarshallingInfoInt<DiagnosticOpts<"ConstexprBacktraceLimit">, "DiagnosticOptions::DefaultConstexprBacktraceLimit">;
15121513
def fcrash_diagnostics_EQ : Joined<["-"], "fcrash-diagnostics=">, Group<f_clang_Group>, Flags<[NoArgumentUnused, CoreOption]>,
15131514
HelpText<"Set level of crash diagnostic reporting, (option: off, compiler, all)">;
15141515
def fcrash_diagnostics : Flag<["-"], "fcrash-diagnostics">, Group<f_clang_Group>, Flags<[NoArgumentUnused, CoreOption]>,
@@ -2289,7 +2290,9 @@ def fthin_link_bitcode_EQ : Joined<["-"], "fthin-link-bitcode=">,
22892290
HelpText<"Write minimized bitcode to <file> for the ThinLTO thin link only">,
22902291
MarshallingInfoString<CodeGenOpts<"ThinLinkBitcodeFile">>;
22912292
def fmacro_backtrace_limit_EQ : Joined<["-"], "fmacro-backtrace-limit=">,
2292-
Group<f_Group>, Flags<[NoXarchOption, CoreOption]>;
2293+
Group<f_Group>, Flags<[NoXarchOption, CC1Option, CoreOption]>,
2294+
HelpText<"Set the maximum number of entries to print in a macro expansion backtrace (0 = no limit)">,
2295+
MarshallingInfoInt<DiagnosticOpts<"MacroBacktraceLimit">, "DiagnosticOptions::DefaultMacroBacktraceLimit">;
22932296
defm merge_all_constants : BoolFOption<"merge-all-constants",
22942297
CodeGenOpts<"MergeAllConstants">, DefaultFalse,
22952298
PosFlag<SetTrue, [CC1Option, CoreOption], "Allow">, NegFlag<SetFalse, [], "Disallow">,
@@ -2893,7 +2896,9 @@ defm show_source_location : BoolFOption<"show-source-location",
28932896
defm spell_checking : BoolFOption<"spell-checking",
28942897
LangOpts<"SpellChecking">, DefaultTrue,
28952898
NegFlag<SetFalse, [CC1Option], "Disable spell-checking">, PosFlag<SetTrue>>;
2896-
def fspell_checking_limit_EQ : Joined<["-"], "fspell-checking-limit=">, Group<f_Group>;
2899+
def fspell_checking_limit_EQ : Joined<["-"], "fspell-checking-limit=">, Group<f_Group>, Flags<[CC1Option]>,
2900+
HelpText<"Set the maximum number of times to perform spell checking on unrecognized identifiers (0 = no limit)">,
2901+
MarshallingInfoInt<DiagnosticOpts<"SpellCheckingLimit">, "DiagnosticOptions::DefaultSpellCheckingLimit">;
28972902
def fsigned_bitfields : Flag<["-"], "fsigned-bitfields">, Group<f_Group>;
28982903
defm signed_char : BoolFOption<"signed-char",
28992904
LangOpts<"CharIsSigned">, DefaultTrue,
@@ -2962,10 +2967,13 @@ def fsyntax_only : Flag<["-"], "fsyntax-only">,
29622967
Flags<[NoXarchOption,CoreOption,CC1Option,FC1Option,FlangOption]>, Group<Action_Group>,
29632968
HelpText<"Run the preprocessor, parser and semantic analysis stages">;
29642969
def ftabstop_EQ : Joined<["-"], "ftabstop=">, Group<f_Group>;
2965-
def ftemplate_depth_EQ : Joined<["-"], "ftemplate-depth=">, Group<f_Group>;
2966-
def ftemplate_depth_ : Joined<["-"], "ftemplate-depth-">, Group<f_Group>;
2967-
def ftemplate_backtrace_limit_EQ : Joined<["-"], "ftemplate-backtrace-limit=">,
2968-
Group<f_Group>;
2970+
def ftemplate_depth_EQ : Joined<["-"], "ftemplate-depth=">, Group<f_Group>, Flags<[CC1Option]>,
2971+
HelpText<"Set the maximum depth of recursive template instantiation">,
2972+
MarshallingInfoInt<LangOpts<"InstantiationDepth">, "1024">;
2973+
def : Joined<["-"], "ftemplate-depth-">, Group<f_Group>, Alias<ftemplate_depth_EQ>;
2974+
def ftemplate_backtrace_limit_EQ : Joined<["-"], "ftemplate-backtrace-limit=">, Group<f_Group>, Flags<[CC1Option]>,
2975+
HelpText<"Set the maximum number of entries to print in a template instantiation backtrace (0 = no limit)">,
2976+
MarshallingInfoInt<DiagnosticOpts<"TemplateBacktraceLimit">, "DiagnosticOptions::DefaultTemplateBacktraceLimit">;
29692977
def foperator_arrow_depth_EQ : Joined<["-"], "foperator-arrow-depth=">,
29702978
Group<f_Group>;
29712979

@@ -5926,18 +5934,6 @@ def ftabstop : Separate<["-"], "ftabstop">, MetaVarName<"<N>">,
59265934
def ferror_limit : Separate<["-"], "ferror-limit">, MetaVarName<"<N>">,
59275935
HelpText<"Set the maximum number of errors to emit before stopping (0 = no limit).">,
59285936
MarshallingInfoInt<DiagnosticOpts<"ErrorLimit">>;
5929-
def fmacro_backtrace_limit : Separate<["-"], "fmacro-backtrace-limit">, MetaVarName<"<N>">,
5930-
HelpText<"Set the maximum number of entries to print in a macro expansion backtrace (0 = no limit).">,
5931-
MarshallingInfoInt<DiagnosticOpts<"MacroBacktraceLimit">, "DiagnosticOptions::DefaultMacroBacktraceLimit">;
5932-
def ftemplate_backtrace_limit : Separate<["-"], "ftemplate-backtrace-limit">, MetaVarName<"<N>">,
5933-
HelpText<"Set the maximum number of entries to print in a template instantiation backtrace (0 = no limit).">,
5934-
MarshallingInfoInt<DiagnosticOpts<"TemplateBacktraceLimit">, "DiagnosticOptions::DefaultTemplateBacktraceLimit">;
5935-
def fconstexpr_backtrace_limit : Separate<["-"], "fconstexpr-backtrace-limit">, MetaVarName<"<N>">,
5936-
HelpText<"Set the maximum number of entries to print in a constexpr evaluation backtrace (0 = no limit).">,
5937-
MarshallingInfoInt<DiagnosticOpts<"ConstexprBacktraceLimit">, "DiagnosticOptions::DefaultConstexprBacktraceLimit">;
5938-
def fspell_checking_limit : Separate<["-"], "fspell-checking-limit">, MetaVarName<"<N>">,
5939-
HelpText<"Set the maximum number of times to perform spell checking on unrecognized identifiers (0 = no limit).">,
5940-
MarshallingInfoInt<DiagnosticOpts<"SpellCheckingLimit">, "DiagnosticOptions::DefaultSpellCheckingLimit">;
59415937
def fcaret_diagnostics_max_lines :
59425938
Separate<["-"], "fcaret-diagnostics-max-lines">, MetaVarName<"<N>">,
59435939
HelpText<"Set the maximum number of source lines to show in a caret diagnostic">,
@@ -6395,9 +6391,6 @@ def ftype_visibility : Joined<["-"], "ftype-visibility=">,
63956391
def fapply_global_visibility_to_externs : Flag<["-"], "fapply-global-visibility-to-externs">,
63966392
HelpText<"Apply global symbol visibility to external declarations without an explicit visibility">,
63976393
MarshallingInfoFlag<LangOpts<"SetVisibilityForExternDecls">>;
6398-
def ftemplate_depth : Separate<["-"], "ftemplate-depth">,
6399-
HelpText<"Maximum depth of recursive template instantiation">,
6400-
MarshallingInfoInt<LangOpts<"InstantiationDepth">, "1024">;
64016394
def foperator_arrow_depth : Separate<["-"], "foperator-arrow-depth">,
64026395
HelpText<"Maximum number of 'operator->'s to call for a member access">,
64036396
MarshallingInfoInt<LangOpts<"ArrowDepth">, "256">;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5969,11 +5969,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
59695969

59705970
addDebugPrefixMapArg(D, TC, Args, CmdArgs);
59715971

5972-
if (Arg *A = Args.getLastArg(options::OPT_ftemplate_depth_,
5973-
options::OPT_ftemplate_depth_EQ)) {
5974-
CmdArgs.push_back("-ftemplate-depth");
5975-
CmdArgs.push_back(A->getValue());
5976-
}
5972+
Args.AddLastArg(CmdArgs, options::OPT_ftemplate_depth_EQ);
59775973

59785974
if (Arg *A = Args.getLastArg(options::OPT_foperator_arrow_depth_EQ)) {
59795975
CmdArgs.push_back("-foperator-arrow-depth");
@@ -6054,25 +6050,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
60546050
else
60556051
CmdArgs.push_back("19");
60566052

6057-
if (Arg *A = Args.getLastArg(options::OPT_fmacro_backtrace_limit_EQ)) {
6058-
CmdArgs.push_back("-fmacro-backtrace-limit");
6059-
CmdArgs.push_back(A->getValue());
6060-
}
6061-
6062-
if (Arg *A = Args.getLastArg(options::OPT_ftemplate_backtrace_limit_EQ)) {
6063-
CmdArgs.push_back("-ftemplate-backtrace-limit");
6064-
CmdArgs.push_back(A->getValue());
6065-
}
6066-
6067-
if (Arg *A = Args.getLastArg(options::OPT_fconstexpr_backtrace_limit_EQ)) {
6068-
CmdArgs.push_back("-fconstexpr-backtrace-limit");
6069-
CmdArgs.push_back(A->getValue());
6070-
}
6071-
6072-
if (Arg *A = Args.getLastArg(options::OPT_fspell_checking_limit_EQ)) {
6073-
CmdArgs.push_back("-fspell-checking-limit");
6074-
CmdArgs.push_back(A->getValue());
6075-
}
6053+
Args.AddLastArg(CmdArgs, options::OPT_fconstexpr_backtrace_limit_EQ);
6054+
Args.AddLastArg(CmdArgs, options::OPT_fmacro_backtrace_limit_EQ);
6055+
Args.AddLastArg(CmdArgs, options::OPT_ftemplate_backtrace_limit_EQ);
6056+
Args.AddLastArg(CmdArgs, options::OPT_fspell_checking_limit_EQ);
60766057

60776058
// Pass -fmessage-length=.
60786059
unsigned MessageLength = 0;

clang/test/Misc/macro-backtrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
void f(int *ip, float *fp) {
1818
if (M12(ip, fp)) { }
19-
// RUN: %clang_cc1 -fsyntax-only -fmacro-backtrace-limit 5 %s 2>&1 \
19+
// RUN: %clang_cc1 -fsyntax-only -fmacro-backtrace-limit=5 %s 2>&1 \
2020
// RUN: | FileCheck %s -check-prefix=CHECK-LIMIT
2121
// CHECK-LIMIT: macro-backtrace.c:18:7: warning: comparison of distinct pointer types ('int *' and 'float *')
2222
// CHECK-LIMIT: if (M12(ip, fp)) { }

clang/test/Misc/reduced-diags-macros-backtrace.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: not %clang_cc1 -fsyntax-only -fmacro-backtrace-limit 0 %s 2>&1 | FileCheck %s --check-prefix=ALL
2-
// RUN: not %clang_cc1 -fsyntax-only -fmacro-backtrace-limit 2 %s 2>&1 | FileCheck %s --check-prefix=SKIP
1+
// RUN: not %clang_cc1 -fsyntax-only -fmacro-backtrace-limit=0 %s 2>&1 | FileCheck %s --check-prefix=ALL
2+
// RUN: not %clang_cc1 -fsyntax-only -fmacro-backtrace-limit=2 %s 2>&1 | FileCheck %s --check-prefix=SKIP
33

44
#define F(x) x + 1
55
#define G(x) F(x) + 2

clang/test/SemaCXX/constexpr-backtrace-limit.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
// 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
1+
// 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
22
// TEST1: constant expression
33
// TEST1-NEXT: exceeded maximum depth of 4
44
// TEST1-NEXT: in call to 'recurse(2)'
55
// TEST1-NEXT: in call to 'recurse(3)'
66
// TEST1-NEXT: in call to 'recurse(4)'
77
// TEST1-NEXT: in call to 'recurse(5)'
88

9-
// 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
9+
// 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
1010
// TEST2: constant expression
1111
// TEST2-NEXT: exceeded maximum depth of 4
1212
// TEST2-NEXT: in call to 'recurse(2)'
1313
// TEST2-NEXT: skipping 2 calls
1414
// TEST2-NEXT: in call to 'recurse(5)'
1515

16-
// 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
16+
// 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
1717
// TEST3: constant expression
1818
// TEST3-NEXT: reinterpret_cast
1919
// TEST3-NEXT: in call to 'recurse(0)'
2020
// TEST3-NEXT: skipping 4 calls
2121
// TEST3-NEXT: in call to 'recurse(5)'
2222

23-
// 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
23+
// 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
2424
// TEST4: constant expression
2525
// TEST4-NEXT: reinterpret_cast
2626
// TEST4-NEXT: in call to 'recurse(0)'

clang/test/SemaCXX/typo-correction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions -fcxx-exceptions %s
2-
// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions -fcxx-exceptions -std=c++20 %s
1+
// RUN: %clang_cc1 -fspell-checking-limit=0 -verify -Wno-c++11-extensions -fcxx-exceptions %s
2+
// RUN: %clang_cc1 -fspell-checking-limit=0 -verify -Wno-c++11-extensions -fcxx-exceptions -std=c++20 %s
33

44
namespace PR21817{
55
int a(-rsing[2]); // expected-error {{undeclared identifier 'rsing'; did you mean 'using'?}}

clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -fsyntax-only -verify -triple %itanium_abi_triple -std=c++11 -ftemplate-depth 16 -fcxx-exceptions -fexceptions %s
1+
// RUN: %clang_cc1 -fsyntax-only -verify -triple %itanium_abi_triple -std=c++11 -ftemplate-depth=16 -fcxx-exceptions -fexceptions %s
22

33
// DR1330: an exception specification for a function template is only
44
// instantiated when it is needed.

clang/test/SemaTemplate/instantiation-depth-defarg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth 128 -ftemplate-backtrace-limit 4 %s
1+
// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth=128 -ftemplate-backtrace-limit=4 %s
22

33
template<int N> struct S {
44
typedef typename S<N-1>::type type;

clang/test/SemaTemplate/instantiation-depth-default.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit 2 %s
1+
// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit=2 %s
22
//
33
// FIXME: Disable this test when Clang was built with ASan, because ASan
44
// increases our per-frame stack usage enough that this test no longer fits

clang/test/SemaTemplate/instantiation-depth-exception-spec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -ftemplate-depth 16 -fcxx-exceptions -fexceptions %s
1+
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -ftemplate-depth=16 -fcxx-exceptions -fexceptions %s
22

33
template<int N> struct X {
44
static int go(int a) noexcept(noexcept(X<N+1>::go(a))); // \

clang/test/SemaTemplate/instantiation-depth-subst-2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -verify %s -ftemplate-depth 2
1+
// RUN: %clang_cc1 -verify %s -ftemplate-depth=2
22

33
template<int N> struct S { };
44
template<typename T> S<T() + T()> operator+(T, T); // expected-error {{instantiation exceeded maximum depth}} expected-note 2{{while substituting}}

clang/test/SemaTemplate/instantiation-depth-subst.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c++11 -verify %s -ftemplate-depth 2
1+
// RUN: %clang_cc1 -std=c++11 -verify %s -ftemplate-depth=2
22

33
// PR9793
44
template<typename T> auto f(T t) -> decltype(f(t)); // \

clang/test/SemaTemplate/instantiation-depth.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth 5 -ftemplate-backtrace-limit 4 %s
1+
// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth=5 -ftemplate-backtrace-limit=4 %s
22
// RUN: %clang -fsyntax-only -Xclang -verify -ftemplate-depth-5 -ftemplate-backtrace-limit=4 %s
33
// RUN: %clang -fsyntax-only -Xclang -verify -ftemplate-depth=5 -ftemplate-backtrace-limit=4 %s
44

@@ -16,7 +16,7 @@ void test() {
1616

1717
#else
1818

19-
// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth 5 -ftemplate-backtrace-limit 4 -std=c++11 -DNOEXCEPT %s
19+
// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth=5 -ftemplate-backtrace-limit=4 -std=c++11 -DNOEXCEPT %s
2020

2121
template<typename T> struct S {
2222
S() noexcept(noexcept(S<S>())); \

0 commit comments

Comments
 (0)