[cfe-dev] -emit-html example

Ted Kremenek kremenek at apple.com
Tue May 6 12:05:35 PDT 2008


On May 1, 2008, at 2:10 PM, Argiris Kirtzidis wrote:

> My motivation to propose the Annotator lib wasn't specifically to  
> apply it for HTMLPrinter, that was more like an example.
> The Annotator's purpose would be to verify clang's suitability for  
> an IDE, at least from the aspect of syntax/semantic colorizing. For  
> example it would answer questions like:
> -Can I colorize all variable names ? (with exclusive color)
> -Can I colorize all type names ?
> -Can I associate opening/closing braces for all kinds of blocks  
> (namespaces, functions etc.) ?
> -Does the AST carry enough information for doing [insert task] ?
>
> Now, assuming that you have a working Annotator lib, the best way to  
> put it to use (without messing with some IDE) would be to make a  
> HTMLAnnotator.
> HTMLAnnotator would be a client of Annotator and HTML Rewrite API.

I think have a playground for such things is useful, but I know if we  
need a separate library at this point.  Probably just adding the  
Annotator class to the Driver would be sufficient for now.  We can  
then easily move it out.  I also don't know if the extra layer of  
indirection is needed until we have another Annotator in mind besides  
HTMLAnnotator (i.e., can we just use the HTMLPrinter directly to  
explore your above questions?).  I'm not strongly objecting against  
adding Annotator; it's just not clear to me that there are other  
clients that would use it.

> What do you think about the above ?
>
>> I don't believe that an IDE would be an ASTConsumer (in the clang  
>> driver sense) either, but would rather interact with the clang  
>> libraries interactively to regenerate ASTs on-the-fly.
>
> I was thinking that in the specific task of semantic colorizing, you  
> would have to utilize Preprocessor+Parser+Sema for a particular  
> source file,
> so the Annotator being an ASTConsumer, that handles the declarations  
> that the parser gives it, seemed reasonable, do you have something  
> else in mind ?

I think this pipeline works fine for playing around with things; an  
IDE would interactively parse different parts of a file, incrementally  
rebuilding ASTs, etc., and thus the ASTConsumer/Annotator interface  
would probably not be ideal.  This pipeline also basically assumes the  
workflow in the Driver, which is why I think putting the Annotator  
class in the Driver makes more sense than creating a separate library.



More information about the cfe-dev mailing list