<div dir="ltr">Yea, we had that discussion a few times, and I can never remember why we ended up in the state we're in.<div>We definitely had a time where we switched to just using the exact same name as the node's class name for the matchers.</div><div>I *think* we didn't do it for cxxRecordDecl, because Richard said that's a relic we should get rid of anyway, but I'm not sure.<br><div><br><div class="gmail_quote"><div dir="ltr">On Fri, Sep 4, 2015 at 8:32 PM Aaron Ballman <<a href="mailto:aaron@aaronballman.com">aaron@aaronballman.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It turns out that the recordDecl() AST matcher doesn't match<br>
RecordDecl objects; instead, it matches CXXRecordDecl objects. This<br>
is... unfortunate... as it makes writing AST matchers more complicated<br>
because of having to translate between recordDecl()/CXXRecordDecl. It<br>
also makes it impossible to match a struct or union declaration in C<br>
or ObjC. However, given how prevalent recordDecl()'s use is in the<br>
wild (I'm guessing), changing it at this point would be a Bad Thing.<br>
<br>
For people trying to write AST matchers for languages like C or ObjC,<br>
I would like to propose adding:<br>
<br>
structDecl()<br>
unionDecl()<br>
tagDecl()<br>
<br>
These will match nicely with the existing enumDecl() AST matcher.<br>
<br>
Additionally, I would like to add cxxRecordDecl() to match<br>
CXXRecordDecl objects. While it duplicates the functionality exposed<br>
by recordDecl(), it more clearly matches the intention of which AST<br>
node it corresponds to.<br>
<br>
Finally, I would like to undocument recordDecl() and change our<br>
existing documentation and AST matcher uses to use<br>
cxxRecordDecl/structDecl() instead. Maybe someday we can deprecate<br>
recordDecl() more officially.<br>
<br>
I'm open to other ideas if there are better ways to move forward. If<br>
you think changing the meaning of recordDecl() is acceptable, I can<br>
also go that route (though I would still propose adding unionDecl()<br>
and cxxRecordDecl() in that case).<br></blockquote><div><br></div><div>I think changing recordDecl is acceptable. I believe very few tools will actually start doing wrong things because of it. I'd like more opinions first, though :)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks!<br>
<br>
~Aaron<br>
</blockquote></div></div></div></div>