r233234 - Reformatting, NFC
Richard Smith
richard-llvm at metafoo.co.uk
Wed Mar 25 17:16:08 PDT 2015
Author: rsmith
Date: Wed Mar 25 19:16:07 2015
New Revision: 233234
URL: http://llvm.org/viewvc/llvm-project?rev=233234&view=rev
Log:
Reformatting, NFC
Modified:
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
Modified: cfe/trunk/lib/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=233234&r1=233233&r2=233234&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Wed Mar 25 19:16:07 2015
@@ -632,12 +632,13 @@ bool Type::hasIntegerRepresentation() co
bool Type::isIntegralType(ASTContext &Ctx) const {
if (const BuiltinType *BT = dyn_cast<BuiltinType>(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<EnumType>(CanonicalType))
- return ET->getDecl()->isComplete(); // Complete enum types are integral in C.
-
+ return ET->getDecl()->isComplete();
+
return false;
}
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=233234&r1=233233&r2=233234&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Mar 25 19:16:07 2015
@@ -1762,8 +1762,8 @@ bool Sema::IsIntegralPromotion(Expr *Fro
// 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 *Fro
// 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 *Fro
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).
More information about the cfe-commits
mailing list