All tests passes. I used git-clang-format to format code, but I am not sure if it is totally legit right now (maybe running clang-format on whole file would change also above lines)
Diff Detail
Event Timeline
Thanks! Did you change all has() to has(ignoringParenImpCasts())? I wonder how many times we could remove the ignoringParenImpCasts without breaking any tests.
Not all - in unit tests I added it only to places where it was required.
To clang-tidy checks I added it everywhere, where inner matcher was expr.
BTW I am not sure if there should be some assertion for ignoringParenImpCast, when inner matcher is stmt. Right now it compiles, but of course
has(stmt()) doesnt match the same things as has(ignoringParenImpCast(stmt())), and it kinda doesn't make sense so I guess it should fail with compiler error.
Not all - in unit tests I added it only to places where it was required.
To clang-tidy checks I added it everywhere, where inner matcher was expr.
BTW I am not sure if there should be some assertion for ignoringParenImpCast, when inner matcher is stmt. Right now it compiles, but of course
has(stmt()) doesnt match the same things as has(ignoringParenImpCast(stmt())), and it kinda doesn't make sense so I guess it should fail with compiler error.
Maybe I don't understand it correctly, but I see in the documentation that ignoringParenImpCasts takes Matcher<Expr> as InnerMatcher, so I don't know what it even accept Matcher<Stmt>
As Expr is a subclass of Stmt (yes, this is somewhat unexpected, and a long story), Matcher<Stmt> is a subclass of Matcher<Expr>; it is a reverse hierarchy.
This should be mentioned in the release notes, since it is a breaking change, lot of out of tree checks might be broken due to this one. And also it might be worth to consider those checks that utilizing the has matcher and did not break after the change. Maybe we were just "lucky" (or more like unlucky).
That's why I have changed all ocurences of has matcher in clang-extra to has(ignoringParenImpCasts(. I will add note in release notes