[cfe-dev] BUG: VarDecl::getSourceRange() incorrect if CallInit style used for builtin type.

Will Wilson will at indefiant.com
Tue Jan 29 14:53:53 PST 2013


Hi All,

I've been digging into a bug that appears when call-style initializers are
used for builtin types. For example:

    int g_foo(1);

Results in an initializer that is solely an IntegerLiteral - the
ParenListExpr that originally surrounded it is lost during
Sema::AddInitializerToDecl(). This unfortunately also loses the end
location for the final ')' and leads the VarDecl::getSourceRange()
returning the location of the IntegerLiteral for the end location.

What should be the correct approach here? Surely the ParenListExpr should
be preserved in the AST? Or if it really is supposed to be folded away at
this stage than how can we retain the end location for the expression?

Any thoughts?

- Will.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130129/c275e028/attachment.html>


More information about the cfe-dev mailing list