From: Chad Rosier Date: Tue, 26 Jun 2012 21:41:40 +0000 (+0000) Subject: Whitespace. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=91cbbbf506c892a26d4301e2b3ccd377b0938817;p=clang Whitespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159229 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 35019b5fc0..694a94d556 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -35,19 +35,19 @@ using namespace clang; /// isOmittedBlockReturnType - Return true if this declarator is missing a -/// return type because this is a omitted return type on a block literal. +/// return type because this is a omitted return type on a block literal. static bool isOmittedBlockReturnType(const Declarator &D) { if (D.getContext() != Declarator::BlockLiteralContext || D.getDeclSpec().hasTypeSpecifier()) return false; - + if (D.getNumTypeObjects() == 0) return true; // ^{ ... } - + if (D.getNumTypeObjects() == 1 && D.getTypeObject(0).Kind == DeclaratorChunk::Function) return true; // ^(int X, float Y) { ... } - + return false; } @@ -412,7 +412,7 @@ static void distributeFunctionTypeAttr(TypeProcessingState &state, continue; } } - + diagnoseBadTypeAttribute(state.getSema(), attr, type); } @@ -587,7 +587,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { SourceLocation DeclLoc = declarator.getIdentifierLoc(); if (DeclLoc.isInvalid()) DeclLoc = DS.getLocStart(); - + ASTContext &Context = S.Context; QualType Result; @@ -640,7 +640,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { Result = Context.getObjCObjectPointerType(Result); break; } - + // If this is a missing declspec in a block literal return context, then it // is inferred from the return statements inside the block. // The declspec is always missing in a lambda expr context; it is either @@ -696,7 +696,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { case DeclSpec::TSW_long: Result = Context.LongTy; break; case DeclSpec::TSW_longlong: Result = Context.LongLongTy; - + // long long is a C99 feature. if (!S.getLangOpts().C99) S.Diag(DS.getTypeSpecWidthLoc(), @@ -711,7 +711,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { case DeclSpec::TSW_long: Result = Context.UnsignedLongTy; break; case DeclSpec::TSW_longlong: Result = Context.UnsignedLongLongTy; - + // long long is a C99 feature. if (!S.getLangOpts().C99) S.Diag(DS.getTypeSpecWidthLoc(), @@ -763,10 +763,10 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { // If the type is deprecated or unavailable, diagnose it. S.DiagnoseUseOfDecl(D, DS.getTypeSpecTypeNameLoc()); - + assert(DS.getTypeSpecWidth() == 0 && DS.getTypeSpecComplex() == 0 && DS.getTypeSpecSign() == 0 && "No qualifiers on tag names!"); - + // TypeQuals handled by caller. Result = Context.getTypeDeclType(D); @@ -859,7 +859,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { Result = Context.IntTy; declarator.setInvalidType(true); } - break; + break; case DeclSpec::TST_auto: { // TypeQuals handled by caller. @@ -879,7 +879,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { Result = Context.IntTy; declarator.setInvalidType(true); } - break; + break; case DeclSpec::TST_error: Result = Context.IntTy; @@ -984,15 +984,15 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { // C90 6.5.3 constraints: "The same type qualifier shall not appear more // than once in the same specifier-list or qualifier-list, either directly // or via one or more typedefs." - if (!S.getLangOpts().C99 && !S.getLangOpts().CPlusPlus + if (!S.getLangOpts().C99 && !S.getLangOpts().CPlusPlus && TypeQuals & Result.getCVRQualifiers()) { if (TypeQuals & DeclSpec::TQ_const && Result.isConstQualified()) { - S.Diag(DS.getConstSpecLoc(), diag::ext_duplicate_declspec) + S.Diag(DS.getConstSpecLoc(), diag::ext_duplicate_declspec) << "const"; } if (TypeQuals & DeclSpec::TQ_volatile && Result.isVolatileQualified()) { - S.Diag(DS.getVolatileSpecLoc(), diag::ext_duplicate_declspec) + S.Diag(DS.getVolatileSpecLoc(), diag::ext_duplicate_declspec) << "volatile"; } @@ -1037,7 +1037,7 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc, if (!PTy->getPointeeType()->isIncompleteOrObjectType()) { DiagID = diag::err_typecheck_invalid_restrict_invalid_pointee; ProblemTy = T->getAs()->getPointeeType(); - } + } } else if (!Ty->isDependentType()) { // FIXME: this deserves a proper diagnostic DiagID = diag::err_typecheck_invalid_restrict_invalid_pointee; @@ -1158,14 +1158,14 @@ QualType Sema::BuildPointerType(QualType T, QualType Sema::BuildReferenceType(QualType T, bool SpelledAsLValue, SourceLocation Loc, DeclarationName Entity) { - assert(Context.getCanonicalType(T) != Context.OverloadTy && + assert(Context.getCanonicalType(T) != Context.OverloadTy && "Unresolved overloaded function type"); - + // C++0x [dcl.ref]p6: - // If a typedef (7.1.3), a type template-parameter (14.3.1), or a - // decltype-specifier (7.1.6.2) denotes a type TR that is a reference to a - // type T, an attempt to create the type "lvalue reference to cv TR" creates - // the type "lvalue reference to T", while an attempt to create the type + // If a typedef (7.1.3), a type template-parameter (14.3.1), or a + // decltype-specifier (7.1.6.2) denotes a type TR that is a reference to a + // type T, an attempt to create the type "lvalue reference to cv TR" creates + // the type "lvalue reference to T", while an attempt to create the type // "rvalue reference to cv TR" creates the type TR. bool LValueRef = SpelledAsLValue || T->getAs(); @@ -1209,15 +1209,15 @@ static bool isArraySizeVLA(Sema &S, Expr *ArraySize, llvm::APSInt &SizeVal) { class VLADiagnoser : public Sema::VerifyICEDiagnoser { public: VLADiagnoser() : Sema::VerifyICEDiagnoser(true) {} - + virtual void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) { } - + virtual void diagnoseFold(Sema &S, SourceLocation Loc, SourceRange SR) { S.Diag(Loc, diag::ext_vla_folded_to_constant) << SR; } } Diagnoser; - + return S.VerifyIntegerConstantExpression(ArraySize, &SizeVal, Diagnoser, S.LangOpts.GNUMode).isInvalid(); } @@ -1246,7 +1246,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, if (getLangOpts().CPlusPlus) { // C++ [dcl.array]p1: // T is called the array element type; this type shall not be a reference - // type, the (possibly cv-qualified) type void, a function type or an + // type, the (possibly cv-qualified) type void, a function type or an // abstract class type. // // Note: function types are handled in the common path with C. @@ -1255,16 +1255,16 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, << getPrintableNameForEntity(Entity) << T; return QualType(); } - + if (T->isVoidType()) { Diag(Loc, diag::err_illegal_decl_array_incomplete_type) << T; return QualType(); } - - if (RequireNonAbstractType(Brackets.getBegin(), T, + + if (RequireNonAbstractType(Brackets.getBegin(), T, diag::err_array_of_abstract_type)) return QualType(); - + } else { // C99 6.7.5.2p1: If the element type is an incomplete or function type, // reject it (e.g. void ary[7], struct foo ary[7], void ary[7]()) @@ -1360,7 +1360,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, if (ConstVal == 0) { // GCC accepts zero sized static arrays. We allow them when // we're not in a SFINAE context. - Diag(ArraySize->getLocStart(), + Diag(ArraySize->getLocStart(), isSFINAEContext()? diag::err_typecheck_zero_array_size : diag::ext_typecheck_zero_array_size) << ArraySize->getSourceRange(); @@ -1371,9 +1371,9 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, << ArraySize->getSourceRange(); ASM = ArrayType::Normal; } - } else if (!T->isDependentType() && !T->isVariablyModifiedType() && + } else if (!T->isDependentType() && !T->isVariablyModifiedType() && !T->isIncompleteType()) { - // Is the array too large? + // Is the array too large? unsigned ActiveSizeBits = ConstantArrayType::getNumAddressingBits(Context, T, ConstVal); if (ActiveSizeBits > ConstantArrayType::getMaxSizeBits(Context)) @@ -1381,7 +1381,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, << ConstVal.toString(10) << ArraySize->getSourceRange(); } - + T = Context.getConstantArrayType(T, ConstVal, ASM, Quals); } // If this is not C99, extwarn about VLA's and C99 array size modifiers. @@ -1389,13 +1389,13 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, if (T->isVariableArrayType()) { // Prohibit the use of non-POD types in VLAs. QualType BaseT = Context.getBaseElementType(T); - if (!T->isDependentType() && + if (!T->isDependentType() && !BaseT.isPODType(Context) && !BaseT->isObjCLifetimeType()) { Diag(Loc, diag::err_vla_non_pod) << BaseT; return QualType(); - } + } // Prohibit the use of VLAs during template argument deduction. else if (isSFINAEContext()) { Diag(Loc, diag::err_vla_in_sfinae); @@ -1490,7 +1490,7 @@ QualType Sema::BuildFunctionType(QualType T, SourceLocation Loc, DeclarationName Entity, FunctionType::ExtInfo Info) { if (T->isArrayType() || T->isFunctionType()) { - Diag(Loc, diag::err_func_returning_array_function) + Diag(Loc, diag::err_func_returning_array_function) << T->isFunctionType() << T; return QualType(); } @@ -1598,7 +1598,7 @@ QualType Sema::BuildMemberPointerType(QualType T, QualType Class, /// /// \returns A suitable block pointer type, if there are no /// errors. Otherwise, returns a NULL type. -QualType Sema::BuildBlockPointerType(QualType T, +QualType Sema::BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity) { if (!T->isFunctionType()) { @@ -1694,7 +1694,7 @@ static void inferARCWriteback(TypeProcessingState &state, // Otherwise, modify the type in-place. Qualifiers qs; - + if (declSpecType->isObjCARCImplicitlyUnretainedType()) qs.addObjCLifetime(Qualifiers::OCL_ExplicitNone); else @@ -1792,7 +1792,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, case UnqualifiedId::IK_LiteralOperatorId: case UnqualifiedId::IK_TemplateId: T = ConvertDeclSpecToType(state); - + if (!D.isInvalidType() && D.getDeclSpec().isTypeSpecOwned()) { OwnedTagDecl = cast(D.getDeclSpec().getRepAsDecl()); // Owned declaration is embedded in declarator. @@ -1804,14 +1804,14 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, case UnqualifiedId::IK_ConstructorTemplateId: case UnqualifiedId::IK_DestructorName: // Constructors and destructors don't have return types. Use - // "void" instead. + // "void" instead. T = SemaRef.Context.VoidTy; break; case UnqualifiedId::IK_ConversionFunctionId: // The result type of a conversion function is the type that it // converts to. - T = SemaRef.GetTypeFromParser(D.getName().ConversionFunctionId, + T = SemaRef.GetTypeFromParser(D.getName().ConversionFunctionId, &ReturnTypeInfo); break; } @@ -2303,7 +2303,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, EPI.RefQualifier = !FTI.hasRefQualifier()? RQ_None : FTI.RefQualifierIsLValueRef? RQ_LValue : RQ_RValue; - + // Otherwise, we have a function with an argument list that is // potentially variadic. SmallVector ArgTys; @@ -2319,7 +2319,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, assert(!ArgTy.isNull() && "Couldn't parse type?"); // Adjust the parameter type. - assert((ArgTy == Context.getAdjustedParameterType(ArgTy)) && + assert((ArgTy == Context.getAdjustedParameterType(ArgTy)) && "Unadjusted type?"); // Look for 'void'. void is allowed only as a single argument to a @@ -2382,7 +2382,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, SmallVector DynamicExceptions; SmallVector DynamicExceptionRanges; Expr *NoexceptExpr = 0; - + if (FTI.getExceptionSpecType() == EST_Dynamic) { // FIXME: It's rather inefficient to have to split into two vectors // here. @@ -2396,14 +2396,14 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, } else if (FTI.getExceptionSpecType() == EST_ComputedNoexcept) { NoexceptExpr = FTI.NoexceptExpr; } - + S.checkExceptionSpecification(FTI.getExceptionSpecType(), DynamicExceptions, DynamicExceptionRanges, NoexceptExpr, Exceptions, EPI); - + if (FTI.getExceptionSpecType() == EST_None && ImplicitlyNoexcept && chunkIndex == 0) { // Only the outermost chunk is marked noexcept, of course. @@ -2483,7 +2483,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, const FunctionProtoType *FnTy = T->getAs(); assert(FnTy && "Why oh why is there not a FunctionProtoType here?"); - // C++ 8.3.5p4: + // C++ 8.3.5p4: // A cv-qualifier-seq shall only be part of the function type // for a nonstatic member function, the function type to which a pointer // to member refers, or the top-level function type of a function typedef @@ -2511,7 +2511,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, // Rebuild function type adding a 'const' qualifier. FunctionProtoType::ExtProtoInfo EPI = FnTy->getExtProtoInfo(); EPI.TypeQuals |= DeclSpec::TQ_const; - T = Context.getFunctionType(FnTy->getResultType(), + T = Context.getFunctionType(FnTy->getResultType(), FnTy->arg_type_begin(), FnTy->getNumArgs(), EPI); } @@ -2564,7 +2564,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, EPI.TypeQuals = 0; EPI.RefQualifier = RQ_None; - T = Context.getFunctionType(FnTy->getResultType(), + T = Context.getFunctionType(FnTy->getResultType(), FnTy->arg_type_begin(), FnTy->getNumArgs(), EPI); } @@ -2580,31 +2580,31 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, // C++0x [dcl.constexpr]p9: // A constexpr specifier used in an object declaration declares the object - // as const. + // as const. if (D.getDeclSpec().isConstexprSpecified() && T->isObjectType()) { T.addConst(); } - // If there was an ellipsis in the declarator, the declaration declares a + // If there was an ellipsis in the declarator, the declaration declares a // parameter pack whose type may be a pack expansion type. if (D.hasEllipsis() && !T.isNull()) { // C++0x [dcl.fct]p13: - // A declarator-id or abstract-declarator containing an ellipsis shall + // A declarator-id or abstract-declarator containing an ellipsis shall // only be used in a parameter-declaration. Such a parameter-declaration // is a parameter pack (14.5.3). [...] switch (D.getContext()) { case Declarator::PrototypeContext: // C++0x [dcl.fct]p13: - // [...] When it is part of a parameter-declaration-clause, the - // parameter pack is a function parameter pack (14.5.3). The type T + // [...] When it is part of a parameter-declaration-clause, the + // parameter pack is a function parameter pack (14.5.3). The type T // of the declarator-id of the function parameter pack shall contain - // a template parameter pack; each template parameter pack in T is + // a template parameter pack; each template parameter pack in T is // expanded by the function parameter pack. // // We represent function parameter packs as function parameters whose // type is a pack expansion. if (!T->containsUnexpandedParameterPack()) { - S.Diag(D.getEllipsisLoc(), + S.Diag(D.getEllipsisLoc(), diag::err_function_parameter_pack_without_parameter_packs) << T << D.getSourceRange(); D.setEllipsisLoc(SourceLocation()); @@ -2612,10 +2612,10 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, T = Context.getPackExpansionType(T, llvm::Optional()); } break; - + case Declarator::TemplateParamContext: // C++0x [temp.param]p15: - // If a template-parameter is a [...] is a parameter-declaration that + // If a template-parameter is a [...] is a parameter-declaration that // declares a parameter pack (8.3.5), then the template-parameter is a // template parameter pack (14.5.3). // @@ -2630,7 +2630,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, ? diag::warn_cxx98_compat_variadic_templates : diag::ext_variadic_templates); break; - + case Declarator::FileContext: case Declarator::KNRTypeListContext: case Declarator::ObjCParameterContext: // FIXME: special diagnostic here? @@ -2683,7 +2683,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S) { if (D.isPrototypeContext() && getLangOpts().ObjCAutoRefCount) inferARCWriteback(state, T); - + return GetFullTypeForDeclarator(state, T, ReturnTypeInfo); } @@ -2770,7 +2770,7 @@ static void transferARCOwnership(TypeProcessingState &state, if (inner == -1) return; - DeclaratorChunk &chunk = D.getTypeObject(inner); + DeclaratorChunk &chunk = D.getTypeObject(inner); if (chunk.Kind == DeclaratorChunk::Pointer) { if (declSpecTy->isObjCRetainableType()) return transferARCOwnershipToDeclSpec(S, declSpecTy, ownership); @@ -2863,7 +2863,7 @@ namespace { const DeclSpec &DS; public: - TypeSpecLocFiller(ASTContext &Context, const DeclSpec &DS) + TypeSpecLocFiller(ASTContext &Context, const DeclSpec &DS) : Context(Context), DS(DS) {} void VisitAttributedTypeLoc(AttributedTypeLoc TL) { @@ -3011,7 +3011,7 @@ namespace { void VisitAtomicTypeLoc(AtomicTypeLoc TL) { TL.setKWLoc(DS.getTypeSpecTypeLoc()); TL.setParensRange(DS.getTypeofParensRange()); - + TypeSourceInfo *TInfo = 0; Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo); TL.getValueLoc().initializeFullCopy(TInfo->getTypeLoc()); @@ -3153,9 +3153,9 @@ Sema::GetTypeSourceInfoForDeclarator(Declarator &D, QualType T, // Handle parameter packs whose type is a pack expansion. if (isa(T)) { cast(CurrTL).setEllipsisLoc(D.getEllipsisLoc()); - CurrTL = CurrTL.getNextTypeLoc().getUnqualifiedLoc(); + CurrTL = CurrTL.getNextTypeLoc().getUnqualifiedLoc(); } - + for (unsigned i = 0, e = D.getNumTypeObjects(); i != e; ++i) { while (isa(CurrTL)) { AttributedTypeLoc TL = cast(CurrTL); @@ -3166,7 +3166,7 @@ Sema::GetTypeSourceInfoForDeclarator(Declarator &D, QualType T, DeclaratorLocFiller(Context, D.getTypeObject(i)).Visit(CurrTL); CurrTL = CurrTL.getNextTypeLoc().getUnqualifiedLoc(); } - + // If we have different source information for the return type, use // that. This really only applies to C++ conversion functions. if (ReturnTypeInfo) { @@ -3176,7 +3176,7 @@ Sema::GetTypeSourceInfoForDeclarator(Declarator &D, QualType T, } else { TypeSpecLocFiller(Context, D.getDeclSpec()).Visit(CurrTL); } - + return TInfo; } @@ -3185,7 +3185,7 @@ ParsedType Sema::CreateParsedType(QualType T, TypeSourceInfo *TInfo) { // FIXME: LocInfoTypes are "transient", only needed for passing to/from Parser // and Sema during declaration parsing. Try deallocating/caching them when // it's appropriate, instead of allocating them and keeping them around. - LocInfoType *LocT = (LocInfoType*)BumpAlloc.Allocate(sizeof(LocInfoType), + LocInfoType *LocT = (LocInfoType*)BumpAlloc.Allocate(sizeof(LocInfoType), TypeAlignment); new (LocT) LocInfoType(T, TInfo); assert(LocT->getTypeClass() != T->getTypeClass() && @@ -3315,13 +3315,13 @@ static bool hasDirectOwnershipQualifier(QualType type) { // X *__strong (...) } else if (const ParenType *paren = dyn_cast(type)) { type = paren->getInnerType(); - + // That's it for things we want to complain about. In particular, // we do not want to look through typedefs, typeof(expr), // typeof(type), or any other way that the type is somehow // abstracted. } else { - + return false; } } @@ -3450,8 +3450,8 @@ static bool handleObjCOwnershipTypeAttr(TypeProcessingState &state, attr.setInvalid(); return true; } - - // Forbid __weak for class objects marked as + + // Forbid __weak for class objects marked as // objc_arc_weak_reference_unavailable if (lifetime == Qualifiers::OCL_Weak) { QualType T = type; @@ -3461,12 +3461,12 @@ static bool handleObjCOwnershipTypeAttr(TypeProcessingState &state, ObjCInterfaceDecl *Class = ObjT->getInterfaceDecl(); if (Class->isArcWeakrefUnavailable()) { S.Diag(AttrLoc, diag::err_arc_unsupported_weak_class); - S.Diag(ObjT->getInterfaceDecl()->getLocation(), + S.Diag(ObjT->getInterfaceDecl()->getLocation(), diag::note_class_declared); } } } - + return true; } @@ -3716,7 +3716,7 @@ static bool handleFunctionTypeAttr(TypeProcessingState &state, return true; } - FunctionType::ExtInfo EI = + FunctionType::ExtInfo EI = unwrapped.get()->getExtInfo().withRegParm(value); type = unwrapped.wrap(S, S.Context.adjustFunctionType(unwrapped.get(), EI)); return true; @@ -3871,11 +3871,11 @@ static void HandleVectorSizeAttr(QualType& CurType, const AttributeList &Attr, /// \brief Process the OpenCL-like ext_vector_type attribute when it occurs on /// a type. -static void HandleExtVectorTypeAttr(QualType &CurType, - const AttributeList &Attr, +static void HandleExtVectorTypeAttr(QualType &CurType, + const AttributeList &Attr, Sema &S) { Expr *sizeExpr; - + // Special case where the argument is a template id. if (Attr.getParameterName()) { CXXScopeSpec SS; @@ -3887,7 +3887,7 @@ static void HandleExtVectorTypeAttr(QualType &CurType, id, false, false); if (Size.isInvalid()) return; - + sizeExpr = Size.get(); } else { // check the attribute arguments. @@ -3897,7 +3897,7 @@ static void HandleExtVectorTypeAttr(QualType &CurType, } sizeExpr = Attr.getArg(0); } - + // Create the vector type. QualType T = S.BuildExtVectorType(CurType, sizeExpr, Attr.getLoc()); if (!T.isNull()) @@ -4033,7 +4033,7 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type, case AttributeList::AT_NSReturnsRetained: if (!state.getSema().getLangOpts().ObjCAutoRefCount) - break; + break; // fallthrough into the function attrs FUNCTION_TYPE_ATTRS_CASELIST: @@ -4081,7 +4081,7 @@ bool Sema::RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser){ if (VarDecl *Var = dyn_cast(DRE->getDecl())) { if (Var->isStaticDataMember() && Var->getInstantiatedFromStaticDataMember()) { - + MemberSpecializationInfo *MSInfo = Var->getMemberSpecializationInfo(); assert(MSInfo && "Missing member specialization information?"); if (MSInfo->getTemplateSpecializationKind() @@ -4089,15 +4089,15 @@ bool Sema::RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser){ // If we don't already have a point of instantiation, this is it. if (MSInfo->getPointOfInstantiation().isInvalid()) { MSInfo->setPointOfInstantiation(E->getLocStart()); - - // This is a modification of an existing AST node. Notify + + // This is a modification of an existing AST node. Notify // listeners. if (ASTMutationListener *L = getASTMutationListener()) L->StaticDataMemberInstantiated(Var); } - + InstantiateStaticDataMemberDefinition(E->getExprLoc(), Var); - + // Update the type to the newly instantiated definition's type both // here and within the expression. if (VarDecl *Def = Var->getDefinition()) { @@ -4107,7 +4107,7 @@ bool Sema::RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser){ E->setType(T); } } - + // We still go on to try to complete the type independently, as it // may also require instantiations or diagnostics if it remains // incomplete. @@ -4129,10 +4129,10 @@ bool Sema::RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser){ namespace { struct TypeDiagnoserDiag : Sema::TypeDiagnoser { unsigned DiagID; - + TypeDiagnoserDiag(unsigned DiagID) : Sema::TypeDiagnoser(DiagID == 0), DiagID(DiagID) {} - + virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) { if (Suppressed) return; S.Diag(Loc, DiagID) << T; @@ -4178,7 +4178,7 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, // If we know about the definition but it is not visible, complain. if (!Diagnoser.Suppressed && Def && !LookupResult::isVisible(Def)) { // Suppress this error outside of a SFINAE context if we've already - // emitted the error once for this type. There's no usefulness in + // emitted the error once for this type. There's no usefulness in // repeating the diagnostic. // FIXME: Add a Fix-It that imports the corresponding module or includes // the header. @@ -4187,13 +4187,13 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, Diag(Def->getLocation(), diag::note_previous_definition); } } - + return false; } const TagType *Tag = T->getAs(); const ObjCInterfaceType *IFace = 0; - + if (Tag) { // Avoid diagnosing invalid decls as incomplete. if (Tag->getDecl()->isInvalidDecl()) @@ -4210,7 +4210,7 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, // Avoid diagnosing invalid decls as incomplete. if (IFace->getDecl()->isInvalidDecl()) return true; - + // Give the external AST source a chance to complete the type. if (IFace->getDecl()->hasExternalLexicalStorage()) { Context.getExternalSource()->CompleteType(IFace->getDecl()); @@ -4218,7 +4218,7 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, return false; } } - + // If we have a class template specialization or a class member of a // class template specialization, or an array with known size of such, // try to instantiate it. @@ -4254,7 +4254,7 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, // We have an incomplete type. Produce a diagnostic. Diagnoser.diagnose(*this, Loc, T); - + // If the type was a forward declaration of a class/struct/union // type, produce a note. if (Tag && !Tag->getDecl()->isInvalidDecl()) @@ -4262,7 +4262,7 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, Tag->isBeingDefined() ? diag::note_type_being_defined : diag::note_forward_declaration) << QualType(Tag, 0); - + // If the Objective-C class was a forward declaration, produce a note. if (IFace && !IFace->getDecl()->isInvalidDecl()) Diag(IFace->getDecl()->getLocation(), diag::note_forward_class); @@ -4271,7 +4271,7 @@ bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, } bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, - unsigned DiagID) { + unsigned DiagID) { TypeDiagnoserDiag Diagnoser(DiagID); return RequireCompleteType(Loc, T, Diagnoser); } @@ -4376,7 +4376,7 @@ bool Sema::RequireLiteralType(SourceLocation Loc, QualType T, return true; } -bool Sema::RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID) { +bool Sema::RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID) { TypeDiagnoserDiag Diagnoser(DiagID); return RequireLiteralType(Loc, T, Diagnoser); } @@ -4422,8 +4422,8 @@ static QualType getDecltypeForExpr(Sema &S, Expr *E) { // The type denoted by decltype(e) is defined as follows: // // - if e is an unparenthesized id-expression or an unparenthesized class - // member access (5.2.5), decltype(e) is the type of the entity named - // by e. If there is no such entity, or if e names a set of overloaded + // member access (5.2.5), decltype(e) is the type of the entity named + // by e. If there is no such entity, or if e names a set of overloaded // functions, the program is ill-formed; if (const DeclRefExpr *DRE = dyn_cast(E)) { if (const ValueDecl *VD = dyn_cast(DRE->getDecl())) @@ -4433,7 +4433,7 @@ static QualType getDecltypeForExpr(Sema &S, Expr *E) { if (const FieldDecl *FD = dyn_cast(ME->getMemberDecl())) return FD->getType(); } - + // C++11 [expr.lambda.prim]p18: // Every occurrence of decltype((x)) where x is a possibly // parenthesized id-expression that names an entity of automatic @@ -4459,16 +4459,16 @@ static QualType getDecltypeForExpr(Sema &S, Expr *E) { // [...] QualType T = E->getType(); switch (E->getValueKind()) { - // - otherwise, if e is an xvalue, decltype(e) is T&&, where T is the + // - otherwise, if e is an xvalue, decltype(e) is T&&, where T is the // type of e; case VK_XValue: T = S.Context.getRValueReferenceType(T); break; - // - otherwise, if e is an lvalue, decltype(e) is T&, where T is the + // - otherwise, if e is an lvalue, decltype(e) is T&, where T is the // type of e; case VK_LValue: T = S.Context.getLValueReferenceType(T); break; // - otherwise, decltype(e) is the type of e. case VK_RValue: break; } - + return T; } @@ -4476,7 +4476,7 @@ QualType Sema::BuildDecltypeType(Expr *E, SourceLocation Loc) { ExprResult ER = CheckPlaceholderExpr(E); if (ER.isInvalid()) return QualType(); E = ER.take(); - + return Context.getDecltypeType(E, getDecltypeForExpr(*this, E)); }