This is an archive of the discontinued LLVM Phabricator instance.

[ASTMatchers] add three matchers for dependent expressions
ClosedPublic

Authored by JonasToth on Sep 10 2018, 12:26 PM.

Details

Summary

The new matchers can be used to check if an expression is type-, value- or instantiation-dependent
in a templated context.
These matchers are used in a clang-tidy check and generally useful as the
problem of unresolved templates occurs more often in clang-tidy and they
provide an easy way to check for this issue.

Diff Detail

Event Timeline

JonasToth created this revision.Sep 10 2018, 12:26 PM

Missing tests and changes to Registry.cpp for dynamic matchers.

Also, do you want to add isInstantiationDependent() at the same time, given the relationship with the other two matchers?

include/clang/ASTMatchers/ASTMatchers.h
777

s/dependant/dependent

787

Your example should include the matcher syntax.

790

s/dependant/dependent

Missing tests and changes to Registry.cpp for dynamic matchers.

Also, do you want to add isInstantiationDependent() at the same time, given the relationship with the other two matchers?

Do you mean a matcher that does return Node.isValueDependent() || Node.isTypeDependent() or hasAncestor(expr(anyOf(isValueDependent(), isTypeDependent())))?

Missing tests and changes to Registry.cpp for dynamic matchers.

Also, do you want to add isInstantiationDependent() at the same time, given the relationship with the other two matchers?

Do you mean a matcher that does return Node.isValueDependent() || Node.isTypeDependent() or hasAncestor(expr(anyOf(isValueDependent(), isTypeDependent())))?

I mean a matcher that does return Node.isInstantiationDependent(); over Expr.

JonasToth updated this revision to Diff 164863.Sep 11 2018, 6:50 AM
  • add isInstantiationDependent matcher as well
  • add unit tests for new matchers
JonasToth updated this revision to Diff 164873.Sep 11 2018, 7:21 AM
  • fix typos, include example in doc and adjust tests
JonasToth marked 3 inline comments as done.Sep 11 2018, 7:24 AM
JonasToth updated this revision to Diff 164876.Sep 11 2018, 7:33 AM

rebase to master

This revision is now accepted and ready to land.Sep 11 2018, 8:51 AM
JonasToth retitled this revision from [ASTMatchers] add two matchers for dependent expressions to [ASTMatchers] add three matchers for dependent expressions.Sep 11 2018, 9:09 AM
JonasToth edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.