[PATCH] D115014: [clang] RFC: NFC: simplify macro tokens assignment

zhouyizhou via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 2 17:32:06 PST 2021

zhouyizhou created this revision.
zhouyizhou added reviewers: lattner, rnk, MaskRay, simon_tatham.
zhouyizhou requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

I think we could simplify Tokens = &*Macro->tokens_begin() in clang::TokenLexer::Init.
Because the type of Tokens is const class clang::Token *, the return type of  Macro->tokens_begin()  is also class clang::Token *, so I think the &* sequence can be removed
Thanks for you time


Signed-off-by: Zhouyi Zhou <zhouzhouyi at gmail.com>

  rG LLVM Github Monorepo



Index: clang/lib/Lex/TokenLexer.cpp
--- clang/lib/Lex/TokenLexer.cpp
+++ clang/lib/Lex/TokenLexer.cpp
@@ -50,7 +50,7 @@
   AtStartOfLine = Tok.isAtStartOfLine();
   HasLeadingSpace = Tok.hasLeadingSpace();
   NextTokGetsSpace = false;
-  Tokens = &*Macro->tokens_begin();
+  Tokens = Macro->tokens_begin();
   OwnsTokens = false;
   DisableMacroExpansion = false;
   IsReinject = false;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115014.391504.patch
Type: text/x-patch
Size: 455 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211203/8b45507e/attachment.bin>

More information about the cfe-commits mailing list