diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-06-10 08:00:26 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-06-10 08:00:26 +0000 |
commit | 3c2fcf8705023e1d91d1c85dc7c8a4aa2248050b (patch) | |
tree | de0c225f322ebdd2b308240318e94939ede31d18 /lib/Sema/SemaOverload.cpp | |
parent | 3335eb7f7c5b82f109c585fb4009ff8240b11a84 (diff) |
PR12964: __int128 and unsigned __int128 are promoted integral types, be sure to
consider them when enumerating builtin operator candidates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158293 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 2ead6a66f8..994471ab5c 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -6399,12 +6399,12 @@ class BuiltinOperatorOverloadBuilder { // The "promoted arithmetic types" are the arithmetic // types are that preserved by promotion (C++ [over.built]p2). static const unsigned FirstIntegralType = 3; - static const unsigned LastIntegralType = 18; + static const unsigned LastIntegralType = 20; static const unsigned FirstPromotedIntegralType = 3, - LastPromotedIntegralType = 9; + LastPromotedIntegralType = 11; static const unsigned FirstPromotedArithmeticType = 0, - LastPromotedArithmeticType = 9; - static const unsigned NumArithmeticTypes = 18; + LastPromotedArithmeticType = 11; + static const unsigned NumArithmeticTypes = 20; /// \brief Get the canonical type for a given arithmetic type index. CanQualType getArithmeticType(unsigned index) { @@ -6420,9 +6420,11 @@ class BuiltinOperatorOverloadBuilder { &ASTContext::IntTy, &ASTContext::LongTy, &ASTContext::LongLongTy, + &ASTContext::Int128Ty, &ASTContext::UnsignedIntTy, &ASTContext::UnsignedLongTy, &ASTContext::UnsignedLongLongTy, + &ASTContext::UnsignedInt128Ty, // End of promoted types. &ASTContext::BoolTy, @@ -6435,7 +6437,7 @@ class BuiltinOperatorOverloadBuilder { &ASTContext::UnsignedCharTy, &ASTContext::UnsignedShortTy, // End of integral types. - // FIXME: What about complex? + // FIXME: What about complex? What about half? }; return S.Context.*ArithmeticTypes[index]; } @@ -6454,20 +6456,24 @@ class BuiltinOperatorOverloadBuilder { // *except* when dealing with signed types of higher rank. // (we could precompute SLL x UI for all known platforms, but it's // better not to make any assumptions). + // We assume that int128 has a higher rank than long long on all platforms. enum PromotedType { - Flt, Dbl, LDbl, SI, SL, SLL, UI, UL, ULL, Dep=-1 + Dep=-1, + Flt, Dbl, LDbl, SI, SL, SLL, S128, UI, UL, ULL, U128 }; static const PromotedType ConversionsTable[LastPromotedArithmeticType] [LastPromotedArithmeticType] = { - /* Flt*/ { Flt, Dbl, LDbl, Flt, Flt, Flt, Flt, Flt, Flt }, - /* Dbl*/ { Dbl, Dbl, LDbl, Dbl, Dbl, Dbl, Dbl, Dbl, Dbl }, - /*LDbl*/ { LDbl, LDbl, LDbl, LDbl, LDbl, LDbl, LDbl, LDbl, LDbl }, - /* SI*/ { Flt, Dbl, LDbl, SI, SL, SLL, UI, UL, ULL }, - /* SL*/ { Flt, Dbl, LDbl, SL, SL, SLL, Dep, UL, ULL }, - /* SLL*/ { Flt, Dbl, LDbl, SLL, SLL, SLL, Dep, Dep, ULL }, - /* UI*/ { Flt, Dbl, LDbl, UI, Dep, Dep, UI, UL, ULL }, - /* UL*/ { Flt, Dbl, LDbl, UL, UL, Dep, UL, UL, ULL }, - /* ULL*/ { Flt, Dbl, LDbl, ULL, ULL, ULL, ULL, ULL, ULL }, +/* Flt*/ { Flt, Dbl, LDbl, Flt, Flt, Flt, Flt, Flt, Flt, Flt, Flt }, +/* Dbl*/ { Dbl, Dbl, LDbl, Dbl, Dbl, Dbl, Dbl, Dbl, Dbl, Dbl, Dbl }, +/*LDbl*/ { LDbl, LDbl, LDbl, LDbl, LDbl, LDbl, LDbl, LDbl, LDbl, LDbl, LDbl }, +/* SI*/ { Flt, Dbl, LDbl, SI, SL, SLL, S128, UI, UL, ULL, U128 }, +/* SL*/ { Flt, Dbl, LDbl, SL, SL, SLL, S128, Dep, UL, ULL, U128 }, +/* SLL*/ { Flt, Dbl, LDbl, SLL, SLL, SLL, S128, Dep, Dep, ULL, U128 }, +/*S128*/ { Flt, Dbl, LDbl, S128, S128, S128, S128, S128, S128, S128, U128 }, +/* UI*/ { Flt, Dbl, LDbl, UI, Dep, Dep, S128, UI, UL, ULL, U128 }, +/* UL*/ { Flt, Dbl, LDbl, UL, UL, Dep, S128, UL, UL, ULL, U128 }, +/* ULL*/ { Flt, Dbl, LDbl, ULL, ULL, ULL, S128, ULL, ULL, ULL, U128 }, +/*U128*/ { Flt, Dbl, LDbl, U128, U128, U128, U128, U128, U128, U128, U128 }, }; assert(L < LastPromotedArithmeticType); @@ -6567,13 +6573,13 @@ public: assert(getArithmeticType(FirstPromotedIntegralType) == S.Context.IntTy && "Invalid first promoted integral type"); assert(getArithmeticType(LastPromotedIntegralType - 1) - == S.Context.UnsignedLongLongTy && + == S.Context.UnsignedInt128Ty && "Invalid last promoted integral type"); assert(getArithmeticType(FirstPromotedArithmeticType) == S.Context.FloatTy && "Invalid first promoted arithmetic type"); assert(getArithmeticType(LastPromotedArithmeticType - 1) - == S.Context.UnsignedLongLongTy && + == S.Context.UnsignedInt128Ty && "Invalid last promoted arithmetic type"); } |