summaryrefslogtreecommitdiffstats
path: root/clang/docs/ClangFormatStyleOptions.rst
diff options
context:
space:
mode:
authormydeveloperday <mydeveloperday@gmail.com>2019-11-12 21:15:17 +0000
committerpaulhoad <mydeveloperday@gmail.com>2019-11-12 21:26:52 +0000
commit335ac2eb662ce5f1888e2a50310b01fba2d40d68 (patch)
tree6572fea0e79874c06cd4bdc683b85ad7e9559478 /clang/docs/ClangFormatStyleOptions.rst
parentfbb228c7d222b991bed20d674e3b43143848fb95 (diff)
downloadbcm5719-llvm-335ac2eb662ce5f1888e2a50310b01fba2d40d68.tar.gz
bcm5719-llvm-335ac2eb662ce5f1888e2a50310b01fba2d40d68.zip
Allow additional file suffixes/extensions considered as source in main include grouping
Summary: By additional regex match, grouping of main include can be enabled in files that are not normally considered as a C/C++ source code. For example, this might be useful in templated code, where template implementations are being held in *Impl.hpp files. On the occassion, 'assume-filename' option description was reworded as it was misleading. It has nothing to do with `style=file` option and it does not influence sourced style filename. Reviewers: rsmith, ioeric, krasimir, sylvestre.ledru, MyDeveloperDay Reviewed By: MyDeveloperDay Subscribers: MyDeveloperDay, cfe-commits Patch by: furdyna Tags: #clang Differential Revision: https://reviews.llvm.org/D67750
Diffstat (limited to 'clang/docs/ClangFormatStyleOptions.rst')
-rw-r--r--clang/docs/ClangFormatStyleOptions.rst20
1 files changed, 20 insertions, 0 deletions
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.
OpenPOWER on IntegriCloud