This is an archive of the discontinued LLVM Phabricator instance.

[clang] Expose helper function to turn PP keywords spelling into PPKeywordKind
AbandonedPublic

Authored by kbobyrev on Sep 17 2020, 7:24 AM.

Details

Reviewers
None

Diff Detail

Event Timeline

kbobyrev created this revision.Sep 17 2020, 7:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 17 2020, 7:24 AM
kbobyrev requested review of this revision.Sep 17 2020, 7:24 AM
riccibruno added inline comments.
clang/include/clang/Basic/TokenKinds.h
99

A string is expensive here and unneeded. Why not a StringRef?

clang/lib/Basic/IdentifierTable.cpp
274

Better to use IdentifierInfo::getName() to avoid recomputing the length.

kbobyrev added inline comments.Sep 18 2020, 1:25 AM
clang/include/clang/Basic/TokenKinds.h
99

Yeah, this piece is unfortunate :( llvm::StringRef doesn't really work with the current code. It relies on checking if using \0 at the end of given string which is not always the case for StringRef (and StringRef itself would not be a suitable data structure to access Name[2] given Name.size() == 2 because of the bounds check.

This is a piece I didn't figure out and hence did not send the patch to the review yet.

kbobyrev updated this revision to Diff 294614.Sep 28 2020, 12:17 AM
kbobyrev marked an inline comment as not done.

Update the patch. Still WIP, stash progress.

kbobyrev planned changes to this revision.Nov 2 2020, 12:45 AM

Not needed yet, waiting for myself to start adding some PP-based FoldingRanges to continue.

kbobyrev abandoned this revision.Oct 26 2021, 12:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 26 2021, 12:08 AM