After r338256, clangd stopped reporting diagnostics if WantDiags::No request
is followed by a WantDiags::Yes request but the AST can be reused.
Details
Diff Detail
- Repository
- rCTE Clang Tools Extra
- Build Status
Buildable 20893 Build 20893: arc lint + arc unit
Event Timeline
Overall LG, just a suggestion to make the code a bit easier to follow.
clangd/TUScheduler.cpp | ||
---|---|---|
378 | The implicit condition here is that we can reuse AST and diagnostics were not reported. I think we can be more explicit here by moving this early return into the CanReuseAST if branch. By doing this, we could also get rid of PrevDiagsWereReported. An additional state variable seems to have made the flow less clear. | |
406–410 | This was preexisting, but it might worth adding a comment explaining when *AST would be false. |
clangd/TUScheduler.cpp | ||
---|---|---|
378 | The problem with that would be that the value of DiagsWereReported would be stale for ~40 lines between the assignment to FileInputs and this point. |
clangd/TUScheduler.cpp | ||
---|---|---|
378 | Update after chatting offline: we agreed to keep the PrevDiagsWereReported and move the early return into the original if branch to make the dependencies between DiagsWereReported and CanReuseAST more explicit. This comment should be done now. |
clangd/TUScheduler.cpp | ||
---|---|---|
381 | I think checking PrevDiagsWereReported here would be more straightforward. |
clangd/TUScheduler.cpp | ||
---|---|---|
381 | Good point. Done. |
The implicit condition here is that we can reuse AST and diagnostics were not reported. I think we can be more explicit here by moving this early return into the CanReuseAST if branch. By doing this, we could also get rid of PrevDiagsWereReported. An additional state variable seems to have made the flow less clear.