diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 1a85bd8b3ecc..6704858f8df8 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -668,7 +668,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, = CondExpr->isTypeDependent() || CondExpr->isValueDependent(); unsigned CondWidth = HasDependentValue ? 0 : Context.getIntWidth(CondTypeBeforePromotion); - bool CondIsSigned + bool CondIsSigned = CondTypeBeforePromotion->isSignedIntegerOrEnumerationType(); // Accumulate all of the case values in a vector so that we can sort them @@ -985,7 +985,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, << CondTypeBeforePromotion; } - llvm::APSInt Hi = + llvm::APSInt Hi = RI->second->getRHS()->EvaluateKnownConstInt(Context); AdjustAPSInt(Hi, CondWidth, CondIsSigned); while (EI != EIend && EI->first < Hi) @@ -1033,12 +1033,12 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, switch (UnhandledNames.size()) { case 0: break; case 1: - Diag(CondExpr->getExprLoc(), TheDefaultStmt + Diag(CondExpr->getExprLoc(), TheDefaultStmt ? diag::warn_def_missing_case1 : diag::warn_missing_case1) << UnhandledNames[0]; break; case 2: - Diag(CondExpr->getExprLoc(), TheDefaultStmt + Diag(CondExpr->getExprLoc(), TheDefaultStmt ? diag::warn_def_missing_case2 : diag::warn_missing_case2) << UnhandledNames[0] << UnhandledNames[1]; break; @@ -1075,10 +1075,10 @@ void Sema::DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, Expr *SrcExpr) { unsigned DIAG = diag::warn_not_in_enum_assignement; - if (Diags.getDiagnosticLevel(DIAG, SrcExpr->getExprLoc()) + if (Diags.getDiagnosticLevel(DIAG, SrcExpr->getExprLoc()) == DiagnosticsEngine::Ignored) return; - + if (const EnumType *ET = DstType->getAs()) if (!Context.hasSameType(SrcType, DstType) && SrcType->isIntegerType()) { @@ -1093,7 +1093,7 @@ Sema::DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, typedef SmallVector, 64> EnumValsTy; EnumValsTy EnumVals; - + // Gather all enum values, set their type and sort them, // allowing easier comparison with rhs constant. for (EnumDecl::enumerator_iterator EDI = ED->enumerator_begin(); @@ -1107,7 +1107,7 @@ Sema::DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, std::stable_sort(EnumVals.begin(), EnumVals.end(), CmpEnumVals); EnumValsTy::iterator EIend = std::unique(EnumVals.begin(), EnumVals.end(), EqEnumVals); - + // See which case values aren't in enum. EnumValsTy::const_iterator EI = EnumVals.begin(); while (EI != EIend && EI->first < RhsVal) @@ -1248,7 +1248,7 @@ public: }; // end class DeclExtractor // DeclMatcher checks to see if the decls are used in a non-evauluated - // context. + // context. class DeclMatcher : public EvaluatedExprVisitor { llvm::SmallPtrSet &Decls; bool FoundDecl; @@ -1447,7 +1447,7 @@ ExprResult Sema::CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection) { if (!collection) return ExprError(); - + // Bail out early if we've got a type-dependent expression. if (collection->isTypeDependent()) return Owned(collection); @@ -1472,7 +1472,7 @@ Sema::CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection) { // If we have a forward-declared type, we can't do this check. // Under ARC, it is an error not to have a forward-declared class. - if (iface && + if (iface && RequireCompleteType(forLoc, QualType(objectType, 0), getLangOpts().ObjCAutoRefCount ? diag::err_arc_collection_forward @@ -1519,10 +1519,10 @@ Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc) { - - ExprResult CollectionExprResult = + + ExprResult CollectionExprResult = CheckObjCForCollectionOperand(ForLoc, collection); - + if (First) { QualType FirstType; if (DeclStmt *DS = dyn_cast(First)) { @@ -1553,12 +1553,12 @@ Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc, return StmtError(Diag(ForLoc, diag::err_selector_element_type) << FirstType << First->getSourceRange()); } - + if (CollectionExprResult.isInvalid()) return StmtError(); - - return Owned(new (Context) ObjCForCollectionStmt(First, - CollectionExprResult.take(), 0, + + return Owned(new (Context) ObjCForCollectionStmt(First, + CollectionExprResult.take(), 0, ForLoc, RParenLoc)); } @@ -1602,7 +1602,7 @@ static bool FinishForRangeVarDecl(Sema &SemaRef, VarDecl *Decl, Expr *Init, // In ARC, infer lifetime. // FIXME: ARC may want to turn this into 'const __unsafe_unretained' if // we're doing the equivalent of fast iteration. - if (SemaRef.getLangOpts().ObjCAutoRefCount && + if (SemaRef.getLangOpts().ObjCAutoRefCount && SemaRef.inferObjCARCLifetime(Decl)) Decl->setInvalidDecl(); @@ -1722,7 +1722,7 @@ Sema::ActOnCXXForRangeStmt(SourceLocation ForLoc, SourceLocation LParenLoc, SourceLocation RParenLoc) { if (!First || !Range) return StmtError(); - + if (ObjCEnumerationCollection(Range)) return ActOnObjCForCollectionStmt(ForLoc, LParenLoc, First, Range, RParenLoc); @@ -1977,13 +1977,13 @@ Sema::BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation ColonLoc, ColonLoc, RParenLoc)); } -/// FinishObjCForCollectionStmt - Attach the body to a objective-C foreach +/// FinishObjCForCollectionStmt - Attach the body to a objective-C foreach /// statement. StmtResult Sema::FinishObjCForCollectionStmt(Stmt *S, Stmt *B) { if (!S || !B) return StmtError(); ObjCForCollectionStmt * ForStmt = cast(S); - + ForStmt->setBody(B); return S; } @@ -1998,7 +1998,7 @@ StmtResult Sema::FinishCXXForRangeStmt(Stmt *S, Stmt *B) { if (isa(S)) return FinishObjCForCollectionStmt(S, B); - + CXXForRangeStmt *ForStmt = cast(S); ForStmt->setBody(B); @@ -2227,7 +2227,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { FnRetType = RetValExp->getType(); else FnRetType = CurCap->ReturnType = Context.DependentTy; - } else { + } else { if (RetValExp) { // C++11 [expr.lambda.prim]p4 bans inferring the result from an // initializer list, because it is not an expression (even @@ -2327,7 +2327,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // Check for unexpanded parameter packs. if (RetValExp && DiagnoseUnexpandedParameterPack(RetValExp)) return StmtError(); - + if (isa(getCurFunction())) return ActOnCapScopeReturnStmt(ReturnLoc, RetValExp); @@ -2343,7 +2343,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { FnRetType = MD->getResultType(); if (MD->hasRelatedResultType() && MD->getClassInterface()) { // In the implementation of a method with a related return type, the - // type used to type-check the validity of return statements within the + // type used to type-check the validity of return statements within the // method body is a pointer to the type of the class being implemented. RelatedRetType = Context.getObjCInterfaceType(MD->getClassInterface()); RelatedRetType = Context.getObjCObjectPointerType(RelatedRetType); @@ -2517,7 +2517,7 @@ static bool CheckAsmLValue(const Expr *E, Sema &S) { /// isOperandMentioned - Return true if the specified operand # is mentioned /// anywhere in the decomposed asm string. -static bool isOperandMentioned(unsigned OpNo, +static bool isOperandMentioned(unsigned OpNo, ArrayRef AsmStrPieces) { for (unsigned p = 0, e = AsmStrPieces.size(); p != e; ++p) { const AsmStmt::AsmStringPiece &Piece = AsmStrPieces[p]; @@ -3199,17 +3199,17 @@ StmtResult Sema::BuildMSDependentExistsStmt(SourceLocation KeywordLoc, Stmt *Nested) { return new (Context) MSDependentExistsStmt(KeywordLoc, IsIfExists, - QualifierLoc, NameInfo, + QualifierLoc, NameInfo, cast(Nested)); } -StmtResult Sema::ActOnMSDependentExistsStmt(SourceLocation KeywordLoc, +StmtResult Sema::ActOnMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, - CXXScopeSpec &SS, + CXXScopeSpec &SS, UnqualifiedId &Name, Stmt *Nested) { - return BuildMSDependentExistsStmt(KeywordLoc, IsIfExists, + return BuildMSDependentExistsStmt(KeywordLoc, IsIfExists, SS.getWithLocInContext(Context), GetNameFromUnqualifiedId(Name), Nested);