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
654

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

656–660

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

667

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);

682

Don't use auto.

687–689

Why do these need their own inner block scopes?

690

auto.

691–692

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

693–694

auto, here and everywhere in this file.

734

Can remove whitespace around here.

746–751

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

steveire updated this revision to Diff 179725.Sun, Dec 30, 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.Sun, Dec 30, 5:44 AM
lebedev.ri added a subscriber: lebedev.ri.

Differential lacks description.

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

targetCtor -> TargetCtor

653

it -> It

654

ctor -> Ctor

657–659

Elide braces

682

Can combine with the previous if statement, I believe.

688

Don't use auto here please.

691

Don't use auto here please.

704

Don't use auto here please.

710

item -> Item