[PATCH] Better support for multiline string literals (including C++11 raw string literals).

Daniel Jasper djasper at google.com
Thu Aug 29 12:35:54 PDT 2013



================
Comment at: lib/Format/Format.cpp:581
@@ +580,3 @@
+        FormatTok->TokenText.find('\n') != StringRef::npos)
+      FormatTok->IsMultiline = true;
+
----------------
Why not store the position itself? Should take as much space as the boolean (not that I am at all worried about space) and then you don't have to re-search.

Actually, how about storing both, the position of the first and the last "\n". I think during the actual formatting, it is possible that we place the same string literal in hundreds or thousands of different combinations. We should then avoid doing this calculation over and over again.


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

COMMIT
  http://llvm-reviews.chandlerc.com/rL189595



More information about the cfe-commits mailing list