From: Richard Trieu Date: Fri, 9 Sep 2011 01:45:06 +0000 (+0000) Subject: Capitialize paramater names in SemaExpr.cpp and resolve any parameter name conflicts... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ccd891ae75e9678f1138868e50508c8083d021fa;p=clang Capitialize paramater names in SemaExpr.cpp and resolve any parameter name conflicts between declarations and definitions from this and previous refactorings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139346 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 007c783cfd..4d32169c5c 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -2247,13 +2247,13 @@ public: /// the function body is parsed, and then do a basic reachability analysis to /// determine if the statement is reachable. If it is unreachable, the /// diagnostic will not be emitted. - bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *stmt, + bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, const PartialDiagnostic &PD); // Primary Expressions. SourceRange getExprRange(Expr *E) const; - ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, UnqualifiedId &Name, + ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand); void DecomposeUnqualifiedId(const UnqualifiedId &Id, @@ -2266,7 +2266,8 @@ public: TemplateArgumentListInfo *ExplicitTemplateArgs = 0, Expr **Args = 0, unsigned NumArgs = 0); - ExprResult LookupInObjCMethod(LookupResult &R, Scope *S, IdentifierInfo *II, + ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, + IdentifierInfo *II, bool AllowBuiltinCreation=false); ExprResult ActOnDependentIdExpression(const CXXScopeSpec &SS, @@ -2307,29 +2308,30 @@ public: ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, - bool ADL); + bool NeedsADL); ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, NamedDecl *D); ExprResult ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind); - ExprResult ActOnNumericConstant(const Token &); - ExprResult ActOnCharacterConstant(const Token &); - ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *Val); + ExprResult ActOnNumericConstant(const Token &Tok); + ExprResult ActOnCharacterConstant(const Token &Tok); + ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E); ExprResult ActOnParenOrParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val); /// ActOnStringLiteral - The specified tokens were lexed as pasted string /// fragments (e.g. "foo" "bar" L"baz"). - ExprResult ActOnStringLiteral(const Token *Toks, unsigned NumToks); + ExprResult ActOnStringLiteral(const Token *StringToks, + unsigned NumStringToks); ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, - MultiTypeArg Types, - MultiExprArg Exprs); + MultiTypeArg ArgTypes, + MultiExprArg ArgExprs); ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, @@ -2340,13 +2342,13 @@ public: // Binary/Unary Operators. 'Tok' is the token for the operator. ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, - Expr *InputArg); + Expr *InputExpr); ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, - UnaryOperatorKind Opc, Expr *input); + UnaryOperatorKind Opc, Expr *Input); ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Op, Expr *Input); - ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *T, + ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R); @@ -2355,15 +2357,15 @@ public: ExprResult ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, - bool isType, void *TyOrEx, + bool IsType, void *TyOrEx, const SourceRange &ArgRange); ExprResult CheckPlaceholderExpr(Expr *E); bool CheckVecStepExpr(Expr *E); bool CheckUnaryExprOrTypeTraitOperand(Expr *E, UnaryExprOrTypeTrait ExprKind); - bool CheckUnaryExprOrTypeTraitOperand(QualType type, SourceLocation OpLoc, - SourceRange R, + bool CheckUnaryExprOrTypeTraitOperand(QualType ExprType, SourceLocation OpLoc, + SourceRange ExprRange, UnaryExprOrTypeTrait ExprKind); ExprResult ActOnSizeofParameterPackExpr(Scope *S, SourceLocation OpLoc, @@ -2429,20 +2431,21 @@ public: /// This provides the location of the left/right parens and a list of comma /// locations. ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, - MultiExprArg Args, SourceLocation RParenLoc, + MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig = 0); ExprResult BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc, Expr **Args, unsigned NumArgs, SourceLocation RParenLoc, - Expr *ExecConfig = 0); + Expr *Config = 0); ExprResult ActOnCUDAExecConfigExpr(Scope *S, SourceLocation LLLLoc, - MultiExprArg ExecConfig, SourceLocation GGGLoc); + MultiExprArg ExecConfig, + SourceLocation GGGLoc); ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, - SourceLocation RParenLoc, Expr *Op); + SourceLocation RParenLoc, Expr *CastExpr); ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, @@ -2458,16 +2461,16 @@ public: ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, - Expr *Op); + Expr *InitExpr); ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, - Expr *InitExpr); + Expr *LiteralExpr); - ExprResult ActOnInitList(SourceLocation LParenLoc, - MultiExprArg InitList, - SourceLocation RParenLoc); + ExprResult ActOnInitList(SourceLocation LBraceLoc, + MultiExprArg InitArgList, + SourceLocation RBraceLoc); ExprResult ActOnDesignatedInitializer(Designation &Desig, SourceLocation Loc, @@ -2475,21 +2478,21 @@ public: ExprResult Init); ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, - tok::TokenKind Kind, Expr *LHS, Expr *RHS); + tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr); ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, - BinaryOperatorKind Opc, Expr *lhs, Expr *rhs); - ExprResult CreateBuiltinBinOp(SourceLocation TokLoc, - BinaryOperatorKind Opc, Expr *lhs, Expr *rhs); + BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr); + ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, + Expr *LHSExpr, Expr *RHSExpr); /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null /// in the case of a the GNU conditional expr extension. ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, - Expr *Cond, Expr *LHS, Expr *RHS); + Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr); /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo". ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, - LabelDecl *LD); + LabelDecl *TheDecl); ExprResult ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc); // "({..})" @@ -2513,28 +2516,26 @@ public: ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, - ParsedType Arg1, + ParsedType ParsedArgTy, OffsetOfComponent *CompPtr, unsigned NumComponents, SourceLocation RParenLoc); // __builtin_choose_expr(constExpr, expr1, expr2) ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, - Expr *cond, Expr *expr1, - Expr *expr2, SourceLocation RPLoc); + Expr *CondExpr, Expr *LHSExpr, + Expr *RHSExpr, SourceLocation RPLoc); // __builtin_va_arg(expr, type) - ExprResult ActOnVAArg(SourceLocation BuiltinLoc, - Expr *expr, ParsedType type, + ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty, SourceLocation RPLoc); - ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, - Expr *expr, TypeSourceInfo *TInfo, - SourceLocation RPLoc); + ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, + TypeSourceInfo *TInfo, SourceLocation RPLoc); // __null ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc); - bool CheckCaseExpression(Expr *expr); + bool CheckCaseExpression(Expr *E); bool CheckMicrosoftIfExistsSymbol(CXXScopeSpec &SS, UnqualifiedId &Name); @@ -2554,13 +2555,13 @@ public: /// ActOnBlockStmtExpr - This is called when the body of a block statement /// literal was successfully completed. ^(int x){...} - ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, - Stmt *Body, Scope *CurScope); + ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, + Scope *CurScope); //===---------------------------- OpenCL Features -----------------------===// /// __builtin_astype(...) - ExprResult ActOnAsTypeExpr(Expr *expr, ParsedType DestTy, + ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc); @@ -5472,8 +5473,8 @@ public: // operators (C99 6.3.1.8). If both operands aren't arithmetic, this // routine returns the first non-arithmetic type found. The client is // responsible for emitting appropriate error diagnostics. - QualType UsualArithmeticConversions(ExprResult &lExpr, ExprResult &rExpr, - bool isCompAssign = false); + QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, + bool IsCompAssign = false); /// AssignConvertType - All of the 'assignment' semantic checks return this /// enum to indicate whether the assignment was allowed. These checks are @@ -5560,23 +5561,25 @@ public: /// argument passing, variable initialization, and function return values. /// C99 6.5.16. AssignConvertType CheckAssignmentConstraints(SourceLocation Loc, - QualType lhs, QualType rhs); + QualType LHSType, + QualType RHSType); /// Check assignment constraints and prepare for a conversion of the /// RHS to the LHS type. - AssignConvertType CheckAssignmentConstraints(QualType lhs, ExprResult &rhs, + AssignConvertType CheckAssignmentConstraints(QualType LHSType, + ExprResult &RHS, CastKind &Kind); // CheckSingleAssignmentConstraints - Currently used by // CheckAssignmentOperands, and ActOnReturnStmt. Prior to type checking, // this routine performs the default function/array converions. - AssignConvertType CheckSingleAssignmentConstraints(QualType lhs, - ExprResult &rExprRes); + AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, + ExprResult &RHS); // \brief If the lhs type is a transparent union, check whether we // can initialize the transparent union with the given expression. - AssignConvertType CheckTransparentUnionArgumentConstraints(QualType lhs, - ExprResult &rExpr); + AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, + ExprResult &RHS); bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType); @@ -5603,41 +5606,47 @@ public: /// or a null QualType (indicating an error diagnostic was issued). /// type checking binary operators (subroutines of CreateBuiltinBinOp). - QualType InvalidOperands(SourceLocation l, ExprResult &lex, ExprResult &rex); + QualType InvalidOperands(SourceLocation Loc, ExprResult &LHS, + ExprResult &RHS); QualType CheckPointerToMemberOperands( // C++ 5.5 ExprResult &lex, ExprResult &rex, ExprValueKind &VK, SourceLocation OpLoc, bool isIndirect); QualType CheckMultiplyDivideOperands( // C99 6.5.5 - ExprResult &lex, ExprResult &rex, SourceLocation OpLoc, bool isCompAssign, - bool isDivide); + ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, + bool IsDivide); QualType CheckRemainderOperands( // C99 6.5.5 - ExprResult &lex, ExprResult &rex, SourceLocation OpLoc, bool isCompAssign = false); + ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, + bool IsCompAssign = false); QualType CheckAdditionOperands( // C99 6.5.6 - ExprResult &lex, ExprResult &rex, SourceLocation OpLoc, QualType* CompLHSTy = 0); + ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, + QualType* CompLHSTy = 0); QualType CheckSubtractionOperands( // C99 6.5.6 - ExprResult &lex, ExprResult &rex, SourceLocation OpLoc, QualType* CompLHSTy = 0); + ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, + QualType* CompLHSTy = 0); QualType CheckShiftOperands( // C99 6.5.7 - ExprResult &lex, ExprResult &rex, SourceLocation OpLoc, unsigned Opc, - bool isCompAssign = false); + ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, unsigned Opc, + bool IsCompAssign = false); QualType CheckCompareOperands( // C99 6.5.8/9 - ExprResult &lex, ExprResult &rex, SourceLocation OpLoc, unsigned Opc, + ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, unsigned OpaqueOpc, bool isRelational); QualType CheckBitwiseOperands( // C99 6.5.[10...12] - ExprResult &lex, ExprResult &rex, SourceLocation OpLoc, bool isCompAssign = false); + ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, + bool IsCompAssign = false); QualType CheckLogicalOperands( // C99 6.5.[13,14] - ExprResult &lex, ExprResult &rex, SourceLocation OpLoc, unsigned Opc); + ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, unsigned Opc); // CheckAssignmentOperands is used for both simple and compound assignment. // For simple assignment, pass both expressions and a null converted type. // For compound assignment, pass both expressions and the converted type. QualType CheckAssignmentOperands( // C99 6.5.16.[1,2] - Expr *lex, ExprResult &rex, SourceLocation OpLoc, QualType convertedType); + Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType); - void ConvertPropertyForLValue(ExprResult &LHS, ExprResult &RHS, QualType& LHSTy); + void ConvertPropertyForLValue(ExprResult &LHS, ExprResult &RHS, + QualType& LHSTy); ExprResult ConvertPropertyForRValue(Expr *E); QualType CheckConditionalOperands( // C99 6.5.15 - ExprResult &cond, ExprResult &lhs, ExprResult &rhs, - ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc); + ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, + ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc); QualType CXXCheckConditionalOperands( // C++ 5.16 ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc); @@ -5653,16 +5662,16 @@ public: } QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, - SourceLocation questionLoc); + SourceLocation QuestionLoc); - bool DiagnoseConditionalForNull(Expr *LHS, Expr *RHS, + bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr, SourceLocation QuestionLoc); /// type checking for vector binary operators. - QualType CheckVectorOperands(ExprResult &lex, ExprResult &rex, - SourceLocation Loc, bool isCompAssign); - QualType CheckVectorCompareOperands(ExprResult &lex, ExprResult &rx, - SourceLocation l, bool isRel); + QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, + SourceLocation Loc, bool IsCompAssign); + QualType CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, + SourceLocation Loc, bool isRelational); /// type checking declaration initializers (C99 6.7.8) bool CheckInitList(const InitializedEntity &Entity, @@ -5700,14 +5709,14 @@ public: /// CheckCastTypes - Check type constraints for casting between types under /// C semantics, or forward to CXXCheckCStyleCast in C++. - ExprResult CheckCastTypes(SourceLocation CastStartLoc, SourceRange TyRange, - QualType CastTy, Expr *CastExpr, CastKind &Kind, + ExprResult CheckCastTypes(SourceLocation CastStartLoc, SourceRange TypeRange, + QualType CastType, Expr *CastExpr, CastKind &Kind, ExprValueKind &VK, CXXCastPath &BasePath, bool FunctionalStyle = false); - ExprResult checkUnknownAnyCast(SourceRange TyRange, QualType castType, - Expr *castExpr, CastKind &castKind, - ExprValueKind &valueKind, CXXCastPath &BasePath); + ExprResult checkUnknownAnyCast(SourceRange TypeRange, QualType CastType, + Expr *CastExpr, CastKind &CastKind, + ExprValueKind &VK, CXXCastPath &Path); // CheckVectorCast - check type constraints for vectors. // Since vectors are an extension, there are no C standard reference for this. @@ -5721,7 +5730,7 @@ public: // We allow casting between vectors and integer datatypes of the same size, // or vectors and the element type of that vector. // returns the cast expr - ExprResult CheckExtVectorCast(SourceRange R, QualType VectorTy, Expr *CastExpr, + ExprResult CheckExtVectorCast(SourceRange R, QualType DestTy, Expr *CastExpr, CastKind &Kind); /// CXXCheckCStyleCast - Check constraints of a C-style or function-style @@ -5785,10 +5794,10 @@ public: /// \param Loc - A location associated with the condition, e.g. the /// 'if' keyword. /// \return true iff there were any errors - ExprResult CheckBooleanCondition(Expr *CondExpr, SourceLocation Loc); + ExprResult CheckBooleanCondition(Expr *E, SourceLocation Loc); ExprResult ActOnBooleanCondition(Scope *S, SourceLocation Loc, - Expr *SubExpr); + Expr *SubExpr); /// DiagnoseAssignmentAsCondition - Given that an expression is /// being used as a boolean condition, warn if it's an assignment. @@ -5796,7 +5805,7 @@ public: /// \brief Redundant parentheses over an equality comparison can indicate /// that the user intended an assignment used as condition. - void DiagnoseEqualityWithExtraParens(ParenExpr *parenE); + void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE); /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid. ExprResult CheckCXXBooleanCondition(Expr *CondExpr); diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 3d00537b81..aab24175a1 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -262,9 +262,8 @@ void Sema::DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc, Diag(D->getLocation(), diag::note_sentinel_here) << isMethod; } -SourceRange Sema::getExprRange(ExprTy *E) const { - Expr *Ex = (Expr *)E; - return Ex? Ex->getSourceRange() : SourceRange(); +SourceRange Sema::getExprRange(Expr *E) const { + return E ? E->getSourceRange() : SourceRange(); } //===----------------------------------------------------------------------===// @@ -546,21 +545,21 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, /// /// \return false if the integer expression is an integer type and is /// successfully converted to the complex type. -static bool handleIntegerToComplexFloatConversion(Sema &S, ExprResult &intExpr, - ExprResult &complexExpr, - QualType intTy, - QualType complexTy, - bool skipCast) { - if (intTy->isComplexType() || intTy->isRealFloatingType()) return true; - if (skipCast) return false; - if (intTy->isIntegerType()) { - QualType fpTy = cast(complexTy)->getElementType(); - intExpr = S.ImpCastExprToType(intExpr.take(), fpTy, CK_IntegralToFloating); - intExpr = S.ImpCastExprToType(intExpr.take(), complexTy, +static bool handleIntegerToComplexFloatConversion(Sema &S, ExprResult &IntExpr, + ExprResult &ComplexExpr, + QualType IntTy, + QualType ComplexTy, + bool SkipCast) { + if (IntTy->isComplexType() || IntTy->isRealFloatingType()) return true; + if (SkipCast) return false; + if (IntTy->isIntegerType()) { + QualType fpTy = cast(ComplexTy)->getElementType(); + IntExpr = S.ImpCastExprToType(IntExpr.take(), fpTy, CK_IntegralToFloating); + IntExpr = S.ImpCastExprToType(IntExpr.take(), ComplexTy, CK_FloatingRealToComplex); } else { - assert(intTy->isComplexIntegerType()); - intExpr = S.ImpCastExprToType(intExpr.take(), complexTy, + assert(IntTy->isComplexIntegerType()); + IntExpr = S.ImpCastExprToType(IntExpr.take(), ComplexTy, CK_IntegralComplexToFloatingComplex); } return false; @@ -572,12 +571,12 @@ static QualType handleComplexFloatToComplexFloatConverstion(Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, - bool isCompAssign) { + bool IsCompAssign) { int order = S.Context.getFloatingTypeOrder(LHSType, RHSType); if (order < 0) { // _Complex float -> _Complex double - if (!isCompAssign) + if (!IsCompAssign) LHS = S.ImpCastExprToType(LHS.take(), RHSType, CK_FloatingComplexCast); return RHSType; } @@ -590,39 +589,39 @@ handleComplexFloatToComplexFloatConverstion(Sema &S, ExprResult &LHS, /// \brief Converts otherExpr to complex float and promotes complexExpr if /// necessary. Helper function of UsualArithmeticConversions() static QualType handleOtherComplexFloatConversion(Sema &S, - ExprResult &complexExpr, - ExprResult &otherExpr, - QualType complexTy, - QualType otherTy, - bool convertComplexExpr, - bool convertOtherExpr) { - int order = S.Context.getFloatingTypeOrder(complexTy, otherTy); + ExprResult &ComplexExpr, + ExprResult &OtherExpr, + QualType ComplexTy, + QualType OtherTy, + bool ConvertComplexExpr, + bool ConvertOtherExpr) { + int order = S.Context.getFloatingTypeOrder(ComplexTy, OtherTy); // If just the complexExpr is complex, the otherExpr needs to be converted, // and the complexExpr might need to be promoted. if (order > 0) { // complexExpr is wider // float -> _Complex double - if (convertOtherExpr) { - QualType fp = cast(complexTy)->getElementType(); - otherExpr = S.ImpCastExprToType(otherExpr.take(), fp, CK_FloatingCast); - otherExpr = S.ImpCastExprToType(otherExpr.take(), complexTy, + if (ConvertOtherExpr) { + QualType fp = cast(ComplexTy)->getElementType(); + OtherExpr = S.ImpCastExprToType(OtherExpr.take(), fp, CK_FloatingCast); + OtherExpr = S.ImpCastExprToType(OtherExpr.take(), ComplexTy, CK_FloatingRealToComplex); } - return complexTy; + return ComplexTy; } // otherTy is at least as wide. Find its corresponding complex type. - QualType result = (order == 0 ? complexTy : - S.Context.getComplexType(otherTy)); + QualType result = (order == 0 ? ComplexTy : + S.Context.getComplexType(OtherTy)); // double -> _Complex double - if (convertOtherExpr) - otherExpr = S.ImpCastExprToType(otherExpr.take(), result, + if (ConvertOtherExpr) + OtherExpr = S.ImpCastExprToType(OtherExpr.take(), result, CK_FloatingRealToComplex); // _Complex float -> _Complex double - if (convertComplexExpr && order < 0) - complexExpr = S.ImpCastExprToType(complexExpr.take(), result, + if (ConvertComplexExpr && order < 0) + ComplexExpr = S.ImpCastExprToType(ComplexExpr.take(), result, CK_FloatingComplexCast); return result; @@ -633,13 +632,13 @@ static QualType handleOtherComplexFloatConversion(Sema &S, static QualType handleComplexFloatConversion(Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, - bool isCompAssign) { + bool IsCompAssign) { // if we have an integer operand, the result is the complex type. if (!handleIntegerToComplexFloatConversion(S, RHS, LHS, RHSType, LHSType, /*skipCast*/false)) return LHSType; if (!handleIntegerToComplexFloatConversion(S, LHS, RHS, LHSType, RHSType, - /*skipCast*/isCompAssign)) + /*skipCast*/IsCompAssign)) return RHSType; // This handles complex/complex, complex/float, or float/complex. @@ -660,47 +659,47 @@ static QualType handleComplexFloatConversion(Sema &S, ExprResult &LHS, if (LHSComplexFloat && RHSComplexFloat) return handleComplexFloatToComplexFloatConverstion(S, LHS, RHS, LHSType, RHSType, - isCompAssign); + IsCompAssign); // If only one operand is complex, promote it if necessary and convert the // other operand to complex. if (LHSComplexFloat) return handleOtherComplexFloatConversion( - S, LHS, RHS, LHSType, RHSType, /*convertComplexExpr*/!isCompAssign, + S, LHS, RHS, LHSType, RHSType, /*convertComplexExpr*/!IsCompAssign, /*convertOtherExpr*/ true); assert(RHSComplexFloat); return handleOtherComplexFloatConversion( S, RHS, LHS, RHSType, LHSType, /*convertComplexExpr*/true, - /*convertOtherExpr*/ !isCompAssign); + /*convertOtherExpr*/ !IsCompAssign); } /// \brief Hande arithmetic conversion from integer to float. Helper function /// of UsualArithmeticConversions() -static QualType handleIntToFloatConversion(Sema &S, ExprResult &floatExpr, - ExprResult &intExpr, - QualType floatTy, QualType intTy, - bool convertFloat, bool convertInt) { - if (intTy->isIntegerType()) { - if (convertInt) +static QualType handleIntToFloatConversion(Sema &S, ExprResult &FloatExpr, + ExprResult &IntExpr, + QualType FloatTy, QualType IntTy, + bool ConvertFloat, bool ConvertInt) { + if (IntTy->isIntegerType()) { + if (ConvertInt) // Convert intExpr to the lhs floating point type. - intExpr = S.ImpCastExprToType(intExpr.take(), floatTy, + IntExpr = S.ImpCastExprToType(IntExpr.take(), FloatTy, CK_IntegralToFloating); - return floatTy; + return FloatTy; } // Convert both sides to the appropriate complex float. - assert(intTy->isComplexIntegerType()); - QualType result = S.Context.getComplexType(floatTy); + assert(IntTy->isComplexIntegerType()); + QualType result = S.Context.getComplexType(FloatTy); // _Complex int -> _Complex float - if (convertInt) - intExpr = S.ImpCastExprToType(intExpr.take(), result, + if (ConvertInt) + IntExpr = S.ImpCastExprToType(IntExpr.take(), result, CK_IntegralComplexToFloatingComplex); // float -> _Complex float - if (convertFloat) - floatExpr = S.ImpCastExprToType(floatExpr.take(), result, + if (ConvertFloat) + FloatExpr = S.ImpCastExprToType(FloatExpr.take(), result, CK_FloatingRealToComplex); return result; @@ -710,7 +709,7 @@ static QualType handleIntToFloatConversion(Sema &S, ExprResult &floatExpr, /// function of UsualArithmeticConversions() static QualType handleFloatConversion(Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, - QualType RHSType, bool isCompAssign) { + QualType RHSType, bool IsCompAssign) { bool LHSFloat = LHSType->isRealFloatingType(); bool RHSFloat = RHSType->isRealFloatingType(); @@ -724,19 +723,19 @@ static QualType handleFloatConversion(Sema &S, ExprResult &LHS, } assert(order < 0 && "illegal float comparison"); - if (!isCompAssign) + if (!IsCompAssign) LHS = S.ImpCastExprToType(LHS.take(), RHSType, CK_FloatingCast); return RHSType; } if (LHSFloat) return handleIntToFloatConversion(S, LHS, RHS, LHSType, RHSType, - /*convertFloat=*/!isCompAssign, + /*convertFloat=*/!IsCompAssign, /*convertInt=*/ true); assert(RHSFloat); return handleIntToFloatConversion(S, RHS, LHS, RHSType, LHSType, /*convertInt=*/ true, - /*convertFloat=*/!isCompAssign); + /*convertFloat=*/!IsCompAssign); } /// \brief Handle conversions with GCC complex int extension. Helper function @@ -746,7 +745,7 @@ static QualType handleFloatConversion(Sema &S, ExprResult &LHS, static QualType handleComplexIntConversion(Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, - bool isCompAssign) { + bool IsCompAssign) { const ComplexType *LHSComplexInt = LHSType->getAsComplexIntegerType(); const ComplexType *RHSComplexInt = RHSType->getAsComplexIntegerType(); @@ -760,7 +759,7 @@ static QualType handleComplexIntConversion(Sema &S, ExprResult &LHS, return LHSType; } - if (!isCompAssign) + if (!IsCompAssign) LHS = S.ImpCastExprToType(LHS.take(), RHSType, CK_IntegralComplexCast); return RHSType; } @@ -773,7 +772,7 @@ static QualType handleComplexIntConversion(Sema &S, ExprResult &LHS, assert(RHSComplexInt); // int -> _Complex int - if (!isCompAssign) + if (!IsCompAssign) LHS = S.ImpCastExprToType(LHS.take(), RHSType, CK_IntegralRealToComplex); return RHSType; } @@ -782,7 +781,7 @@ static QualType handleComplexIntConversion(Sema &S, ExprResult &LHS, /// UsualArithmeticConversions() static QualType handleIntegerConversion(Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, - QualType RHSType, bool isCompAssign) { + QualType RHSType, bool IsCompAssign) { // The rules for this case are in C99 6.3.1.8 int order = S.Context.getIntegerTypeOrder(LHSType, RHSType); bool LHSSigned = LHSType->hasSignedIntegerRepresentation(); @@ -792,7 +791,7 @@ static QualType handleIntegerConversion(Sema &S, ExprResult &LHS, if (order >= 0) { RHS = S.ImpCastExprToType(RHS.take(), LHSType, CK_IntegralCast); return LHSType; - } else if (!isCompAssign) + } else if (!IsCompAssign) LHS = S.ImpCastExprToType(LHS.take(), RHSType, CK_IntegralCast); return RHSType; } else if (order != (LHSSigned ? 1 : -1)) { @@ -801,7 +800,7 @@ static QualType handleIntegerConversion(Sema &S, ExprResult &LHS, if (RHSSigned) { RHS = S.ImpCastExprToType(RHS.take(), LHSType, CK_IntegralCast); return LHSType; - } else if (!isCompAssign) + } else if (!IsCompAssign) LHS = S.ImpCastExprToType(LHS.take(), RHSType, CK_IntegralCast); return RHSType; } else if (S.Context.getIntWidth(LHSType) != S.Context.getIntWidth(RHSType)) { @@ -811,7 +810,7 @@ static QualType handleIntegerConversion(Sema &S, ExprResult &LHS, if (LHSSigned) { RHS = S.ImpCastExprToType(RHS.take(), LHSType, CK_IntegralCast); return LHSType; - } else if (!isCompAssign) + } else if (!IsCompAssign) LHS = S.ImpCastExprToType(LHS.take(), RHSType, CK_IntegralCast); return RHSType; } else { @@ -822,7 +821,7 @@ static QualType handleIntegerConversion(Sema &S, ExprResult &LHS, QualType result = S.Context.getCorrespondingUnsignedType(LHSSigned ? LHSType : RHSType); RHS = S.ImpCastExprToType(RHS.take(), result, CK_IntegralCast); - if (!isCompAssign) + if (!IsCompAssign) LHS = S.ImpCastExprToType(LHS.take(), result, CK_IntegralCast); return result; } @@ -835,8 +834,8 @@ static QualType handleIntegerConversion(Sema &S, ExprResult &LHS, /// FIXME: verify the conversion rules for "complex int" are consistent with /// GCC. QualType Sema::UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, - bool isCompAssign) { - if (!isCompAssign) { + bool IsCompAssign) { + if (!IsCompAssign) { LHS = UsualUnaryConversions(LHS.take()); if (LHS.isInvalid()) return QualType(); @@ -869,7 +868,7 @@ QualType Sema::UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, QualType LHSBitfieldPromoteTy = Context.isPromotableBitField(LHS.get()); if (!LHSBitfieldPromoteTy.isNull()) LHSType = LHSBitfieldPromoteTy; - if (LHSType != LHSUnpromotedType && !isCompAssign) + if (LHSType != LHSUnpromotedType && !IsCompAssign) LHS = ImpCastExprToType(LHS.take(), LHSType, CK_IntegralCast); // If both types are identical, no conversion is needed. @@ -881,21 +880,21 @@ QualType Sema::UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, // Handle complex types first (C99 6.3.1.8p1). if (LHSType->isComplexType() || RHSType->isComplexType()) return handleComplexFloatConversion(*this, LHS, RHS, LHSType, RHSType, - isCompAssign); + IsCompAssign); // Now handle "real" floating types (i.e. float, double, long double). if (LHSType->isRealFloatingType() || RHSType->isRealFloatingType()) return handleFloatConversion(*this, LHS, RHS, LHSType, RHSType, - isCompAssign); + IsCompAssign); // Handle GCC complex int extension. if (LHSType->isComplexIntegerType() || RHSType->isComplexIntegerType()) return handleComplexIntConversion(*this, LHS, RHS, LHSType, RHSType, - isCompAssign); + IsCompAssign); // Finally, we have two differing integer types. return handleIntegerConversion(*this, LHS, RHS, LHSType, RHSType, - isCompAssign); + IsCompAssign); } //===----------------------------------------------------------------------===// @@ -908,13 +907,13 @@ Sema::ActOnGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, - MultiTypeArg types, - MultiExprArg exprs) { - unsigned NumAssocs = types.size(); - assert(NumAssocs == exprs.size()); + MultiTypeArg ArgTypes, + MultiExprArg ArgExprs) { + unsigned NumAssocs = ArgTypes.size(); + assert(NumAssocs == ArgExprs.size()); - ParsedType *ParsedTypes = types.release(); - Expr **Exprs = exprs.release(); + ParsedType *ParsedTypes = ArgTypes.release(); + Expr **Exprs = ArgExprs.release(); TypeSourceInfo **Types = new TypeSourceInfo*[NumAssocs]; for (unsigned i = 0; i < NumAssocs; ++i) { @@ -1186,21 +1185,21 @@ diagnoseUncapturableValueReference(Sema &S, SourceLocation loc, /// There is a well-formed capture at a particular scope level; /// propagate it through all the nested blocks. -static CaptureResult propagateCapture(Sema &S, unsigned validScopeIndex, - const BlockDecl::Capture &capture) { - VarDecl *var = capture.getVariable(); +static CaptureResult propagateCapture(Sema &S, unsigned ValidScopeIndex, + const BlockDecl::Capture &Capture) { + VarDecl *var = Capture.getVariable(); // Update all the inner blocks with the capture information. - for (unsigned i = validScopeIndex + 1, e = S.FunctionScopes.size(); + for (unsigned i = ValidScopeIndex + 1, e = S.FunctionScopes.size(); i != e; ++i) { BlockScopeInfo *innerBlock = cast(S.FunctionScopes[i]); innerBlock->Captures.push_back( - BlockDecl::Capture(capture.getVariable(), capture.isByRef(), - /*nested*/ true, capture.getCopyExpr())); + BlockDecl::Capture(Capture.getVariable(), Capture.isByRef(), + /*nested*/ true, Capture.getCopyExpr())); innerBlock->CaptureMap[var] = innerBlock->Captures.size(); // +1 } - return capture.isByRef() ? CR_CaptureByRef : CR_Capture; + return Capture.isByRef() ? CR_CaptureByRef : CR_Capture; } /// shouldCaptureValueReference - Determine if a reference to the @@ -1209,9 +1208,9 @@ static CaptureResult propagateCapture(Sema &S, unsigned validScopeIndex, /// This also keeps the captures set in the BlockScopeInfo records /// up-to-date. static CaptureResult shouldCaptureValueReference(Sema &S, SourceLocation loc, - ValueDecl *value) { + ValueDecl *Value) { // Only variables ever require capture. - VarDecl *var = dyn_cast(value); + VarDecl *var = dyn_cast(Value); if (!var) return CR_NoCapture; // Fast path: variables from the current context never require capture. @@ -1320,19 +1319,19 @@ static CaptureResult shouldCaptureValueReference(Sema &S, SourceLocation loc, blockScope->Captures.back()); } -static ExprResult BuildBlockDeclRefExpr(Sema &S, ValueDecl *vd, +static ExprResult BuildBlockDeclRefExpr(Sema &S, ValueDecl *VD, const DeclarationNameInfo &NameInfo, - bool byRef) { - assert(isa(vd) && "capturing non-variable"); + bool ByRef) { + assert(isa(VD) && "capturing non-variable"); - VarDecl *var = cast(vd); + VarDecl *var = cast(VD); assert(var->hasLocalStorage() && "capturing non-local"); - assert(byRef == var->hasAttr() && "byref set wrong"); + assert(ByRef == var->hasAttr() && "byref set wrong"); QualType exprType = var->getType().getNonReferenceType(); BlockDeclRefExpr *BDRE; - if (!byRef) { + if (!ByRef) { // The variable will be bound by copy; make it const within the // closure, but record that this was done in the expression. bool constAdded = !exprType.isConstQualified(); @@ -1597,8 +1596,8 @@ ExprResult Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS, UnqualifiedId &Id, bool HasTrailingLParen, - bool isAddressOfOperand) { - assert(!(isAddressOfOperand && HasTrailingLParen) && + bool IsAddressOfOperand) { + assert(!(IsAddressOfOperand && HasTrailingLParen) && "cannot be direct & operand and have a trailing lparen"); if (SS.isInvalid()) @@ -1640,7 +1639,7 @@ ExprResult Sema::ActOnIdExpression(Scope *S, } if (DependentID) - return ActOnDependentIdExpression(SS, NameInfo, isAddressOfOperand, + return ActOnDependentIdExpression(SS, NameInfo, IsAddressOfOperand, TemplateArgs); bool IvarLookupFollowUp = false; @@ -1660,7 +1659,7 @@ ExprResult Sema::ActOnIdExpression(Scope *S, if (MemberOfUnknownSpecialization || (R.getResultKind() == LookupResult::NotFoundInCurrentInstantiation)) - return ActOnDependentIdExpression(SS, NameInfo, isAddressOfOperand, + return ActOnDependentIdExpression(SS, NameInfo, IsAddressOfOperand, TemplateArgs); } else { IvarLookupFollowUp = (!SS.isSet() && II && getCurMethodDecl()); @@ -1669,7 +1668,7 @@ ExprResult Sema::ActOnIdExpression(Scope *S, // If the result might be in a dependent base class, this is a dependent // id-expression. if (R.getResultKind() == LookupResult::NotFoundInCurrentInstantiation) - return ActOnDependentIdExpression(SS, NameInfo, isAddressOfOperand, + return ActOnDependentIdExpression(SS, NameInfo, IsAddressOfOperand, TemplateArgs); // If this reference is in an Objective-C method, then we need to do @@ -1752,7 +1751,7 @@ ExprResult Sema::ActOnIdExpression(Scope *S, // instance method. if (!R.empty() && (*R.begin())->isCXXClassMember()) { bool MightBeImplicitMember; - if (!isAddressOfOperand) + if (!IsAddressOfOperand) MightBeImplicitMember = true; else if (!SS.isEmpty()) MightBeImplicitMember = false; @@ -2646,8 +2645,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok) { return Owned(Res); } -ExprResult Sema::ActOnParenExpr(SourceLocation L, - SourceLocation R, Expr *E) { +ExprResult Sema::ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E) { assert((E != 0) && "ActOnParenExpr() missing expr"); return Owned(new (Context) ParenExpr(L, R, E)); } @@ -2713,9 +2711,9 @@ static bool CheckObjCTraitOperandConstraints(Sema &S, QualType T, /// expression. The logic mostly mirrors the type-based overload, but may modify /// the expression as it completes the type for that expression through template /// instantiation, etc. -bool Sema::CheckUnaryExprOrTypeTraitOperand(Expr *Op, +bool Sema::CheckUnaryExprOrTypeTraitOperand(Expr *E, UnaryExprOrTypeTrait ExprKind) { - QualType ExprTy = Op->getType(); + QualType ExprTy = E->getType(); // C++ [expr.sizeof]p2: "When applied to a reference or a reference type, // the result is the size of the referenced type." @@ -2725,36 +2723,36 @@ bool Sema::CheckUnaryExprOrTypeTraitOperand(Expr *Op, ExprTy = Ref->getPointeeType(); if (ExprKind == UETT_VecStep) - return CheckVecStepTraitOperandType(*this, ExprTy, Op->getExprLoc(), - Op->getSourceRange()); + return CheckVecStepTraitOperandType(*this, ExprTy, E->getExprLoc(), + E->getSourceRange()); // Whitelist some types as extensions - if (!CheckExtensionTraitOperandType(*this, ExprTy, Op->getExprLoc(), - Op->getSourceRange(), ExprKind)) + if (!CheckExtensionTraitOperandType(*this, ExprTy, E->getExprLoc(), + E->getSourceRange(), ExprKind)) return false; - if (RequireCompleteExprType(Op, + if (RequireCompleteExprType(E, PDiag(diag::err_sizeof_alignof_incomplete_type) - << ExprKind << Op->getSourceRange(), + << ExprKind << E->getSourceRange(), std::make_pair(SourceLocation(), PDiag(0)))) return true; // Completeing the expression's type may have changed it. - ExprTy = Op->getType(); + ExprTy = E->getType(); if (const ReferenceType *Ref = ExprTy->getAs()) ExprTy = Ref->getPointeeType(); - if (CheckObjCTraitOperandConstraints(*this, ExprTy, Op->getExprLoc(), - Op->getSourceRange(), ExprKind)) + if (CheckObjCTraitOperandConstraints(*this, ExprTy, E->getExprLoc(), + E->getSourceRange(), ExprKind)) return true; if (ExprKind == UETT_SizeOf) { - if (DeclRefExpr *DeclRef = dyn_cast(Op->IgnoreParens())) { + if (DeclRefExpr *DeclRef = dyn_cast(E->IgnoreParens())) { if (ParmVarDecl *PVD = dyn_cast(DeclRef->getFoundDecl())) { QualType OType = PVD->getOriginalType(); QualType Type = PVD->getType(); if (Type->isPointerType() && OType->isArrayType()) { - Diag(Op->getExprLoc(), diag::warn_sizeof_array_param) + Diag(E->getExprLoc(), diag::warn_sizeof_array_param) << Type << OType; Diag(PVD->getLocation(), diag::note_declared_at); } @@ -2780,34 +2778,34 @@ bool Sema::CheckUnaryExprOrTypeTraitOperand(Expr *Op, /// standard conversions are not applied to the operand of sizeof. /// /// This policy is followed for all of the unary trait expressions. -bool Sema::CheckUnaryExprOrTypeTraitOperand(QualType exprType, +bool Sema::CheckUnaryExprOrTypeTraitOperand(QualType ExprType, SourceLocation OpLoc, SourceRange ExprRange, UnaryExprOrTypeTrait ExprKind) { - if (exprType->isDependentType()) + if (ExprType->isDependentType()) return false; // C++ [expr.sizeof]p2: "When applied to a reference or a reference type, // the result is the size of the referenced type." // C++ [expr.alignof]p3: "When alignof is applied to a reference type, the // result shall be the alignment of the referenced type." - if (const ReferenceType *Ref = exprType->getAs()) - exprType = Ref->getPointeeType(); + if (const ReferenceType *Ref = ExprType->getAs()) + ExprType = Ref->getPointeeType(); if (ExprKind == UETT_VecStep) - return CheckVecStepTraitOperandType(*this, exprType, OpLoc, ExprRange); + return CheckVecStepTraitOperandType(*this, ExprType, OpLoc, ExprRange); // Whitelist some types as extensions - if (!CheckExtensionTraitOperandType(*this, exprType, OpLoc, ExprRange, + if (!CheckExtensionTraitOperandType(*this, ExprType, OpLoc, ExprRange, ExprKind)) return false; - if (RequireCompleteType(OpLoc, exprType, + if (RequireCompleteType(OpLoc, ExprType, PDiag(diag::err_sizeof_alignof_incomplete_type) << ExprKind << ExprRange)) return true; - if (CheckObjCTraitOperandConstraints(*this, exprType, OpLoc, ExprRange, + if (CheckObjCTraitOperandConstraints(*this, ExprType, OpLoc, ExprRange, ExprKind)) return true; @@ -2911,12 +2909,12 @@ Sema::CreateUnaryExprOrTypeTraitExpr(Expr *E, SourceLocation OpLoc, /// Note that the ArgRange is invalid if isType is false. ExprResult Sema::ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc, - UnaryExprOrTypeTrait ExprKind, bool isType, + UnaryExprOrTypeTrait ExprKind, bool IsType, void *TyOrEx, const SourceRange &ArgRange) { // If error parsing type, ignore. if (TyOrEx == 0) return ExprError(); - if (isType) { + if (IsType) { TypeSourceInfo *TInfo; (void) GetTypeFromParser(ParsedType::getFromOpaquePtr(TyOrEx), &TInfo); return CreateUnaryExprOrTypeTraitExpr(TInfo, OpLoc, ExprKind, ArgRange); @@ -2928,7 +2926,7 @@ Sema::ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc, } static QualType CheckRealImagOperand(Sema &S, ExprResult &V, SourceLocation Loc, - bool isReal) { + bool IsReal) { if (V.get()->isTypeDependent()) return S.Context.DependentTy; @@ -2952,12 +2950,12 @@ static QualType CheckRealImagOperand(Sema &S, ExprResult &V, SourceLocation Loc, if (PR.isInvalid()) return QualType(); if (PR.get() != V.get()) { V = move(PR); - return CheckRealImagOperand(S, V, Loc, isReal); + return CheckRealImagOperand(S, V, Loc, IsReal); } // Reject anything else. S.Diag(Loc, diag::err_realimag_invalid_type) << V.get()->getType() - << (isReal ? "__real" : "__imag"); + << (IsReal ? "__real" : "__imag"); return QualType(); } @@ -3008,7 +3006,7 @@ Sema::ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, ExprResult Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, - Expr *Idx, SourceLocation RLoc) { + Expr *Idx, SourceLocation RLoc) { Expr *LHSExp = Base; Expr *RHSExp = Idx; @@ -3403,16 +3401,16 @@ static ExprResult rebuildUnknownAnyFunction(Sema &S, Expr *fn); /// locations. ExprResult Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, - MultiExprArg args, SourceLocation RParenLoc, + MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig) { - unsigned NumArgs = args.size(); + unsigned NumArgs = ArgExprs.size(); // Since this might be a postfix expression, get rid of ParenListExprs. ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Fn); if (Result.isInvalid()) return ExprError(); Fn = Result.take(); - Expr **Args = args.release(); + Expr **Args = ArgExprs.release(); if (getLangOptions().CPlusPlus) { // If this is a pseudo-destructor expression, build the call immediately. @@ -3508,7 +3506,7 @@ Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, ExprResult Sema::ActOnCUDAExecConfigExpr(Scope *S, SourceLocation LLLLoc, - MultiExprArg execConfig, SourceLocation GGGLoc) { + MultiExprArg ExecConfig, SourceLocation GGGLoc) { FunctionDecl *ConfigDecl = Context.getcudaConfigureCallDecl(); if (!ConfigDecl) return ExprError(Diag(LLLLoc, diag::err_undeclared_var_use) @@ -3518,27 +3516,27 @@ Sema::ActOnCUDAExecConfigExpr(Scope *S, SourceLocation LLLLoc, DeclRefExpr *ConfigDR = new (Context) DeclRefExpr( ConfigDecl, ConfigQTy, VK_LValue, LLLLoc); - return ActOnCallExpr(S, ConfigDR, LLLLoc, execConfig, GGGLoc, 0); + return ActOnCallExpr(S, ConfigDR, LLLLoc, ExecConfig, GGGLoc, 0); } /// ActOnAsTypeExpr - create a new asType (bitcast) from the arguments. /// /// __builtin_astype( value, dst type ) /// -ExprResult Sema::ActOnAsTypeExpr(Expr *expr, ParsedType destty, +ExprResult Sema::ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc) { ExprValueKind VK = VK_RValue; ExprObjectKind OK = OK_Ordinary; - QualType DstTy = GetTypeFromParser(destty); - QualType SrcTy = expr->getType(); + QualType DstTy = GetTypeFromParser(ParsedDestTy); + QualType SrcTy = E->getType(); if (Context.getTypeSize(DstTy) != Context.getTypeSize(SrcTy)) return ExprError(Diag(BuiltinLoc, diag::err_invalid_astype_of_different_size) << DstTy << SrcTy - << expr->getSourceRange()); - return Owned(new (Context) AsTypeExpr(expr, DstTy, VK, OK, BuiltinLoc, + << E->getSourceRange()); + return Owned(new (Context) AsTypeExpr(E, DstTy, VK, OK, BuiltinLoc, RParenLoc)); } @@ -3738,23 +3736,23 @@ Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, ExprResult Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, - SourceLocation RParenLoc, Expr *literalExpr) { + SourceLocation RParenLoc, Expr *LiteralExpr) { QualType literalType = TInfo->getType(); if (literalType->isArrayType()) { if (RequireCompleteType(LParenLoc, Context.getBaseElementType(literalType), PDiag(diag::err_illegal_decl_array_incomplete_type) << SourceRange(LParenLoc, - literalExpr->getSourceRange().getEnd()))) + LiteralExpr->getSourceRange().getEnd()))) return ExprError(); if (literalType->isVariableArrayType()) return ExprError(Diag(LParenLoc, diag::err_variable_object_no_init) - << SourceRange(LParenLoc, literalExpr->getSourceRange().getEnd())); + << SourceRange(LParenLoc, LiteralExpr->getSourceRange().getEnd())); } else if (!literalType->isDependentType() && RequireCompleteType(LParenLoc, literalType, PDiag(diag::err_typecheck_decl_incomplete_type) << SourceRange(LParenLoc, - literalExpr->getSourceRange().getEnd()))) + LiteralExpr->getSourceRange().getEnd()))) return ExprError(); InitializedEntity Entity @@ -3762,17 +3760,17 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, InitializationKind Kind = InitializationKind::CreateCStyleCast(LParenLoc, SourceRange(LParenLoc, RParenLoc)); - InitializationSequence InitSeq(*this, Entity, Kind, &literalExpr, 1); + InitializationSequence InitSeq(*this, Entity, Kind, &LiteralExpr, 1); ExprResult Result = InitSeq.Perform(*this, Entity, Kind, - MultiExprArg(*this, &literalExpr, 1), + MultiExprArg(*this, &LiteralExpr, 1), &literalType); if (Result.isInvalid()) return ExprError(); - literalExpr = Result.get(); + LiteralExpr = Result.get(); bool isFileScope = getCurFunctionOrMethodDecl() == 0; if (isFileScope) { // 6.5.2.5p3 - if (CheckForConstantInitializer(literalExpr, literalType)) + if (CheckForConstantInitializer(LiteralExpr, literalType)) return ExprError(); } @@ -3781,14 +3779,14 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, return MaybeBindToTemporary( new (Context) CompoundLiteralExpr(LParenLoc, TInfo, literalType, - VK, literalExpr, isFileScope)); + VK, LiteralExpr, isFileScope)); } ExprResult -Sema::ActOnInitList(SourceLocation LBraceLoc, MultiExprArg initlist, +Sema::ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc) { - unsigned NumInit = initlist.size(); - Expr **InitList = initlist.release(); + unsigned NumInit = InitArgList.size(); + Expr **InitList = InitArgList.release(); // Semantic analysis for initializers is done by ActOnDeclarator() and // CheckInitializer() - it requires knowledge of the object being intialized. @@ -3946,118 +3944,121 @@ static CastKind PrepareScalarCast(Sema &S, ExprResult &Src, QualType DestTy) { } /// CheckCastTypes - Check type constraints for casting between types. -ExprResult Sema::CheckCastTypes(SourceLocation CastStartLoc, SourceRange TyR, - QualType castType, Expr *castExpr, - CastKind& Kind, ExprValueKind &VK, - CXXCastPath &BasePath, bool FunctionalStyle) { - if (castExpr->getType() == Context.UnknownAnyTy) - return checkUnknownAnyCast(TyR, castType, castExpr, Kind, VK, BasePath); +ExprResult Sema::CheckCastTypes(SourceLocation CastStartLoc, + SourceRange TypeRange, QualType CastType, + Expr *CastExpr, CastKind &Kind, + ExprValueKind &VK, CXXCastPath &BasePath, + bool FunctionalStyle) { + if (CastExpr->getType() == Context.UnknownAnyTy) + return checkUnknownAnyCast(TypeRange, CastType, CastExpr, Kind, VK, + BasePath); if (getLangOptions().CPlusPlus) return CXXCheckCStyleCast(SourceRange(CastStartLoc, - castExpr->getLocEnd()), - castType, VK, castExpr, Kind, BasePath, + CastExpr->getLocEnd()), + CastType, VK, CastExpr, Kind, BasePath, FunctionalStyle); - assert(!castExpr->getType()->isPlaceholderType()); + assert(!CastExpr->getType()->isPlaceholderType()); // We only support r-value casts in C. VK = VK_RValue; // C99 6.5.4p2: the cast type needs to be void or scalar and the expression // type needs to be scalar. - if (castType->isVoidType()) { + if (CastType->isVoidType()) { // We don't necessarily do lvalue-to-rvalue conversions on this. - ExprResult castExprRes = IgnoredValueConversions(castExpr); + ExprResult castExprRes = IgnoredValueConversions(CastExpr); if (castExprRes.isInvalid()) return ExprError(); - castExpr = castExprRes.take(); + CastExpr = castExprRes.take(); // Cast to void allows any expr type. Kind = CK_ToVoid; - return Owned(castExpr); + return Owned(CastExpr); } - ExprResult castExprRes = DefaultFunctionArrayLvalueConversion(castExpr); + ExprResult castExprRes = DefaultFunctionArrayLvalueConversion(CastExpr); if (castExprRes.isInvalid()) return ExprError(); - castExpr = castExprRes.take(); + CastExpr = castExprRes.take(); - if (RequireCompleteType(TyR.getBegin(), castType, + if (RequireCompleteType(TypeRange.getBegin(), CastType, diag::err_typecheck_cast_to_incomplete)) return ExprError(); - if (!castType->isScalarType() && !castType->isVectorType()) { - if (Context.hasSameUnqualifiedType(castType, castExpr->getType()) && - (castType->isStructureType() || castType->isUnionType())) { + if (!CastType->isScalarType() && !CastType->isVectorType()) { + if (Context.hasSameUnqualifiedType(CastType, CastExpr->getType()) && + (CastType->isStructureType() || CastType->isUnionType())) { // GCC struct/union extension: allow cast to self. // FIXME: Check that the cast destination type is complete. - Diag(TyR.getBegin(), diag::ext_typecheck_cast_nonscalar) - << castType << castExpr->getSourceRange(); + Diag(TypeRange.getBegin(), diag::ext_typecheck_cast_nonscalar) + << CastType << CastExpr->getSourceRange(); Kind = CK_NoOp; - return Owned(castExpr); + return Owned(CastExpr); } - if (castType->isUnionType()) { + if (CastType->isUnionType()) { // GCC cast to union extension - RecordDecl *RD = castType->getAs()->getDecl(); + RecordDecl *RD = CastType->getAs()->getDecl(); RecordDecl::field_iterator Field, FieldEnd; for (Field = RD->field_begin(), FieldEnd = RD->field_end(); Field != FieldEnd; ++Field) { if (Context.hasSameUnqualifiedType(Field->getType(), - castExpr->getType()) && + CastExpr->getType()) && !Field->isUnnamedBitfield()) { - Diag(TyR.getBegin(), diag::ext_typecheck_cast_to_union) - << castExpr->getSourceRange(); + Diag(TypeRange.getBegin(), diag::ext_typecheck_cast_to_union) + << CastExpr->getSourceRange(); break; } } if (Field == FieldEnd) { - Diag(TyR.getBegin(), diag::err_typecheck_cast_to_union_no_type) - << castExpr->getType() << castExpr->getSourceRange(); + Diag(TypeRange.getBegin(), diag::err_typecheck_cast_to_union_no_type) + << CastExpr->getType() << CastExpr->getSourceRange(); return ExprError(); } Kind = CK_ToUnion; - return Owned(castExpr); + return Owned(CastExpr); } // Reject any other conversions to non-scalar types. - Diag(TyR.getBegin(), diag::err_typecheck_cond_expect_scalar) - << castType << castExpr->getSourceRange(); + Diag(TypeRange.getBegin(), diag::err_typecheck_cond_expect_scalar) + << CastType << CastExpr->getSourceRange(); return ExprError(); } // The type we're casting to is known to be a scalar or vector. // Require the operand to be a scalar or vector. - if (!castExpr->getType()->isScalarType() && - !castExpr->getType()->isVectorType()) { - Diag(castExpr->getLocStart(), + if (!CastExpr->getType()->isScalarType() && + !CastExpr->getType()->isVectorType()) { + Diag(CastExpr->getLocStart(), diag::err_typecheck_expect_scalar_operand) - << castExpr->getType() << castExpr->getSourceRange(); + << CastExpr->getType() << CastExpr->getSourceRange(); return ExprError(); } - if (castType->isExtVectorType()) - return CheckExtVectorCast(TyR, castType, castExpr, Kind); + if (CastType->isExtVectorType()) + return CheckExtVectorCast(TypeRange, CastType, CastExpr, Kind); - if (castType->isVectorType()) { - if (castType->getAs()->getVectorKind() == + if (CastType->isVectorType()) { + if (CastType->getAs()->getVectorKind() == VectorType::AltiVecVector && - (castExpr->getType()->isIntegerType() || - castExpr->getType()->isFloatingType())) { + (CastExpr->getType()->isIntegerType() || + CastExpr->getType()->isFloatingType())) { Kind = CK_VectorSplat; - return Owned(castExpr); - } else if (CheckVectorCast(TyR, castType, castExpr->getType(), Kind)) { + return Owned(CastExpr); + } else if (CheckVectorCast(TypeRange, CastType, CastExpr->getType(), + Kind)) { return ExprError(); } else - return Owned(castExpr); + return Owned(CastExpr); } - if (castExpr->getType()->isVectorType()) { - if (CheckVectorCast(TyR, castExpr->getType(), castType, Kind)) + if (CastExpr->getType()->isVectorType()) { + if (CheckVectorCast(TypeRange, CastExpr->getType(), CastType, Kind)) return ExprError(); else - return Owned(castExpr); + return Owned(CastExpr); } // The source and target types are both scalars, i.e. @@ -4065,70 +4066,70 @@ ExprResult Sema::CheckCastTypes(SourceLocation CastStartLoc, SourceRange TyR, // - all kinds of pointers // Note that member pointers were filtered out with C++, above. - if (isa(castExpr)) { - Diag(castExpr->getLocStart(), diag::err_cast_selector_expr); + if (isa(CastExpr)) { + Diag(CastExpr->getLocStart(), diag::err_cast_selector_expr); return ExprError(); } // If either type is a pointer, the other type has to be either an // integer or a pointer. - QualType castExprType = castExpr->getType(); - if (!castType->isArithmeticType()) { - if (!castExprType->isIntegralType(Context) && - castExprType->isArithmeticType()) { - Diag(castExpr->getLocStart(), + QualType CastExprType = CastExpr->getType(); + if (!CastType->isArithmeticType()) { + if (!CastExprType->isIntegralType(Context) && + CastExprType->isArithmeticType()) { + Diag(CastExpr->getLocStart(), diag::err_cast_pointer_from_non_pointer_int) - << castExprType << castExpr->getSourceRange(); + << CastExprType << CastExpr->getSourceRange(); return ExprError(); } - } else if (!castExpr->getType()->isArithmeticType()) { - if (!castType->isIntegralType(Context) && castType->isArithmeticType()) { - Diag(castExpr->getLocStart(), diag::err_cast_pointer_to_non_pointer_int) - << castType << castExpr->getSourceRange(); + } else if (!CastExpr->getType()->isArithmeticType()) { + if (!CastType->isIntegralType(Context) && CastType->isArithmeticType()) { + Diag(CastExpr->getLocStart(), diag::err_cast_pointer_to_non_pointer_int) + << CastType << CastExpr->getSourceRange(); return ExprError(); } } if (getLangOptions().ObjCAutoRefCount) { // Diagnose problems with Objective-C casts involving lifetime qualifiers. - CheckObjCARCConversion(SourceRange(CastStartLoc, castExpr->getLocEnd()), - castType, castExpr, CCK_CStyleCast); + CheckObjCARCConversion(SourceRange(CastStartLoc, CastExpr->getLocEnd()), + CastType, CastExpr, CCK_CStyleCast); - if (const PointerType *CastPtr = castType->getAs()) { - if (const PointerType *ExprPtr = castExprType->getAs()) { + if (const PointerType *CastPtr = CastType->getAs()) { + if (const PointerType *ExprPtr = CastExprType->getAs()) { Qualifiers CastQuals = CastPtr->getPointeeType().getQualifiers(); Qualifiers ExprQuals = ExprPtr->getPointeeType().getQualifiers(); if (CastPtr->getPointeeType()->isObjCLifetimeType() && ExprPtr->getPointeeType()->isObjCLifetimeType() && !CastQuals.compatiblyIncludesObjCLifetime(ExprQuals)) { - Diag(castExpr->getLocStart(), + Diag(CastExpr->getLocStart(), diag::err_typecheck_incompatible_ownership) - << castExprType << castType << AA_Casting - << castExpr->getSourceRange(); + << CastExprType << CastType << AA_Casting + << CastExpr->getSourceRange(); return ExprError(); } } } - else if (!CheckObjCARCUnavailableWeakConversion(castType, castExprType)) { - Diag(castExpr->getLocStart(), + else if (!CheckObjCARCUnavailableWeakConversion(CastType, CastExprType)) { + Diag(CastExpr->getLocStart(), diag::err_arc_convesion_of_weak_unavailable) << 1 - << castExprType << castType - << castExpr->getSourceRange(); + << CastExprType << CastType + << CastExpr->getSourceRange(); return ExprError(); } } - castExprRes = Owned(castExpr); - Kind = PrepareScalarCast(*this, castExprRes, castType); + castExprRes = Owned(CastExpr); + Kind = PrepareScalarCast(*this, castExprRes, CastType); if (castExprRes.isInvalid()) return ExprError(); - castExpr = castExprRes.take(); + CastExpr = castExprRes.take(); if (Kind == CK_BitCast) - CheckCastAlign(castExpr, castType, TyR); + CheckCastAlign(CastExpr, CastType, TypeRange); - return Owned(castExpr); + return Owned(CastExpr); } bool Sema::CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty, @@ -4191,11 +4192,11 @@ ExprResult Sema::CheckExtVectorCast(SourceRange R, QualType DestTy, ExprResult Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, - SourceLocation RParenLoc, Expr *castExpr) { - assert(!D.isInvalidType() && (castExpr != 0) && + SourceLocation RParenLoc, Expr *CastExpr) { + assert(!D.isInvalidType() && (CastExpr != 0) && "ActOnCastExpr(): missing type or expr"); - TypeSourceInfo *castTInfo = GetTypeForDeclaratorCast(D, castExpr->getType()); + TypeSourceInfo *castTInfo = GetTypeForDeclaratorCast(D, CastExpr->getType()); if (D.isInvalidType()) return ExprError(); @@ -4211,8 +4212,8 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, // Check for an altivec or OpenCL literal, // i.e. all the elements are integer constants. - ParenExpr *PE = dyn_cast(castExpr); - ParenListExpr *PLE = dyn_cast(castExpr); + ParenExpr *PE = dyn_cast(CastExpr); + ParenListExpr *PLE = dyn_cast(CastExpr); if (getLangOptions().AltiVec && castType->isVectorType() && (PE || PLE)) { if (PLE && PLE->getNumExprs() == 0) { Diag(PLE->getExprLoc(), diag::err_altivec_empty_initializer); @@ -4230,35 +4231,35 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, // If this is a vector initializer, '(' type ')' '(' init, ..., init ')' // then handle it as such. if (isVectorLiteral) - return BuildVectorLiteral(LParenLoc, RParenLoc, castExpr, castTInfo); + return BuildVectorLiteral(LParenLoc, RParenLoc, CastExpr, castTInfo); // If the Expr being casted is a ParenListExpr, handle it specially. // This is not an AltiVec-style cast, so turn the ParenListExpr into a // sequence of BinOp comma operators. - if (isa(castExpr)) { - ExprResult Result = MaybeConvertParenListExprToParenExpr(S, castExpr); + if (isa(CastExpr)) { + ExprResult Result = MaybeConvertParenListExprToParenExpr(S, CastExpr); if (Result.isInvalid()) return ExprError(); - castExpr = Result.take(); + CastExpr = Result.take(); } - return BuildCStyleCastExpr(LParenLoc, castTInfo, RParenLoc, castExpr); + return BuildCStyleCastExpr(LParenLoc, castTInfo, RParenLoc, CastExpr); } ExprResult Sema::BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, - SourceLocation RParenLoc, Expr *castExpr) { + SourceLocation RParenLoc, Expr *CastExpr) { CastKind Kind = CK_Invalid; ExprValueKind VK = VK_RValue; CXXCastPath BasePath; ExprResult CastResult = CheckCastTypes(LParenLoc, SourceRange(LParenLoc, RParenLoc), Ty->getType(), - castExpr, Kind, VK, BasePath); + CastExpr, Kind, VK, BasePath); if (CastResult.isInvalid()) return ExprError(); - castExpr = CastResult.take(); + CastExpr = CastResult.take(); return Owned(CStyleCastExpr::Create( - Context, Ty->getType().getNonLValueExprType(Context), VK, Kind, castExpr, + Context, Ty->getType().getNonLValueExprType(Context), VK, Kind, CastExpr, &BasePath, Ty, LParenLoc, RParenLoc)); } @@ -4339,10 +4340,10 @@ ExprResult Sema::BuildVectorLiteral(SourceLocation LParenLoc, /// This is not an AltiVec-style cast, so turn the ParenListExpr into a sequence /// of comma binary operators. ExprResult -Sema::MaybeConvertParenListExprToParenExpr(Scope *S, Expr *expr) { - ParenListExpr *E = dyn_cast(expr); +Sema::MaybeConvertParenListExprToParenExpr(Scope *S, Expr *OrigExpr) { + ParenListExpr *E = dyn_cast(OrigExpr); if (!E) - return Owned(expr); + return Owned(OrigExpr); ExprResult Result(E->getExpr(0)); @@ -4356,8 +4357,8 @@ Sema::MaybeConvertParenListExprToParenExpr(Scope *S, Expr *expr) { } ExprResult Sema::ActOnParenOrParenListExpr(SourceLocation L, - SourceLocation R, - MultiExprArg Val) { + SourceLocation R, + MultiExprArg Val) { unsigned nexprs = Val.size(); Expr **exprs = reinterpret_cast(Val.release()); assert((exprs != 0) && "ActOnParenOrParenListExpr() missing expr list"); @@ -4599,13 +4600,13 @@ checkConditionalObjectPointersCompatibility(Sema &S, ExprResult &LHS, /// expression is not a pointer, true otherwise. static bool checkPointerIntegerMismatch(Sema &S, ExprResult &Int, Expr* PointerExpr, SourceLocation Loc, - bool isIntFirstExpr) { + bool IsIntFirstExpr) { if (!PointerExpr->getType()->isPointerType() || !Int.get()->getType()->isIntegerType()) return false; - Expr *Expr1 = isIntFirstExpr ? Int.get() : PointerExpr; - Expr *Expr2 = isIntFirstExpr ? PointerExpr : Int.get(); + Expr *Expr1 = IsIntFirstExpr ? Int.get() : PointerExpr; + Expr *Expr2 = IsIntFirstExpr ? PointerExpr : Int.get(); S.Diag(Loc, diag::warn_typecheck_cond_pointer_integer_mismatch) << Expr1->getType() << Expr2->getType() @@ -5656,7 +5657,7 @@ QualType Sema::InvalidOperands(SourceLocation Loc, ExprResult &LHS, } QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, - SourceLocation Loc, bool isCompAssign) { + SourceLocation Loc, bool IsCompAssign) { // For conversion purposes, we ignore any qualifiers. // For example, "const float" and "float" are equivalent. QualType LHSType = @@ -5676,7 +5677,7 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, return LHSType; } - if (!isCompAssign) + if (!IsCompAssign) LHS = ImpCastExprToType(LHS.take(), RHSType, CK_BitCast); return RHSType; } @@ -5694,7 +5695,7 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, // Canonicalize the ExtVector to the LHS, remember if we swapped so we can // swap back (so that we don't reverse the inputs to a subtract, for instance. bool swapped = false; - if (RHSType->isExtVectorType() && !isCompAssign) { + if (RHSType->isExtVectorType() && !IsCompAssign) { swapped = true; std::swap(RHS, LHS); std::swap(RHSType, LHSType); @@ -5736,12 +5737,12 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, QualType Sema::CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, - bool isCompAssign, bool isDiv) { + bool IsCompAssign, bool IsDiv) { if (LHS.get()->getType()->isVectorType() || RHS.get()->getType()->isVectorType()) - return CheckVectorOperands(LHS, RHS, Loc, isCompAssign); + return CheckVectorOperands(LHS, RHS, Loc, IsCompAssign); - QualType compType = UsualArithmeticConversions(LHS, RHS, isCompAssign); + QualType compType = UsualArithmeticConversions(LHS, RHS, IsCompAssign); if (LHS.isInvalid() || RHS.isInvalid()) return QualType(); @@ -5750,7 +5751,7 @@ QualType Sema::CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, return InvalidOperands(Loc, LHS, RHS); // Check for division by zero. - if (isDiv && + if (IsDiv && RHS.get()->isNullPointerConstant(Context, Expr::NPC_ValueDependentIsNotNull)) DiagRuntimeBehavior(Loc, RHS.get(), PDiag(diag::warn_division_by_zero) @@ -5760,16 +5761,16 @@ QualType Sema::CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, } QualType Sema::CheckRemainderOperands( - ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool isCompAssign) { + ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign) { if (LHS.get()->getType()->isVectorType() || RHS.get()->getType()->isVectorType()) { if (LHS.get()->getType()->hasIntegerRepresentation() && RHS.get()->getType()->hasIntegerRepresentation()) - return CheckVectorOperands(LHS, RHS, Loc, isCompAssign); + return CheckVectorOperands(LHS, RHS, Loc, IsCompAssign); return InvalidOperands(Loc, LHS, RHS); } - QualType compType = UsualArithmeticConversions(LHS, RHS, isCompAssign); + QualType compType = UsualArithmeticConversions(LHS, RHS, IsCompAssign); if (LHS.isInvalid() || RHS.isInvalid()) return QualType(); @@ -6154,7 +6155,7 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult &LHS, ExprResult &RHS, // C99 6.5.7 QualType Sema::CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, unsigned Opc, - bool isCompAssign) { + bool IsCompAssign) { // C99 6.5.7p2: Each of the operands shall have integer type. if (!LHS.get()->getType()->hasIntegerRepresentation() || !RHS.get()->getType()->hasIntegerRepresentation()) @@ -6170,7 +6171,7 @@ QualType Sema::CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, // Vector shifts promote their scalar inputs to vector type. if (LHS.get()->getType()->isVectorType() || RHS.get()->getType()->isVectorType()) - return CheckVectorOperands(LHS, RHS, Loc, isCompAssign); + return CheckVectorOperands(LHS, RHS, Loc, IsCompAssign); // Shifts don't perform usual arithmetic conversions, they just do integer // promotions on each operand. C99 6.5.7p3 @@ -6182,7 +6183,7 @@ QualType Sema::CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, if (LHS.isInvalid()) return QualType(); QualType LHSType = LHS.get()->getType(); - if (isCompAssign) LHS = OldLHS; + if (IsCompAssign) LHS = OldLHS; // The RHS is simpler. RHS = UsualUnaryConversions(RHS.take()); @@ -6236,8 +6237,8 @@ static void checkEnumComparison(Sema &S, SourceLocation Loc, ExprResult &LHS, /// \brief Diagnose bad pointer comparisons. static void diagnoseDistinctPointerComparison(Sema &S, SourceLocation Loc, ExprResult &LHS, ExprResult &RHS, - bool isError) { - S.Diag(Loc, isError ? diag::err_typecheck_comparison_of_distinct_pointers + bool IsError) { + S.Diag(Loc, IsError ? diag::err_typecheck_comparison_of_distinct_pointers : diag::ext_typecheck_comparison_of_distinct_pointers) << LHS.get()->getType() << RHS.get()->getType() << LHS.get()->getSourceRange() << RHS.get()->getSourceRange(); @@ -6293,9 +6294,9 @@ static bool convertPointersToCompositeType(Sema &S, SourceLocation Loc, static void diagnoseFunctionPointerToVoidComparison(Sema &S, SourceLocation Loc, ExprResult &LHS, ExprResult &RHS, - bool isError) { - S.Diag(Loc,isError ? diag::err_typecheck_comparison_of_fptr_to_void - : diag::ext_typecheck_comparison_of_fptr_to_void) + bool IsError) { + S.Diag(Loc, IsError ? diag::err_typecheck_comparison_of_fptr_to_void + : diag::ext_typecheck_comparison_of_fptr_to_void) << LHS.get()->getType() << RHS.get()->getType() << LHS.get()->getSourceRange() << RHS.get()->getSourceRange(); } @@ -6303,13 +6304,13 @@ static void diagnoseFunctionPointerToVoidComparison(Sema &S, SourceLocation Loc, // C99 6.5.8, C++ [expr.rel] QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, unsigned OpaqueOpc, - bool isRelational) { + bool IsRelational) { BinaryOperatorKind Opc = (BinaryOperatorKind) OpaqueOpc; // Handle vector comparisons separately. if (LHS.get()->getType()->isVectorType() || RHS.get()->getType()->isVectorType()) - return CheckVectorCompareOperands(LHS, RHS, Loc, isRelational); + return CheckVectorCompareOperands(LHS, RHS, Loc, IsRelational); QualType LHSType = LHS.get()->getType(); QualType RHSType = RHS.get()->getType(); @@ -6320,7 +6321,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, checkEnumComparison(*this, Loc, LHS, RHS); if (!LHSType->hasFloatingRepresentation() && - !(LHSType->isBlockPointerType() && isRelational) && + !(LHSType->isBlockPointerType() && IsRelational) && !LHS.get()->getLocStart().isMacroID() && !RHS.get()->getLocStart().isMacroID()) { // For non-floating point types, check for self-comparisons of the form @@ -6430,7 +6431,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, // The result of comparisons is 'bool' in C++, 'int' in C. QualType ResultTy = Context.getLogicalOperationType(); - if (isRelational) { + if (IsRelational) { if (LHSType->isRealType() && RHSType->isRealType()) return ResultTy; } else { @@ -6458,7 +6459,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, if (getLangOptions().CPlusPlus) { if (LCanPointeeTy == RCanPointeeTy) return ResultTy; - if (!isRelational && + if (!IsRelational && (LCanPointeeTy->isVoidType() || RCanPointeeTy->isVoidType())) { // Valid unless comparison between non-null pointer and function pointer // This is a gcc extension compatibility comparison. @@ -6486,12 +6487,12 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, if (Context.typesAreCompatible(LCanPointeeTy.getUnqualifiedType(), RCanPointeeTy.getUnqualifiedType())) { // Valid unless a relational comparison of function pointers - if (isRelational && LCanPointeeTy->isFunctionType()) { + if (IsRelational && LCanPointeeTy->isFunctionType()) { Diag(Loc, diag::ext_typecheck_ordered_comparison_of_function_pointers) << LHSType << RHSType << LHS.get()->getSourceRange() << RHS.get()->getSourceRange(); } - } else if (!isRelational && + } else if (!IsRelational && (LCanPointeeTy->isVoidType() || RCanPointeeTy->isVoidType())) { // Valid unless comparison between non-null pointer and function pointer if ((LCanPointeeTy->isFunctionType() || RCanPointeeTy->isFunctionType()) @@ -6520,7 +6521,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, // comparisons of member pointers to null pointer constants. if (RHSIsNull && ((LHSType->isAnyPointerType() || LHSType->isNullPtrType()) || - (!isRelational && + (!IsRelational && (LHSType->isMemberPointerType() || LHSType->isBlockPointerType())))) { RHS = ImpCastExprToType(RHS.take(), LHSType, LHSType->isMemberPointerType() @@ -6530,7 +6531,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, } if (LHSIsNull && ((RHSType->isAnyPointerType() || RHSType->isNullPtrType()) || - (!isRelational && + (!IsRelational && (RHSType->isMemberPointerType() || RHSType->isBlockPointerType())))) { LHS = ImpCastExprToType(LHS.take(), RHSType, RHSType->isMemberPointerType() @@ -6540,7 +6541,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, } // Comparison of member pointers. - if (!isRelational && + if (!IsRelational && LHSType->isMemberPointerType() && RHSType->isMemberPointerType()) { if (convertPointersToCompositeType(*this, Loc, LHS, RHS)) return QualType(); @@ -6557,7 +6558,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, } // Handle block pointer types. - if (!isRelational && LHSType->isBlockPointerType() && + if (!IsRelational && LHSType->isBlockPointerType() && RHSType->isBlockPointerType()) { QualType lpointee = LHSType->getAs()->getPointeeType(); QualType rpointee = RHSType->getAs()->getPointeeType(); @@ -6573,7 +6574,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, } // Allow block pointers to be compared with null pointer constants. - if (!isRelational + if (!IsRelational && ((LHSType->isBlockPointerType() && RHSType->isPointerType()) || (LHSType->isPointerType() && RHSType->isBlockPointerType()))) { if (!LHSIsNull && !RHSIsNull) { @@ -6629,9 +6630,9 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, bool isError = false; if ((LHSIsNull && LHSType->isIntegerType()) || (RHSIsNull && RHSType->isIntegerType())) { - if (isRelational && !getLangOptions().CPlusPlus) + if (IsRelational && !getLangOptions().CPlusPlus) DiagID = diag::ext_typecheck_ordered_comparison_of_pointer_and_zero; - } else if (isRelational && !getLangOptions().CPlusPlus) + } else if (IsRelational && !getLangOptions().CPlusPlus) DiagID = diag::ext_typecheck_ordered_comparison_of_pointer_integer; else if (getLangOptions().CPlusPlus) { DiagID = diag::err_typecheck_comparison_of_pointer_integer; @@ -6657,12 +6658,12 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, } // Handle block pointers. - if (!isRelational && RHSIsNull + if (!IsRelational && RHSIsNull && LHSType->isBlockPointerType() && RHSType->isIntegerType()) { RHS = ImpCastExprToType(RHS.take(), LHSType, CK_NullToPointer); return ResultTy; } - if (!isRelational && LHSIsNull + if (!IsRelational && LHSIsNull && LHSType->isIntegerType() && RHSType->isBlockPointerType()) { LHS = ImpCastExprToType(LHS.take(), RHSType, CK_NullToPointer); return ResultTy; @@ -6677,7 +6678,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, /// types. QualType Sema::CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, - bool isRelational) { + bool IsRelational) { // Check to make sure we're operating on vectors of the same type and width, // Allowing one side to be a scalar of element type. QualType vType = CheckVectorOperands(LHS, RHS, Loc, /*isCompAssign*/false); @@ -6707,7 +6708,7 @@ QualType Sema::CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, } // Check for comparisons of floating point operands using != and ==. - if (!isRelational && LHSType->hasFloatingRepresentation()) { + if (!IsRelational && LHSType->hasFloatingRepresentation()) { assert (RHSType->hasFloatingRepresentation()); CheckFloatComparison(Loc, LHS.get(), RHS.get()); } @@ -6731,19 +6732,19 @@ QualType Sema::CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, } inline QualType Sema::CheckBitwiseOperands( - ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool isCompAssign) { + ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign) { if (LHS.get()->getType()->isVectorType() || RHS.get()->getType()->isVectorType()) { if (LHS.get()->getType()->hasIntegerRepresentation() && RHS.get()->getType()->hasIntegerRepresentation()) - return CheckVectorOperands(LHS, RHS, Loc, isCompAssign); + return CheckVectorOperands(LHS, RHS, Loc, IsCompAssign); return InvalidOperands(Loc, LHS, RHS); } ExprResult LHSResult = Owned(LHS), RHSResult = Owned(RHS); QualType compType = UsualArithmeticConversions(LHSResult, RHSResult, - isCompAssign); + IsCompAssign); if (LHSResult.isInvalid() || RHSResult.isInvalid()) return QualType(); LHS = LHSResult.take(); @@ -7122,7 +7123,7 @@ static QualType CheckCommaOperands(Sema &S, ExprResult &LHS, ExprResult &RHS, static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op, ExprValueKind &VK, SourceLocation OpLoc, - bool isInc, bool isPrefix) { + bool IsInc, bool IsPrefix) { if (Op->isTypeDependent()) return S.Context.DependentTy; @@ -7131,7 +7132,7 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op, if (S.getLangOptions().CPlusPlus && ResType->isBooleanType()) { // Decrement of bool is not allowed. - if (!isInc) { + if (!IsInc) { S.Diag(OpLoc, diag::err_decrement_bool) << Op->getSourceRange(); return QualType(); } @@ -7155,12 +7156,12 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op, ExprResult PR = S.CheckPlaceholderExpr(Op); if (PR.isInvalid()) return QualType(); return CheckIncrementDecrementOperand(S, PR.take(), VK, OpLoc, - isInc, isPrefix); + IsInc, IsPrefix); } else if (S.getLangOptions().AltiVec && ResType->isVectorType()) { // OK! ( C/C++ Language Extensions for CBEA(Version 2.6) 10.3 ) } else { S.Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement) - << ResType << int(isInc) << Op->getSourceRange(); + << ResType << int(IsInc) << Op->getSourceRange(); return QualType(); } // At this point, we know we have a real, complex or pointer type. @@ -7170,7 +7171,7 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op, // In C++, a prefix increment is the same type as the operand. Otherwise // (in C or with postfix), the increment is the unqualified type of the // operand. - if (isPrefix && S.getLangOptions().CPlusPlus) { + if (IsPrefix && S.getLangOptions().CPlusPlus) { VK = VK_LValue; return ResType; } else { @@ -7642,7 +7643,7 @@ static void DiagnoseSelfAssignment(Sema &S, Expr *LHSExpr, Expr *RHSExpr, // expression. These are mainly cases where the null pointer is used as an // integer instead of a pointer. static void checkArithmeticNull(Sema &S, ExprResult &LHS, ExprResult &RHS, - SourceLocation Loc, bool isCompare) { + SourceLocation Loc, bool IsCompare) { // The canonical way to check for a GNU null is with isNullPointerConstant, // but we use a bit of a hack here for speed; this is a relatively // hot path, and isNullPointerConstant is slow. @@ -7667,7 +7668,7 @@ static void checkArithmeticNull(Sema &S, ExprResult &LHS, ExprResult &RHS, // Comparison operations would not make sense with a null pointer no matter // what the other expression is. - if (!isCompare) { + if (!IsCompare) { S.Diag(Loc, diag::warn_null_in_arithmetic_operation) << (LHSNull ? LHS.get()->getSourceRange() : SourceRange()) << (RHSNull ? RHS.get()->getSourceRange() : SourceRange()); @@ -8197,8 +8198,7 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc, } ExprResult Sema::BuildUnaryOp(Scope *S, SourceLocation OpLoc, - UnaryOperatorKind Opc, - Expr *Input) { + UnaryOperatorKind Opc, Expr *Input) { if (getLangOptions().CPlusPlus && Input->getType()->isOverloadableType() && UnaryOperator::getOverloadedOperator(Opc) != OO_None) { // Find all of the overloaded operators visible from this @@ -8237,9 +8237,9 @@ ExprResult Sema::ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, /// ns_returns_retained function) and, if so, rebuild it to hoist the /// release out of the full-expression. Otherwise, return null. /// Cannot fail. -static Expr *maybeRebuildARCConsumingStmt(Stmt *s) { +static Expr *maybeRebuildARCConsumingStmt(Stmt *Statement) { // Should always be wrapped with one of these. - ExprWithCleanups *cleanups = dyn_cast(s); + ExprWithCleanups *cleanups = dyn_cast(Statement); if (!cleanups) return 0; ImplicitCastExpr *cast = dyn_cast(cleanups->getSubExpr()); @@ -8494,13 +8494,13 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, - ParsedType argty, + ParsedType ParsedArgTy, OffsetOfComponent *CompPtr, unsigned NumComponents, - SourceLocation RPLoc) { + SourceLocation RParenLoc) { TypeSourceInfo *ArgTInfo; - QualType ArgTy = GetTypeFromParser(argty, &ArgTInfo); + QualType ArgTy = GetTypeFromParser(ParsedArgTy, &ArgTInfo); if (ArgTy.isNull()) return ExprError(); @@ -8508,7 +8508,7 @@ ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S, ArgTInfo = Context.getTrivialTypeSourceInfo(ArgTy, TypeLoc); return BuildBuiltinOffsetOf(BuiltinLoc, ArgTInfo, CompPtr, NumComponents, - RPLoc); + RParenLoc); } @@ -8554,12 +8554,12 @@ ExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc, //===----------------------------------------------------------------------===// /// ActOnBlockStart - This callback is invoked when a block literal is started. -void Sema::ActOnBlockStart(SourceLocation CaretLoc, Scope *BlockScope) { +void Sema::ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope) { BlockDecl *Block = BlockDecl::Create(Context, CurContext, CaretLoc); - PushBlockScope(BlockScope, Block); + PushBlockScope(CurScope, Block); CurContext->addDecl(Block); - if (BlockScope) - PushDeclContext(BlockScope, Block); + if (CurScope) + PushDeclContext(CurScope, Block); else CurContext = Block; } @@ -8785,11 +8785,11 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, } ExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc, - Expr *expr, ParsedType type, + Expr *E, ParsedType Ty, SourceLocation RPLoc) { TypeSourceInfo *TInfo; - GetTypeFromParser(type, &TInfo); - return BuildVAArgExpr(BuiltinLoc, expr, TInfo, RPLoc); + GetTypeFromParser(Ty, &TInfo); + return BuildVAArgExpr(BuiltinLoc, E, TInfo, RPLoc); } ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc, @@ -9461,7 +9461,7 @@ void Sema::MarkDeclarationsReferencedInExpr(Expr *E) { /// behavior of a program, such as passing a non-POD value through an ellipsis. /// Failure to do so will likely result in spurious diagnostics or failures /// during overload resolution or within sizeof/alignof/typeof/typeid. -bool Sema::DiagRuntimeBehavior(SourceLocation Loc, const Stmt *stmt, +bool Sema::DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, const PartialDiagnostic &PD) { switch (ExprEvalContexts.back().Context) { case Unevaluated: @@ -9470,9 +9470,9 @@ bool Sema::DiagRuntimeBehavior(SourceLocation Loc, const Stmt *stmt, case PotentiallyEvaluated: case PotentiallyEvaluatedIfUsed: - if (stmt && getCurFunctionOrMethodDecl()) { + if (Statement && getCurFunctionOrMethodDecl()) { FunctionScopes.back()->PossiblyUnreachableDiags. - push_back(sema::PossiblyUnreachableDiag(PD, Loc, stmt)); + push_back(sema::PossiblyUnreachableDiag(PD, Loc, Statement)); } else Diag(Loc, PD); @@ -9567,16 +9567,16 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) { /// \brief Redundant parentheses over an equality comparison can indicate /// that the user intended an assignment used as condition. -void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *parenE) { +void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *ParenE) { // Don't warn if the parens came from a macro. - SourceLocation parenLoc = parenE->getLocStart(); + SourceLocation parenLoc = ParenE->getLocStart(); if (parenLoc.isInvalid() || parenLoc.isMacroID()) return; // Don't warn for dependent expressions. - if (parenE->isTypeDependent()) + if (ParenE->isTypeDependent()) return; - Expr *E = parenE->IgnoreParens(); + Expr *E = ParenE->IgnoreParens(); if (BinaryOperator *opE = dyn_cast(E)) if (opE->getOpcode() == BO_EQ && @@ -9586,8 +9586,8 @@ void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *parenE) { Diag(Loc, diag::warn_equality_with_extra_parens) << E->getSourceRange(); Diag(Loc, diag::note_equality_comparison_silence) - << FixItHint::CreateRemoval(parenE->getSourceRange().getBegin()) - << FixItHint::CreateRemoval(parenE->getSourceRange().getEnd()); + << FixItHint::CreateRemoval(ParenE->getSourceRange().getBegin()) + << FixItHint::CreateRemoval(ParenE->getSourceRange().getEnd()); Diag(Loc, diag::note_equality_comparison_to_assign) << FixItHint::CreateReplacement(Loc, "="); } @@ -9623,11 +9623,11 @@ ExprResult Sema::CheckBooleanCondition(Expr *E, SourceLocation Loc) { } ExprResult Sema::ActOnBooleanCondition(Scope *S, SourceLocation Loc, - Expr *Sub) { - if (!Sub) + Expr *SubExpr) { + if (!SubExpr) return ExprError(); - return CheckBooleanCondition(Sub, Loc); + return CheckBooleanCondition(SubExpr, Loc); } namespace { @@ -9972,27 +9972,27 @@ ExprResult RebuildUnknownAnyExpr::resolveDecl(Expr *expr, ValueDecl *decl) { /// Check a cast of an unknown-any type. We intentionally only /// trigger this for C-style casts. -ExprResult Sema::checkUnknownAnyCast(SourceRange typeRange, QualType castType, - Expr *castExpr, CastKind &castKind, - ExprValueKind &VK, CXXCastPath &path) { +ExprResult Sema::checkUnknownAnyCast(SourceRange TypeRange, QualType CastType, + Expr *CastExpr, CastKind &CastKind, + ExprValueKind &VK, CXXCastPath &Path) { // Rewrite the casted expression from scratch. - ExprResult result = RebuildUnknownAnyExpr(*this, castType).Visit(castExpr); + ExprResult result = RebuildUnknownAnyExpr(*this, CastType).Visit(CastExpr); if (!result.isUsable()) return ExprError(); - castExpr = result.take(); - VK = castExpr->getValueKind(); - castKind = CK_NoOp; + CastExpr = result.take(); + VK = CastExpr->getValueKind(); + CastKind = CK_NoOp; - return castExpr; + return CastExpr; } -static ExprResult diagnoseUnknownAnyExpr(Sema &S, Expr *e) { - Expr *orig = e; +static ExprResult diagnoseUnknownAnyExpr(Sema &S, Expr *E) { + Expr *orig = E; unsigned diagID = diag::err_uncasted_use_of_unknown_any; while (true) { - e = e->IgnoreParenImpCasts(); - if (CallExpr *call = dyn_cast(e)) { - e = call->getCallee(); + E = E->IgnoreParenImpCasts(); + if (CallExpr *call = dyn_cast(E)) { + E = call->getCallee(); diagID = diag::err_uncasted_call_of_unknown_any; } else { break; @@ -10001,13 +10001,13 @@ static ExprResult diagnoseUnknownAnyExpr(Sema &S, Expr *e) { SourceLocation loc; NamedDecl *d; - if (DeclRefExpr *ref = dyn_cast(e)) { + if (DeclRefExpr *ref = dyn_cast(E)) { loc = ref->getLocation(); d = ref->getDecl(); - } else if (MemberExpr *mem = dyn_cast(e)) { + } else if (MemberExpr *mem = dyn_cast(E)) { loc = mem->getMemberLoc(); d = mem->getMemberDecl(); - } else if (ObjCMessageExpr *msg = dyn_cast(e)) { + } else if (ObjCMessageExpr *msg = dyn_cast(E)) { diagID = diag::err_uncasted_call_of_unknown_any; loc = msg->getSelectorLoc(); d = msg->getMethodDecl(); @@ -10018,8 +10018,8 @@ static ExprResult diagnoseUnknownAnyExpr(Sema &S, Expr *e) { return ExprError(); } } else { - S.Diag(e->getExprLoc(), diag::err_unsupported_unknown_any_expr) - << e->getSourceRange(); + S.Diag(E->getExprLoc(), diag::err_unsupported_unknown_any_expr) + << E->getSourceRange(); return ExprError(); } @@ -10057,10 +10057,10 @@ ExprResult Sema::CheckPlaceholderExpr(Expr *E) { return Owned(E); } -bool Sema::CheckCaseExpression(Expr *expr) { - if (expr->isTypeDependent()) +bool Sema::CheckCaseExpression(Expr *E) { + if (E->isTypeDependent()) return true; - if (expr->isValueDependent() || expr->isIntegerConstantExpr(Context)) - return expr->getType()->isIntegralOrEnumerationType(); + if (E->isValueDependent() || E->isIntegerConstantExpr(Context)) + return E->getType()->isIntegralOrEnumerationType(); return false; }