[cfe-dev] -emit-html example

Nuno Lopes nunoplopes at sapo.pt
Thu Apr 17 15:13:02 PDT 2008


Hi,

Thanks for sending a preview! I have been reading the commits in the past 
weeks and I was really curious to see what the output would look like 
(unfortunately I did not have time to play with clang for the last couple of 
weeks).
Anyway, I think the output is great! However I found some little problems, 
like:
 - the output jumps from line 1659 to 2085
 - macro expansion is a bit weird in IE7, at least. the box is very little 
and wraps text after each word (I've attached a snapshot). In Firefox it 
looks much prettier, though.

Keep up the great work!

Nuno


----- Original Message ----- 
From: "Chris Lattner" <clattner at apple.com>
To: "cfe-dev" <cfe-dev at cs.uiuc.edu>
Sent: Thursday, April 17, 2008 10:41 PM
Subject: [cfe-dev] -emit-html example


> One of the spiffy things that Ted is doing with his static analysis
> stuff is having it emit reports in HTML.  A required part of this is
> just being able to turn code itself into HTML.  I think that the stuff
> clang is doing is pretty cool, so I thought I'd show an example.
>
> Here's "gcc.c" from llvm-gcc converted to html with:
>
> $ clang -I <tons of stuff> gcc.c -emit-html -o gcc.html
>
>
>
> the code has line numbers and is syntax highlighted.  In addition, if
> you float your mouse over a macro (which are displayed in red bold
> letters), a pop-up shows the tokens that that instance of the macro
> expanded out into.  I picked gcc.c because it has a ton of macros.
> Take a look at the examples around line 1410 and line 750 for some fun
> examples.
>
> One of this nice things about this is that it builds on the clang
> rewriter, lexer, preprocessor etc, and as such is only a tiny amount
> of code.  Also, the HTML emission is really fast even thought this
> makes a 1.1M html file :).
>
>
> One of the things we're shooting for is self contained files (they
> don't depend on external javascript or images for example), so that
> the html can be copied around like this without losing pieces of the
> content.  Ted's analysis tool further annotates the output with the
> bugs he finds, he'll send out an email about that in the next few days.
>
> Anyway, give -emit-html a try, if you have ideas for making it better,
> it's really easy to improve: for example, the code to do the macro
> expansions is ~70 lines of commented code at the end of HTMLRewrite.
>
> -Chris 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-html-IE7.png
Type: image/png
Size: 12149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080417/d1ae196b/attachment.png>


More information about the cfe-dev mailing list