Add name resolution information to trace stream (#2986)

Adds the following information about name resolution to the trace
output:
* Name resolution process
```
** resolving stmt | decl `<stmt | decl>` (<source_location>)
   ...
** finished resolving stmt | decl `<stmt | decl>` (<source_location>)
```
* When a name is added to the static scope
```
--- declared `<name>` as `<entity>` in `<scope>` (<source_location>)
```
* When a name is resolved
```
--- resolved `<name>` as `<result>` in `<scope>` (<source_location>)
```
* Marking a name declared/usable
```
--- marked `<name>` <usable | declared but not usable> in `<scope>`
```
This commit is contained in:
Prabhat Sachdeva
2023-07-21 01:18:18 +00:00
committed by GitHub
parent 880b67b012
commit 418bad939a
8 changed files with 435 additions and 59 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ auto AnalyzeProgram(Nonnull<Arena*> arena, AST ast,
if (trace_stream->is_enabled()) {
*trace_stream << "********** resolving names **********\n";
}
CARBON_RETURN_IF_ERROR(ResolveNames(ast));
CARBON_RETURN_IF_ERROR(ResolveNames(ast, trace_stream));
set_prog_phase.update_phase(ProgramPhase::ControlFlowResolution);
if (trace_stream->is_enabled()) {