[PATCH] D124748: [clang-format] Fix whitespace counting stuff

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 1 23:35:35 PDT 2022


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/FormatTokenLexer.cpp:839
 
+void FormatTokenLexer::resizeToken(size_t NewLen) {
+  resetLexer(SourceMgr.getFileOffset(Lex->getSourceLocation(
----------------
Can you add some documentation?


================
Comment at: clang/lib/Format/FormatTokenLexer.cpp:868
+      break;
+      // A '\' followed by a newline always escapes the newline, regardless
+      // of whether there is another '\' before it.
----------------
I'd put (and search while reading) the comment after the case.


================
Comment at: clang/lib/Format/FormatTokenLexer.cpp:871-872
+    case '\\':
+      // The source has a null byte at the end. It is not necessary to
+      // check Cur + 1 < Text.end().
+      if (Cur[1] == '\n' || Cur[1] == '\r')
----------------
Please verify your assumption with an assert.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124748/new/

https://reviews.llvm.org/D124748



More information about the cfe-commits mailing list