[SYCL] Don't diagnose checks in a discarded statement. #3714
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.
For the checks we do in SemaSYCL via the callgraph, we don't want to
diagnose when it is in a discarded statement. This adds the
infrastructure for another bug, where we visit constexpr during this
too.
Note this is a 'draft' since I don't find myself with the time to implement the "rest" of this (tests + all the rest of the constexpr stuff). I believe @elizabethandrews was assigned the constexpr-call bug after @mibintc gave up on it ( :D), so this might be of interest to her!
The change to the CallGraph.cpp (CGBuilder) should be all that is necessary, we simply have to implement the 'visit' functions for every situation we can come up with for constant-evaluation. I believe the ill-planned ConstexprRAII (which likely needs removing once we fix this?) has at least most of the list implemented, so that should be at least a head start.