[cfe-dev] A bunch of more or less related issues

Chris Lattner clattner at apple.com
Mon Jun 29 10:28:02 PDT 2009


On Jun 29, 2009, at 9:06 AM, Olaf Krzikalla wrote:

> Hi @clang,
>
> while working on AST processing I stumbled over the one or another
> little quirk. I like to point them out now before the list becomes  
> too long:
>
> 1. Why StmtPrinter::Indent always indent with two spaces hence
> effectively doubling the indent? It cost me a while to find that out  
> as
> it is IMHO unexprected.

Because "two character spacing" is the "one true way" :)

> 2. What is the full expression according to ISO in "if (int a =  
> expr)"?
> IMHO it is expr, but I'm not really sure since I saw  
> CXXConditionDeclExpr.

This is a C++'ism, I'm not really sure.

> 3. When I try to rewrite a freestanding expression I have trouble with
> the semicolon. Example:
> { expr; }
> The semicolon is obv. not included in the source range of expr. But  
> the
> parent of expr is already the CompoundStmt meaning that there seems to
> be no place to hold the information about the semicolon at all.  
> Actually
> an encapsulating helper statement would be needed or there is a more
> clever solution. But maybe I just have to take this as a known  
> limitation.

Yes, we don't model the semi right now.  In theory we could handle it  
with a new StmtExpr class, but we don't have that, and probably don't  
want it for space reasons.

> 4. Why takes the FloatingLiteral ctor the "isexact" bool variable as a
> pointer?

Good question, no idea, I'll fix it.

> 5. Is it possible to change the PrinterHelper::handledStmt function so
> that it takes the current indentation as a third argument?

Someone else can probably answer this better than me,

-Chris




More information about the cfe-dev mailing list