This is an archive of the discontinued LLVM Phabricator instance.

[NFC][Lexer] Remove getLangOpts function from Lexer
ClosedPublic

Authored by yurai007 on Feb 23 2022, 4:32 AM.

Details

Summary

Given that there is only one external user of Lexer::getLangOpts
we can remove getter entirely without much pain.

Diff Detail

Event Timeline

yurai007 requested review of this revision.Feb 23 2022, 4:32 AM
yurai007 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2022, 4:32 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
yurai007 edited the summary of this revision. (Show Details)Feb 23 2022, 4:33 AM
yurai007 added inline comments.Feb 23 2022, 5:31 AM
clang/lib/Lex/ModuleMap.cpp
1628

That's interesting. ModuleMapParser::Map already has LangOpts member (which is const LangOptions &). If we could prove there are equal to Lexer::LangOpts after: https://reviews.llvm.org/D120334 maybe it would be possible to not introduce Lexer::getSpelling convenience method at all.

serge-sans-paille added inline comments.
clang/include/clang/Lex/Lexer.h
323

nit: *static*

This revision is now accepted and ready to land.Feb 23 2022, 5:38 AM
yurai007 updated this revision to Diff 410802.Feb 23 2022, 6:29 AM
yurai007 marked an inline comment as done.
yurai007 updated this revision to Diff 412120.Mar 1 2022, 8:41 AM

Rebased to https://reviews.llvm.org/D120334 and simplified by removing non-static Lexer::getSpelling function.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2022, 2:18 AM