[cfe-commits] r72607 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/CodeGen/builtin-nanf.c

Chris Lattner clattner at apple.com
Fri May 29 21:31:26 PDT 2009


On May 29, 2009, at 8:56 PM, Mike Stump wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=72607&view=rev
> Log:
> Improve __builtin_nanf support; we now can deal with them as  
> constants.

Thanks for working on this Mike!

> +      if (!S->isWide()) {
>         const llvm::fltSemantics &Sem =
>           Info.Ctx.getFloatTypeSemantics(E->getType());
> -        Result = llvm::APFloat::getNaN(Sem);
> +        char *s = (char *)malloc (S->getByteLength()+1);

Isn't this memory leaked?  Why not use a SmallString<16> or something  
(with an appropriate resize)?

-Chris



More information about the cfe-commits mailing list