[PATCH] D129050: [clang-format] Update documentation

2023-09-07 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments.



Comment at: clang/docs/ClangFormat.rst:20
 
-  $ clang-format -help
+  $ clang-format --help
   OVERVIEW: A tool to format 
C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.

owenpan wrote:
> This should be edited in `dump_format_help.py` instead.
Fixed in c47c480b1845.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129050/new/

https://reviews.llvm.org/D129050

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D129050: [clang-format] Update documentation

2023-09-05 Thread Owen Pan via Phabricator via cfe-commits
Herald added a subscriber: wangpc.
Herald added reviewers: rymiel, HazardyKnusperkeks, owenpan.
Herald added a comment.

NOTE: Clang-Format Team Automated Review Comment

It looks like your clang-format review does not contain any unit tests, please 
try to ensure all code changes have a unit test (unless this is an `NFC` or 
refactoring, adding documentation etc..)

Add your unit tests in `clang/unittests/Format` and you can build with `ninja 
FormatTests`.  We recommend using the `verifyFormat(xxx)` format of unit tests 
rather than `EXPECT_EQ` as this will ensure you change is tolerant to random 
whitespace changes (see FormatTest.cpp as an example)

For situations where your change is altering the TokenAnnotator.cpp which can 
happen if you are trying to improve the annotation phase to ensure we are 
correctly identifying the type of a token, please add a token annotator test in 
`TokenAnnotatorTest.cpp`




Comment at: clang/docs/ClangFormat.rst:20
 
-  $ clang-format -help
+  $ clang-format --help
   OVERVIEW: A tool to format 
C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.

This should be edited in `dump_format_help.py` instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129050/new/

https://reviews.llvm.org/D129050

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D129050: [clang-format] Update documentation

2022-07-04 Thread Nico Weber via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1ab37d996ce3: [clang-format] Update documentation (authored 
by thakis).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129050/new/

https://reviews.llvm.org/D129050

Files:
  clang/docs/ClangFormat.rst

Index: clang/docs/ClangFormat.rst
===
--- clang/docs/ClangFormat.rst
+++ clang/docs/ClangFormat.rst
@@ -17,7 +17,7 @@
 
 .. code-block:: console
 
-  $ clang-format -help
+  $ clang-format --help
   OVERVIEW: A tool to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.
 
   If no arguments are specified, it formats the code from standard input
@@ -40,9 +40,11 @@
Use with caution, as this might lead to dramatically
differing format depending on an option being
supported or not.
---assume-filename= - Override filename used to determine the language.
- When reading from stdin, clang-format assumes this
- filename to determine the language.
+--assume-filename= - Set filename used to determine the language and to find
+ .clang-format file.
+ Only used when reading from stdin.
+ If this is not passed, the .clang-format file is searched
+ relative to the current working directory when reading stdin.
  Unrecognized filenames are treated as C++.
  supported:
CSharp: .cs
@@ -62,7 +64,7 @@
 --fallback-style=  - The name of the predefined style used as a
  fallback in case clang-format is invoked with
  -style=file, but can not find the .clang-format
- file to use.
+ file to use. Defaults to 'LLVM'.
  Use -fallback-style=none to skip formatting.
 --ferror-limit=  - Set the maximum number of clang-format errors to emit
  before stopping (0 = no limit).
@@ -92,17 +94,19 @@
  determined by the QualifierAlignment style flag
 --sort-includes- If set, overrides the include sorting behavior
  determined by the SortIncludes style flag
---style=   - Coding style, currently supports:
-   LLVM, GNU, Google, Chromium, Microsoft, Mozilla, WebKit.
- Use -style=file to load style configuration from
- .clang-format file located in one of the parent
- directories of the source file (or current
- directory for stdin).
- Use -style=file: to explicitly specify
- the configuration file.
- Use -style="{key: value, ...}" to set specific
- parameters, e.g.:
-   -style="{BasedOnStyle: llvm, IndentWidth: 8}"
+--style=   - Set coding style.  can be:
+ 1. A preset: LLVM, GNU, Google, Chromium, Microsoft,
+Mozilla, WebKit.
+ 2. 'file' to load style configuration from a
+.clang-format file in one of the parent directories
+of the source file (for stdin, see --assume-filename).
+If no .clang-format file is found, falls back to
+--fallback-style.
+--style=file is the default.
+ 3. 'file:' to explicitly specify
+the configuration file.
+ 4. "{key: value, ...}" to set specific parameters, e.g.:
+--style="{BasedOnStyle: llvm, IndentWidth: 8}"
 --verbose  - If set, shows the list of processed files
 
   Generic Options:
