mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-05-13 17:37:00 +00:00

In interactive C++ it is convenient to roll back to a previous state of the compiler. For example: clang-repl> int x = 42; clang-repl> %undo clang-repl> float x = 24 // not an error To support this, the patch extends the functionality used to recover from errors and adds functionality to recover the low-level execution infrastructure. The current implementation is based on watermarks. It exploits the fact that at each incremental input the underlying compiler infrastructure is in a valid state. We can only go N incremental inputs back to a previous valid state. We do not need and do not do any further dependency tracking. This patch was co-developed with V. Vassilev, relies on the past work of Purva Chaudhari in clang-repl and is inspired by the past work on the same feature in the Cling interpreter. Co-authored-by: Purva-Chaudhari <purva.chaudhari02@gmail.com> Co-authored-by: Vassil Vassilev <v.g.vassilev@gmail.com> Signed-off-by: Jun Zhang <jun@junz.org>
19 lines
686 B
C
19 lines
686 B
C
// RUN: cat %s | \
|
|
// RUN: clang-repl -Xcc -fno-color-diagnostics -Xcc -Xclang -Xcc -ast-dump \
|
|
// RUN: -Xcc -Xclang -Xcc -ast-dump-filter -Xcc -Xclang -Xcc Test 2>&1| \
|
|
// RUN: FileCheck %s
|
|
|
|
int TestVar = 12;
|
|
// CHECK: Dumping TestVar:
|
|
// CHECK-NEXT: VarDecl [[var_ptr:0x[0-9a-f]+]] <{{.*}} TestVar 'int' cinit
|
|
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 12
|
|
|
|
void TestFunc() { ++TestVar; }
|
|
// CHECK: Dumping TestFunc:
|
|
// CHECK-NEXT: FunctionDecl {{.*}} TestFunc 'void ()'
|
|
// CHECK-NEXT: CompoundStmt{{.*}}
|
|
// CHECK-NEXT: UnaryOperator{{.*}} 'int' lvalue prefix '++'
|
|
// CHECK-NEXT: DeclRefExpr{{.*}} 'int' lvalue Var [[var_ptr]] 'TestVar' 'int'
|
|
|
|
%quit
|