[PATCH] D17385: clang-format: [JS] re-quote single or double quoted strings.
Daniel Jasper via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 1 21:03:19 PST 2016
djasper added inline comments.
Comment at: lib/Format/Format.cpp:1131
@@ +1130,3 @@
+ // and adjust ColumnWidth to take the added escapes into account.
+ FormatTok->ColumnWidth = ColumnWidth;
Maybe add a FIXME saying that we also need to modify the TokenText if we want to be able to correctly split a long string literal.
Comment at: lib/Format/Format.cpp:1134
@@ +1133,3 @@
+ SourceRange Range(FormatTok->Tok.getLocation(), FormatTok->Tok.getEndLoc());
+ SourceMgr, CharSourceRange::getCharRange(Range), Out.str()));
Thinking about this some more, I think it would be better to have replacements just changing each of the replaced quotes. Otherwise, this can get really tricky once we want to start to automatically split up long string literals. Should not make a difference performance-wise.
More information about the cfe-commits