This patch adds a new field called EmittedDeferredDecls in CodeGenModule
that keeps track of decls that were deferred and have been emitted.
The intention of this patch is to solve issues in the incremental c++,
we'll lose info of decls that are lazily emitted when we undo their
usage.
See example below:
clang-repl> inline int foo() { return 42;}
clang-repl> int bar = foo();
clang-repl> %undo
clang-repl> int baz = foo();
JIT session error: Symbols not found: [ _Z3foov ]
error: Failed to materialize symbols: { (main, { baz, $.incr_module_2.inits.0,
orc_init_func.incr_module_2 }) }
Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D128782
29 lines
695 B
C++
29 lines
695 B
C++
// RUN: clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);' \
|
|
// RUN: 'auto r1 = printf("i = %d\n", i);' | FileCheck --check-prefix=CHECK-DRIVER %s
|
|
// REQUIRES: host-supports-jit
|
|
// UNSUPPORTED: system-aix
|
|
// CHECK-DRIVER: i = 10
|
|
// RUN: cat %s | clang-repl | FileCheck %s
|
|
extern "C" int printf(const char *, ...);
|
|
int x1 = 0;
|
|
int x2 = 42;
|
|
%undo
|
|
int x2 = 24;
|
|
auto r1 = printf("x1 = %d\n", x1);
|
|
// CHECK: x1 = 0
|
|
auto r2 = printf("x2 = %d\n", x2);
|
|
// CHECK-NEXT: x2 = 24
|
|
|
|
int foo() { return 1; }
|
|
%undo
|
|
int foo() { return 2; }
|
|
auto r3 = printf("foo() = %d\n", foo());
|
|
// CHECK-NEXT: foo() = 2
|
|
|
|
inline int bar() { return 42;}
|
|
auto r4 = bar();
|
|
%undo
|
|
auto r5 = bar();
|
|
|
|
%quit
|