[PATCH] D116558: [clang-format][NFC] Don't pass member by argument

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 3 14:20:30 PST 2022


HazardyKnusperkeks created this revision.
HazardyKnusperkeks added reviewers: owenpan, MyDeveloperDay, curdeius.
HazardyKnusperkeks added a project: clang-format.
HazardyKnusperkeks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

And then use the argument and member.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116558

Files:
  clang/lib/Format/TokenAnnotator.cpp


Index: clang/lib/Format/TokenAnnotator.cpp
===================================================================
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -75,7 +75,7 @@
       : Style(Style), Line(Line), CurrentToken(Line.First), AutoFound(false),
         Keywords(Keywords) {
     Contexts.push_back(Context(tok::unknown, 1, /*IsExpression=*/false));
-    resetTokenMetadata(CurrentToken);
+    resetTokenMetadata();
   }
 
 private:
@@ -1409,8 +1409,8 @@
            Tok.Next->Next->Next && Tok.Next->Next->Next->is(tok::l_paren);
   }
 
-  void resetTokenMetadata(FormatToken *Token) {
-    if (!Token)
+  void resetTokenMetadata() {
+    if (!CurrentToken)
       return;
 
     // Reset token type in case we have already looked at it and then
@@ -1439,7 +1439,7 @@
       CurrentToken = CurrentToken->Next;
     }
 
-    resetTokenMetadata(CurrentToken);
+    resetTokenMetadata();
   }
 
   /// A struct to hold information valid in a specific context, e.g.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116558.397140.patch
Type: text/x-patch
Size: 1006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220103/7d706fc5/attachment.bin>


More information about the cfe-commits mailing list