This patch adds a regular expression to configure suffixes of an included file to check whether it is the "main" include of the current file. Previously, clang-format has allowed arbitrary suffixes on the formatted file, which is still the case when no IncludeMainRegex is specified.
Details
Diff Detail
Event Timeline
include/clang/Format/Format.h | ||
---|---|---|
415 | I chose this name for better alphabetical ordering. I don't strongly lean either way, WDYT? | |
lib/Format/Format.cpp | ||
1967 | I believe this is more efficient. In many cases, no Regex will need to be formed at all and the cases where it is formed more than once are rare (many includes starting with HeaderStem, but not matching the regex). |
Submitted as r263943.
include/clang/Format/Format.h | ||
---|---|---|
415 | Renamed to IncludeIsMainRegex, which seems to be better than either of the other. |
I'd probably call it MainIncludeRegex.