[PATCH] D150139: [clang-repl] Enable basic multiline support.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 11 11:28:03 PDT 2023


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!



================
Comment at: clang/test/Interpreter/multiline.cpp:12-17
+void f(int x) \ 
+{                                               \
+  printf("x=\
+          %d", x); \
+}
+f(i);
----------------
v.g.vassilev wrote:
> aaron.ballman wrote:
> > Another fun test case:
> > ```
> > // Requires -ftrigraphs but the following line ends with a backslash (surprise!)
> > i=??/
> >   12;
> > ```
> Yes, the implementation of the multiline support here is actually rather rudimentary. It intentionally does not include deeper language understanding but provides a way for the users typing "well-behaved" code to tell clang-repl that more is coming before it could compile it. In theory we could check for the `??/` trigraph and do the same but I don't think that would be used people use clang-repl on things like IBM 3270 terminals which seem not to have some characters and trigraphs could help there ;) 
> 
> Our full-fledged solution is described here https://discourse.llvm.org/t/rfc-flexible-lexer-buffering-for-handling-incomplete-input-in-interactive-c-c/64180/9
> 
> Until that lands we can have this to unblock work on things like OpenMP support.
Okay, that's reasonable enough for the initial commit. Thanks!


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150139/new/

https://reviews.llvm.org/D150139



More information about the cfe-commits mailing list