[clang][ExprConst] Try to minimize emitting unneeded diagnostics #159528
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are a few places in clang where we pass a list of diagnostic notes to the
evaluate*functions, which so some extra work when that list is passed (e.g. attaching call stacks to the diagnostics). We then sometimes later don't use the notes list at all, or we only use it to check if any notes have been emitted.This patch adds two new flags to
EvalStatusto check if any diagnostics have been emitted (right now one of the would suffice though, I guess), which replaces theNotes.empty()use case.It also changes the signature of
EvaluateAsInitializerto pass anEvalStatusobject instead, so we don't have to pass a notes list but can still examine the resulting flags.