[cfe-dev] __builtin_nan support
Eli Friedman
eli.friedman at gmail.com
Mon May 19 12:06:09 PDT 2008
On Mon, May 19, 2008 at 11:02 AM, Nate Begeman <natebegeman at mac.com> wrote:
> Attached patch implements __builtin_nan, __builtin_nanf, and __builtin_nanl.
@@ -58,6 +57,10 @@
if (SemaBuiltinUnorderedCompare(TheCall.get()))
return true;
return TheCall.take();
+ case Builtin::BI__builtin_nan:
+ case Builtin::BI__builtin_nanf:
+ case Builtin::BI__builtin_nanl:
+ return SemaBuiltinNaN(FnInfo->getBuiltinID(), TheCall.get());
case Builtin::BI__builtin_shufflevector:
return SemaBuiltinShuffleVector(TheCall.get());
}
This is unsafe; in the case where SemaBuiltinNaN doesn't find a string
literal, you end up with a dangling pointer.
+ llvm::APInt Val(64, 0x7ff8000000000000ULL, false);
+
+ char *endp = 0;
+ uint64_t Significand = strtoull(data, &endp, 0);
Windows doesn't have strtoull.
-Eli
More information about the cfe-dev
mailing list