[cfe-dev] Matching CXXRecordDecl
Manuel Klimek
klimek at google.com
Fri Jun 27 03:26:32 PDT 2014
On Thu, Jun 26, 2014 at 11:42 PM, Daniel Dilts <diltsman at gmail.com> wrote:
> I am attempting to rename a class. I have matched the CXXRecordDecl that
> I want to rename, and I can rename the class declaration/definition.
>
> I have been matching with something like
> recordDecl(isDerivedFrom(Class->getName().str())) where Class is of type
> CXXRecordDecl*.
>
> Is there a possibility that it would match a type with the same name as
> Class but in a different namespace?
>
Yep.
> Is there a way to just pass the CXXRecordDecl or associated Type to the
> AST matcher?
>
1. you can use '::ns::MyClass' to only match fully qualified names
2. if you're doing match-in-match, and you already have a CXXRecordDecl,
you can use isDerivedFrom(recordDecl(equalsNode(yourRecordDecl)))
Cheers,
/Manuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140627/43ba470d/attachment.html>
More information about the cfe-dev
mailing list