Suggestion for new AST-matchers

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Suggestion for new AST-matchers

suyash singh via cfe-dev
I was thinking it might be worthwhile to add a few AST-matchers, something like
isAssociativeOperator, isCommutativeOperator and maybe isDistributiveOperator.

I'm still quite new in the clang community so before starting to work on them I would like to check if they have potential to be accepted.

So, might these matchers be relevant for clang?

--
/Kim Viggedal

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Suggestion for new AST-matchers

suyash singh via cfe-dev
On Wed, Mar 11, 2020 at 7:11 AM Kim Viggedal via cfe-dev
<[hidden email]> wrote:
>
> I was thinking it might be worthwhile to add a few AST-matchers, something like
> isAssociativeOperator, isCommutativeOperator and maybe isDistributiveOperator.
>
> I'm still quite new in the clang community so before starting to work on them I would like to check if they have potential to be accepted.
>
> So, might these matchers be relevant for clang?

It's possible! When we add new AST matchers, we typically want there
to be some obvious uses for the matcher (for instance, clang-tidy
checks that could be refactored to use them, new clang-tidy checks
made possible, etc). It's not immediately obvious to me what these
matchers would be used for in general as opposed to being a local
matcher used by 1-2 checks, however, you may have other ideas in mind
that I'm not thinking of.

~Aaron

>
> --
> /Kim Viggedal
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Suggestion for new AST-matchers

suyash singh via cfe-dev
I think these matchers could be useful in many cases, or maybe just the one tidy check, I think it's hard to tell myself.
So I guess I'll just start out with trying them out as local matchers for one check and take it from there if I can find more uses for them.

Den ons 11 mars 2020 kl 13:06 skrev Aaron Ballman <[hidden email]>:
On Wed, Mar 11, 2020 at 7:11 AM Kim Viggedal via cfe-dev
<[hidden email]> wrote:
>
> I was thinking it might be worthwhile to add a few AST-matchers, something like
> isAssociativeOperator, isCommutativeOperator and maybe isDistributiveOperator.
>
> I'm still quite new in the clang community so before starting to work on them I would like to check if they have potential to be accepted.
>
> So, might these matchers be relevant for clang?

It's possible! When we add new AST matchers, we typically want there
to be some obvious uses for the matcher (for instance, clang-tidy
checks that could be refactored to use them, new clang-tidy checks
made possible, etc). It's not immediately obvious to me what these
matchers would be used for in general as opposed to being a local
matcher used by 1-2 checks, however, you may have other ideas in mind
that I'm not thinking of.

~Aaron

>
> --
> /Kim Viggedal
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


--
/Kim Viggedal

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Suggestion for new AST-matchers

suyash singh via cfe-dev
On Wed, Mar 11, 2020 at 10:21 AM Kim Viggedal <[hidden email]> wrote:
>
> I think these matchers could be useful in many cases, or maybe just the one tidy check, I think it's hard to tell myself.
> So I guess I'll just start out with trying them out as local matchers for one check and take it from there if I can find more uses for them.

I think that's a good approach. We often start with a local matcher in
a clang-tidy check and then hoist it out to be a global matcher once
we've found a second need for it. That seems to strike a pretty good
balance.

~Aaron

>
> Den ons 11 mars 2020 kl 13:06 skrev Aaron Ballman <[hidden email]>:
>>
>> On Wed, Mar 11, 2020 at 7:11 AM Kim Viggedal via cfe-dev
>> <[hidden email]> wrote:
>> >
>> > I was thinking it might be worthwhile to add a few AST-matchers, something like
>> > isAssociativeOperator, isCommutativeOperator and maybe isDistributiveOperator.
>> >
>> > I'm still quite new in the clang community so before starting to work on them I would like to check if they have potential to be accepted.
>> >
>> > So, might these matchers be relevant for clang?
>>
>> It's possible! When we add new AST matchers, we typically want there
>> to be some obvious uses for the matcher (for instance, clang-tidy
>> checks that could be refactored to use them, new clang-tidy checks
>> made possible, etc). It's not immediately obvious to me what these
>> matchers would be used for in general as opposed to being a local
>> matcher used by 1-2 checks, however, you may have other ideas in mind
>> that I'm not thinking of.
>>
>> ~Aaron
>>
>> >
>> > --
>> > /Kim Viggedal
>> > _______________________________________________
>> > cfe-dev mailing list
>> > [hidden email]
>> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
>
> --
> /Kim Viggedal
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Suggestion for new AST-matchers

suyash singh via cfe-dev
In reply to this post by suyash singh via cfe-dev
I'm inclined to disagree somewhat. Matchers aren't just useful for clang tidy. If it's obvious that people would find uses for them in other tools they should have a place in ASTMatchers.

Regards 
Nathan James

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev