[clang] 2c94f75 - [clang-format] update --files help description

Yuanfang Chen via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 11 10:25:23 PDT 2022


Author: Yuanfang Chen
Date: 2022-10-11T10:25:04-07:00
New Revision: 2c94f75f00af16b6b4c2336e5cbfd8187d8bf33c

URL: https://github.com/llvm/llvm-project/commit/2c94f75f00af16b6b4c2336e5cbfd8187d8bf33c
DIFF: https://github.com/llvm/llvm-project/commit/2c94f75f00af16b6b4c2336e5cbfd8187d8bf33c.diff

LOG: [clang-format] update --files help description

correlates the option with reponse file concept.

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D135115

Added: 
    

Modified: 
    clang/docs/ClangFormat.rst
    clang/tools/clang-format/ClangFormat.cpp

Removed: 
    


################################################################################
diff  --git a/clang/docs/ClangFormat.rst b/clang/docs/ClangFormat.rst
index ec5489785804a..2ad3b50339eba 100644
--- a/clang/docs/ClangFormat.rst
+++ b/clang/docs/ClangFormat.rst
@@ -26,7 +26,7 @@ to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.
   together with <file>s, the files are edited in-place. Otherwise, the
   result is written to the standard output.
 
-  USAGE: clang-format [options] [<file> ...]
+  USAGE: clang-format [options] [@<file>] [<file> ...]
 
   OPTIONS:
 
@@ -69,7 +69,8 @@ to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.
     --ferror-limit=<uint>          - Set the maximum number of clang-format errors to emit
                                      before stopping (0 = no limit).
                                      Used only with --dry-run or -n
-    --files=<string>               - Provide a list of files to run clang-format
+    --files=<filename>             - A file containing a list of files to process, one
+                                     per line.
     -i                             - Inplace edit <file>s, if specified.
     --length=<uint>                - Format a range of this length (in bytes).
                                      Multiple ranges can be formatted by specifying

diff  --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp
index 269bc59506b2d..9e8b881c8fafe 100644
--- a/clang/tools/clang-format/ClangFormat.cpp
+++ b/clang/tools/clang-format/ClangFormat.cpp
@@ -125,9 +125,11 @@ static cl::opt<std::string> QualifierAlignment(
              "determined by the QualifierAlignment style flag"),
     cl::init(""), cl::cat(ClangFormatCategory));
 
-static cl::opt<std::string>
-    Files("files", cl::desc("Provide a list of files to run clang-format"),
-          cl::init(""), cl::cat(ClangFormatCategory));
+static cl::opt<std::string> Files(
+    "files",
+    cl::desc("A file containing a list of files to process, one per line."),
+    cl::value_desc("filename"),
+    cl::init(""), cl::cat(ClangFormatCategory));
 
 static cl::opt<bool>
     Verbose("verbose", cl::desc("If set, shows the list of processed files"),


        


More information about the cfe-commits mailing list