[cfe-commits] r120877 - in /cfe/trunk: include/clang/Basic/LangOptions.h include/clang/Driver/CC1Options.td lib/Frontend/CompilerInvocation.cpp lib/Sema/SemaExpr.cpp test/CodeGen/cl-single-precision-constant.c
Frits van Bommel
fvbommel at gmail.com
Sat Dec 4 00:33:10 PST 2010
On Sat, Dec 4, 2010 at 2:50 AM, Peter Collingbourne <peter at pcc.me.uk> wrote:
> +def cl_single_precision_constant : Flag<"-cl-single-precision-constant">,
> + HelpText<"OpenCL only. Treat double precision floating-point constant as single precision constant.">;
This claims the option is OpenCL only, but that doesn't seem to be
checked below:
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Dec 3 19:50:56 2010
> @@ -2394,6 +2394,9 @@
> bool isExact = (result == APFloat::opOK);
> Res = FloatingLiteral::Create(Context, Val, isExact, Ty, Tok.getLocation());
>
> + if (getLangOptions().SinglePrecisionConstants && Ty == Context.DoubleTy)
> + ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast);
> +
> } else if (!Literal.isIntegerLiteral()) {
> return ExprError();
> } else {
>
More information about the cfe-commits
mailing list