================
@@ -0,0 +1,25 @@
+// REQUIRES: host-supports-jit
+// RUN: cat %s | clang-repl 2>&1 | FileCheck %s
+//
+// This test demonstrates that stale entries in CodeGen keep foo and infn
+// reachable after %undo. It motivates removing stale entries from
+// CodeGenModule::DeferredDecls and CodeGenModule::Manglings via
+// CodeGenModule::forgetDecl (PR #234493).
+
+extern "C" int printf(const char *, ...);
+
+static int foo(int x);
+static int foo(int x) { return x + 1; }
+%undo
+auto sfr = printf("foo=%d\n", foo(10));
+// CHECK-NOT: foo=11
+// CHECK: JIT session error: Symbols not found
----------------
SahilPatidar wrote:
With `main`, I see that `b=11`:
```cpp
clang-repl> auto b = printf("b=%d\n", foo(10));
In file included from <<< inputs >>>:1:
input_line_2:1:12: warning: function 'foo' has internal linkage but is not
defined [-Wundefined-internal]
1 | static int foo(int x);
| ^
input_line_4:1:27: note: used here
1 | auto b = printf("b=%d\n", foo(10));
| ^
b=11
clang-repl>
```
This PR [#223305](https://github.com/llvm/llvm-project/pull/223305) requires
this changes (forgetDecl). To keep the changes in a separate PR, we’re doing
this.
https://github.com/llvm/llvm-project/pull/234493
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits