[PATCH] D105087: [clang-format] PR49960 clang-format doesn't handle ASI after "return" on JavaScript

Martin Probst via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 1 04:36:34 PDT 2021


mprobst accepted this revision.
mprobst added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1001
+  if (TokenPosition < AllTokens.size()) {
+    FormatToken *PeekNext = AllTokens[TokenPosition];
+    return PeekNext;
----------------
nit: just `return AllTokens[TokenPosition]`?


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1024
+    // Don't go past the end of the file.
+    if (!eof()) {
+      // Look for  return xxx = val; but not return xxx().
----------------
do you still need this, given peeknext protects against running past the doc end?


================
Comment at: clang/lib/Format/UnwrappedLineParser.h:188
 
+  // Peek to the next token
+  FormatToken *peekNextToken() const;
----------------
cam you document what this does to the "current token" pointer?


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

https://reviews.llvm.org/D105087



More information about the cfe-commits mailing list