clang
8.0.0
|
Style for sorting and grouping C++ #include directives. More...
#include "clang/Tooling/Inclusions/IncludeStyle.h"
Classes | |
struct | IncludeCategory |
See documentation of IncludeCategories . More... | |
Public Types | |
enum | IncludeBlocksStyle { IBS_Preserve, IBS_Merge, IBS_Regroup } |
Styles for sorting multiple #include blocks. More... | |
Public Attributes | |
IncludeBlocksStyle | IncludeBlocks |
Dependent on the value, multiple #include blocks can be sorted as one and divided based on category. More... | |
std::vector< IncludeCategory > | IncludeCategories |
Regular expressions denoting the different #include categories used for ordering #includes . More... | |
std::string | IncludeIsMainRegex |
Specify a regular expression of suffixes that are allowed in the file-to-main-include mapping. More... | |
Style for sorting and grouping C++ #include directives.
Definition at line 21 of file IncludeStyle.h.
Styles for sorting multiple #include
blocks.
Definition at line 23 of file IncludeStyle.h.
IncludeBlocksStyle clang::tooling::IncludeStyle::IncludeBlocks |
Dependent on the value, multiple #include
blocks can be sorted as one and divided based on category.
Definition at line 54 of file IncludeStyle.h.
Referenced by clang::format::getLLVMStyle(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), clang::format::FormatStyle::operator==(), and clang::format::sortCppIncludes().
std::vector<IncludeCategory> clang::tooling::IncludeStyle::IncludeCategories |
Regular expressions denoting the different #include
categories used for ordering #includes
.
POSIX extended <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html>
_ regular expressions are supported.
These regular expressions are matched against the filename of an include (including the <> or "") in order. The value belonging to the first matching regular expression is assigned and #includes
are sorted first according to increasing category number and then alphabetically within each category.
If none of the regular expressions match, INT_MAX is assigned as category. The main header for a source file automatically gets category 0. so that it is generally kept at the beginning of the #includes
(http://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.
To configure this in the .clang-format file, use:
Definition at line 99 of file IncludeStyle.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), clang::tooling::HeaderIncludes::HeaderIncludes(), clang::tooling::IncludeCategoryManager::IncludeCategoryManager(), llvm::yaml::MappingTraits< FormatStyle >::mapping(), and clang::format::FormatStyle::operator==().
std::string clang::tooling::IncludeStyle::IncludeIsMainRegex |
Specify a regular expression of suffixes that are allowed in the file-to-main-include mapping.
When guessing whether a #include is the "main" include (to assign category 0, see above), use this regex of allowed suffixes to the header stem. A partial match is done, so that:
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.
Definition at line 112 of file IncludeStyle.h.
Referenced by clang::format::getGoogleStyle(), clang::format::getLLVMStyle(), and llvm::yaml::MappingTraits< FormatStyle >::mapping().