From 09d19efaa147762f84aed55efa7930bb3616a4e5 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 4 Jul 2013 03:08:24 +0000 Subject: [PATCH] Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185610 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/CXXInheritance.h | 4 ++-- include/clang/Analysis/CallGraph.h | 4 ++-- include/clang/Edit/Commit.h | 2 +- include/clang/Lex/MacroInfo.h | 2 +- include/clang/Sema/Overload.h | 2 +- include/clang/Sema/TypoCorrection.h | 4 ++-- include/clang/Serialization/ModuleManager.h | 6 +++--- lib/AST/ASTDumper.cpp | 4 ++-- lib/AST/ASTImporter.cpp | 2 +- lib/AST/CXXInheritance.cpp | 8 ++++---- lib/Basic/FileManager.cpp | 2 +- lib/Driver/Driver.cpp | 2 +- lib/Parse/ParseAST.cpp | 2 +- lib/Parse/ParseDeclCXX.cpp | 2 +- lib/Rewrite/Frontend/RewriteModernObjC.cpp | 16 ++++++++-------- lib/Rewrite/Frontend/RewriteObjC.cpp | 16 ++++++++-------- lib/Sema/SemaDecl.cpp | 2 +- lib/Sema/SemaExpr.cpp | 2 +- lib/Sema/SemaInit.cpp | 6 +++--- lib/Sema/SemaLambda.cpp | 8 ++++---- lib/Sema/SemaLookup.cpp | 4 ++-- lib/Sema/SemaStmt.cpp | 2 +- lib/Sema/SemaTemplateInstantiate.cpp | 18 +++++++++--------- lib/Serialization/ASTWriter.cpp | 8 ++++---- lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 4 ++-- .../Checkers/SimpleStreamChecker.cpp | 4 ++-- lib/StaticAnalyzer/Core/BugReporter.cpp | 2 +- tools/libclang/CIndex.cpp | 4 ++-- tools/libclang/CIndexHigh.cpp | 2 +- tools/libclang/CXCursor.cpp | 6 +++--- 30 files changed, 75 insertions(+), 75 deletions(-) diff --git a/include/clang/AST/CXXInheritance.h b/include/clang/AST/CXXInheritance.h index 2983e04cda..dbe4ad0f5a 100644 --- a/include/clang/AST/CXXInheritance.h +++ b/include/clang/AST/CXXInheritance.h @@ -287,9 +287,9 @@ public: // Iterate over the set of overriding virtual methods in a given // subobject. - typedef SmallVector::iterator + typedef SmallVectorImpl::iterator overriding_iterator; - typedef SmallVector::const_iterator + typedef SmallVectorImpl::const_iterator overriding_const_iterator; // Add a new overriding method for a particular subobject. diff --git a/include/clang/Analysis/CallGraph.h b/include/clang/Analysis/CallGraph.h index 5015eb6149..593ba575c7 100644 --- a/include/clang/Analysis/CallGraph.h +++ b/include/clang/Analysis/CallGraph.h @@ -144,8 +144,8 @@ private: public: CallGraphNode(Decl *D) : FD(D) {} - typedef SmallVector::iterator iterator; - typedef SmallVector::const_iterator const_iterator; + typedef SmallVectorImpl::iterator iterator; + typedef SmallVectorImpl::const_iterator const_iterator; /// Iterators through all the callees/children of the node. inline iterator begin() { return CalledFunctions.begin(); } diff --git a/include/clang/Edit/Commit.h b/include/clang/Edit/Commit.h index 48e3d593aa..2a296421d3 100644 --- a/include/clang/Edit/Commit.h +++ b/include/clang/Edit/Commit.h @@ -103,7 +103,7 @@ public: CharSourceRange::getTokenRange(TokenInnerRange)); } - typedef SmallVector::const_iterator edit_iterator; + typedef SmallVectorImpl::const_iterator edit_iterator; edit_iterator edit_begin() const { return CachedEdits.begin(); } edit_iterator edit_end() const { return CachedEdits.end(); } diff --git a/include/clang/Lex/MacroInfo.h b/include/clang/Lex/MacroInfo.h index b4ce4db7dd..8cb370e6f8 100644 --- a/include/clang/Lex/MacroInfo.h +++ b/include/clang/Lex/MacroInfo.h @@ -251,7 +251,7 @@ public: return ReplacementTokens[Tok]; } - typedef SmallVector::const_iterator tokens_iterator; + typedef SmallVectorImpl::const_iterator tokens_iterator; tokens_iterator tokens_begin() const { return ReplacementTokens.begin(); } tokens_iterator tokens_end() const { return ReplacementTokens.end(); } bool tokens_empty() const { return ReplacementTokens.empty(); } diff --git a/include/clang/Sema/Overload.h b/include/clang/Sema/Overload.h index c685843f18..490caf091f 100644 --- a/include/clang/Sema/Overload.h +++ b/include/clang/Sema/Overload.h @@ -773,7 +773,7 @@ namespace clang { /// \brief Clear out all of the candidates. void clear(); - typedef SmallVector::iterator iterator; + typedef SmallVectorImpl::iterator iterator; iterator begin() { return Candidates.begin(); } iterator end() { return Candidates.end(); } diff --git a/include/clang/Sema/TypoCorrection.h b/include/clang/Sema/TypoCorrection.h index 6d21b44494..79ce79c240 100644 --- a/include/clang/Sema/TypoCorrection.h +++ b/include/clang/Sema/TypoCorrection.h @@ -195,12 +195,12 @@ public: return CorrectionRange; } - typedef SmallVector::iterator decl_iterator; + typedef SmallVectorImpl::iterator decl_iterator; decl_iterator begin() { return isKeyword() ? CorrectionDecls.end() : CorrectionDecls.begin(); } decl_iterator end() { return CorrectionDecls.end(); } - typedef SmallVector::const_iterator const_decl_iterator; + typedef SmallVectorImpl::const_iterator const_decl_iterator; const_decl_iterator begin() const { return isKeyword() ? CorrectionDecls.end() : CorrectionDecls.begin(); } diff --git a/include/clang/Serialization/ModuleManager.h b/include/clang/Serialization/ModuleManager.h index b2c406346a..ca643ba45f 100644 --- a/include/clang/Serialization/ModuleManager.h +++ b/include/clang/Serialization/ModuleManager.h @@ -96,9 +96,9 @@ class ModuleManager { void returnVisitState(VisitState *State); public: - typedef SmallVector::iterator ModuleIterator; - typedef SmallVector::const_iterator ModuleConstIterator; - typedef SmallVector::reverse_iterator ModuleReverseIterator; + typedef SmallVectorImpl::iterator ModuleIterator; + typedef SmallVectorImpl::const_iterator ModuleConstIterator; + typedef SmallVectorImpl::reverse_iterator ModuleReverseIterator; typedef std::pair ModuleOffset; explicit ModuleManager(FileManager &FileMgr); diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index dddc4d4c18..c66676f1ad 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -335,8 +335,8 @@ void ASTDumper::indent() { OS << "\n"; ColorScope Color(*this, IndentColor); - for (llvm::SmallVector::const_iterator I = Indents.begin(), - E = Indents.end(); + for (SmallVectorImpl::const_iterator I = Indents.begin(), + E = Indents.end(); I != E; ++I) { switch (*I) { case IT_Child: diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp index 8490458016..deac0c5dfb 100644 --- a/lib/AST/ASTImporter.cpp +++ b/lib/AST/ASTImporter.cpp @@ -4410,7 +4410,7 @@ Decl *ASTImporter::Import(Decl *FromD) { } else if (TypedefNameDecl *FromTypedef = dyn_cast(FromD)) { // When we've finished transforming a typedef, see whether it was the // typedef for an anonymous tag. - for (SmallVector::iterator + for (SmallVectorImpl::iterator FromTag = AnonTagsWithPendingTypedefs.begin(), FromTagEnd = AnonTagsWithPendingTypedefs.end(); FromTag != FromTagEnd; ++FromTag) { diff --git a/lib/AST/CXXInheritance.cpp b/lib/AST/CXXInheritance.cpp index 0e0b35d92a..6195a7dc68 100644 --- a/lib/AST/CXXInheritance.cpp +++ b/lib/AST/CXXInheritance.cpp @@ -447,7 +447,7 @@ FindNestedNameSpecifierMember(const CXXBaseSpecifier *Specifier, void OverridingMethods::add(unsigned OverriddenSubobject, UniqueVirtualMethod Overriding) { - SmallVector &SubobjectOverrides + SmallVectorImpl &SubobjectOverrides = Overrides[OverriddenSubobject]; if (std::find(SubobjectOverrides.begin(), SubobjectOverrides.end(), Overriding) == SubobjectOverrides.end()) @@ -650,11 +650,11 @@ CXXRecordDecl::getFinalOverriders(CXXFinalOverriderMap &FinalOverriders) const { SOEnd = OM->second.end(); SO != SOEnd; ++SO) { - SmallVector &Overriding = SO->second; + SmallVectorImpl &Overriding = SO->second; if (Overriding.size() < 2) continue; - for (SmallVector::iterator + for (SmallVectorImpl::iterator Pos = Overriding.begin(), PosEnd = Overriding.end(); Pos != PosEnd; /* increment in loop */) { @@ -669,7 +669,7 @@ CXXRecordDecl::getFinalOverriders(CXXFinalOverriderMap &FinalOverriders) const { // in a base class subobject that hides the virtual base class // subobject. bool Hidden = false; - for (SmallVector::iterator + for (SmallVectorImpl::iterator OP = Overriding.begin(), OPEnd = Overriding.end(); OP != OPEnd && !Hidden; ++OP) { diff --git a/lib/Basic/FileManager.cpp b/lib/Basic/FileManager.cpp index 9cc59027ab..d8deac72c4 100644 --- a/lib/Basic/FileManager.cpp +++ b/lib/Basic/FileManager.cpp @@ -610,7 +610,7 @@ void FileManager::GetUniqueIDMapping( UIDToFiles[FE->getValue()->getUID()] = FE->getValue(); // Map virtual file entries - for (SmallVector::const_iterator + for (SmallVectorImpl::const_iterator VFE = VirtualFileEntries.begin(), VFEEnd = VirtualFileEntries.end(); VFE != VFEEnd; ++VFE) if (*VFE && *VFE != NON_EXISTENT_FILE) diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 135af0404b..3f3d001449 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1077,7 +1077,7 @@ void Driver::BuildActions(const ToolChain &TC, const DerivedArgList &Args, // Build the pipeline for this file. OwningPtr Current(new InputAction(*InputArg, InputType)); - for (llvm::SmallVector::iterator + for (SmallVectorImpl::iterator i = PL.begin(), e = PL.end(); i != e; ++i) { phases::ID Phase = *i; diff --git a/lib/Parse/ParseAST.cpp b/lib/Parse/ParseAST.cpp index 7cd8a21ac4..5678ece0c8 100644 --- a/lib/Parse/ParseAST.cpp +++ b/lib/Parse/ParseAST.cpp @@ -145,7 +145,7 @@ void clang::ParseAST(Sema &S, bool PrintStats, bool SkipFunctionBodies) { } // Process any TopLevelDecls generated by #pragma weak. - for (SmallVector::iterator + for (SmallVectorImpl::iterator I = S.WeakTopLevelDecls().begin(), E = S.WeakTopLevelDecls().end(); I != E; ++I) Consumer->HandleTopLevelDecl(DeclGroupRef(*I)); diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index d630879390..67f9c3c7a7 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -2243,7 +2243,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, SmallVector Ranges; DeclaratorInfo.getCXX11AttributeRanges(Ranges); if (!Ranges.empty()) { - for (SmallVector::iterator I = Ranges.begin(), + for (SmallVectorImpl::iterator I = Ranges.begin(), E = Ranges.end(); I != E; ++I) { Diag((*I).getBegin(), diag::err_attributes_not_allowed) << *I; diff --git a/lib/Rewrite/Frontend/RewriteModernObjC.cpp b/lib/Rewrite/Frontend/RewriteModernObjC.cpp index 0e59b113c9..fd1f26347a 100644 --- a/lib/Rewrite/Frontend/RewriteModernObjC.cpp +++ b/lib/Rewrite/Frontend/RewriteModernObjC.cpp @@ -4262,7 +4262,7 @@ std::string RewriteModernObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, // Create local declarations to avoid rewriting all closure decl ref exprs. // First, emit a declaration for all "by ref" decls. - for (SmallVector::iterator I = BlockByRefDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E; ++I) { S += " "; std::string Name = (*I)->getNameAsString(); @@ -4273,7 +4273,7 @@ std::string RewriteModernObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by ref\n"; } // Next, emit a declaration for all "by copy" declarations. - for (SmallVector::iterator I = BlockByCopyDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E; ++I) { S += " "; // Handle nested closure invocation. For example: @@ -4374,7 +4374,7 @@ std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Ta if (BlockDeclRefs.size()) { // Output all "by copy" declarations. - for (SmallVector::iterator I = BlockByCopyDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E; ++I) { S += " "; std::string FieldName = (*I)->getNameAsString(); @@ -4403,7 +4403,7 @@ std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Ta S += FieldName + ";\n"; } // Output all "by ref" declarations. - for (SmallVector::iterator I = BlockByRefDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E; ++I) { S += " "; std::string FieldName = (*I)->getNameAsString(); @@ -4422,7 +4422,7 @@ std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Ta Constructor += ", int flags=0)"; // Initialize all "by copy" arguments. bool firsTime = true; - for (SmallVector::iterator I = BlockByCopyDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E; ++I) { std::string Name = (*I)->getNameAsString(); if (firsTime) { @@ -4437,7 +4437,7 @@ std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Ta Constructor += Name + "(_" + Name + ")"; } // Initialize all "by ref" arguments. - for (SmallVector::iterator I = BlockByRefDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E; ++I) { std::string Name = (*I)->getNameAsString(); if (firsTime) { @@ -5520,7 +5520,7 @@ Stmt *RewriteModernObjC::SynthBlockInitExpr(BlockExpr *Exp, if (BlockDeclRefs.size()) { Expr *Exp; // Output all "by copy" declarations. - for (SmallVector::iterator I = BlockByCopyDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E; ++I) { if (isObjCType((*I)->getType())) { // FIXME: Conform to ABI ([[obj retain] autorelease]). @@ -5554,7 +5554,7 @@ Stmt *RewriteModernObjC::SynthBlockInitExpr(BlockExpr *Exp, InitExprs.push_back(Exp); } // Output all "by ref" declarations. - for (SmallVector::iterator I = BlockByRefDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E; ++I) { ValueDecl *ND = (*I); std::string Name(ND->getNameAsString()); diff --git a/lib/Rewrite/Frontend/RewriteObjC.cpp b/lib/Rewrite/Frontend/RewriteObjC.cpp index 2f5cd0f6c6..662efaa63a 100644 --- a/lib/Rewrite/Frontend/RewriteObjC.cpp +++ b/lib/Rewrite/Frontend/RewriteObjC.cpp @@ -3366,7 +3366,7 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, // Create local declarations to avoid rewriting all closure decl ref exprs. // First, emit a declaration for all "by ref" decls. - for (SmallVector::iterator I = BlockByRefDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E; ++I) { S += " "; std::string Name = (*I)->getNameAsString(); @@ -3377,7 +3377,7 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by ref\n"; } // Next, emit a declaration for all "by copy" declarations. - for (SmallVector::iterator I = BlockByCopyDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E; ++I) { S += " "; // Handle nested closure invocation. For example: @@ -3478,7 +3478,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, if (BlockDeclRefs.size()) { // Output all "by copy" declarations. - for (SmallVector::iterator I = BlockByCopyDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E; ++I) { S += " "; std::string FieldName = (*I)->getNameAsString(); @@ -3507,7 +3507,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, S += FieldName + ";\n"; } // Output all "by ref" declarations. - for (SmallVector::iterator I = BlockByRefDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E; ++I) { S += " "; std::string FieldName = (*I)->getNameAsString(); @@ -3526,7 +3526,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, Constructor += ", int flags=0)"; // Initialize all "by copy" arguments. bool firsTime = true; - for (SmallVector::iterator I = BlockByCopyDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E; ++I) { std::string Name = (*I)->getNameAsString(); if (firsTime) { @@ -3541,7 +3541,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag, Constructor += Name + "(_" + Name + ")"; } // Initialize all "by ref" arguments. - for (SmallVector::iterator I = BlockByRefDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E; ++I) { std::string Name = (*I)->getNameAsString(); if (firsTime) { @@ -4548,7 +4548,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, if (BlockDeclRefs.size()) { Expr *Exp; // Output all "by copy" declarations. - for (SmallVector::iterator I = BlockByCopyDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E; ++I) { if (isObjCType((*I)->getType())) { // FIXME: Conform to ABI ([[obj retain] autorelease]). @@ -4582,7 +4582,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, InitExprs.push_back(Exp); } // Output all "by ref" declarations. - for (SmallVector::iterator I = BlockByRefDecls.begin(), + for (SmallVectorImpl::iterator I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E; ++I) { ValueDecl *ND = (*I); std::string Name(ND->getNameAsString()); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 162b5b8c09..389655686c 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -5810,7 +5810,7 @@ static NamedDecl* DiagnoseInvalidRedeclaration( if (CXXMethodDecl *NewMD = dyn_cast(NewFD)) NewFDisConst = NewMD->isConst(); - for (SmallVector, 1>::iterator + for (SmallVectorImpl>::iterator NearMatch = NearMatches.begin(), NearMatchEnd = NearMatches.end(); NearMatch != NearMatchEnd; ++NearMatch) { FunctionDecl *FD = NearMatch->first; diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 6f3997eb36..d2f784c1d5 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1350,7 +1350,7 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc, Diag(ControllingExpr->getLocStart(), diag::err_generic_sel_multi_match) << ControllingExpr->getSourceRange() << ControllingExpr->getType() << (unsigned) CompatIndices.size(); - for (SmallVector::iterator I = CompatIndices.begin(), + for (SmallVectorImpl::iterator I = CompatIndices.begin(), E = CompatIndices.end(); I != E; ++I) { Diag(Types[*I]->getTypeLoc().getBeginLoc(), diag::note_compat_assoc) diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 18328553d3..96291923bd 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -3383,7 +3383,7 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S, // be changed while iterating (e.g. because of deserialization). // To be safe we copy the lookup results to a new container. SmallVector Ctors(R.begin(), R.end()); - for (SmallVector::iterator + for (SmallVectorImpl::iterator CI = Ctors.begin(), CE = Ctors.end(); CI != CE; ++CI) { NamedDecl *D = *CI; DeclAccessPair FoundDecl = DeclAccessPair::make(D, D->getAccess()); @@ -4009,7 +4009,7 @@ static void TryUserDefinedConversion(Sema &S, // be changed while iterating. To be safe we copy the lookup results // to a new container. SmallVector CopyOfCon(R.begin(), R.end()); - for (SmallVector::iterator + for (SmallVectorImpl::iterator Con = CopyOfCon.begin(), ConEnd = CopyOfCon.end(); Con != ConEnd; ++Con) { NamedDecl *D = *Con; @@ -4716,7 +4716,7 @@ static void LookupCopyAndMoveConstructors(Sema &S, // be changed while iterating (e.g. because of deserialization). // To be safe we copy the lookup results to a new container. SmallVector Ctors(R.begin(), R.end()); - for (SmallVector::iterator + for (SmallVectorImpl::iterator CI = Ctors.begin(), CE = Ctors.end(); CI != CE; ++CI) { NamedDecl *D = *CI; CXXConstructorDecl *Constructor = 0; diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp index b2dbf0553f..1e6ef9baf7 100644 --- a/lib/Sema/SemaLambda.cpp +++ b/lib/Sema/SemaLambda.cpp @@ -608,10 +608,10 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, // Handle explicit captures. SourceLocation PrevCaptureLoc = Intro.Default == LCD_None? Intro.Range.getBegin() : Intro.DefaultLoc; - for (SmallVector::const_iterator - C = Intro.Captures.begin(), - E = Intro.Captures.end(); - C != E; + for (SmallVectorImpl::const_iterator + C = Intro.Captures.begin(), + E = Intro.Captures.end(); + C != E; PrevCaptureLoc = C->Loc, ++C) { if (C->Kind == LCK_This) { // C++11 [expr.prim.lambda]p8: diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index d3fd69982f..2538fad7c5 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -3470,8 +3470,8 @@ void NamespaceSpecifierSet::SortNamespaces() { std::sort(sortedDistances.begin(), sortedDistances.end()); Specifiers.clear(); - for (SmallVector::iterator DI = sortedDistances.begin(), - DIEnd = sortedDistances.end(); + for (SmallVectorImpl::iterator DI = sortedDistances.begin(), + DIEnd = sortedDistances.end(); DI != DIEnd; ++DI) { SpecifierInfoList &SpecList = DistanceMap[*DI]; Specifiers.append(SpecList.begin(), SpecList.end()); diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 7c2ee9dbe7..45162744b1 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -1411,7 +1411,7 @@ namespace { // Load SourceRanges into diagnostic if there is room. // Otherwise, load the SourceRange of the conditional expression. if (Ranges.size() <= PartialDiagnostic::MaxArguments) - for (SmallVector::iterator I = Ranges.begin(), + for (SmallVectorImpl::iterator I = Ranges.begin(), E = Ranges.end(); I != E; ++I) PDiag << *I; diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 9babafedc9..dd9ceae50d 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -435,7 +435,7 @@ void Sema::PrintInstantiationStack() { // FIXME: In all of these cases, we need to show the template arguments unsigned InstantiationIdx = 0; - for (SmallVector::reverse_iterator + for (SmallVectorImpl::reverse_iterator Active = ActiveTemplateInstantiations.rbegin(), ActiveEnd = ActiveTemplateInstantiations.rend(); Active != ActiveEnd; @@ -615,7 +615,7 @@ Optional Sema::isSFINAEContext() const { if (InNonInstantiationSFINAEContext) return Optional(0); - for (SmallVector::const_reverse_iterator + for (SmallVectorImpl::const_reverse_iterator Active = ActiveTemplateInstantiations.rbegin(), ActiveEnd = ActiveTemplateInstantiations.rend(); Active != ActiveEnd; @@ -2286,7 +2286,7 @@ Sema::InstantiateClassTemplateSpecialization( SmallVector InstantiatedTemplateParameters; if (Matched.size() >= 1) { - SmallVector::iterator Best = Matched.begin(); + SmallVectorImpl::iterator Best = Matched.begin(); if (Matched.size() == 1) { // -- If exactly one matching specialization is found, the // instantiation is generated from that specialization. @@ -2299,8 +2299,8 @@ Sema::InstantiateClassTemplateSpecialization( // specialized than all of the other matching // specializations, then the use of the class template is // ambiguous and the program is ill-formed. - for (SmallVector::iterator P = Best + 1, - PEnd = Matched.end(); + for (SmallVectorImpl::iterator P = Best + 1, + PEnd = Matched.end(); P != PEnd; ++P) { if (getMoreSpecializedPartialSpecialization(P->Partial, Best->Partial, PointOfInstantiation) @@ -2311,8 +2311,8 @@ Sema::InstantiateClassTemplateSpecialization( // Determine if the best partial specialization is more specialized than // the others. bool Ambiguous = false; - for (SmallVector::iterator P = Matched.begin(), - PEnd = Matched.end(); + for (SmallVectorImpl::iterator P = Matched.begin(), + PEnd = Matched.end(); P != PEnd; ++P) { if (P != Best && getMoreSpecializedPartialSpecialization(P->Partial, Best->Partial, @@ -2330,8 +2330,8 @@ Sema::InstantiateClassTemplateSpecialization( << ClassTemplateSpec; // Print the matching partial specializations. - for (SmallVector::iterator P = Matched.begin(), - PEnd = Matched.end(); + for (SmallVectorImpl::iterator P = Matched.begin(), + PEnd = Matched.end(); P != PEnd; ++P) Diag(P->Partial->getLocation(), diag::note_partial_spec_match) << getTemplateArgumentBindingsText( diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index bf01e9c2f2..b9061ad756 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -3120,7 +3120,7 @@ public: // Only emit declarations that aren't from a chained PCH, though. SmallVector Decls(IdResolver.begin(II), IdResolver.end()); - for (SmallVector::reverse_iterator D = Decls.rbegin(), + for (SmallVectorImpl::reverse_iterator D = Decls.rbegin(), DEnd = Decls.rend(); D != DEnd; ++D) clang::io::Emit32(Out, Writer.getDeclID(getMostRecentLocalDecl(*D))); @@ -4022,7 +4022,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, // Make sure visible decls, added to DeclContexts previously loaded from // an AST file, are registered for serialization. - for (SmallVector::iterator + for (SmallVectorImpl::iterator I = UpdatingVisibleDecls.begin(), E = UpdatingVisibleDecls.end(); I != E; ++I) { GetDeclRef(*I); @@ -4296,8 +4296,8 @@ void ASTWriter::WriteDeclReplacementsBlock() { return; RecordData Record; - for (SmallVector::iterator - I = ReplacedDecls.begin(), E = ReplacedDecls.end(); I != E; ++I) { + for (SmallVectorImpl::iterator + I = ReplacedDecls.begin(), E = ReplacedDecls.end(); I != E; ++I) { Record.push_back(I->ID); Record.push_back(I->Offset); Record.push_back(I->Loc); diff --git a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp index c5286d1a50..1229a326fd 100644 --- a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -1670,8 +1670,8 @@ void MallocChecker::checkDeadSymbols(SymbolReaper &SymReaper, if (!Errors.empty()) { static SimpleProgramPointTag Tag("MallocChecker : DeadSymbolsLeak"); N = C.addTransition(C.getState(), C.getPredecessor(), &Tag); - for (SmallVector::iterator - I = Errors.begin(), E = Errors.end(); I != E; ++I) { + for (SmallVectorImpl::iterator + I = Errors.begin(), E = Errors.end(); I != E; ++I) { reportLeak(*I, N, C); } } diff --git a/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp b/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp index c2786e184b..9ca0ab5d7f 100644 --- a/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp @@ -227,8 +227,8 @@ void SimpleStreamChecker::reportLeaks(SymbolVector LeakedStreams, ExplodedNode *ErrNode) const { // Attach bug reports to the leak node. // TODO: Identify the leaked file descriptor. - for (SmallVector::iterator - I = LeakedStreams.begin(), E = LeakedStreams.end(); I != E; ++I) { + for (SmallVectorImpl::iterator + I = LeakedStreams.begin(), E = LeakedStreams.end(); I != E; ++I) { BugReport *R = new BugReport(*LeakBugType, "Opened file is never closed; potential resource leak", ErrNode); R->markInteresting(*I); diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp index 6b110ad28b..912d5c501d 100644 --- a/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -2743,7 +2743,7 @@ void BugReporter::FlushReports() { SmallVector bugTypes; for (BugTypesTy::iterator I=BugTypes.begin(), E=BugTypes.end(); I!=E; ++I) bugTypes.push_back(*I); - for (SmallVector::iterator + for (SmallVectorImpl::iterator I = bugTypes.begin(), E = bugTypes.end(); I != E; ++I) const_cast(*I)->FlushReports(*this); diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 09bb0eba8f..eecb16a17e 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -308,8 +308,8 @@ bool CursorVisitor::visitDeclsFromFileRegion(FileID File, bool VisitedAtLeastOnce = false; DeclContext *CurDC = 0; - SmallVector::iterator DIt = Decls.begin(); - for (SmallVector::iterator DE = Decls.end(); DIt != DE; ++DIt) { + SmallVectorImpl::iterator DIt = Decls.begin(); + for (SmallVectorImpl::iterator DE = Decls.end(); DIt != DE; ++DIt) { Decl *D = *DIt; if (D->getSourceRange().isInvalid()) continue; diff --git a/tools/libclang/CIndexHigh.cpp b/tools/libclang/CIndexHigh.cpp index 2a55af57fc..c772dbbcb9 100644 --- a/tools/libclang/CIndexHigh.cpp +++ b/tools/libclang/CIndexHigh.cpp @@ -36,7 +36,7 @@ static void getTopOverriddenMethods(CXTranslationUnit TU, return; } - for (SmallVector::iterator + for (SmallVectorImpl::iterator I = Overridden.begin(), E = Overridden.end(); I != E; ++I) getTopOverriddenMethods(TU, cxcursor::getCursorDecl(*I), Methods); } diff --git a/tools/libclang/CXCursor.cpp b/tools/libclang/CXCursor.cpp index 5f798f92c6..2be0d8294b 100644 --- a/tools/libclang/CXCursor.cpp +++ b/tools/libclang/CXCursor.cpp @@ -75,7 +75,7 @@ CXCursor cxcursor::MakeCXCursor(const Decl *D, CXTranslationUnit TU, RegionOfInterest.getBegin() == RegionOfInterest.getEnd()) { SmallVector SelLocs; cast(D)->getSelectorLocs(SelLocs); - SmallVector::iterator + SmallVectorImpl::iterator I=std::find(SelLocs.begin(), SelLocs.end(),RegionOfInterest.getBegin()); if (I != SelLocs.end()) SelectorIdIndex = I - SelLocs.begin(); @@ -493,7 +493,7 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent, RegionOfInterest.getBegin() == RegionOfInterest.getEnd()) { SmallVector SelLocs; cast(S)->getSelectorLocs(SelLocs); - SmallVector::iterator + SmallVectorImpl::iterator I=std::find(SelLocs.begin(), SelLocs.end(),RegionOfInterest.getBegin()); if (I != SelLocs.end()) SelectorIdIndex = I - SelLocs.begin(); @@ -837,7 +837,7 @@ void cxcursor::getOverriddenCursors(CXCursor cursor, SmallVector OverDecls; D->getASTContext().getOverriddenMethods(D, OverDecls); - for (SmallVector::iterator + for (SmallVectorImpl::iterator I = OverDecls.begin(), E = OverDecls.end(); I != E; ++I) { overridden.push_back(MakeCXCursor(*I, TU)); } -- 2.40.0