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
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 3db1603..1139116 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -292,6 +292,24 @@
- 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
--------