@@ -235,37 +239,41 @@
 
 .. code-block:: console
 
-  usage: clang-format-diff.py [-h] [-i] [-p NUM] [-regex PATTERN] [-style STYLE]
+  usage: clang-format-diff.py [-h] [-i] [-p NUM] [-regex PATTERN] [-iregex PATTERN] [-sort-includes] [-v] [-style STYLE]

[PATCH] D129050: [clang-format] Update documentation

2022-07-03 Thread Nico Weber via Phabricator via cfe-commits
thakis added inline comments.



Comment at: clang/docs/ClangFormat.rst:233
 
 Script for patch reformatting
 =

(As far as I can tell, we don't have `git clang-format` docs anywhere? But 
that's for a different patch.)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129050/new/

https://reviews.llvm.org/D129050

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D129050: [clang-format] Update documentation

2022-07-03 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added reviewers: MyDeveloperDay, curdeius.
Herald added a project: All.
thakis requested review of this revision.

- Update `clang-format --help` output after b1f0efc06acc 
.
- Update `clang-format-diff.py` help text, which apparently hasn't been updated 
in a while. Since git and svn examples are now part of the help text, remove 
them in the text following the help text.


https://reviews.llvm.org/D129050

Files:
  clang/docs/ClangFormat.rst

Index: clang/docs/ClangFormat.rst
===
--- clang/docs/ClangFormat.rst
+++ clang/docs/ClangFormat.rst
@@ -17,7 +17,7 @@
 
 .. code-block:: console
 
-  $ clang-format -help
+  $ clang-format --help
   OVERVIEW: A tool to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.
 
   If no arguments are specified, it formats the code from standard input
@@ -40,9 +40,11 @@
Use with caution, as this might lead to dramatically
differing format depending on an option being
supported or not.
---assume-filename= - Override filename used to determine the language.
- When reading from stdin, clang-format assumes this
- filename to determine the language.
+--assume-filename= - Set filename used to determine the language and to find
+ .clang-format file.
+ Only used when reading from stdin.
+ If this is not passed, the .clang-format file is searched
+ relative to the current working directory when reading stdin.
  Unrecognized filenames are treated as C++.
  supported:
CSharp: .cs
@@ -62,7 +64,7 @@
 --fallback-style=  - The name of the predefined style used as a
  fallback in case clang-format is invoked with
  -style=file, but can not find the .clang-format
- file to use.
+ file to use. Defaults to 'LLVM'.
  Use -fallback-style=none to skip formatting.
 --ferror-limit=  - Set the maximum number of clang-format errors to emit
  before stopping (0 = no limit).
@@ -92,17 +94,19 @@
  determined by the QualifierAlignment style flag
 --sort-includes- If set, overrides the include sorting behavior
  determined by the SortIncludes style flag
---style=   - Coding style, currently supports:
-   LLVM, GNU, Google, Chromium, Microsoft, Mozilla, WebKit.
- Use -style=file to load style configuration from
- .clang-format file located in one of the parent
- directories of the source file (or current
- directory for stdin).
- Use -style=file: to explicitly specify
- the configuration file.
- Use -style="{key: value, ...}" to set specific
- parameters, e.g.:
-   -style="{BasedOnStyle: llvm, IndentWidth: 8}"
+--style=   - Set coding style.  can be:
+ 1. A preset: LLVM, GNU, Google, Chromium, Microsoft,
+Mozilla, WebKit.
+ 2. 'file' to load style configuration from a
+.clang-format file in one of the parent directories
+of the source file (for stdin, see --assume-filename).
+If no .clang-format file is found, falls back to
+--fallback-style.
+--style=file is the default.
+ 3. 'file:' to explicitly specify
+the configuration file.
+ 4. "{key: value, ...}" to set specific parameters, e.g.:
+--style="{BasedOnStyle: llvm, IndentWidth: 8}"
 --verbose  - If set, shows the list of processed files
 
   Generic Options:
@@ -235,37 +239,41 @@
 
 .. code-block:: console
 
-  usage: