This is an archive of the discontinued LLVM Phabricator instance.

Refactored NumericLiteralParser to not require a Preprocessor
ClosedPublic

Authored by gribozavr on Jul 9 2020, 6:01 AM.

Details

Summary

We would like to use NumericLiteralParser in the implementation of the
syntax tree builder, and plumbing a preprocessor there seems
inconvenient and superfluous.

Diff Detail

Event Timeline

gribozavr created this revision.Jul 9 2020, 6:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2020, 6:01 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
eduucaldas accepted this revision.Jul 9 2020, 7:38 AM

Additionally, consider applying a similar change to CharLiteralParser, for consistency.

All the comments are just suggestions. Feel free to land this without answering them.

clang/include/clang/Lex/LiteralSupport.h
57–59

We don't need to remove this constructor, we can keep the same signature and make it call the new constructor. The same is done for StringLiteralParser.

That would allow some callers that don't care much about the implementation details to just use the simpler to write version.

clang/lib/Lex/LiteralSupport.cpp
770

How about just using Lexer::AdvanceToTokenCharacter?

This revision is now accepted and ready to land.Jul 9 2020, 7:38 AM
gribozavr updated this revision to Diff 276740.Jul 9 2020, 8:04 AM

Addressed code review comments.

gribozavr2 added inline comments.
clang/include/clang/Lex/LiteralSupport.h
57–59

I'd prefer a simpler public API over convenience.

clang/lib/Lex/LiteralSupport.cpp
770

Done.

This revision was automatically updated to reflect the committed changes.