r204045 - [C++11] Replacing FunctionProtoType iterators param_type_begin() and param_type_end() with iterator_range param_types(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman
aaron at aaronballman.com
Mon Mar 17 08:23:02 PDT 2014
Author: aaronballman
Date: Mon Mar 17 10:23:01 2014
New Revision: 204045
URL: http://llvm.org/viewvc/llvm-project?rev=204045&view=rev
Log:
[C++11] Replacing FunctionProtoType iterators param_type_begin() and param_type_end() with iterator_range param_types(). Updating all of the usages of the iterators with range-based for loops.
Modified:
cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/Mangle.cpp
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/Index/USRGeneration.cpp
cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp
cfe/trunk/lib/Rewrite/Frontend/RewriteObjC.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
Modified: cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h Mon Mar 17 10:23:01 2014
@@ -873,10 +873,8 @@ DEF_TRAVERSE_TYPE(FunctionNoProtoType,
DEF_TRAVERSE_TYPE(FunctionProtoType, {
TRY_TO(TraverseType(T->getReturnType()));
- for (FunctionProtoType::param_type_iterator A = T->param_type_begin(),
- AEnd = T->param_type_end();
- A != AEnd; ++A) {
- TRY_TO(TraverseType(*A));
+ for (const auto &A : T->param_types()) {
+ TRY_TO(TraverseType(A));
}
for (FunctionProtoType::exception_iterator E = T->exception_begin(),
Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Mon Mar 17 10:23:01 2014
@@ -954,10 +954,8 @@ DEF_TRAVERSE_TYPE(FunctionNoProtoType,
DEF_TRAVERSE_TYPE(FunctionProtoType, {
TRY_TO(TraverseType(T->getReturnType()));
- for (FunctionProtoType::param_type_iterator A = T->param_type_begin(),
- AEnd = T->param_type_end();
- A != AEnd; ++A) {
- TRY_TO(TraverseType(*A));
+ for (const auto &A : T->param_types()) {
+ TRY_TO(TraverseType(A));
}
for (FunctionProtoType::exception_iterator E = T->exception_begin(),
Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Mon Mar 17 10:23:01 2014
@@ -626,11 +626,11 @@ public:
// Iterators
child_range children() {
- return child_range(&Body[0], &Body[0]+CompoundStmtBits.NumStmts);
+ return child_range(Body, Body + CompoundStmtBits.NumStmts);
}
const_child_range children() const {
- return child_range(&Body[0], &Body[0]+CompoundStmtBits.NumStmts);
+ return child_range(Body, Body + CompoundStmtBits.NumStmts);
}
};
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Mon Mar 17 10:23:01 2014
@@ -26,6 +26,7 @@
#include "clang/Basic/Visibility.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/FoldingSet.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/PointerUnion.h"
@@ -3059,6 +3060,11 @@ public:
}
typedef const QualType *param_type_iterator;
+ typedef llvm::iterator_range<param_type_iterator> param_type_range;
+
+ param_type_range param_types() const {
+ return param_type_range(param_type_begin(), param_type_end());
+ }
param_type_iterator param_type_begin() const {
return reinterpret_cast<const QualType *>(this+1);
}
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Mar 17 10:23:01 2014
@@ -5380,19 +5380,11 @@ void ASTContext::getObjCEncodingForTypeI
S += "@?";
// Block parameters
if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT)) {
- for (FunctionProtoType::param_type_iterator I = FPT->param_type_begin(),
- E = FPT->param_type_end();
- I && (I != E); ++I) {
- getObjCEncodingForTypeImpl(*I, S,
- ExpandPointedToStructures,
- ExpandStructures,
- FD,
- false /* OutermostType */,
- EncodingProperty,
- false /* StructField */,
- EncodeBlockParameters,
- EncodeClassNames);
- }
+ for (const auto &I : FPT->param_types())
+ getObjCEncodingForTypeImpl(
+ I, S, ExpandPointedToStructures, ExpandStructures, FD,
+ false /* OutermostType */, EncodingProperty,
+ false /* StructField */, EncodeBlockParameters, EncodeClassNames);
}
S += '>';
}
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Mon Mar 17 10:23:01 2014
@@ -1598,10 +1598,8 @@ QualType ASTNodeImporter::VisitFunctionP
// Import argument types
SmallVector<QualType, 4> ArgTypes;
- for (FunctionProtoType::param_type_iterator A = T->param_type_begin(),
- AEnd = T->param_type_end();
- A != AEnd; ++A) {
- QualType ArgType = Importer.Import(*A);
+ for (const auto &A : T->param_types()) {
+ QualType ArgType = Importer.Import(A);
if (ArgType.isNull())
return QualType();
ArgTypes.push_back(ArgType);
Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Mon Mar 17 10:23:01 2014
@@ -2012,10 +2012,8 @@ void CXXNameMangler::mangleBareFunctionT
return;
}
- for (FunctionProtoType::param_type_iterator Arg = Proto->param_type_begin(),
- ArgEnd = Proto->param_type_end();
- Arg != ArgEnd; ++Arg)
- mangleType(Context.getASTContext().getSignatureParameterType(*Arg));
+ for (const auto &Arg : Proto->param_types())
+ mangleType(Context.getASTContext().getSignatureParameterType(Arg));
FunctionTypeDepth.pop(saved);
Modified: cfe/trunk/lib/AST/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Mangle.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Mangle.cpp (original)
+++ cfe/trunk/lib/AST/Mangle.cpp Mon Mar 17 10:23:01 2014
@@ -163,13 +163,9 @@ void MangleContext::mangleName(const Nam
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD))
if (!MD->isStatic())
++ArgWords;
- for (FunctionProtoType::param_type_iterator Arg = Proto->param_type_begin(),
- ArgEnd = Proto->param_type_end();
- Arg != ArgEnd; ++Arg) {
- QualType AT = *Arg;
+ for (const auto &AT : Proto->param_types())
// Size should be aligned to DWORD boundary
ArgWords += llvm::RoundUpToAlignment(ASTContext.getTypeSize(AT), 32) / 32;
- }
Out << 4 * ArgWords;
}
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Mon Mar 17 10:23:01 2014
@@ -1551,11 +1551,8 @@ void MicrosoftCXXNameMangler::mangleFunc
Out << 'X';
} else {
// Happens for function pointer type arguments for example.
- for (FunctionProtoType::param_type_iterator
- Arg = Proto->param_type_begin(),
- ArgEnd = Proto->param_type_end();
- Arg != ArgEnd; ++Arg)
- mangleArgumentType(*Arg, Range);
+ for (const auto &Arg : Proto->param_types())
+ mangleArgumentType(Arg, Range);
// <builtin-type> ::= Z # ellipsis
if (Proto->isVariadic())
Out << 'Z';
Modified: cfe/trunk/lib/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Mon Mar 17 10:23:01 2014
@@ -2232,10 +2232,8 @@ static CachedProperties computeCachedPro
case Type::FunctionProto: {
const FunctionProtoType *FPT = cast<FunctionProtoType>(T);
CachedProperties result = Cache::get(FPT->getReturnType());
- for (FunctionProtoType::param_type_iterator ai = FPT->param_type_begin(),
- ae = FPT->param_type_end();
- ai != ae; ++ai)
- result = merge(result, Cache::get(*ai));
+ for (const auto &ai : FPT->param_types())
+ result = merge(result, Cache::get(ai));
return result;
}
case Type::ObjCInterface: {
@@ -2318,10 +2316,8 @@ static LinkageInfo computeLinkageInfo(co
case Type::FunctionProto: {
const FunctionProtoType *FPT = cast<FunctionProtoType>(T);
LinkageInfo LV = computeLinkageInfo(FPT->getReturnType());
- for (FunctionProtoType::param_type_iterator ai = FPT->param_type_begin(),
- ae = FPT->param_type_end();
- ai != ae; ++ai)
- LV.merge(computeLinkageInfo(*ai));
+ for (const auto &ai : FPT->param_types())
+ LV.merge(computeLinkageInfo(ai));
return LV;
}
case Type::ObjCInterface:
Modified: cfe/trunk/lib/Index/USRGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/USRGeneration.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/Index/USRGeneration.cpp (original)
+++ cfe/trunk/lib/Index/USRGeneration.cpp Mon Mar 17 10:23:01 2014
@@ -638,11 +638,8 @@ void USRGenerator::VisitType(QualType T)
if (const FunctionProtoType *FT = T->getAs<FunctionProtoType>()) {
Out << 'F';
VisitType(FT->getReturnType());
- for (FunctionProtoType::param_type_iterator I = FT->param_type_begin(),
- E = FT->param_type_end();
- I != E; ++I) {
- VisitType(*I);
- }
+ for (const auto &I : FT->param_types())
+ VisitType(I);
if (FT->isVariadic())
Out << '.';
return;
Modified: cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/Frontend/RewriteModernObjC.cpp Mon Mar 17 10:23:01 2014
@@ -623,10 +623,8 @@ void RewriteModernObjC::RewriteBlocksInF
NamedDecl *D) {
if (const FunctionProtoType *fproto
= dyn_cast<FunctionProtoType>(funcType.IgnoreParens())) {
- for (FunctionProtoType::param_type_iterator I = fproto->param_type_begin(),
- E = fproto->param_type_end();
- I && (I != E); ++I)
- if (isTopLevelBlockPointerType(*I)) {
+ for (const auto &I : fproto->param_types())
+ if (isTopLevelBlockPointerType(I)) {
// All the args are checked/rewritten. Don't call twice!
RewriteBlockPointerDecl(D);
break;
@@ -4660,10 +4658,8 @@ QualType RewriteModernObjC::convertFunct
bool modified = convertObjCTypeToCStyleType(Res);
if (FTP) {
- for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
- E = FTP->param_type_end();
- I && (I != E); ++I) {
- QualType t = *I;
+ for (auto &I : FTP->param_types()) {
+ QualType t = I;
// Make sure we convert "t (^)(...)" to "t (*)(...)".
if (convertObjCTypeToCStyleType(t))
modified = true;
@@ -4729,10 +4725,8 @@ Stmt *RewriteModernObjC::SynthesizeBlock
// Push the block argument type.
ArgTypes.push_back(PtrBlock);
if (FTP) {
- for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
- E = FTP->param_type_end();
- I && (I != E); ++I) {
- QualType t = *I;
+ for (auto &I : FTP->param_types()) {
+ QualType t = I;
// Make sure we convert "t (^)(...)" to "t (*)(...)".
if (!convertBlockPointerToFunctionPointer(t))
convertToUnqualifiedObjCType(t);
@@ -4950,10 +4944,8 @@ bool RewriteModernObjC::PointerTypeTakes
FTP = BPT->getPointeeType()->getAs<FunctionProtoType>();
}
if (FTP) {
- for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
- E = FTP->param_type_end();
- I != E; ++I)
- if (isTopLevelBlockPointerType(*I))
+ for (const auto &I : FTP->param_types())
+ if (isTopLevelBlockPointerType(I))
return true;
}
return false;
@@ -4970,13 +4962,11 @@ bool RewriteModernObjC::PointerTypeTakes
FTP = BPT->getPointeeType()->getAs<FunctionProtoType>();
}
if (FTP) {
- for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
- E = FTP->param_type_end();
- I != E; ++I) {
- if ((*I)->isObjCQualifiedIdType())
+ for (const auto &I : FTP->param_types()) {
+ if (I->isObjCQualifiedIdType())
return true;
- if ((*I)->isObjCObjectPointerType() &&
- (*I)->getPointeeType()->isObjCQualifiedInterfaceType())
+ if (I->isObjCObjectPointerType() &&
+ I->getPointeeType()->isObjCQualifiedInterfaceType())
return true;
}
Modified: cfe/trunk/lib/Rewrite/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Frontend/RewriteObjC.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/Frontend/RewriteObjC.cpp Mon Mar 17 10:23:01 2014
@@ -554,10 +554,8 @@ void RewriteObjC::RewriteBlocksInFunctio
NamedDecl *D) {
if (const FunctionProtoType *fproto
= dyn_cast<FunctionProtoType>(funcType.IgnoreParens())) {
- for (FunctionProtoType::param_type_iterator I = fproto->param_type_begin(),
- E = fproto->param_type_end();
- I && (I != E); ++I)
- if (isTopLevelBlockPointerType(*I)) {
+ for (const auto &I : fproto->param_types())
+ if (isTopLevelBlockPointerType(I)) {
// All the args are checked/rewritten. Don't call twice!
RewriteBlockPointerDecl(D);
break;
@@ -3741,10 +3739,8 @@ QualType RewriteObjC::convertFunctionTyp
bool HasBlockType = convertBlockPointerToFunctionPointer(Res);
if (FTP) {
- for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
- E = FTP->param_type_end();
- I && (I != E); ++I) {
- QualType t = *I;
+ for (auto &I : FTP->param_types()) {
+ QualType t = I;
// Make sure we convert "t (^)(...)" to "t (*)(...)".
if (convertBlockPointerToFunctionPointer(t))
HasBlockType = true;
@@ -3812,10 +3808,8 @@ Stmt *RewriteObjC::SynthesizeBlockCall(C
// Push the block argument type.
ArgTypes.push_back(PtrBlock);
if (FTP) {
- for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
- E = FTP->param_type_end();
- I && (I != E); ++I) {
- QualType t = *I;
+ for (auto &I : FTP->param_types()) {
+ QualType t = I;
// Make sure we convert "t (^)(...)" to "t (*)(...)".
if (!convertBlockPointerToFunctionPointer(t))
convertToUnqualifiedObjCType(t);
@@ -4016,10 +4010,8 @@ bool RewriteObjC::PointerTypeTakesAnyBlo
FTP = BPT->getPointeeType()->getAs<FunctionProtoType>();
}
if (FTP) {
- for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
- E = FTP->param_type_end();
- I != E; ++I)
- if (isTopLevelBlockPointerType(*I))
+ for (const auto &I : FTP->param_types())
+ if (isTopLevelBlockPointerType(I))
return true;
}
return false;
@@ -4036,13 +4028,11 @@ bool RewriteObjC::PointerTypeTakesAnyObj
FTP = BPT->getPointeeType()->getAs<FunctionProtoType>();
}
if (FTP) {
- for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(),
- E = FTP->param_type_end();
- I != E; ++I) {
- if ((*I)->isObjCQualifiedIdType())
+ for (const auto &I : FTP->param_types()) {
+ if (I->isObjCQualifiedIdType())
return true;
- if ((*I)->isObjCObjectPointerType() &&
- (*I)->getPointeeType()->isObjCQualifiedInterfaceType())
+ if (I->isObjCObjectPointerType() &&
+ I->getPointeeType()->isObjCQualifiedInterfaceType())
return true;
}
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Mar 17 10:23:01 2014
@@ -2649,8 +2649,7 @@ bool Sema::MergeFunctionDecl(FunctionDec
// The old declaration provided a function prototype, but the
// new declaration does not. Merge in the prototype.
assert(!OldProto->hasExceptionSpec() && "Exception spec in C");
- SmallVector<QualType, 16> ParamTypes(OldProto->param_type_begin(),
- OldProto->param_type_end());
+ SmallVector<QualType, 16> ParamTypes(OldProto->param_types());
NewQType =
Context.getFunctionType(NewFuncType->getReturnType(), ParamTypes,
OldProto->getExtProtoInfo());
@@ -2659,16 +2658,10 @@ bool Sema::MergeFunctionDecl(FunctionDec
// Synthesize a parameter for each argument type.
SmallVector<ParmVarDecl*, 16> Params;
- for (FunctionProtoType::param_type_iterator
- ParamType = OldProto->param_type_begin(),
- ParamEnd = OldProto->param_type_end();
- ParamType != ParamEnd; ++ParamType) {
- ParmVarDecl *Param = ParmVarDecl::Create(Context, New,
- SourceLocation(),
- SourceLocation(), 0,
- *ParamType, /*TInfo=*/0,
- SC_None,
- 0);
+ for (const auto &ParamType : OldProto->param_types()) {
+ ParmVarDecl *Param = ParmVarDecl::Create(Context, New, SourceLocation(),
+ SourceLocation(), 0, ParamType,
+ /*TInfo=*/0, SC_None, 0);
Param->setScopeInfo(0, Params.size());
Param->setImplicit();
Params.push_back(Param);
@@ -6909,11 +6902,9 @@ Sema::ActOnFunctionDeclarator(Scope *S,
// @endcode
// Synthesize a parameter for each argument type.
- for (FunctionProtoType::param_type_iterator AI = FT->param_type_begin(),
- AE = FT->param_type_end();
- AI != AE; ++AI) {
+ for (const auto &AI : FT->param_types()) {
ParmVarDecl *Param =
- BuildParmVarDeclForTypedef(NewFD, D.getIdentifierLoc(), *AI);
+ BuildParmVarDeclForTypedef(NewFD, D.getIdentifierLoc(), AI);
Param->setScopeInfo(0, Params.size());
Params.push_back(Param);
}
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Mar 17 10:23:01 2014
@@ -4611,10 +4611,8 @@ NamedDecl * Sema::DeclClonePragmaWeak(Na
QualType FDTy = FD->getType();
if (const FunctionProtoType *FT = FDTy->getAs<FunctionProtoType>()) {
SmallVector<ParmVarDecl*, 16> Params;
- for (FunctionProtoType::param_type_iterator AI = FT->param_type_begin(),
- AE = FT->param_type_end();
- AI != AE; ++AI) {
- ParmVarDecl *Param = BuildParmVarDeclForTypedef(NewFD, Loc, *AI);
+ for (const auto &AI : FT->param_types()) {
+ ParmVarDecl *Param = BuildParmVarDeclForTypedef(NewFD, Loc, AI);
Param->setScopeInfo(0, Params.size());
Params.push_back(Param);
}
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Mar 17 10:23:01 2014
@@ -10419,13 +10419,9 @@ void Sema::ActOnBlockArguments(SourceLoc
// Fake up parameter variables if we have a typedef, like
// ^ fntype { ... }
} else if (const FunctionProtoType *Fn = T->getAs<FunctionProtoType>()) {
- for (FunctionProtoType::param_type_iterator I = Fn->param_type_begin(),
- E = Fn->param_type_end();
- I != E; ++I) {
- ParmVarDecl *Param =
- BuildParmVarDeclForTypedef(CurBlock->TheDecl,
- ParamInfo.getLocStart(),
- *I);
+ for (const auto &I : Fn->param_types()) {
+ ParmVarDecl *Param = BuildParmVarDeclForTypedef(
+ CurBlock->TheDecl, ParamInfo.getLocStart(), I);
Params.push_back(Param);
}
}
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Mon Mar 17 10:23:01 2014
@@ -2180,11 +2180,8 @@ addAssociatedClassesAndNamespaces(Associ
// types and those associated with the return type.
case Type::FunctionProto: {
const FunctionProtoType *Proto = cast<FunctionProtoType>(T);
- for (FunctionProtoType::param_type_iterator
- Arg = Proto->param_type_begin(),
- ArgEnd = Proto->param_type_end();
- Arg != ArgEnd; ++Arg)
- Queue.push_back(Arg->getTypePtr());
+ for (const auto &Arg : Proto->param_types())
+ Queue.push_back(Arg.getTypePtr());
// fallthrough
}
case Type::FunctionNoProto: {
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=204045&r1=204044&r2=204045&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Mon Mar 17 10:23:01 2014
@@ -3912,10 +3912,8 @@ bool UnnamedLocalNoLinkageFinder::VisitE
bool UnnamedLocalNoLinkageFinder::VisitFunctionProtoType(
const FunctionProtoType* T) {
- for (FunctionProtoType::param_type_iterator A = T->param_type_begin(),
- AEnd = T->param_type_end();
- A != AEnd; ++A) {
- if (Visit(*A))
+ for (const auto &A : T->param_types()) {
+ if (Visit(A))
return true;
}
More information about the cfe-commits
mailing list