[PATCH] D73937: [Driver] Change -fmax-tokens $arg to -fmax-tokens=$arg
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 4 09:44:23 PST 2020
MaskRay updated this revision to Diff 242359.
MaskRay added a comment.
Rename to fmax_tokens_EQ as a convention
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73937/new/
https://reviews.llvm.org/D73937
Files:
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Parse/Parser.cpp
clang/test/Parser/max-tokens.cpp
Index: clang/test/Parser/max-tokens.cpp
===================================================================
--- clang/test/Parser/max-tokens.cpp
+++ clang/test/Parser/max-tokens.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -verify %s -DMAX_TOKENS -fmax-tokens 2
-// RUN: %clang_cc1 -fsyntax-only -verify %s -DMAX_TOKENS_OVERRIDE -fmax-tokens 9
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DMAX_TOKENS -fmax-tokens=2
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DMAX_TOKENS_OVERRIDE -fmax-tokens=9
int x, y, z;
Index: clang/lib/Parse/Parser.cpp
===================================================================
--- clang/lib/Parse/Parser.cpp
+++ clang/lib/Parse/Parser.cpp
@@ -650,7 +650,7 @@
return false;
case tok::eof:
- // Check whether -fmax-tokens was reached.
+ // Check whether -fmax-tokens= was reached.
if (PP.getMaxTokens() != 0 && PP.getTokenCount() > PP.getMaxTokens()) {
PP.Diag(Tok.getLocation(), diag::warn_max_tokens_total)
<< PP.getTokenCount() << PP.getMaxTokens();
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3320,7 +3320,7 @@
Opts.CompleteMemberPointers = Args.hasArg(OPT_fcomplete_member_pointers);
Opts.BuildingPCHWithObjectFile = Args.hasArg(OPT_building_pch_with_obj);
- Opts.MaxTokens = getLastArgIntValue(Args, OPT_fmax_tokens, 0, Diags);
+ Opts.MaxTokens = getLastArgIntValue(Args, OPT_fmax_tokens_EQ, 0, Diags);
}
static bool isStrictlyPreprocessorAction(frontend::ActionKind Action) {
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5731,7 +5731,7 @@
Args.AddLastArg(CmdArgs, options::OPT_dM);
Args.AddLastArg(CmdArgs, options::OPT_dD);
- Args.AddLastArg(CmdArgs, options::OPT_fmax_tokens);
+ Args.AddLastArg(CmdArgs, options::OPT_fmax_tokens_EQ);
// Handle serialized diagnostics.
if (Arg *A = Args.getLastArg(options::OPT__serialize_diags)) {
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -646,9 +646,8 @@
def interface_stub_version_EQ : JoinedOrSeparate<["-"], "interface-stub-version=">, Flags<[CC1Option]>;
def exported__symbols__list : Separate<["-"], "exported_symbols_list">;
def e : JoinedOrSeparate<["-"], "e">, Group<Link_Group>;
-def fmax_tokens : Separate<["-"], "fmax-tokens">,
- HelpText<"Max total number of preprocessed tokens for -Wmax-tokens.">,
- Group<f_Group>, Flags<[CC1Option]>;
+def fmax_tokens_EQ : Joined<["-"], "fmax-tokens=">, Group<f_Group>, Flags<[CC1Option]>,
+ HelpText<"Max total number of preprocessed tokens for -Wmax-tokens.">;
def fPIC : Flag<["-"], "fPIC">, Group<f_Group>;
def fno_PIC : Flag<["-"], "fno-PIC">, Group<f_Group>;
def fPIE : Flag<["-"], "fPIE">, Group<f_Group>;
Index: clang/include/clang/Basic/DiagnosticGroups.td
===================================================================
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -1168,14 +1168,14 @@
.. code-block: c++
#pragma clang max_tokens_here 1234
-2. As a per-translation unit limit, using the ``-fmax-tokens`` command-line
+2. As a per-translation unit limit, using the ``-fmax-tokens=`` command-line
flag:
.. code-block: console
- clang -c a.cpp -fmax-tokens 1234
+ clang -c a.cpp -fmax-tokens=1234
3. As a per-translation unit limit using the ``clang max_tokens_total`` pragma,
- which works like and overrides the ``-fmax-tokens`` flag:
+ which works like and overrides the ``-fmax-tokens=`` flag:
.. code-block: c++
#pragma clang max_file_tokens 1234
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73937.242359.patch
Type: text/x-patch
Size: 4042 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200204/72d6bf92/attachment.bin>
More information about the cfe-commits
mailing list