This is an archive of the discontinued LLVM Phabricator instance.

[ASTMatchers] Add hasSubExpr() matcher.
AbandonedPublic

Authored by courbet on Mar 21 2018, 3:52 AM.

Details

Summary

This is needed to implement more checks in D38455.

Diff Detail

Event Timeline

courbet created this revision.Mar 21 2018, 3:52 AM

I think hasSourceExpression() already does what you're looking for.

void f() {
  int i = 1.0f;
}

clang-query> match implicitCastExpr(hasSourceExpression(floatLiteral()))

Match #1:

C:\Users\aballman.GRAMMATECH\Desktop\test.c:2:11: note: "root" binds here

int i = 1.0f;
        ^~~~

1 match.

Thanks for the pointer. I missed the trampoline through GetSourceExpressionMatcher<T>.

courbet abandoned this revision.Mar 21 2018, 9:38 AM