summaryrefslogtreecommitdiffstats
path: root/clang/docs/ClangFormatStyleOptions.rst
diff options
context:
space:
mode:
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