This is an archive of the discontinued LLVM Phabricator instance.

Searching for tokens including comments
AcceptedPublic

Authored by barcisz on Sep 12 2022, 1:45 PM.

Details

Summary

This is a small diff that adds an optional argument to the Lexer::findNextToken that allows for searching for the token while including comments (instead of having to
instantiate the lexer separately). This is a prerequisite to D133942, used to insert a statement after another statement while preserving the comments that are on the same line, which is itself a prerequisite to D133956, a new CUDA clang-tidy check

Diff Detail

Event Timeline

barcisz created this revision.Sep 12 2022, 1:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2022, 1:45 PM
barcisz requested review of this revision.Sep 12 2022, 1:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2022, 1:45 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Can you help me understand the expected use for these change?

clang/lib/Lex/Lexer.cpp
1278

Drive-by change? (We don't typically use top-level const except for occasional structure members.)

barcisz edited the summary of this revision. (Show Details)Sep 15 2022, 1:15 PM
barcisz edited the summary of this revision. (Show Details)Sep 15 2022, 3:00 PM

Can you help me understand the expected use for these change?

Changed the description to answer your question - it's a prerequisite to D133942 and D133956

aaron.ballman accepted this revision.Sep 16 2022, 8:15 AM

Ah, thank you for the extra description, that helped a lot. The changes LGTM, though you should hold off on landing them until we're sure the clang-tidy changes are going in.

This revision is now accepted and ready to land.Sep 16 2022, 8:15 AM