This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
tbaeder marked an inline comment as done.
Closed by commit rG5cc721b3f96e: [clang][Driver] Add
-fcaret-diagnostics-max-lines= as a driver option (authored by tbaeder).
Changed prior to commit:
https://reviews.llvm.org/D152090?vs=530168&id=530448#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152090/new/
https://reviews.llvm.org/D152090
Files:
clang/docs/ReleaseNotes.rst
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/caret-diagnostics-max-lines.cpp
clang/test/FixIt/fixit-function-call.cpp
clang/test/Misc/caret-diags-multiline.cpp
clang/test/Sema/caret-diags-complex-init.cpp
Index: clang/test/Sema/caret-diags-complex-init.cpp
===================================================================
--- clang/test/Sema/caret-diags-complex-init.cpp
+++ clang/test/Sema/caret-diags-complex-init.cpp
@@ -1,4 +1,4 @@
-// RUN: not %clang_cc1 -std=c++11 -fsyntax-only
-fno-diagnostics-show-line-numbers -fcaret-diagnostics-max-lines 5 %s 2>&1 |
FileCheck %s -strict-whitespace
+// RUN: not %clang_cc1 -std=c++11 -fsyntax-only
-fno-diagnostics-show-line-numbers -fcaret-diagnostics-max-lines=5 %s 2>&1 |
FileCheck %s -strict-whitespace
//CHECK: {{.*}}: error: excess elements in scalar initializer
Index: clang/test/Misc/caret-diags-multiline.cpp
===================================================================
--- clang/test/Misc/caret-diags-multiline.cpp
+++ clang/test/Misc/caret-diags-multiline.cpp
@@ -1,4 +1,4 @@
-// RUN: not %clang_cc1 -std=c++11 -fno-diagnostics-show-line-numbers
-fcaret-diagnostics-max-lines 5 -Wsometimes-uninitialized %s 2>&1 | FileCheck
%s --strict-whitespace
+// RUN: not %clang_cc1 -std=c++11 -fno-diagnostics-show-line-numbers
-fcaret-diagnostics-max-lines=5 -Wsometimes-uninitialized %s 2>&1 | FileCheck
%s --strict-whitespace
void line(int);
Index: clang/test/FixIt/fixit-function-call.cpp
===================================================================
--- clang/test/FixIt/fixit-function-call.cpp
+++ clang/test/FixIt/fixit-function-call.cpp
@@ -1,4 +1,4 @@
-// RUN: not %clang_cc1 -fdiagnostics-parseable-fixits
-fno-diagnostics-show-line-numbers -fcaret-diagnostics-max-lines 1 -x c++ %s 2>
%t
+// RUN: not %clang_cc1 -fdiagnostics-parseable-fixits
-fno-diagnostics-show-line-numbers -fcaret-diagnostics-max-lines=1 -x c++ %s 2>
%t
// RUN: FileCheck %s < %t
// PR5941
// END.
Index: clang/test/Driver/caret-diagnostics-max-lines.cpp
===================================================================
--- /dev/null
+++ clang/test/Driver/caret-diagnostics-max-lines.cpp
@@ -0,0 +1,3 @@
+//RUN: %clang++ -### -fcaret-diagnostics-max-lines=2 %s 2>&1 | FileCheck %s
+
+// CHECK: "-fcaret-diagnostics-max-lines=2"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -6062,6 +6062,7 @@
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);
+ Args.AddLastArg(CmdArgs, options::OPT_fcaret_diagnostics_max_lines_EQ);
// Pass -fmessage-length=.
unsigned MessageLength = 0;
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -2312,6 +2312,11 @@
Group<f_Group>, Flags<[NoXarchOption, CC1Option, CoreOption]>,
HelpText<"Set the maximum number of entries to print in a macro expansion
backtrace (0 = no limit)">,
MarshallingInfoInt<DiagnosticOpts<"MacroBacktraceLimit">,
"DiagnosticOptions::DefaultMacroBacktraceLimit">;
+def fcaret_diagnostics_max_lines_EQ :
+ Joined<["-"], "fcaret-diagnostics-max-lines=">,
+ Group<f_Group>, Flags<[CC1Option, CoreOption]>,
+ HelpText<"Set the maximum number of source lines to show in a caret
diagnostic (0 = no limit).">,
+ MarshallingInfoInt<DiagnosticOpts<"SnippetLineLimit">,
"DiagnosticOptions::DefaultSnippetLineLimit">;
defm merge_all_constants : BoolFOption<"merge-all-constants",
CodeGenOpts<"MergeAllConstants">, DefaultFalse,
PosFlag<SetTrue, [CC1Option, CoreOption], "Allow">, NegFlag<SetFalse, [],
"Disallow">,
@@ -6003,10 +6008,6 @@
def ferror_limit : Separate<["-"], "ferror-limit">, MetaVarName<"<N>">,
HelpText<"Set the maximum number of errors to emit before stopping (0 = no
limit).">,
MarshallingInfoInt<DiagnosticOpts<"ErrorLimit">>;
-def fcaret_diagnostics_max_lines :
- Separate<["-"], "fcaret-diagnostics-max-lines">, MetaVarName<"<N>">,
- HelpText<"Set the maximum number of source lines to show in a caret
diagnostic">,
- MarshallingInfoInt<DiagnosticOpts<"SnippetLineLimit">,
"DiagnosticOptions::DefaultSnippetLineLimit">;
def verify_EQ : CommaJoined<["-"], "verify=">,
MetaVarName<"<prefixes>">,
HelpText<"Verify diagnostic output using comment directives that start with"
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -230,9 +230,11 @@
------------------
- The flag ``-std=c++23`` has been added. This behaves the same as the existing
flag ``-std=c++2b``.
-
- ``-dumpdir`` has been implemented to specify auxiliary and dump output
filenames for features like ``-gsplit-dwarf``.
+- ``-fcaret-diagnostics-max-lines=`` has been added as a driver options, which
+ lets users control the maximum number of source lines printed for a
+ caret diagnostic.
Deprecated Compiler Flags
-------------------------
Index: clang/test/Sema/caret-diags-complex-init.cpp
===================================================================
--- clang/test/Sema/caret-diags-complex-init.cpp
+++ clang/test/Sema/caret-diags-complex-init.cpp
@@ -1,4 +1,4 @@
-// RUN: not %clang_cc1 -std=c++11 -fsyntax-only -fno-diagnostics-show-line-numbers -fcaret-diagnostics-max-lines 5 %s 2>&1 | FileCheck %s -strict-whitespace
+// RUN: not %clang_cc1 -std=c++11 -fsyntax-only -fno-diagnostics-show-line-numbers -fcaret-diagnostics-max-lines=5 %s 2>&1 | FileCheck %s -strict-whitespace
//CHECK: {{.*}}: error: excess elements in scalar initializer
Index: clang/test/Misc/caret-diags-multiline.cpp
===================================================================
--- clang/test/Misc/caret-diags-multiline.cpp
+++ clang/test/Misc/caret-diags-multiline.cpp
@@ -1,4 +1,4 @@
-// RUN: not %clang_cc1 -std=c++11 -fno-diagnostics-show-line-numbers -fcaret-diagnostics-max-lines 5 -Wsometimes-uninitialized %s 2>&1 | FileCheck %s --strict-whitespace
+// RUN: not %clang_cc1 -std=c++11 -fno-diagnostics-show-line-numbers -fcaret-diagnostics-max-lines=5 -Wsometimes-uninitialized %s 2>&1 | FileCheck %s --strict-whitespace
void line(int);
Index: clang/test/FixIt/fixit-function-call.cpp
===================================================================
--- clang/test/FixIt/fixit-function-call.cpp
+++ clang/test/FixIt/fixit-function-call.cpp
@@ -1,4 +1,4 @@
-// RUN: not %clang_cc1 -fdiagnostics-parseable-fixits -fno-diagnostics-show-line-numbers -fcaret-diagnostics-max-lines 1 -x c++ %s 2> %t
+// RUN: not %clang_cc1 -fdiagnostics-parseable-fixits -fno-diagnostics-show-line-numbers -fcaret-diagnostics-max-lines=1 -x c++ %s 2> %t
// RUN: FileCheck %s < %t
// PR5941
// END.
Index: clang/test/Driver/caret-diagnostics-max-lines.cpp
===================================================================
--- /dev/null
+++ clang/test/Driver/caret-diagnostics-max-lines.cpp
@@ -0,0 +1,3 @@
+//RUN: %clang++ -### -fcaret-diagnostics-max-lines=2 %s 2>&1 | FileCheck %s
+
+// CHECK: "-fcaret-diagnostics-max-lines=2"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -6062,6 +6062,7 @@
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);
+ Args.AddLastArg(CmdArgs, options::OPT_fcaret_diagnostics_max_lines_EQ);
// Pass -fmessage-length=.
unsigned MessageLength = 0;
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -2312,6 +2312,11 @@
Group<f_Group>, Flags<[NoXarchOption, CC1Option, CoreOption]>,
HelpText<"Set the maximum number of entries to print in a macro expansion backtrace (0 = no limit)">,
MarshallingInfoInt<DiagnosticOpts<"MacroBacktraceLimit">, "DiagnosticOptions::DefaultMacroBacktraceLimit">;
+def fcaret_diagnostics_max_lines_EQ :
+ Joined<["-"], "fcaret-diagnostics-max-lines=">,
+ Group<f_Group>, Flags<[CC1Option, CoreOption]>,
+ HelpText<"Set the maximum number of source lines to show in a caret diagnostic (0 = no limit).">,
+ MarshallingInfoInt<DiagnosticOpts<"SnippetLineLimit">, "DiagnosticOptions::DefaultSnippetLineLimit">;
defm merge_all_constants : BoolFOption<"merge-all-constants",
CodeGenOpts<"MergeAllConstants">, DefaultFalse,
PosFlag<SetTrue, [CC1Option, CoreOption], "Allow">, NegFlag<SetFalse, [], "Disallow">,
@@ -6003,10 +6008,6 @@
def ferror_limit : Separate<["-"], "ferror-limit">, MetaVarName<"<N>">,
HelpText<"Set the maximum number of errors to emit before stopping (0 = no limit).">,
MarshallingInfoInt<DiagnosticOpts<"ErrorLimit">>;
-def fcaret_diagnostics_max_lines :
- Separate<["-"], "fcaret-diagnostics-max-lines">, MetaVarName<"<N>">,
- HelpText<"Set the maximum number of source lines to show in a caret diagnostic">,
- MarshallingInfoInt<DiagnosticOpts<"SnippetLineLimit">, "DiagnosticOptions::DefaultSnippetLineLimit">;
def verify_EQ : CommaJoined<["-"], "verify=">,
MetaVarName<"<prefixes>">,
HelpText<"Verify diagnostic output using comment directives that start with"
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -230,9 +230,11 @@
------------------
- The flag ``-std=c++23`` has been added. This behaves the same as the existing
flag ``-std=c++2b``.
-
- ``-dumpdir`` has been implemented to specify auxiliary and dump output
filenames for features like ``-gsplit-dwarf``.
+- ``-fcaret-diagnostics-max-lines=`` has been added as a driver options, which
+ lets users control the maximum number of source lines printed for a
+ caret diagnostic.
Deprecated Compiler Flags
-------------------------
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits