aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/include/clang/Tooling/Inclusions/IncludeStyle.h')
-rw-r--r--contrib/llvm-project/clang/include/clang/Tooling/Inclusions/IncludeStyle.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/contrib/llvm-project/clang/include/clang/Tooling/Inclusions/IncludeStyle.h b/contrib/llvm-project/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
index 266763a5b1bd..2648297724e1 100644
--- a/contrib/llvm-project/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
+++ b/contrib/llvm-project/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
@@ -84,18 +84,27 @@ struct IncludeStyle {
/// (https://llvm.org/docs/CodingStandards.html#include-style). However, you
/// can also assign negative priorities if you have certain headers that
/// always need to be first.
+ ///
+ /// There is a third and optional field ``SortPriority`` which can used while
+ /// ``IncludeBloks = IBS_Regroup`` to define the priority in which ``#includes``
+ /// should be ordered, and value of ``Priority`` defines the order of
+ /// ``#include blocks`` and also enables to group ``#includes`` of different
+ /// priority for order.``SortPriority`` is set to the value of ``Priority``
+ /// as default if it is not assigned.
///
/// To configure this in the .clang-format file, use:
/// \code{.yaml}
/// IncludeCategories:
/// - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
/// Priority: 2
+ /// SortPriority: 2
/// - Regex: '^(<|"(gtest|gmock|isl|json)/)'
/// Priority: 3
/// - Regex: '<[[:alnum:].]+>'
/// Priority: 4
/// - Regex: '.*'
/// Priority: 1
+ /// SortPriority: 0
/// \endcode
std::vector<IncludeCategory> IncludeCategories;
@@ -111,6 +120,26 @@ struct IncludeStyle {
/// 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.
std::string IncludeIsMainRegex;
+
+ /// 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.
+ std::string IncludeIsMainSourceRegex;
};
} // namespace tooling