Page MenuHomePhabricator

[ASTMatchers] Add matchers available through casting to derived
Needs ReviewPublic

Authored by steveire on Nov 11 2018, 2:40 PM.

Details

Reviewers
aaron.ballman

Diff Detail

Event Timeline

steveire created this revision.Nov 11 2018, 2:40 PM

These commits are available on github if it's convenient to see it all together there:

https://github.com/steveire/clang/commits/matcher-output

Here is context for the changes I'm making in case it is useful:

https://steveire.wordpress.com/2018/11/11/future-developments-in-clang-query/

Note that the commits pushed for review so far don't implement everything I wrote about there.

aaron.ballman added inline comments.Nov 12 2018, 3:21 PM
lib/ASTMatchers/Dynamic/Registry.cpp
645

Don't use auto here (and if you did. the const would go on the other side).

647–651

I think this can be replaced with llvm::find_if().

659

I'd prefer this to not be a default argument (the callers can pass it in). It might also be nice to use an enum here rather than a bool, but alternative to that, you should stick in comments in the callers that describe the parameter name. e.g. getMatchingMatchersImpl(yada, /*ExactOnly*/true);

711

Don't use auto.

716–718

Why do these need their own inner block scopes?

719

auto.

720–721

if (TypeForMatcherOpt && StaticType.isBaseOf(...)) {

722–723

auto, here and everywhere in this file.

749

Can remove whitespace around here.

761–766

It seems like getMatchingMatchersImpl() should just be renamed to getMatchingMatchers().

steveire updated this revision to Diff 179725.Dec 30 2018, 4:46 AM

Some updates

lebedev.ri retitled this revision from Add matchers available through casting to derived to [ASTMatchers] Add matchers available through casting to derived.Dec 30 2018, 5:44 AM
lebedev.ri added a subscriber: lebedev.ri.

Differential lacks description.

aaron.ballman added inline comments.Dec 31 2018, 8:11 AM
lib/ASTMatchers/Dynamic/Registry.cpp
642

targetCtor -> TargetCtor

644

it -> It

645

ctor -> Ctor

648–650

Elide braces

709

Can combine with the previous if statement, I believe.

715

Don't use auto here please.

718

Don't use auto here please.

731

Don't use auto here please.

737

item -> Item