Skip to content

Commit 0874110

Browse files
committed
[Driver] Change some Separate CC1 options to use the Joined = form
1 parent e1fa30d commit 0874110

File tree

9 files changed

+28
-44
lines changed

9 files changed

+28
-44
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,8 +1502,12 @@ defm constant_cfstrings : BoolFOption<"constant-cfstrings",
15021502
NegFlag<SetTrue, [CC1Option], "Disable creation of CodeFoundation-type constant strings">,
15031503
PosFlag<SetFalse>>;
15041504
def fconstant_string_class_EQ : Joined<["-"], "fconstant-string-class=">, Group<f_Group>;
1505-
def fconstexpr_depth_EQ : Joined<["-"], "fconstexpr-depth=">, Group<f_Group>;
1506-
def fconstexpr_steps_EQ : Joined<["-"], "fconstexpr-steps=">, Group<f_Group>;
1505+
def fconstexpr_depth_EQ : Joined<["-"], "fconstexpr-depth=">, Group<f_Group>, Flags<[CC1Option]>,
1506+
HelpText<"Set the maximum depth of recursive constexpr function calls">,
1507+
MarshallingInfoInt<LangOpts<"ConstexprCallDepth">, "512">;
1508+
def fconstexpr_steps_EQ : Joined<["-"], "fconstexpr-steps=">, Group<f_Group>, Flags<[CC1Option]>,
1509+
HelpText<"Set the maximum number of steps in constexpr function evaluation">,
1510+
MarshallingInfoInt<LangOpts<"ConstexprStepLimit">, "1048576">;
15071511
def fexperimental_new_constant_interpreter : Flag<["-"], "fexperimental-new-constant-interpreter">, Group<f_Group>,
15081512
HelpText<"Enable the experimental new constant interpreter">, Flags<[CC1Option]>,
15091513
MarshallingInfoFlag<LangOpts<"EnableNewConstInterp">>;
@@ -2974,8 +2978,9 @@ def : Joined<["-"], "ftemplate-depth-">, Group<f_Group>, Alias<ftemplate_depth_E
29742978
def ftemplate_backtrace_limit_EQ : Joined<["-"], "ftemplate-backtrace-limit=">, Group<f_Group>, Flags<[CC1Option]>,
29752979
HelpText<"Set the maximum number of entries to print in a template instantiation backtrace (0 = no limit)">,
29762980
MarshallingInfoInt<DiagnosticOpts<"TemplateBacktraceLimit">, "DiagnosticOptions::DefaultTemplateBacktraceLimit">;
2977-
def foperator_arrow_depth_EQ : Joined<["-"], "foperator-arrow-depth=">,
2978-
Group<f_Group>;
2981+
def foperator_arrow_depth_EQ : Joined<["-"], "foperator-arrow-depth=">, Group<f_Group>, Flags<[CC1Option]>,
2982+
HelpText<"Maximum number of 'operator->'s to call for a member access">,
2983+
MarshallingInfoInt<LangOpts<"ArrowDepth">, "256">;
29792984

29802985
def fsave_optimization_record : Flag<["-"], "fsave-optimization-record">,
29812986
Group<f_Group>, HelpText<"Generate a YAML optimization record file">;
@@ -6391,15 +6396,6 @@ def ftype_visibility : Joined<["-"], "ftype-visibility=">,
63916396
def fapply_global_visibility_to_externs : Flag<["-"], "fapply-global-visibility-to-externs">,
63926397
HelpText<"Apply global symbol visibility to external declarations without an explicit visibility">,
63936398
MarshallingInfoFlag<LangOpts<"SetVisibilityForExternDecls">>;
6394-
def foperator_arrow_depth : Separate<["-"], "foperator-arrow-depth">,
6395-
HelpText<"Maximum number of 'operator->'s to call for a member access">,
6396-
MarshallingInfoInt<LangOpts<"ArrowDepth">, "256">;
6397-
def fconstexpr_depth : Separate<["-"], "fconstexpr-depth">,
6398-
HelpText<"Maximum depth of recursive constexpr function calls">,
6399-
MarshallingInfoInt<LangOpts<"ConstexprCallDepth">, "512">;
6400-
def fconstexpr_steps : Separate<["-"], "fconstexpr-steps">,
6401-
HelpText<"Maximum number of steps in constexpr function evaluation">,
6402-
MarshallingInfoInt<LangOpts<"ConstexprStepLimit">, "1048576">;
64036399
def fbracket_depth : Separate<["-"], "fbracket-depth">,
64046400
HelpText<"Maximum nesting level for parentheses, brackets, and braces">,
64056401
MarshallingInfoInt<LangOpts<"BracketDepth">, "256">;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5970,21 +5970,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
59705970
addDebugPrefixMapArg(D, TC, Args, CmdArgs);
59715971

