Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] AST/Model changes in 4.0

Hi Alan,
you can generate AST in CDT 3.1, also. The rename-refactoring may serve
as an example for how to do it.

Here is a short summary on the three models in use:

ICElement:
* used to represent c-elements in the ui (e.g.: outline, cview, 
  type-hierarchy, call-hierarchy) 
* you are allowed to hold on to these elements.

IIndex API (since 4.0):
* allows to explore functions, variables and types, their declarations
  and references.
* used to gather information for some features (e.g.: search, 
  call-hierarchy, type-hierarchy, include-browser).
* you are not allowed to hold on to objects obtained via this API, you
  have to convert them into ICElements or into something that is 
  appropriate for you before you give up the read-lock on the database.

IASTTranslationUnit:
* contains all the details of the code of one translation-unit including
  all the headers.
* there is a variant of IASTTranslationUnit that contains the details
  about a single file and is backed up by IIndex for declarations that
  can be found in the included headers. 
* used for creating the index but also for some features (e.g.: 
  navigation, content-assist, semantic highlighting, rename refactoring)
* you should not hold on to more than one instance of an AST at each
  point in time, as these consume a lot of memory.

 

> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx 
> [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Alan Conway
> Sent: Mittwoch, 28. Februar 2007 05:37
> To: CDT General developers list.
> Subject: [cdt-dev] AST/Model changes in 4.0 
> 
> Emanuel Graf wrote:
> > Hi Alan,
> >
> > Checkout the CDT 3.1 Branch. HEAD compiles against Eclipse 3.3M5.
> >
> > Emanuel
> >
> Thanks! I seen in 3.1there is no ITranslationUnit.getAST(). 
> Is there an 
> alternative way to track down the AST for a compilation unit 
> in 3.1 or 
> do I need to roll forward to eclipse 3.3?
> 
> I need to find out for a given translation unit:
>  - what types does it refer to
>  - for each type does it need a full declaration or would a 
> forward decl 
> suffice?
>  - for each type that that was included from a header, which 
> header did 
> it come from?
> 
> I think I need the AST for this but I'm still very unclear on the 
> division of responsibilities between the AST hierarchy and 
> the CElement 
> hierarchy. Any hints much appreciated.
> 
> Cheers,
> Alan.
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 


Back to the top