[PATCH] D83091: [FileCheck] Improve -dump-input documentation
Joel E. Denny via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 14:36:17 PDT 2020
jdenny created this revision.
jdenny added reviewers: probinson, thopre, jhenderson, mehdi_amini.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
jdenny added a child revision: D82203: [FileCheck] Implement -dump-input-context.
Document the default of `fail` in `-help`. Extend `-dump-input=help`
to help users find related command-line options, but let `-help`
provide their full documentation.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D83091
Files:
llvm/test/FileCheck/dump-input-enable.txt
llvm/utils/FileCheck/FileCheck.cpp
Index: llvm/utils/FileCheck/FileCheck.cpp
===================================================================
--- llvm/utils/FileCheck/FileCheck.cpp
+++ llvm/utils/FileCheck/FileCheck.cpp
@@ -121,10 +121,9 @@
cl::desc("Dump input to stderr, adding annotations representing\n"
"currently enabled diagnostics. When there are multiple\n"
"occurrences of this option, the <value> that appears earliest\n"
- "in the list below has precedence.\n"),
+ "in the list below has precedence. The default is 'fail'.\n"),
cl::value_desc("mode"),
- cl::values(clEnumValN(DumpInputHelp, "help",
- "Explain dump format and quit"),
+ cl::values(clEnumValN(DumpInputHelp, "help", "Explain input dump and quit"),
clEnumValN(DumpInputAlways, "always", "Always dump input"),
clEnumValN(DumpInputFail, "fail", "Dump input on failure"),
clEnumValN(DumpInputNever, "never", "Never dump input")));
@@ -180,8 +179,15 @@
static void DumpInputAnnotationHelp(raw_ostream &OS) {
OS << "The following description was requested by -dump-input=help to\n"
- << "explain the input annotations printed by -dump-input=always and\n"
- << "-dump-input=fail:\n\n";
+ << "explain the input dump printed by FileCheck.\n"
+ << "\n"
+ << "Related command-line options:\n"
+ << " - -dump-input=<value> enables or disables the input dump\n"
+ << " - -v and -vv add more annotations\n"
+ << " - -color forces colors to be enabled both in the dump and below\n"
+ << " - -help documents the above options in more detail\n"
+ << "\n"
+ << "Input dump annotation format:\n";
// Labels for input lines.
OS << " - ";
@@ -233,8 +239,7 @@
WithColor(OS, raw_ostream::CYAN, true, false) << "discarded match";
OS << ", ";
WithColor(OS, raw_ostream::CYAN, true, true) << "unmatched input";
- OS << "\n\n"
- << "If you are not seeing color above or in input dumps, try: -color\n";
+ OS << "\n";
}
/// An annotation for a single input line.
@@ -675,12 +680,10 @@
if (DumpInput == DumpInputAlways ||
(ExitCode == 1 && DumpInput == DumpInputFail)) {
errs() << "\n"
- << "Input file: "
- << InputFilename
- << "\n"
+ << "Input file: " << InputFilename << "\n"
<< "Check file: " << CheckFilename << "\n"
<< "\n"
- << "-dump-input=help describes the format of the following dump.\n"
+ << "-dump-input=help explains the following input dump.\n"
<< "\n";
std::vector<InputAnnotation> Annotations;
unsigned LabelWidth;
Index: llvm/test/FileCheck/dump-input-enable.txt
===================================================================
--- llvm/test/FileCheck/dump-input-enable.txt
+++ llvm/test/FileCheck/dump-input-enable.txt
@@ -224,7 +224,7 @@
; HELP-NOT: {{.}}
; HELP: The following description was requested by -dump-input=help
-; HELP: try{{.*}}-color
+; HELP: - colors {{.*}}
; HELP-NOT: {{.}}
; Trace is sometimes suppressed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83091.275226.patch
Type: text/x-patch
Size: 3119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200702/04095ab0/attachment.bin>
More information about the llvm-commits
mailing list