Index: lib/AST/Type.cpp =================================================================== --- lib/AST/Type.cpp +++ lib/AST/Type.cpp @@ -1,4 +1,4 @@ -//===--- Type.cpp - Type representation and manipulation ------------------===// +//===--- Type.cpp - Type representation and manipulation --------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -27,6 +27,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Support/raw_ostream.h" #include + using namespace clang; bool Qualifiers::isStrictSupersetOf(Qualifiers Other) const { @@ -190,7 +191,7 @@ /// This method should never be used when type qualifiers are meaningful. const Type *Type::getArrayElementTypeNoTypeQual() const { // If this is directly an array type, return it. - if (const ArrayType *ATy = dyn_cast(this)) + if (const auto *ATy = dyn_cast(this)) return ATy->getElementType().getTypePtr(); // If the canonical form of this type isn't the right kind, reject it. @@ -226,7 +227,7 @@ #define ABSTRACT_TYPE(Class, Parent) #define TYPE(Class, Parent) \ case Type::Class: { \ - const Class##Type *ty = cast(this); \ + const auto *ty = cast(this); \ if (!ty->isSugared()) return QualType(ty, 0); \ return ty->desugar(); \ } @@ -245,7 +246,7 @@ #define ABSTRACT_TYPE(Class, Parent) #define TYPE(Class, Parent) \ case Type::Class: { \ - const Class##Type *Ty = cast(CurTy); \ + const auto *Ty = cast(CurTy); \ if (!Ty->isSugared()) \ return SplitQualType(Ty, Qs); \ Cur = Ty->desugar(); \ @@ -274,7 +275,7 @@ #define ABSTRACT_TYPE(Class, Parent) #define TYPE(Class, Parent) \ case Type::Class: { \ - const Class##Type *ty = cast(split.Ty); \ + const auto *ty = cast(split.Ty); \ if (!ty->isSugared()) goto done; \ next = ty->desugar(); \ break; \ @@ -307,13 +308,13 @@ /// reaches a T or a non-sugared type. template static const T *getAsSugar(const Type *Cur) { while (true) { - if (const T *Sugar = dyn_cast(Cur)) + if (const auto *Sugar = dyn_cast(Cur)) return Sugar; switch (Cur->getTypeClass()) { #define ABSTRACT_TYPE(Class, Parent) #define TYPE(Class, Parent) \ case Type::Class: { \ - const Class##Type *Ty = cast(Cur); \ + const auto *Ty = cast(Cur); \ if (!Ty->isSugared()) return 0; \ Cur = Ty->desugar().getTypePtr(); \ break; \ @@ -346,7 +347,7 @@ #define ABSTRACT_TYPE(Class, Parent) #define TYPE(Class, Parent) \ case Class: { \ - const Class##Type *Ty = cast(Cur); \ + const auto *Ty = cast(Cur); \ if (!Ty->isSugared()) return Cur; \ Cur = Ty->desugar().getTypePtr(); \ break; \ @@ -395,7 +396,7 @@ } bool Type::isComplexType() const { - if (const ComplexType *CT = dyn_cast(CanonicalType)) + if (const auto *CT = dyn_cast(CanonicalType)) return CT->getElementType()->isFloatingType(); return false; } @@ -430,13 +431,13 @@ const RecordType *Type::getAsStructureType() const { // If this is directly a structure type, return it. - if (const RecordType *RT = dyn_cast(this)) { + if (const auto *RT = dyn_cast(this)) { if (RT->getDecl()->isStruct()) return RT; } // If the canonical form of this type isn't the right kind, reject it. - if (const RecordType *RT = dyn_cast(CanonicalType)) { + if (const auto *RT = dyn_cast(CanonicalType)) { if (!RT->getDecl()->isStruct()) return nullptr; @@ -449,13 +450,13 @@ const RecordType *Type::getAsUnionType() const { // If this is directly a union type, return it. - if (const RecordType *RT = dyn_cast(this)) { + if (const auto *RT = dyn_cast(this)) { if (RT->getDecl()->isUnion()) return RT; } // If the canonical form of this type isn't the right kind, reject it. - if (const RecordType *RT = dyn_cast(CanonicalType)) { + if (const auto *RT = dyn_cast(CanonicalType)) { if (!RT->getDecl()->isUnion()) return nullptr; @@ -519,7 +520,7 @@ bool Type::isObjCInertUnsafeUnretainedType() const { const Type *cur = this; while (true) { - if (auto attributed = dyn_cast(cur)) { + if (const auto *attributed = dyn_cast(cur)) { if (attributed->getAttrKind() == AttributedType::attr_objc_inert_unsafe_unretained) return true; @@ -651,7 +652,6 @@ } namespace { - template QualType simpleTransform(ASTContext &ctx, QualType type, F &&f); @@ -1057,7 +1057,6 @@ // from the split type. return ctx.getQualifiedType(result, splitType.Quals); } - } // end anonymous namespace /// Substitute the given type arguments for Objective-C type @@ -1073,7 +1072,8 @@ // Replace an Objective-C type parameter reference with the corresponding // type argument. if (const auto *typedefTy = dyn_cast(splitType.Ty)) { - if (auto *typeParam = dyn_cast(typedefTy->getDecl())) { + if (const auto *typeParam = + dyn_cast(typedefTy->getDecl())) { // If we have type arguments, use them. if (!typeArgs.empty()) { // FIXME: Introduce SubstObjCTypeParamType ? @@ -1277,12 +1277,12 @@ Optional> Type::getObjCSubstitutions( const DeclContext *dc) const { // Look through method scopes. - if (auto method = dyn_cast(dc)) + if (const auto *method = dyn_cast(dc)) dc = method->getDeclContext(); // Find the class or category in which the type we're substituting // was declared. - const ObjCInterfaceDecl *dcClassDecl = dyn_cast(dc); + const auto *dcClassDecl = dyn_cast(dc); const ObjCCategoryDecl *dcCategoryDecl = nullptr; ObjCTypeParamList *dcTypeParams = nullptr; if (dcClassDecl) { @@ -1584,14 +1584,14 @@ return Visit(T->getOriginalType()); } }; -} +} // end anonymous namespace AutoType *Type::getContainedAutoType() const { return GetContainedAutoVisitor().Visit(this); } bool Type::hasIntegerRepresentation() const { - if (const VectorType *VT = dyn_cast(CanonicalType)) + if (const auto *VT = dyn_cast(CanonicalType)) return VT->getElementType()->isIntegerType(); else return isIntegerType(); @@ -1617,21 +1617,20 @@ /// /// \returns true if the type is considered an integral type, false otherwise. bool Type::isIntegralType(ASTContext &Ctx) const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) + if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() >= BuiltinType::Bool && BT->getKind() <= BuiltinType::Int128; // Complete enum types are integral in C. if (!Ctx.getLangOpts().CPlusPlus) - if (const EnumType *ET = dyn_cast(CanonicalType)) + if (const auto *ET = dyn_cast(CanonicalType)) return ET->getDecl()->isComplete(); return false; } - bool Type::isIntegralOrUnscopedEnumerationType() const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) + if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() >= BuiltinType::Bool && BT->getKind() <= BuiltinType::Int128; @@ -1639,16 +1638,14 @@ // enumeration type in the sense required here. // C++0x: However, if the underlying type of the enum is fixed, it is // considered complete. - if (const EnumType *ET = dyn_cast(CanonicalType)) + if (const auto *ET = dyn_cast(CanonicalType)) return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped(); return false; } - - bool Type::isCharType() const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) + if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() == BuiltinType::Char_U || BT->getKind() == BuiltinType::UChar || BT->getKind() == BuiltinType::Char_S || @@ -1657,20 +1654,20 @@ } bool Type::isWideCharType() const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) + if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() == BuiltinType::WChar_S || BT->getKind() == BuiltinType::WChar_U; return false; } bool Type::isChar16Type() const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) + if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() == BuiltinType::Char16; return false; } bool Type::isChar32Type() const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) + if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() == BuiltinType::Char32; return false; } @@ -1678,7 +1675,7 @@ /// \brief Determine whether this type is any of the built-in character /// types. bool Type::isAnyCharacterType() const { - const BuiltinType *BT = dyn_cast(CanonicalType); + const auto *BT = dyn_cast(CanonicalType); if (!BT) return false; switch (BT->getKind()) { default: return false; @@ -1698,12 +1695,12 @@ /// signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], /// an enum decl which has a signed representation bool Type::isSignedIntegerType() const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) { + if (const auto *BT = dyn_cast(CanonicalType)) { return BT->getKind() >= BuiltinType::Char_S && BT->getKind() <= BuiltinType::Int128; } - if (const EnumType *ET = dyn_cast(CanonicalType)) { + if (const auto *ET = dyn_cast(CanonicalType)) { // Incomplete enum types are not treated as integer types. // FIXME: In C++, enum types are never integer types. if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped()) @@ -1714,12 +1711,12 @@ } bool Type::isSignedIntegerOrEnumerationType() const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) { + if (const auto *BT = dyn_cast(CanonicalType)) { return BT->getKind() >= BuiltinType::Char_S && BT->getKind() <= BuiltinType::Int128; } - if (const EnumType *ET = dyn_cast(CanonicalType)) { + if (const auto *ET = dyn_cast(CanonicalType)) { if (ET->getDecl()->isComplete()) return ET->getDecl()->getIntegerType()->isSignedIntegerType(); } @@ -1728,7 +1725,7 @@ } bool Type::hasSignedIntegerRepresentation() const { - if (const VectorType *VT = dyn_cast(CanonicalType)) + if (const auto *VT = dyn_cast(CanonicalType)) return VT->getElementType()->isSignedIntegerOrEnumerationType(); else return isSignedIntegerOrEnumerationType(); @@ -1738,12 +1735,12 @@ /// unsigned, according to C99 6.2.5p6 [which returns true for _Bool], an enum /// decl which has an unsigned representation bool Type::isUnsignedIntegerType() const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) { + if (const auto *BT = dyn_cast(CanonicalType)) { return BT->getKind() >= BuiltinType::Bool && BT->getKind() <= BuiltinType::UInt128; } - if (const EnumType *ET = dyn_cast(CanonicalType)) { + if (const auto *ET = dyn_cast(CanonicalType)) { // Incomplete enum types are not treated as integer types. // FIXME: In C++, enum types are never integer types. if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped()) @@ -1754,12 +1751,12 @@ } bool Type::isUnsignedIntegerOrEnumerationType() const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) { + if (const auto *BT = dyn_cast(CanonicalType)) { return BT->getKind() >= BuiltinType::Bool && BT->getKind() <= BuiltinType::UInt128; } - if (const EnumType *ET = dyn_cast(CanonicalType)) { + if (const auto *ET = dyn_cast(CanonicalType)) { if (ET->getDecl()->isComplete()) return ET->getDecl()->getIntegerType()->isUnsignedIntegerType(); } @@ -1768,48 +1765,48 @@ } bool Type::hasUnsignedIntegerRepresentation() const { - if (const VectorType *VT = dyn_cast(CanonicalType)) + if (const auto *VT = dyn_cast(CanonicalType)) return VT->getElementType()->isUnsignedIntegerOrEnumerationType(); else return isUnsignedIntegerOrEnumerationType(); } bool Type::isFloatingType() const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) + if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() >= BuiltinType::Half && BT->getKind() <= BuiltinType::LongDouble; - if (const ComplexType *CT = dyn_cast(CanonicalType)) + if (const auto *CT = dyn_cast(CanonicalType)) return CT->getElementType()->isFloatingType(); return false; } bool Type::hasFloatingRepresentation() const { - if (const VectorType *VT = dyn_cast(CanonicalType)) + if (const auto *VT = dyn_cast(CanonicalType)) return VT->getElementType()->isFloatingType(); else return isFloatingType(); } bool Type::isRealFloatingType() const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) + if (const auto *BT = dyn_cast(CanonicalType)) return BT->isFloatingPoint(); return false; } bool Type::isRealType() const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) + if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() >= BuiltinType::Bool && BT->getKind() <= BuiltinType::LongDouble; - if (const EnumType *ET = dyn_cast(CanonicalType)) + if (const auto *ET = dyn_cast(CanonicalType)) return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped(); return false; } bool Type::isArithmeticType() const { - if (const BuiltinType *BT = dyn_cast(CanonicalType)) + if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() >= BuiltinType::Bool && BT->getKind() <= BuiltinType::LongDouble; - if (const EnumType *ET = dyn_cast(CanonicalType)) + if (const auto *ET = dyn_cast(CanonicalType)) // GCC allows forward declaration of enum types (forbid by C99 6.7.2.3p2). // If a body isn't seen by the time we get here, return false. // @@ -1824,7 +1821,7 @@ assert(isScalarType()); const Type *T = CanonicalType.getTypePtr(); - if (const BuiltinType *BT = dyn_cast(T)) { + if (const auto *BT = dyn_cast(T)) { if (BT->getKind() == BuiltinType::Bool) return STK_Bool; if (BT->getKind() == BuiltinType::NullPtr) return STK_CPointer; if (BT->isInteger()) return STK_Integral; @@ -1841,7 +1838,7 @@ } else if (isa(T)) { assert(cast(T)->getDecl()->isComplete()); return STK_Integral; - } else if (const ComplexType *CT = dyn_cast(T)) { + } else if (const auto *CT = dyn_cast(T)) { if (CT->getElementType()->isRealFloatingType()) return STK_FloatingComplex; return STK_IntegralComplex; @@ -1860,8 +1857,8 @@ /// subsumes the notion of C aggregates (C99 6.2.5p21) because it also /// includes union types. bool Type::isAggregateType() const { - if (const RecordType *Record = dyn_cast(CanonicalType)) { - if (CXXRecordDecl *ClassDecl = dyn_cast(Record->getDecl())) + if (const auto *Record = dyn_cast(CanonicalType)) { + if (const auto *ClassDecl = dyn_cast(Record->getDecl())) return ClassDecl->isAggregate(); return true; @@ -1949,8 +1946,7 @@ ->isIncompleteType(Def); case ObjCInterface: { // ObjC interfaces are incomplete if they are @class, not @interface. - ObjCInterfaceDecl *Interface - = cast(CanonicalType)->getDecl(); + auto *Interface = cast(CanonicalType)->getDecl(); if (Def) *Def = Interface; return !Interface->hasDefinition(); @@ -2017,7 +2013,7 @@ return true; case Type::Record: - if (CXXRecordDecl *ClassDecl + if (const auto *ClassDecl = dyn_cast(cast(CanonicalType)->getDecl())) return ClassDecl->isPOD(); @@ -2071,8 +2067,7 @@ if (CanonicalType->isScalarType() || CanonicalType->isVectorType()) return true; if (const RecordType *RT = CanonicalType->getAs()) { - if (const CXXRecordDecl *ClassDecl = - dyn_cast(RT->getDecl())) { + if (const auto *ClassDecl = dyn_cast(RT->getDecl())) { // C++11 [class]p6: // A trivial class is a class that has a default constructor, // has no non-trivial default constructors, and is trivially @@ -2132,8 +2127,7 @@ return true; if (const RecordType *RT = CanonicalType->getAs()) { - if (const CXXRecordDecl *ClassDecl = - dyn_cast(RT->getDecl())) { + if (const auto *ClassDecl = dyn_cast(RT->getDecl())) { if (!ClassDecl->isTriviallyCopyable()) return false; } @@ -2144,8 +2138,6 @@ return false; } - - bool Type::isLiteralType(const ASTContext &Ctx) const { if (isDependentType()) return false; @@ -2193,8 +2185,7 @@ // -- all non-static data members and base classes of literal types // // We resolve DR1361 by ignoring the second bullet. - if (const CXXRecordDecl *ClassDecl = - dyn_cast(RT->getDecl())) + if (const auto *ClassDecl = dyn_cast(RT->getDecl())) return ClassDecl->isLiteral(); return true; @@ -2231,8 +2222,7 @@ // As an extension, Clang treats vector types as Scalar types. if (BaseTy->isScalarType() || BaseTy->isVectorType()) return true; if (const RecordType *RT = BaseTy->getAs()) { - if (const CXXRecordDecl *ClassDecl = - dyn_cast(RT->getDecl())) + if (const auto *ClassDecl = dyn_cast(RT->getDecl())) if (!ClassDecl->isStandardLayout()) return false; @@ -2283,8 +2273,7 @@ // As an extension, Clang treats vector types as Scalar types. if (BaseTy->isScalarType() || BaseTy->isVectorType()) return true; if (const RecordType *RT = BaseTy->getAs()) { - if (const CXXRecordDecl *ClassDecl = - dyn_cast(RT->getDecl())) { + if (const auto *ClassDecl = dyn_cast(RT->getDecl())) { // C++11 [class]p10: // A POD struct is a non-union class that is both a trivial class [...] if (!ClassDecl->isTrivial()) return false; @@ -2487,11 +2476,11 @@ bool Type::isElaboratedTypeSpecifier() const { ElaboratedTypeKeyword Keyword; - if (const ElaboratedType *Elab = dyn_cast(this)) + if (const auto *Elab = dyn_cast(this)) Keyword = Elab->getKeyword(); - else if (const DependentNameType *DepName = dyn_cast(this)) + else if (const auto *DepName = dyn_cast(this)) Keyword = DepName->getKeyword(); - else if (const DependentTemplateSpecializationType *DepTST = + else if (const auto *DepTST = dyn_cast(this)) Keyword = DepTST->getKeyword(); else @@ -2679,7 +2668,7 @@ FunctionTypeBits.RefQualifier = epi.RefQualifier; // Fill in the trailing argument array. - QualType *argSlot = reinterpret_cast(this+1); + auto *argSlot = reinterpret_cast(this+1); for (unsigned i = 0; i != NumParams; ++i) { if (params[i]->isDependentType()) setDependent(); @@ -2723,8 +2712,7 @@ } else if (getExceptionSpecType() == EST_Uninstantiated) { // Store the function decl from which we will resolve our // exception specification. - FunctionDecl **slot = - reinterpret_cast(argSlot + NumParams); + auto **slot = reinterpret_cast(argSlot + NumParams); slot[0] = epi.ExceptionSpec.SourceDecl; slot[1] = epi.ExceptionSpec.SourceTemplate; // This exception specification doesn't make the type dependent, because @@ -2732,13 +2720,12 @@ } else if (getExceptionSpecType() == EST_Unevaluated) { // Store the function decl from which we will resolve our // exception specification. - FunctionDecl **slot = - reinterpret_cast(argSlot + NumParams); + auto **slot = reinterpret_cast(argSlot + NumParams); slot[0] = epi.ExceptionSpec.SourceDecl; } if (epi.ConsumedParameters) { - bool *consumedParams = const_cast(getConsumedParamsBuffer()); + auto *consumedParams = const_cast(getConsumedParamsBuffer()); for (unsigned i = 0; i != NumParams; ++i) consumedParams[i] = epi.ConsumedParameters[i]; } @@ -3132,8 +3119,7 @@ T.getKind() == TemplateName::SubstTemplateTemplateParmPack) && "Unexpected template name for TemplateSpecializationType"); - TemplateArgument *TemplateArgs - = reinterpret_cast(this + 1); + auto *TemplateArgs = reinterpret_cast(this + 1); for (unsigned Arg = 0; Arg < NumArgs; ++Arg) { // Update instantiation-dependent and variably-modified bits. // If the canonical type exists and is non-dependent, the template @@ -3155,7 +3141,7 @@ // Store the aliased type if this is a type alias template specialization. if (TypeAlias) { - TemplateArgument *Begin = reinterpret_cast(this + 1); + auto *Begin = reinterpret_cast(this + 1); *reinterpret_cast(Begin + getNumArgs()) = AliasedType; } } @@ -3209,7 +3195,6 @@ } namespace { - /// \brief The cached properties of a type. class CachedProperties { Linkage L; @@ -3227,7 +3212,7 @@ L.hasLocalOrUnnamedType() | R.hasLocalOrUnnamedType()); } }; -} +} // end anonymous namespace static CachedProperties computeCachedProperties(const Type *T); @@ -3269,7 +3254,7 @@ T->TypeBits.CachedLocalOrUnnamed = Result.hasLocalOrUnnamedType(); } }; -} +} // namespace clang // Instantiate the friend template at a private class. In a // reasonable implementation, these symbols will be internal. @@ -3305,7 +3290,7 @@ case Type::Record: case Type::Enum: { - const TagDecl *Tag = cast(T)->getDecl(); + const auto *Tag = cast(T)->getDecl(); // C++ [basic.link]p8: // - it is a class or enumeration type that is named (or has a name @@ -3331,7 +3316,7 @@ case Type::RValueReference: return Cache::get(cast(T)->getPointeeType()); case Type::MemberPointer: { - const MemberPointerType *MPT = cast(T); + const auto *MPT = cast(T); return merge(Cache::get(MPT->getClass()), Cache::get(MPT->getPointeeType())); } @@ -3345,7 +3330,7 @@ case Type::FunctionNoProto: return Cache::get(cast(T)->getReturnType()); case Type::FunctionProto: { - const FunctionProtoType *FPT = cast(T); + const auto *FPT = cast(T); CachedProperties result = Cache::get(FPT->getReturnType()); for (const auto &ai : FPT->param_types()) result = merge(result, Cache::get(ai)); @@ -3414,7 +3399,7 @@ case Type::RValueReference: return computeLinkageInfo(cast(T)->getPointeeType()); case Type::MemberPointer: { - const MemberPointerType *MPT = cast(T); + const auto *MPT = cast(T); LinkageInfo LV = computeLinkageInfo(MPT->getClass()); LV.merge(computeLinkageInfo(MPT->getPointeeType())); return LV; @@ -3429,7 +3414,7 @@ case Type::FunctionNoProto: return computeLinkageInfo(cast(T)->getReturnType()); case Type::FunctionProto: { - const FunctionProtoType *FPT = cast(T); + const auto *FPT = cast(T); LinkageInfo LV = computeLinkageInfo(FPT->getReturnType()); for (const auto &ai : FPT->param_types()) LV.merge(computeLinkageInfo(ai)); @@ -3474,7 +3459,7 @@ do { // Check whether this is an attributed type with nullability // information. - if (auto attributed = dyn_cast(type.getTypePtr())) { + if (const auto *attributed = dyn_cast(type.getTypePtr())) { if (auto nullability = attributed->getImmediateNullability()) return nullability; } @@ -3617,7 +3602,7 @@ } Optional AttributedType::stripOuterNullability(QualType &T) { - if (auto attributed = dyn_cast(T.getTypePtr())) { + if (const auto *attributed = dyn_cast(T.getTypePtr())) { if (auto nullability = attributed->getImmediateNullability()) { T = attributed->getModifiedType(); return nullability; @@ -3673,11 +3658,10 @@ const Type *canon = getCanonicalTypeInternal().getTypePtr(); // Walk down to the base type. We don't care about qualifiers for this. - while (const ArrayType *array = dyn_cast(canon)) + while (const auto *array = dyn_cast(canon)) canon = array->getElementType().getTypePtr(); - if (const ObjCObjectPointerType *opt - = dyn_cast(canon)) { + if (const auto *opt = dyn_cast(canon)) { // Class and Class don't require retention. if (opt->getObjectType()->isObjCClass()) return true; @@ -3687,12 +3671,13 @@ } bool Type::isObjCNSObjectType() const { - if (const TypedefType *typedefType = dyn_cast(this)) + if (const auto *typedefType = dyn_cast(this)) return typedefType->getDecl()->hasAttr(); return false; } + bool Type::isObjCIndependentClassType() const { - if (const TypedefType *typedefType = dyn_cast(this)) + if (const auto *typedefType = dyn_cast(this)) return typedefType->getDecl()->hasAttr(); return false; } @@ -3701,6 +3686,7 @@ isBlockPointerType() || isObjCNSObjectType(); } + bool Type::isObjCIndirectLifetimeType() const { if (isObjCLifetimeType()) return true;