diff options
Diffstat (limited to 'include/clang/Sema/Sema.h')
-rw-r--r-- | include/clang/Sema/Sema.h | 171 |
1 files changed, 90 insertions, 81 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); |