diff options
author | Richard Trieu <rtrieu@google.com> | 2011-09-09 01:45:06 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2011-09-09 01:45:06 +0000 |
commit | ccd891ae75e9678f1138868e50508c8083d021fa (patch) | |
tree | 3fbce3520b2f0bbc9bc20caf0ea5c12d037369f1 | |
parent | 69ff26bd1e7a2faffec0c3b9740cfb0c6bb354c5 (diff) |
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
-rw-r--r-- | include/clang/Sema/Sema.h | 171 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 690 |
2 files changed, 435 insertions, 426 deletions
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<ComplexType>(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<ComplexType>(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<ComplexType>(complexTy)->getElementType(); - otherExpr = S.ImpCastExprToType(otherExpr.take(), fp, CK_FloatingCast); - otherExpr = S.ImpCastExprToType(otherExpr.take(), complexTy, + if (ConvertOtherExpr) { + QualType fp = cast<ComplexType>(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(); |