[PATCH] D147073: [Coverage] Handle invalid end location of an expression/statement.
Hans Wennborg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 4 01:00:36 PDT 2023
hans added a comment.
In D147073#4240793 <https://reviews.llvm.org/D147073#4240793>, @zequanwu wrote:
> In D147073#4240017 <https://reviews.llvm.org/D147073#4240017>, @hans wrote:
>
>> I'm not familiar with this code. I suppose the question is whether it's reasonable for this code to expect that the source locations are always valid or not?
>
> Yes.
>
> For `0 ? T<C>{} : T<C>{};`, the both branches have valid start location but invalid end location. See comments at https://github.com/llvm/llvm-project/issues/45481#issuecomment-1487267814.
>
> For the `std::strong_ordering`, I found that `DeclRefExpr` in the ConditionalOperator's true branch has invalid start and end locations. It might because it's inside a `PseudoObjectExpr`. Maybe we should simply just skip visiting `PseudoObjectExpr`, I see that its begin and end location are the same. I'm not familiar with that expression, so, I just handled it by adding checks for validating begin and end locations.
Right, I'm just wondering if it's reasonable that this code should have to handle such situations. (It seems it can't handle it perfectly anyway, since the coverage won't be completely correct.) Maybe Aaron can comment on what the expectations are for these locations.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147073/new/
https://reviews.llvm.org/D147073
More information about the cfe-commits
mailing list