-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"In file included from" diagnostic prelude omitted incorrectly if preceding note from the same file #62001
Comments
@AaronBallman do you have a feeling for why the diagnostic is failing in this way? |
I believe this behavior is on purpose to reduce the amount of diagnostic noise -- we silence include stacks from notes by default, but we have
|
Thanks, I wasn't aware of that option. In this case though, I want the include stack for the line
My understanding is that include stacks for errors were only supposed to be suppressed if the prior error was from the same file, but in this case we're suppressing when the prior note was from the same file. (It might still make sense to do that with |
Oh, thank you for the clarification, you're right, the preface is missing from the second error still (my eyes glossed over that). I stepped through in a debugger and we're hitting this early return: https://github.com/llvm/llvm-project/blob/main/clang/lib/Frontend/DiagnosticRenderer.cpp#L171 -- we're storing the last location from the note and comparing that against the location for the subsequent error. |
a.cpp
:b.h
:c.h
:Run the following:
Note that the
./b.h:2:42: error:
line is missing theIn file included from
prelude indicating the source of the include. This seems to occur when the previously generated note was from the same file the error is being generated from; if I change theb1(0)
line tob3()
instead, so that the first error doesn't have a note fromb.h
, then the second error does get the expected prelude.I discovered this while debugging a script to parse Clang error output. I imagine that SARIF output will be a better option for that sort of work once it's stabilized, but it doesn't currently seem to include the "In file included from" information, which is useful for my purposes.
The text was updated successfully, but these errors were encountered: