[cfe-dev] Getting ASTContext within an AST Matcher

Vane, Edwin edwin.vane at intel.com
Mon Nov 26 12:46:00 PST 2012


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? 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.

--
Edwin Vane
  Software Developer
  Intel of Canada, Inc.





More information about the cfe-dev mailing list