[cfe-dev] Getting ASTContext within an AST Matcher

Manuel Klimek klimek at google.com
Tue Nov 27 07:55:40 PST 2012


On Tue, Nov 27, 2012 at 4:48 PM, Vane, Edwin <edwin.vane at intel.com> wrote:

>  But MatchFinder is only available to a Callback that’s called as the
> result of a match. I’m writing a custom matcher and all I have access to is
> an ASTMatchFinder, the AST Node being considered at the time and the
> BoundNodesTreeBuilder.
>

Ah, ok, now I understand... I think we should add a method getASTContext to
the ASTMatchFinder interface (in ASTMatchersInternal.h). Do you want to
take a stab at it?

Cheers,
/Manuel


> ****
>
> ** **
>
> *From:* Manuel Klimek [mailto:klimek at google.com]
> *Sent:* Tuesday, November 27, 2012 3:35 AM
> *To:* Vane, Edwin
> *Cc:* cfe-dev at cs.uiuc.edu
> *Subject:* Re: [cfe-dev] Getting ASTContext within an AST Matcher****
>
> ** **
>
> On Mon, Nov 26, 2012 at 9:46 PM, Vane, Edwin <edwin.vane at intel.com> wrote:
> ****
>
> Hi all,
>
> I'm writing an AST Matcher that operates on Expr. I'd like to use
> isNullPointerConstant() but it requires an ASTContext. In the past I've
> been able to get an ASTContext from a Decl subclassed object using
> Decl::getASTContext() but that clearly won't work with Expr. So how does
> one get access to the ASTContext in my situation? Must the matcher
> mechanism be modified to provide the ASTContext to matchers? ****
>
>  ** **
>
> The MatchFinder::MatchResult has a field Context.****
>
>  ****
>
> How global is an ASTContext? Given the name it seems to imply there's one
> context for one particular AST the matchers are being run on. If so it
> should be pretty easy to modify the matcher mechanism to provide this info,
> perhaps through MatchFinder.****
>
>  ** **
>
> Assessment correct :)****
>
> ** **
>
> Cheers,****
>
> /Manuel****
>
>  ****
>
>
> --
> Edwin Vane
>   Software Developer
>   Intel of Canada, Inc.
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev****
>
>  ** **
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121127/b110bd62/attachment.html>


More information about the cfe-dev mailing list