[cfe-commits] [llvm-commits] [patch] fp128 sint_to_fp folding fix

Richard Smith richard at metafoo.co.uk
Fri Jan 18 11:23:58 PST 2013


On Fri, Jan 18, 2013 at 1:54 AM, Tim Northover <t.p.northover at gmail.com> wrote:
> Hi Richard,
>
> Thanks very much for your suggestion, that does sound much nicer if we
> can make it work; I'm afraid I may need some more guidance
> implementing it though.
>
>> Instead of storing the fltSemantics* on the FloatingLiteral, you can
>> use ASTContext::getFloatTypeSemantics(Literal->getType()). You'll need
>> to update getValue to take a const ASTContext&.
>
> The ripple effects of this change are getting rather large. Most
> worrying so far is ASTDumper, a visitor for the AST. When it needs to
> call the getValue function (well, actually
> getValueAsApproximateDouble, but same idea) there's no ASTContext
> available. In principle it could be added as a class member to
> ASTDumper, but this is particularly worrying for the Stmt::dump()
> method, which doesn't appear to have one available when constructing
> the dumper.
>
> Am I missing some way to conjure up an ASTContext?

The AST dumper is a bit of a special case. It's intended to be usable
by running Expr->dump() from a debugger, and consequently it does not
have access to the ASTContext.

If this isn't working out well, how about replacing the IsIEEE flag in
FloatingLiteralBitfields with a float kind enumeration?



More information about the cfe-commits mailing list