[cfe-dev] Keeping invalid AST nodes

Vassil Vassilev vvasilev at cern.ch
Mon Mar 24 12:54:51 PDT 2014


On 24/03/14 20:25, Etienne Ollivier wrote:
> Hello,
> Could you describe what you mean by declaring the name as dependent?
> I am trying to implement your solution with
> ExternalSemaSource::LookupUnqualified but I didn't succeed yet.
You will get a call to this function, just before clang issues an error. 
Say upon lookup of unknown identifier. There you are given the chance to 
do something with this unknown name. For example, one could define the 
unknown name and return it so that the compiler can carry on parsing. 
The issue is that if you declare it as a concrete type, many semantic 
checks will be performed. One way to avoid this is to declare the name 
as of dependent type, which by definition turns of further semantic 
checks. This will produce more 'dependent' nodes which then one needs to 
fix up by himself/herself.
>
> I would like to keep the invalid nodes in the AST since I am working on a
> project where I try to get metrics from files.
As long as you don't do codegen and you don't need *very* concrete AST 
it should be fine.

I hope this helps.
Vassil
> For example sometimes the declaration of a function is in another file that
> I don't have but I would still need to count the times where it is called.
>
> Thanks for your help
>
>
>
> --
> View this message in context: http://clang-developers.42468.n3.nabble.com/Keeping-invalid-AST-nodes-tp4027991p4038587.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list