This is the second part of the below RFC:
https://discourse.llvm.org/t/rfc-handle-execution-results-in-clang-repl/68493
This patch implements a Value class that can be used to carry expression
results in clang-repl. In other words, when we see a top expression
without semi, it will be captured and stored to a Value object. You can
explicitly specify where you want to store the object, like:
Value V; llvm::cantFail(Interp->ParseAndExecute("int x = 42;")); llvm::cantFail(Interp->ParseAndExecute("x", &V));
V now stores some useful infomation about x, you can get its real
value (42), it's clang::QualType or anything interesting.
However, if you don't specify the optional argument, it will be captured
to a local variable, and automatically called Value::dump, which is
not implemented yet in this patch.
Signed-off-by: Jun Zhang <jun@junz.org>
Should we name this repl_input_end to make it clear this is generally expected to only be used for REPL input?