forked from OSchip/llvm-project
Type traits: No need for switch to handle __builtin_types_compatible_p
__builtin_types_compatible_p() isn't a C++ type trait at all, rather a GNU C special-case, so it's fine to use BoolTy the default return type for binary type traits. This brings BTT in line with other arities that already default to BoolTy. Cleanup only, no change in behaviour. llvm-svn: 196646
This commit is contained in:
parent
db47bcc63d
commit
8baeac7bfd
|
@ -3938,16 +3938,10 @@ ExprResult Sema::BuildBinaryTypeTrait(BinaryTypeTrait BTT,
|
||||||
if (!LhsT->isDependentType() && !RhsT->isDependentType())
|
if (!LhsT->isDependentType() && !RhsT->isDependentType())
|
||||||
Value = EvaluateBinaryTypeTrait(*this, BTT, LhsT, RhsT, KWLoc);
|
Value = EvaluateBinaryTypeTrait(*this, BTT, LhsT, RhsT, KWLoc);
|
||||||
|
|
||||||
// Select trait result type.
|
QualType ResultType = Context.BoolTy;
|
||||||
QualType ResultType;
|
// __builtin_types_compatible_p is a GNU C extension, not a C++ type trait.
|
||||||
switch (BTT) {
|
if (BTT == BTT_TypeCompatible)
|
||||||
case BTT_IsBaseOf: ResultType = Context.BoolTy; break;
|
ResultType = Context.IntTy;
|
||||||
case BTT_IsConvertible: ResultType = Context.BoolTy; break;
|
|
||||||
case BTT_IsSame: ResultType = Context.BoolTy; break;
|
|
||||||
case BTT_TypeCompatible: ResultType = Context.IntTy; break;
|
|
||||||
case BTT_IsConvertibleTo: ResultType = Context.BoolTy; break;
|
|
||||||
case BTT_IsTriviallyAssignable: ResultType = Context.BoolTy;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Owned(new (Context) BinaryTypeTraitExpr(KWLoc, BTT, LhsTSInfo,
|
return Owned(new (Context) BinaryTypeTraitExpr(KWLoc, BTT, LhsTSInfo,
|
||||||
RhsTSInfo, Value, RParen,
|
RhsTSInfo, Value, RParen,
|
||||||
|
|
Loading…
Reference in New Issue