From 03376dc2c525c725323993fe0a17fd5d7313a9e7 Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Mon, 7 Jul 2014 09:02:20 +0000 Subject: [PATCH] Switch over a few uses of param_begin() to parameters() llvm-svn: 212442 --- clang/lib/Sema/SemaCodeComplete.cpp | 4 ++-- clang/lib/Sema/SemaDeclAttr.cpp | 2 +- clang/lib/Sema/SemaExpr.cpp | 2 +- clang/lib/Sema/SemaExprObjC.cpp | 34 +++++++++++++++++----------------- clang/lib/Sema/SemaPseudoObject.cpp | 18 +++++++++--------- clang/tools/libclang/CXCursor.cpp | 4 ++-- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index e2149ed..3d250e3 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -5322,7 +5322,7 @@ static QualType getPreferredArgumentTypeForMessageSend(ResultBuilder &Results, if (R.Priority <= BestPriority) { const ObjCMethodDecl *Method = cast(R.Declaration); if (NumSelIdents <= Method->param_size()) { - QualType MyPreferredType = Method->param_begin()[NumSelIdents - 1] + QualType MyPreferredType = Method->parameters()[NumSelIdents - 1] ->getType(); if (R.Priority < BestPriority || PreferredType.isNull()) { BestPriority = R.Priority; @@ -6994,7 +6994,7 @@ void Sema::CodeCompleteObjCMethodDeclSelector(Scope *S, // Suggest parameter names we've seen before. unsigned NumSelIdents = SelIdents.size(); if (NumSelIdents && NumSelIdents <= MethList->Method->param_size()) { - ParmVarDecl *Param = MethList->Method->param_begin()[NumSelIdents-1]; + ParmVarDecl *Param = MethList->Method->parameters()[NumSelIdents-1]; if (Param->getIdentifier()) { CodeCompletionBuilder Builder(Results.getAllocator(), Results.getCodeCompletionTUInfo()); diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index a1d1d0c..45ca8dc 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -85,7 +85,7 @@ static QualType getFunctionOrMethodParamType(const Decl *D, unsigned Idx) { if (const BlockDecl *BD = dyn_cast(D)) return BD->getParamDecl(Idx)->getType(); - return cast(D)->param_begin()[Idx]->getType(); + return cast(D)->parameters()[Idx]->getType(); } static QualType getFunctionOrMethodResultType(const Decl *D) { diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 864c282..92cfc5a 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -7694,7 +7694,7 @@ static bool hasIsEqualMethod(Sema &S, const Expr *LHS, const Expr *RHS) { if (!Method) return false; - QualType T = Method->param_begin()[0]->getType(); + QualType T = Method->parameters()[0]->getType(); if (!T->isObjCObjectPointerType()) return false; diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 0cae6bf..5002332 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -291,7 +291,7 @@ ExprResult Sema::BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number) { return ExprError(); // Convert the number to the type that the parameter expects. - ParmVarDecl *ParamDecl = Method->param_begin()[0]; + ParmVarDecl *ParamDecl = Method->parameters()[0]; InitializedEntity Entity = InitializedEntity::InitializeParameter(Context, ParamDecl); ExprResult ConvertedNumber = PerformCopyInitialization(Entity, @@ -581,7 +581,7 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) { } // Convert the expression to the type that the parameter requires. - ParmVarDecl *ParamDecl = BoxingMethod->param_begin()[0]; + ParmVarDecl *ParamDecl = BoxingMethod->parameters()[0]; InitializedEntity Entity = InitializedEntity::InitializeParameter(Context, ParamDecl); ExprResult ConvertedValueExpr = PerformCopyInitialization(Entity, @@ -689,13 +689,13 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) { return ExprError(); // Dig out the type that all elements should be converted to. - QualType T = Method->param_begin()[0]->getType(); + QualType T = Method->parameters()[0]->getType(); const PointerType *PtrT = T->getAs(); if (!PtrT || !Context.hasSameUnqualifiedType(PtrT->getPointeeType(), IdT)) { Diag(SR.getBegin(), diag::err_objc_literal_method_sig) << Sel; - Diag(Method->param_begin()[0]->getLocation(), + Diag(Method->parameters()[0]->getLocation(), diag::note_objc_literal_method_param) << 0 << T << Context.getPointerType(IdT.withConst()); @@ -703,13 +703,13 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) { } // Check that the 'count' parameter is integral. - if (!Method->param_begin()[1]->getType()->isIntegerType()) { + if (!Method->parameters()[1]->getType()->isIntegerType()) { Diag(SR.getBegin(), diag::err_objc_literal_method_sig) << Sel; - Diag(Method->param_begin()[1]->getLocation(), + Diag(Method->parameters()[1]->getLocation(), diag::note_objc_literal_method_param) << 1 - << Method->param_begin()[1]->getType() + << Method->parameters()[1]->getType() << "integral"; return ExprError(); } @@ -718,7 +718,7 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) { ArrayWithObjectsMethod = Method; } - QualType ObjectsType = ArrayWithObjectsMethod->param_begin()[0]->getType(); + QualType ObjectsType = ArrayWithObjectsMethod->parameters()[0]->getType(); QualType RequiredType = ObjectsType->castAs()->getPointeeType(); // Check that each of the elements provided is valid in a collection literal, @@ -816,13 +816,13 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, return ExprError(); // Dig out the type that all values should be converted to. - QualType ValueT = Method->param_begin()[0]->getType(); + QualType ValueT = Method->parameters()[0]->getType(); const PointerType *PtrValue = ValueT->getAs(); if (!PtrValue || !Context.hasSameUnqualifiedType(PtrValue->getPointeeType(), IdT)) { Diag(SR.getBegin(), diag::err_objc_literal_method_sig) << Sel; - Diag(Method->param_begin()[0]->getLocation(), + Diag(Method->parameters()[0]->getLocation(), diag::note_objc_literal_method_param) << 0 << ValueT << Context.getPointerType(IdT.withConst()); @@ -830,7 +830,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, } // Dig out the type that all keys should be converted to. - QualType KeyT = Method->param_begin()[1]->getType(); + QualType KeyT = Method->parameters()[1]->getType(); const PointerType *PtrKey = KeyT->getAs(); if (!PtrKey || !Context.hasSameUnqualifiedType(PtrKey->getPointeeType(), @@ -856,7 +856,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, if (err) { Diag(SR.getBegin(), diag::err_objc_literal_method_sig) << Sel; - Diag(Method->param_begin()[1]->getLocation(), + Diag(Method->parameters()[1]->getLocation(), diag::note_objc_literal_method_param) << 1 << KeyT << Context.getPointerType(IdT.withConst()); @@ -865,11 +865,11 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, } // Check that the 'count' parameter is integral. - QualType CountType = Method->param_begin()[2]->getType(); + QualType CountType = Method->parameters()[2]->getType(); if (!CountType->isIntegerType()) { Diag(SR.getBegin(), diag::err_objc_literal_method_sig) << Sel; - Diag(Method->param_begin()[2]->getLocation(), + Diag(Method->parameters()[2]->getLocation(), diag::note_objc_literal_method_param) << 2 << CountType << "integral"; @@ -880,9 +880,9 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, DictionaryWithObjectsMethod = Method; } - QualType ValuesT = DictionaryWithObjectsMethod->param_begin()[0]->getType(); + QualType ValuesT = DictionaryWithObjectsMethod->parameters()[0]->getType(); QualType ValueT = ValuesT->castAs()->getPointeeType(); - QualType KeysT = DictionaryWithObjectsMethod->param_begin()[1]->getType(); + QualType KeysT = DictionaryWithObjectsMethod->parameters()[1]->getType(); QualType KeyT = KeysT->castAs()->getPointeeType(); // Check that each of the keys and values provided is valid in a collection @@ -1368,7 +1368,7 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType, Expr *argExpr = Args[i]; - ParmVarDecl *param = Method->param_begin()[i]; + ParmVarDecl *param = Method->parameters()[i]; assert(argExpr && "CheckMessageArgumentTypes(): missing expression"); // Strip the unbridged-cast placeholder expression off unless it's diff --git a/clang/lib/Sema/SemaPseudoObject.cpp b/clang/lib/Sema/SemaPseudoObject.cpp index 35684b4..c8d34f8 100644 --- a/clang/lib/Sema/SemaPseudoObject.cpp +++ b/clang/lib/Sema/SemaPseudoObject.cpp @@ -1099,7 +1099,7 @@ static void CheckKeyForObjCARCConversion(Sema &S, QualType ContainerT, true /*instance*/); if (!Getter) return; - QualType T = Getter->param_begin()[0]->getType(); + QualType T = Getter->parameters()[0]->getType(); S.CheckObjCARCConversion(Key->getSourceRange(), T, Key, Sema::CCK_ImplicitConversion); } @@ -1192,13 +1192,13 @@ bool ObjCSubscriptOpBuilder::findAtIndexGetter() { } if (AtIndexGetter) { - QualType T = AtIndexGetter->param_begin()[0]->getType(); + QualType T = AtIndexGetter->parameters()[0]->getType(); if ((arrayRef && !T->isIntegralOrEnumerationType()) || (!arrayRef && !T->isObjCObjectPointerType())) { S.Diag(RefExpr->getKeyExpr()->getExprLoc(), arrayRef ? diag::err_objc_subscript_index_type : diag::err_objc_subscript_key_type) << T; - S.Diag(AtIndexGetter->param_begin()[0]->getLocation(), + S.Diag(AtIndexGetter->parameters()[0]->getLocation(), diag::note_parameter_type) << T; return false; } @@ -1315,26 +1315,26 @@ bool ObjCSubscriptOpBuilder::findAtIndexSetter() { bool err = false; if (AtIndexSetter && arrayRef) { - QualType T = AtIndexSetter->param_begin()[1]->getType(); + QualType T = AtIndexSetter->parameters()[1]->getType(); if (!T->isIntegralOrEnumerationType()) { S.Diag(RefExpr->getKeyExpr()->getExprLoc(), diag::err_objc_subscript_index_type) << T; - S.Diag(AtIndexSetter->param_begin()[1]->getLocation(), + S.Diag(AtIndexSetter->parameters()[1]->getLocation(), diag::note_parameter_type) << T; err = true; } - T = AtIndexSetter->param_begin()[0]->getType(); + T = AtIndexSetter->parameters()[0]->getType(); if (!T->isObjCObjectPointerType()) { S.Diag(RefExpr->getBaseExpr()->getExprLoc(), diag::err_objc_subscript_object_type) << T << arrayRef; - S.Diag(AtIndexSetter->param_begin()[0]->getLocation(), + S.Diag(AtIndexSetter->parameters()[0]->getLocation(), diag::note_parameter_type) << T; err = true; } } else if (AtIndexSetter && !arrayRef) for (unsigned i=0; i <2; i++) { - QualType T = AtIndexSetter->param_begin()[i]->getType(); + QualType T = AtIndexSetter->parameters()[i]->getType(); if (!T->isObjCObjectPointerType()) { if (i == 1) S.Diag(RefExpr->getKeyExpr()->getExprLoc(), @@ -1342,7 +1342,7 @@ bool ObjCSubscriptOpBuilder::findAtIndexSetter() { else S.Diag(RefExpr->getBaseExpr()->getExprLoc(), diag::err_objc_subscript_dic_object_type) << T; - S.Diag(AtIndexSetter->param_begin()[i]->getLocation(), + S.Diag(AtIndexSetter->parameters()[i]->getLocation(), diag::note_parameter_type) << T; err = true; } diff --git a/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp index 8c9cdf4..6b0e2eb 100644 --- a/clang/tools/libclang/CXCursor.cpp +++ b/clang/tools/libclang/CXCursor.cpp @@ -1005,11 +1005,11 @@ CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i) { const Decl *D = cxcursor::getCursorDecl(C); if (const ObjCMethodDecl *MD = dyn_cast_or_null(D)) { if (i < MD->param_size()) - return cxcursor::MakeCXCursor(MD->param_begin()[i], + return cxcursor::MakeCXCursor(MD->parameters()[i], cxcursor::getCursorTU(C)); } else if (const FunctionDecl *FD = dyn_cast_or_null(D)) { if (i < FD->param_size()) - return cxcursor::MakeCXCursor(FD->param_begin()[i], + return cxcursor::MakeCXCursor(FD->parameters()[i], cxcursor::getCursorTU(C)); } } -- 2.7.4