diff options
Diffstat (limited to 'clang/docs')
| -rw-r--r-- | clang/docs/ClangFormat.rst | 6 | ||||
| -rw-r--r-- | clang/docs/ClangFormatStyleOptions.rst | 20 | ||||
| -rw-r--r-- | clang/docs/ReleaseNotes.rst | 18 |
3 files changed, 41 insertions, 3 deletions
diff --git a/clang/docs/ClangFormat.rst b/clang/docs/ClangFormat.rst index 7fe050ec9e2..1138b233267 100644 --- a/clang/docs/ClangFormat.rst +++ b/clang/docs/ClangFormat.rst @@ -31,9 +31,9 @@ to format C/C++/Java/JavaScript/Objective-C/Protobuf/C# code. Clang-format options: --Werror - If set, changes formatting warnings to errors - --assume-filename=<string> - When reading from stdin, clang-format assumes this - filename to look for a style config file (with - -style=file) and to determine the language. + --assume-filename=<string> - Override filename used to determine the language. + When reading from stdin, clang-format assumes this + filename to determine the language. --cursor=<uint> - The position of the cursor when invoking clang-format from an editor integration --dry-run - If set, do not actually make the formatting changes diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index e0ad9653213..1a9c5b8395f 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -1581,6 +1581,26 @@ the configuration (without a prefix: ``Auto``). For example, if configured to "(_test)?$", then a header a.h would be seen as the "main" include in both a.cc and a_test.cc. +**IncludeIsMainSourceRegex** (``std::string``) + Specify a regular expression for files being formatted + that are allowed to be considered "main" in the + file-to-main-include mapping. + + By default, clang-format considers files as "main" only when they end + with: ``.c``, ``.cc``, ``.cpp``, ``.c++``, ``.cxx``, ``.m`` or ``.mm`` + extensions. + For these files a guessing of "main" include takes place + (to assign category 0, see above). This config option allows for + additional suffixes and extensions for files to be considered as "main". + + For example, if this option is configured to ``(Impl\.hpp)$``, + then a file ``ClassImpl.hpp`` is considered "main" (in addition to + ``Class.c``, ``Class.cc``, ``Class.cpp`` and so on) and "main + include file" logic will be executed (with *IncludeIsMainRegex* setting + also being respected in later phase). Without this option set, + ``ClassImpl.hpp`` would not have the main include file put on top + before any other include. + **IndentCaseLabels** (``bool``) Indent case labels one level from the switch statement. diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 3db1603e063..1139116ed10 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -292,6 +292,24 @@ clang-format - clang-format gets a new option called ``--dry-run`` or ``-n`` to emit a warning. +- Option *IncludeIsMainSourceRegex* added to allow for additional + suffixes and file extensions to be considered as a source file + for execution of logic that looks for "main *include* file" to put + it on top. + + By default, clang-format considers *source* files as "main" only when + they end with: ``.c``, ``.cc``, ``.cpp``, ``.c++``, ``.cxx``, + ``.m`` or ``.mm`` extensions. This config option allows to + extend this set of source files considered as "main". + + For example, if this option is configured to ``(Impl\.hpp)$``, + then a file ``ClassImpl.hpp`` is considered "main" (in addition to + ``Class.c``, ``Class.cc``, ``Class.cpp`` and so on) and "main + include file" logic will be executed (with *IncludeIsMainRegex* setting + also being respected in later phase). Without this option set, + ``ClassImpl.hpp`` would not have the main include file put on top + before any other include. + libclang -------- |

