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

Vassil Vassilev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 11 01:46:22 PDT 2023


v.g.vassilev added inline comments.


================
Comment at: clang/test/Interpreter/multiline.cpp:12-17
+void f(int x) \ 
+{                                               \
+  printf("x=\
+          %d", x); \
+}
+f(i);
----------------
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.


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