diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-07 16:09:59 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-07 16:09:59 +0000 |
commit | b2b8b1dc669c2a486e0841f6ac6aab6dc5cc6ec0 (patch) | |
tree | 52c666be558e1a81bba2452267c28c7b5f6562f2 /clang/lib | |
parent | bcc77b04bb75722f6acaa29a408d7f8dc1d0e170 (diff) | |
download | llvm-b2b8b1dc669c2a486e0841f6ac6aab6dc5cc6ec0.zip llvm-b2b8b1dc669c2a486e0841f6ac6aab6dc5cc6ec0.tar.gz llvm-b2b8b1dc669c2a486e0841f6ac6aab6dc5cc6ec0.tar.bz2 |
[C++11] Replacing BlockDecl iterators param_begin() and param_end() with iterator_range params(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203250
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 9 | ||||
-rw-r--r-- | clang/lib/AST/ASTDumper.cpp | 5 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 5 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 11 |
5 files changed, 14 insertions, 22 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 8df2eae..d3a82c4 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -4804,9 +4804,8 @@ std::string ASTContext::getObjCEncodingForBlock(const BlockExpr *Expr) const { SourceLocation Loc; CharUnits PtrSize = getTypeSizeInChars(VoidPtrTy); CharUnits ParmOffset = PtrSize; - for (BlockDecl::param_const_iterator PI = Decl->param_begin(), - E = Decl->param_end(); PI != E; ++PI) { - QualType PType = (*PI)->getType(); + for (auto PI : Decl->params()) { + QualType PType = PI->getType(); CharUnits sz = getObjCEncodingTypeSize(PType); if (sz.isZero()) continue; @@ -4820,9 +4819,7 @@ std::string ASTContext::getObjCEncodingForBlock(const BlockExpr *Expr) const { // Argument types. ParmOffset = PtrSize; - for (BlockDecl::param_const_iterator PI = Decl->param_begin(), E = - Decl->param_end(); PI != E; ++PI) { - ParmVarDecl *PVDecl = *PI; + for (auto PVDecl : Decl->params()) { QualType PType = PVDecl->getOriginalType(); if (const ArrayType *AT = dyn_cast<ArrayType>(PType->getCanonicalTypeInternal())) { diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp index 42edf5b..c1a8eaf 100644 --- a/clang/lib/AST/ASTDumper.cpp +++ b/clang/lib/AST/ASTDumper.cpp @@ -1439,9 +1439,8 @@ void ASTDumper::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) { } void ASTDumper::VisitBlockDecl(const BlockDecl *D) { - for (BlockDecl::param_const_iterator I = D->param_begin(), E = D->param_end(); - I != E; ++I) - dumpDecl(*I); + for (auto I : D->params()) + dumpDecl(I); if (D->isVariadic()) { IndentScope Indent(*this); diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index a75f341..86afa32 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -1117,9 +1117,8 @@ CodeGenFunction::GenerateBlockFunction(GlobalDecl GD, args.push_back(&selfDecl); // Now add the rest of the parameters. - for (BlockDecl::param_const_iterator i = blockDecl->param_begin(), - e = blockDecl->param_end(); i != e; ++i) - args.push_back(*i); + for (auto i : blockDecl->params()) + args.push_back(i); // Create the function declaration. const FunctionProtoType *fnType = blockInfo.getBlockExpr()->getFunctionType(); diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 7add3c2..4cab371 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -2163,11 +2163,9 @@ void CodeGenFunction::EmitLambdaBlockInvokeBody() { CallArgs.add(RValue::get(ThisPtr), ThisType); // Add the rest of the parameters. - for (BlockDecl::param_const_iterator I = BD->param_begin(), - E = BD->param_end(); I != E; ++I) { - ParmVarDecl *param = *I; + for (auto param : BD->params()) EmitDelegateCallArg(CallArgs, param, param->getLocStart()); - } + assert(!Lambda->isGenericLambda() && "generic lambda interconversion to block not implemented"); EmitForwardingCallToLambda(Lambda->getLambdaCallOperator(), CallArgs); diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 2566db3..caca6d1 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -10446,15 +10446,14 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, ProcessDeclAttributes(CurScope, CurBlock->TheDecl, ParamInfo); // Put the parameter variables in scope. - for (BlockDecl::param_iterator AI = CurBlock->TheDecl->param_begin(), - E = CurBlock->TheDecl->param_end(); AI != E; ++AI) { - (*AI)->setOwningFunction(CurBlock->TheDecl); + for (auto AI : CurBlock->TheDecl->params()) { + AI->setOwningFunction(CurBlock->TheDecl); // If this has an identifier, add it to the scope stack. - if ((*AI)->getIdentifier()) { - CheckShadow(CurBlock->TheScope, *AI); + if (AI->getIdentifier()) { + CheckShadow(CurBlock->TheScope, AI); - PushOnScopeChains(*AI, CurBlock->TheScope); + PushOnScopeChains(AI, CurBlock->TheScope); } } } |