Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] CDT DOM Usage

The class called CDOM is where everything starts. Checking for
references to that class should give you all the uses of the DOM that
exist in the CDT.

There is little documentation the DOM and I definitely need to write
some. To quickly summarize, the nodes under IASTTranslationUnit give the
AST for the file and all it's includes. You can find the file/macro
location for each node in the getNodeLocations call on IASTNode. Symbols
are represented as IASTName's. You can resolve the Symbol to get it's
semantic information, i.e. IBinding, using the resolveBinding call on
IASTName. You can then use the binding to get declarations, definitions,
and references in a translation unit using the appropriate calls on
IASTTranslationUnit. You can also use names and bindings in the
DOMSearchUtil utility class to do cross project/workspace searches for
various things.

Now to put that in a nice developer doc...

Hope this helps,
Doug


On Wed, 2005-09-28 at 14:39 -0400, Nick Allen wrote:
> I am trying to make sense of the CDT DOM.  I have been looking
> through 
> the code and test cases, but it has been a slow process.  Can anyone 
> point to code examples (mailing list archives, test cases, design 
> documents, etc) that might help me understand its proper usage.  
> 
> BTW, for now I am simply trying to parse a file and determine the C++ 
> classes which have been declared in that file.
> 
> Thanks in advance for any help.
> 
> --Nick
> 
> 
> 
> 
> _______________________________________________ 
> cdt-dev mailing list 
> cdt-dev@xxxxxxxxxxx 
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 



Back to the top