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

Eli Friedman eli.friedman at gmail.com
Mon Jun 29 10:58:58 PDT 2009

On Mon, Jun 29, 2009 at 9:06 AM, Olaf
Krzikalla<Olaf.Krzikalla at tu-dresden.de> 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.

>From a brief investigation, I think that's simply a bug; patch welcome.

> 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.

ISO isn't really relevant here, I think.  The way the AST is
structured, the if statement contains an CXXConditionDeclExpr, which
references the decl; "expr" is simply the intialializer for "a".

> 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.

There has been some discussion of adding helpers for cases like this,
but nobody has stepped up to implement them; see also
http://llvm.org/bugs/show_bug.cgi?id=3765 .

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

No good reason, as far as I can tell; patch welcome.

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

That sounds fine; patch welcome.


More information about the cfe-dev mailing list