[cfe-dev] Best strategies

Miguel Guedes miguel.a.guedes at gmail.com
Fri Nov 2 05:55:02 PDT 2012

Hello List,

I'm looking at developing a FOSS tool for GNU/Emacs, written in C++, 
that makes use of clang's powerful features.  In particular I'm 
interested in contextual/semantic aware code-completion and extraction 
of information (ie. list of methods, attributes, etc). IOW, something 
similar to what CEDET [0] does, only much faster, reliable and useful.

I've created a simple program that accesses all of a C/C++ source file's 
symbols using the AST-consumer approach, but I'm not quite sure I'm 
pursuing the right approach, given the requirements above.

What would be the right approach for:

  * implementing code-completion? Should I be looking at using the 
clang::CodeComplete* [1] set of classes? If so, how would one go about 
implementing the CodeCompleteConsumer class?

  * extracting contextual aware information? For instance, extracting 
the list of methods of an arbitrary class.

  * caching of parsed source file data? For instance, if one is editing 
file A and it includes B, C and D headers, it would be great if clang 
could be instructed to only reload/reparse file A and not the others for 
obvious performance reasons.

Many thanks!


[0] http://cedet.sourceforge.net
[1] http://clang.llvm.org/doxygen/classclang_1_1CodeCompleteConsumer.html

More information about the cfe-dev mailing list