This is an archive of the discontinued LLVM Phabricator instance.

[clang-repl] Add basic multiline input support
Needs ReviewPublic

Authored by sunho on Feb 2 2023, 12:47 AM.

Details

Reviewers
v.g.vassilev
Summary

Add basic multi-line input support to clang-repl by using newly available SourceFileGrower interface of Preprocessor.

Compared to cling, this change uses fully fledged clang preprocessor (not MetaLexer) so it supports very complicated macro expressions.

Diff Detail

Event Timeline

sunho created this revision.Feb 2 2023, 12:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2023, 12:47 AM
sunho retitled this revision from Add multiline support in clang-repl to [clang-repl] Add basic multiline support.Feb 2 2023, 12:50 AM
sunho edited the summary of this revision. (Show Details)
sunho updated this revision to Diff 494983.Feb 5 2023, 7:32 PM
This comment was removed by sunho.
sunho updated this revision to Diff 494985.Feb 5 2023, 7:34 PM
This comment was removed by sunho.
sunho retitled this revision from [clang-repl] Add basic multiline support to [clang-repl] Add basic multiline input support.Feb 6 2023, 3:04 AM
sunho edited the summary of this revision. (Show Details)
sunho published this revision for review.Feb 6 2023, 3:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 6 2023, 3:07 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
v.g.vassilev added inline comments.Feb 15 2023, 12:02 AM
clang/lib/Interpreter/IncrementalParser.cpp
260

I think we can simplify the heuristics here by asking if the end source location of the last created declaration is the same as the parser/lexer current token that is observed before EOF. If that's the case, then we are done. If not we can request more input.