diff options
author | Zoe Carver <z.zoelec2@gmail.com> | 2019-09-23 15:41:20 +0000 |
---|---|---|
committer | Zoe Carver <z.zoelec2@gmail.com> | 2019-09-23 15:41:20 +0000 |
commit | 511dbd83d63ce0cf95e3ac7d07eb9444d92a02e8 (patch) | |
tree | a7e29e48f2e7df155662da06debd1b4d98fdce1e /clang/lib/Sema/SemaExprCXX.cpp | |
parent | f73ea05db03bcd208aa8fb0bb88643a3c6ab6c4f (diff) | |
download | bcm5719-llvm-511dbd83d63ce0cf95e3ac7d07eb9444d92a02e8.tar.gz bcm5719-llvm-511dbd83d63ce0cf95e3ac7d07eb9444d92a02e8.zip |
Fix __is_signed builtin
Summary: This patch fixes the __is_signed builtin type trait to work with floating point types and enums. Now, the builtin will return true if it is passed a floating point type and false for an enum type.
Reviewers: EricWF, rsmith, erichkeane, craig.topper, efriedma
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67897
llvm-svn: 372621
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 10180351925..a9efbbc9e5e 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -4605,7 +4605,9 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT, return RD->hasAttr<FinalAttr>(); return false; case UTT_IsSigned: - return T->isSignedIntegerType(); + // Enum types should always return false. + // Floating points should always return true. + return !T->isEnumeralType() && (T->isFloatingType() || T->isSignedIntegerType()); case UTT_IsUnsigned: return T->isUnsignedIntegerType(); |