SahilPatidar wrote:

Our new error-recovery PR tests are failing, and they depend on this. Because 
the current Clang-Repl recovery doesn’t handle instantiation-related cases, so 
this is the only test I have so far.

In the existing recovery, without forgetDecl usage, foo is still reachable.
```cpp
clang-repl> extern "C" int printf(const char *, ...);
clang-repl> static int foo(int x);
clang-repl> static int foo(int x) { return x + 1; }
clang-repl> %undo
clang-repl> auto b = printf("b=%d\n", foo10));
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> %quit
```
With forgetDecl usage:
```cpp
clang-repl> extern "C" int printf(const char *, ...);
clang-repl> static int sf(int x);
clang-repl> static int sf(int x) { return x + 1; }
clang-repl> %undo
clang-repl> auto b = printf("b=%d\n", sf(10));
In file included from <<< inputs >>>:1:
input_line_2:1:12: warning: function 'sf' has internal linkage but is not 
defined [-Wundefined-internal]
    1 | static int sf(int x);
      |            ^
input_line_4:1:27: note: used here
    1 | auto b = printf("b=%d\n", sf(10));
      |                           ^
JIT session error: Symbols not found: [ __ZL2sfi ]
error: Failed to materialize symbols: { (main, { 
____orc_init_func.incr_module_4, $.incr_module_4.__inits.0, _b }) }
clang-repl> 
```

https://github.com/llvm/llvm-project/pull/234493
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to