[PATCH] D18313: clang-format: Make include sorting's main include detection configurable.
Manuel Klimek via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 21 06:30:41 PDT 2016
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.
lg
================
Comment at: include/clang/Format/Format.h:415
@@ +414,3 @@
+ /// as the "main" include in both a.cc and a_test.cc.
+ std::string IncludeMainRegex;
+
----------------
I'd probably call it MainIncludeRegex.
================
Comment at: lib/Format/Format.cpp:1967
@@ -1963,3 +1966,3 @@
if (FileStem.startswith(HeaderStem)) {
- Category = 0;
- MainIncludeFound = true;
+ llvm::Regex MainFileRegex(
+ (Twine(HeaderStem) + Style.IncludeMainRegex).str());
----------------
Try to not set up the Regex in a loop.
================
Comment at: lib/Format/Format.cpp:1968
@@ +1967,3 @@
+ llvm::Regex MainFileRegex(
+ (Twine(HeaderStem) + Style.IncludeMainRegex).str());
+ if (MainFileRegex.match(FileStem)) {
----------------
Twine() shouldn't be needed.
http://reviews.llvm.org/D18313
More information about the cfe-commits
mailing list