[PATCH] When in pre-c++11 mode, treat _T("xxx") as a single string literal, repeat the _T() part around each fragment. This addresses http://llvm.org/PR17122

Daniel Jasper djasper at google.com
Mon Sep 16 06:09:16 PDT 2013



================
Comment at: lib/Format/ContinuationIndenter.cpp:679
@@ +678,3 @@
+    if ((Text.startswith(Prefix = "_T(\"") && Text.endswith(Postfix = "\")")) ||
+        (Text.endswith(Postfix = "\"") && (Text.startswith(Prefix = "\"") ||
+                                          Text.startswith(Prefix = "u\"") ||
----------------
Alexander Kornienko wrote:
> Daniel Jasper wrote:
> > Alexander Kornienko wrote:
> > > Daniel Jasper wrote:
> > > > Who came up with this format?
> > > > 
> > > > Also these seem like a lot of string comparisons (albeit short strings). Would it make sense to precalculate this to get it out of the critical path?
> > > Clang-format produced this format before I added parens around the second operand of ||.
> > > 
> > > Fixed.
> > Any thoughts to the second part of this comment?
> Sorry, missed this part.
> 
> We could store Prefix and Suffix (or PrefixLength and SuffixLength to reduce the overhead) for each FormatToken, which is a string. I'll prepare the patch for this.
This would also be fine as a follow-up, but then leave a FIXME here.


http://llvm-reviews.chandlerc.com/D1640

BRANCH
  svn

ARCANIST PROJECT
  clang



More information about the cfe-commits mailing list