From: Bill Wendling Date: Wed, 22 Feb 2012 09:51:33 +0000 (+0000) Subject: More ArrayRef-ification of methods. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=341785ec52f87c0803ba52dc88faac4e136f8593;p=clang More ArrayRef-ification of methods. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151152 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/ASTDiagnostic.h b/include/clang/AST/ASTDiagnostic.h index 6e36372004..64e955ea14 100644 --- a/include/clang/AST/ASTDiagnostic.h +++ b/include/clang/AST/ASTDiagnostic.h @@ -44,7 +44,7 @@ namespace clang { unsigned NumPrevArgs, SmallVectorImpl &Output, void *Cookie, - SmallVectorImpl &QualTypeVals); + ArrayRef QualTypeVals); } // end namespace clang #endif diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index 896b12f61e..72f82aa9e3 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -961,7 +961,7 @@ protected: /// /// \returns the first/last pair of declarations. static std::pair - BuildDeclChain(const SmallVectorImpl &Decls, bool FieldsAlreadyLoaded); + BuildDeclChain(ArrayRef Decls, bool FieldsAlreadyLoaded); DeclContext(Decl::Kind K) : DeclKind(K), ExternalLexicalStorage(false), diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index f9eaf99c95..3e54b4352b 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -289,7 +289,7 @@ private: unsigned NumPrevArgs, SmallVectorImpl &Output, void *Cookie, - SmallVectorImpl &QualTypeVals); + ArrayRef QualTypeVals); void *ArgToStringCookie; ArgToStringFnTy ArgToStringFn; diff --git a/lib/AST/ASTDiagnostic.cpp b/lib/AST/ASTDiagnostic.cpp index dd3be44a1f..9e0a360fcb 100644 --- a/lib/AST/ASTDiagnostic.cpp +++ b/lib/AST/ASTDiagnostic.cpp @@ -154,17 +154,16 @@ static std::string ConvertTypeToDiagnosticString(ASTContext &Context, QualType Ty, const DiagnosticsEngine::ArgumentValue *PrevArgs, unsigned NumPrevArgs, - SmallVectorImpl &QualTypeVals) { + ArrayRef QualTypeVals) { // FIXME: Playing with std::string is really slow. bool ForceAKA = false; QualType CanTy = Ty.getCanonicalType(); std::string S = Ty.getAsString(Context.getPrintingPolicy()); std::string CanS = CanTy.getAsString(Context.getPrintingPolicy()); - for (SmallVectorImpl::iterator I = QualTypeVals.begin(), - E = QualTypeVals.end(); I != E; ++I) { + for (unsigned I = 0, E = QualTypeVals.size(); I != E; ++I) { QualType CompareTy = - QualType::getFromOpaquePtr(reinterpret_cast(*I)); + QualType::getFromOpaquePtr(reinterpret_cast(QualTypeVals[I])); if (CompareTy == Ty) continue; // Same types QualType CompareCanTy = CompareTy.getCanonicalType(); @@ -235,7 +234,7 @@ void clang::FormatASTNodeDiagnosticArgument( unsigned NumPrevArgs, SmallVectorImpl &Output, void *Cookie, - SmallVectorImpl &QualTypeVals) { + ArrayRef QualTypeVals) { ASTContext &Context = *static_cast(Cookie); std::string S; diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index efbc5f9923..dbb0b6bfa4 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -872,7 +872,7 @@ DeclContext::collectAllContexts(llvm::SmallVectorImpl &Contexts){ } std::pair -DeclContext::BuildDeclChain(const SmallVectorImpl &Decls, +DeclContext::BuildDeclChain(ArrayRef Decls, bool FieldsAlreadyLoaded) { // Build up a chain of declarations via the Decl::NextInContextAndBits field. Decl *FirstNewDecl = 0; diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index c2631bba3f..4a63d97933 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -27,7 +27,7 @@ static void DummyArgToStringFn(DiagnosticsEngine::ArgumentKind AK, intptr_t QT, unsigned NumPrevArgs, SmallVectorImpl &Output, void *Cookie, - SmallVectorImpl &QualTypeVals) { + ArrayRef QualTypeVals) { const char *Str = ""; Output.append(Str, Str+strlen(Str)); } diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index f2051e9298..d6cfc1aac7 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -583,7 +583,7 @@ FinishArgumentPackDeduction(Sema &S, TemplateParameterList *TemplateParams, bool HasAnyArguments, SmallVectorImpl &Deduced, - const SmallVectorImpl &PackIndices, + ArrayRef PackIndices, SmallVectorImpl &SavedPacks, SmallVectorImpl< SmallVector > &NewlyDeducedPacks,