llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Jonas Rembser (guitargeek)

<details>
<summary>Changes</summary>

To decide whether an input is a declaration or a statement, the parser 
classifies the input's first names at file scope. For `f();` with an undeclared 
`f`, that leaves an annot_non_type_undeclared token behind. The 
TopLevelStmtDecl that is parsed next has a function scope of its own, but it 
never looks `f` up again.

Clients can resolve names in that scope through an ExternalSemaSource. ROOT 
does that for objects and functions that only exist at runtime, like objects 
read from a file. It resolves them only in statements, not at file scope. With 
a source that knows `dynamic_fn` only in function scopes, such a statement 
failed:
```
  Interp-&gt;Parse("dynamic_fn();");
  input_line_1:1:1: error: use of undeclared identifier 'dynamic_fn'
```

Turn the annotation back into the identifier, so that the statement looks the 
name up in its own scope.

Assisted-by: Claude Opus 5.5

This is another PR that addresses a problem when using Clang-Repl instead of 
Cling in ROOT.

---
Full diff: https://github.com/llvm/llvm-project/pull/240108.diff


2 Files Affected:

- (modified) clang/lib/Parse/Parser.cpp (+12-1) 
- (modified) clang/unittests/Interpreter/InterpreterTest.cpp (+38) 


``````````diff
<html><body><h1>504 Gateway Time-out</h1>
The server didn't respond in time.
</body></html>

``````````

</details>


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

Reply via email to