[PATCH] D42187: [clang-format] Adds a canonical delimiter to raw string formatting

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 04:22:50 PST 2018


krasimir added inline comments.


================
Comment at: lib/Format/ContinuationIndenter.cpp:1336
+  unsigned OldSuffixSize = 2 + OldDelimiter.size();
+  std::string RawText =
+      Current.TokenText.substr(OldPrefixSize).drop_back(OldSuffixSize);
----------------
bkramer wrote:
> Can this be a StringRef? Can RawText outlive the Current token?
Nice catch! The reformatting code creates a virtual source code environment which expects a null-terminated string. Added a comment why this is necessary.


Repository:
  rC Clang

https://reviews.llvm.org/D42187





More information about the cfe-commits mailing list