[cfe-dev] Finding function declaration?
jordan_rose at apple.com
Sun May 17 14:13:33 PDT 2015
> On May 17, 2015, at 6:12 , Manuel Klimek <klimek at google.com> wrote:
> On Sun, May 17, 2015 at 2:09 PM Ben Laurie <benl at google.com <mailto:benl at google.com>> wrote:
> On 16 May 2015 at 16:15, Manuel Klimek <klimek at google.com <mailto:klimek at google.com>> wrote:
> On Thu, May 14, 2015 at 3:46 PM Ben Laurie <benl at google.com <mailto:benl at google.com>> wrote:
> On 14 May 2015 at 14:43, Manuel Klimek <klimek at google.com <mailto:klimek at google.com>> wrote:
> Ah, wrong parent map :) the ast context has a function to retrieve parents that supports crossing into decls. I can look up the details when I'm back at a real computer ...
> Ah! Thanks.
> You can get the ASTContext from the CheckerContext, and then call getParents() on it.
> Mildly puzzled why there might be multiple parents, but in any case, it works, thanks.
> Template instantiation works in clang by doing tree transformations from the template pattern to the instantiated template.
> To make this scale, non-type-dependent statements are shared between all instantiations of a template (including its pattern).
Actually, you can solve the original problem a bit more easily: the current LocationContext (which is also in the CheckerContext) contains a reference to the current function, method, or block.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev