Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Re-using CDT to support other statically typed objectoriented language

Hi Jens,
with a few exceptions the indexer acesses the ast via its public interfaces. Where intenal interfaces are used
this is (as far as I know) done in a safe way, i.e. it is checked whether the internal interface is actually
implemented. So you could get away with reusing the cpp-implementation for the PDOMBindings.
However, you should use a different linkage to store the UNO-IDL bindings in the index. To make this happen
* Create an AbstractLanguage for your UNO-IDL returning your linkage-id.
*  IASTTranslationUnit.getLinkage() needs to return the linkage
* Your PDOMLinkage needs to return the linkage-id
==> I'd recommend to make a copy of PDOMCPPLinkage and PDOMCPPLinkageFactory and remove the stuff you
don't need for UNO-IDL + change the linkage-id.
To support composition of index-fragments (index for multiple projects) you also need to create a copy (and remove unneeded stuff) of CPPCompositesFactory. You need to make CIndex.getCompositeFactory() return your factory.
If things work out, I think it'd be best to integrate the few parts that are necessary (ILinkage.UNO_IDL, PDOMUNOIDLLinkage, ...) into CDT.

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Elmenthaler, Jens
Sent: Monday, February 04, 2008 5:03 PM
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] Re-using CDT to support other statically typed objectoriented language
Importance: Low

Hi Folks,


I have a statically typed, object oriented language that also uses the C preprocessor (UNO IDL, the IDL of the component framework coming with OpenOffice).


I started with the language extension point. A basic parser creating the AST part is up and running, which enables the AST-based functionality already.

So, thanks to you folks, I have a great editor with header file navigation, outline view, include browser, … almost for free (with almost not using any internal API of CDT:-). This is really cool!


Now I’m getting greedy: I want to turn on the index-based functionality as well.


I was having a look and see 2 basic strategies to get myself hooked up with the PDOM:

A) The UNO IDL AST nodes can completely be mapped to the ICPPAST* tree without conflicts or “bending” their meaning, so far. So I let the PDOMCPPLinkage create the PDOM nodes.

-> little effort.


- larger effort.

- need to sub-class PDOMLinkage and PDOMBindung, which creates lot more dependencies to internal CDT API.


I decided for A). Here my questions:

1)       I have seen that there were already prototypes for other languages (e.g. C#) in the CDT. Can anybody advice an ‘official’ way?

2)       Is the PDOMCPPLinkage depending on any CPP AST implementation classes? Then strategy A) wouldn’t work. By now I couldn’t see I reason why it shouldn’t work.

3)       Should I create bugzilla entries that would enhance the CDT to support other statically typed languages (in my view the CDT somehow is the counterpart to the DLTK, which is the platform for dynamically typed languages). I could at least create a list of interfaces that should be moved to public CDT packages.


Any advice is welcome.



Jens Elmenthaler.




Jens Elmenthaler
Platform & Components Lab

Architecture Development Team


Verigy Germany GmbH, Herrenberger Str. 130, 71034 Böblingen
Sitz der Gesellschaft: Böblingen - Amtsgericht Böblingen HRB 6167

WEEE-Reg.-Nr. DE 16968742
Geschäftsführer: Hans-Jürgen Wagner, Dietmar Höller

Tel: +49 7031 4357-119



Back to the top