From 2d666fd01a1eb0e24499f2aa87dd23e16e795579 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 26 Mar 2015 00:16:07 +0000 Subject: [PATCH] Reformatting, NFC git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233234 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/Type.cpp | 9 +++++---- lib/Sema/SemaOverload.cpp | 12 ++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 6e1d683c55..0e8b1e8119 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -632,12 +632,13 @@ bool Type::hasIntegerRepresentation() const { bool Type::isIntegralType(ASTContext &Ctx) const { if (const BuiltinType *BT = dyn_cast(CanonicalType)) return BT->getKind() >= BuiltinType::Bool && - BT->getKind() <= BuiltinType::Int128; - + BT->getKind() <= BuiltinType::Int128; + + // Complete enum types are integral in C. if (!Ctx.getLangOpts().CPlusPlus) if (const EnumType *ET = dyn_cast(CanonicalType)) - return ET->getDecl()->isComplete(); // Complete enum types are integral in C. - + return ET->getDecl()->isComplete(); + return false; } diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 77c5310aa4..fbf110b321 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -1762,8 +1762,8 @@ bool Sema::IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType) { // We have already pre-calculated the promotion type, so this is trivial. if (ToType->isIntegerType() && !RequireCompleteType(From->getLocStart(), FromType, 0)) - return Context.hasSameUnqualifiedType(ToType, - FromEnumType->getDecl()->getPromotionType()); + return Context.hasSameUnqualifiedType( + ToType, FromEnumType->getDecl()->getPromotionType()); } // C++0x [conv.prom]p2: @@ -1811,13 +1811,12 @@ bool Sema::IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType) { // other value of that type for promotion purposes (C++ 4.5p3). // FIXME: We should delay checking of bit-fields until we actually perform the // conversion. - using llvm::APSInt; - if (From) + if (From) { if (FieldDecl *MemberDecl = From->getSourceBitField()) { - APSInt BitWidth; + llvm::APSInt BitWidth; if (FromType->isIntegralType(Context) && MemberDecl->getBitWidth()->isIntegerConstantExpr(BitWidth, Context)) { - APSInt ToSize(BitWidth.getBitWidth(), BitWidth.isUnsigned()); + llvm::APSInt ToSize(BitWidth.getBitWidth(), BitWidth.isUnsigned()); ToSize = Context.getTypeSize(ToType); // Are we promoting to an int from a bitfield that fits in an int? @@ -1835,6 +1834,7 @@ bool Sema::IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType) { return false; } } + } // An rvalue of type bool can be converted to an rvalue of type int, // with false becoming zero and true becoming one (C++ 4.5p4). -- 2.40.0