klimek 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;
+
----------------
djasper wrote:
> I chose this name for better alphabetical ordering. I don't strongly lean
> either way, WDYT?
I'd still lean slightly towards MainIncludeRegex... but feel free to keep.
================
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());
----------------
djasper wrote:
> 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).
Ok, makes sense.
http://reviews.llvm.org/D18313
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits