llvm / llvm/llvm-project

[clang] Clang should have an option/mode to better recover from fatal parser errors

Open
#200,090 3 comments 1 reaction 0 assignees View on GitHub
clang clangd
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Motivated by https://github.com/clangd/clangd/issues/2229 and https://github.com/clangd/clangd/issues/1953

Basically, one example is when Clang encounters missing include it stops properly parsing after that. For regular Clang this results in missing errors that'd be still useful for the developer, e.g.: https://godbolt.org/z/Tj6foq8da

For clangd it results in bogus/hard to understand errors like in the first issue or worse.
In reality, many such "fatal errors" should be easy to recover (i.e. report missing include and treat as if there was none or it was empty).

I'm sure there are other examples but this is the most prominent one (coupled with the fact that `--include` option exist and can sneak in even if it's not required for correct compilation).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.