Tokens don't currently have a way to track their source-based spelling,
which makes implementing some warnings difficult.
This patch is the basis for two independent warnings, and should be
a non-functional change.
Paths
| Differential D107291
[clang][lexer] adds a way for tokens to track their physical spelling AbandonedPublic Authored by cjdb on Aug 2 2021, 9:54 AM.
Details
Summary Tokens don't currently have a way to track their source-based spelling, This patch is the basis for two independent warnings, and should be
Diff Detail
Event Timelinecjdb added a child revision: D107294: [clang-tidy] adds warning to suggest users replace symbols with words.Aug 2 2021, 10:14 AM Comment Actions A few questions, also for @aaron.ballman Can we have a "isDigraph" flag instead of keeping a pointer for the spelling? Do we maybe want to promote and etc to proper keywords and maybe add functions to check isAndOrAmpAmp ? so that we can in the future make void f(auto and) ill-formed in the committee?
Comment Actions You should always be able to go back to the token's spelling through the SourceManager object. Is there a reason why SourceManager::getCharacterData() is insufficient? I'm a bit worried about adding another pointer to Token because we sometimes store these in containers (like we do for cached tokens), so the overhead might be noticeable (or it might not, I don't know). Comment Actions
I found it very strange that there wasn't already a way for me to do this. Thanks, I've abandoned this patch and will adjust the dependents accordingly. cjdb removed a child revision: D107294: [clang-tidy] adds warning to suggest users replace symbols with words.Aug 3 2021, 12:16 AM
Revision Contents
Diff 363509 clang/include/clang/Lex/Token.h
clang/lib/Lex/Lexer.cpp
|
Did you intend to remove these?