59725972
Args.AddLastArg(CmdArgs, options::OPT_ftemplate_depth_EQ);
5973-
5974-
if (Arg *A = Args.getLastArg(options::OPT_foperator_arrow_depth_EQ)) {
5975-
CmdArgs.push_back("-foperator-arrow-depth");
5976-
CmdArgs.push_back(A->getValue());
5977-
}
5978-
5979-
if (Arg *A = Args.getLastArg(options::OPT_fconstexpr_depth_EQ)) {
5980-
CmdArgs.push_back("-fconstexpr-depth");
5981-
CmdArgs.push_back(A->getValue());
5982-
}
5983-
5984-
if (Arg *A = Args.getLastArg(options::OPT_fconstexpr_steps_EQ)) {
5985-
CmdArgs.push_back("-fconstexpr-steps");
5986-
CmdArgs.push_back(A->getValue());
5987-
}
5973+
Args.AddLastArg(CmdArgs, options::OPT_foperator_arrow_depth_EQ);
5974+
Args.AddLastArg(CmdArgs, options::OPT_fconstexpr_depth_EQ);
5975+
Args.AddLastArg(CmdArgs, options::OPT_fconstexpr_steps_EQ);
59885976

59895977
Args.AddLastArg(CmdArgs, options::OPT_fexperimental_library);
59905978

clang/test/AST/Interp/depth-limit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -fconstexpr-depth 100 -verify %s
2-
// RUN: %clang_cc1 -fconstexpr-depth 100 -verify=ref %s
1+
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -fconstexpr-depth=100 -verify %s
2+
// RUN: %clang_cc1 -fconstexpr-depth=100 -verify=ref %s
33

44
constexpr int f(int a) {
55
if (a == 100)

clang/test/AST/Interp/depth-limit2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -fconstexpr-depth 2 -verify %s
2-
// RUN: %clang_cc1 -fconstexpr-depth 2 -verify=ref %s
1+
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -fconstexpr-depth=2 -verify %s
2+
// RUN: %clang_cc1 -fconstexpr-depth=2 -verify=ref %s
33

44

55
constexpr int func() {

clang/test/CXX/expr/expr.const/p2-0x.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -pedantic -verify=expected,cxx11 -fcxx-exceptions %s -fconstexpr-depth 128 -triple i686-pc-linux-gnu
2-
// RUN: %clang_cc1 -fsyntax-only -std=c++2a -pedantic -verify=expected,cxx20 -fcxx-exceptions %s -fconstexpr-depth 128 -triple i686-pc-linux-gnu
1+
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -pedantic -verify=expected,cxx11 -fcxx-exceptions %s -fconstexpr-depth=128 -triple i686-pc-linux-gnu
2+
// RUN: %clang_cc1 -fsyntax-only -std=c++2a -pedantic -verify=expected,cxx20 -fcxx-exceptions %s -fconstexpr-depth=128 -triple i686-pc-linux-gnu
33

44
// A conditional-expression is a core constant expression unless it involves one
55
// of the following as a potentially evaluated subexpression [...]:

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/constexpr-depth.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s -DMAX=128 -fconstexpr-depth 128
2-
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s -DMAX=2 -fconstexpr-depth 2
1+
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s -DMAX=128 -fconstexpr-depth=128
2+
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s -DMAX=2 -fconstexpr-depth=2
33
// RUN: %clang -std=c++11 -fsyntax-only -Xclang -verify %s -DMAX=10 -fconstexpr-depth=10
44

55
constexpr int depth(int n) { return n > 1 ? depth(n-1) : 0; } // expected-note {{exceeded maximum depth}} expected-note +{{}}

clang/test/SemaCXX/constexpr-steps.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -std=c++1y -fsyntax-only -verify %s -DMAX=1234 -fconstexpr-steps 1234
2-
// RUN: %clang_cc1 -std=c++1y -fsyntax-only -verify %s -DMAX=10 -fconstexpr-steps 10
1+
// RUN: %clang_cc1 -std=c++1y -fsyntax-only -verify %s -DMAX=1234 -fconstexpr-steps=1234
2+
// RUN: %clang_cc1 -std=c++1y -fsyntax-only -verify %s -DMAX=10 -fconstexpr-steps=10
33
// RUN: %clang -std=c++1y -fsyntax-only -Xclang -verify %s -DMAX=12345 -fconstexpr-steps=12345
44

55
// This takes a total of n + 4 steps according to our current rules:

clang/test/SemaCXX/operator-arrow-depth.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -fsyntax-only -verify %s -DMAX=128 -foperator-arrow-depth 128
2-
// RUN: %clang_cc1 -fsyntax-only -verify %s -DMAX=2 -foperator-arrow-depth 2
1+
// RUN: %clang_cc1 -fsyntax-only -verify %s -DMAX=128 -foperator-arrow-depth=128
2+
// RUN: %clang_cc1 -fsyntax-only -verify %s -DMAX=2 -foperator-arrow-depth=2
33
// RUN: %clang -fsyntax-only -Xclang -verify %s -DMAX=10 -foperator-arrow-depth=10
44

55
template<int N> struct B;

0 commit comments

Comments
 (0)