[cfe-dev] [AST Matchers] has matcher bug?
Manuel Klimek via cfe-dev
cfe-dev at lists.llvm.org
Tue May 17 03:22:20 PDT 2016
The problem is that in C++ you often have implicit conversions that are
completely irrelevant.
has() ignoring implicit conversions is more closely resembling what's
written in the code.
Both options:
1. adding a new function hasDirect
2. changing has() to not go through implicit conversions, and refactoring
all uses of has() to has(ignoringParenImpCasts())
... seem fine to me, with different trade-offs.
Thoughts?
/Manuel
On Sun, May 15, 2016 at 3:06 PM Piotr Padlewski <piotr.padlewski at gmail.com>
wrote:
> Thanks for response Alexey.
> Is there any reason why it do so? This is very unintuitive and it also
> makes it harder and uglier to use matchers - instead of saying
> something(has(something2())) I have to say
> something2(hasParent(something())).
>
> Piotr
>
> 2016-05-15 13:38 GMT+02:00 Alexey Sidorin <alexey.v.sidorin at ya.ru>:
>
>> Hello Piotr,
>>
>> has() matcher ignores implicit casts and parens. That's not a bug
>> (however, it will be good to point it in doxygen).
>>
>>
>> 13.05.2016 15:27, Piotr Padlewski via cfe-dev пишет:
>>
>> I am have a problem with has matcher. It doesn't work for cases like
>> implicitCastExpr(has(implicitCastExpr()))
>> or
>>
>> cxxMemberCallExpr(has(materializeTemporaryExpr())))
>>
>> or
>>
>> returnStmt(has(implicitCastExpr()))
>>
>> Here is a bug in bugzilla
>>
>> https://llvm.org/bugs/show_bug.cgi?id=27713
>>
>> Am I doing something wrong or it is a bug? This thing blocks me on 2 clang-tidy checks that I am working on.
>>
>> Thanks
>>
>> Piotr
>>
>>
>>
>> _______________________________________________
>> cfe-dev mailing listcfe-dev at lists.llvm.orghttp://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160517/d3cbf386/attachment.html>
More information about the cfe-dev
mailing list