djasper added inline comments. ================ 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 chose this name for better alphabetical ordering. I don't strongly lean either way, WDYT?
================ 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()); ---------------- 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). http://reviews.llvm.org/D18313 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits