diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2017-04-21 23:14:55 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2017-04-21 23:14:55 +0000 |
commit | 42f8eee150bbe361eb5f7a9acfa5838e0661177b (patch) | |
tree | 06748ae24f1552fd4c5f45c8cc3bf00c038abbf9 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | e1bd7cceca0b2c2d85d821b5fb7779c697c25469 (diff) | |
download | llvm-42f8eee150bbe361eb5f7a9acfa5838e0661177b.zip llvm-42f8eee150bbe361eb5f7a9acfa5838e0661177b.tar.gz llvm-42f8eee150bbe361eb5f7a9acfa5838e0661177b.tar.bz2 |
cmath: Skip Libc for integral types in isinf, etc.
For std::isinf, the standard requires effectively calling isinf as
double from Libc for integral types. But integral types are never
infinite; we don't need to call Libc to return false.
Also short-circuit other functions where Libc won't have interesting
answers: signbit, fpclassify, isfinite, isnan, and isnormal.
I added correctness tests for integral types since we're no longer
deferring to Libc.
In review it was pointed out that in future revisions of the C++
standard we may add more types to std::is_arithmetic (e.g.,
std::is_fixed_point). I'll leave it to a future commit to hack this to
allow using math functions on those. We'll need to change things like
__libcpp_fpclassify anyway, so I'm not sure anything here would really
be future-proof.
https://reviews.llvm.org/D31561
rdar://problem/31361223
llvm-svn: 301060
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions