From 2e603c67c204b6bc9d96bf090ef4fd3a5b04aa51 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 10 Jun 2022 22:45:26 -0700 Subject: [PATCH] [clang] Construct SmallVector with iterator ranges (NFC) --- clang/lib/AST/ExprConstant.cpp | 2 +- clang/lib/AST/ItaniumMangle.cpp | 3 +-- clang/lib/Parse/ParseDecl.cpp | 3 +-- clang/lib/Sema/SemaExprCXX.cpp | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 896650e..3c62a83 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -6560,7 +6560,7 @@ static bool HandleDestructionImpl(EvalInfo &Info, SourceLocation CallLoc, // We don't have a good way to iterate fields in reverse, so collect all the // fields first and then walk them backwards. - SmallVector Fields(RD->field_begin(), RD->field_end()); + SmallVector Fields(RD->fields()); for (const FieldDecl *FD : llvm::reverse(Fields)) { if (FD->isUnnamedBitfield()) continue; diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index a941639..91f4177 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -5646,8 +5646,7 @@ void CXXNameMangler::mangleValueInTemplateArg(QualType T, const APValue &V, assert(RD && "unexpected type for record value"); // Drop trailing zero-initialized elements. - llvm::SmallVector Fields(RD->field_begin(), - RD->field_end()); + llvm::SmallVector Fields(RD->fields()); while ( !Fields.empty() && (Fields.back()->isUnnamedBitfield() || diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 0cdf915..a1a768b 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -4490,8 +4490,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, // If attributes exist after struct contents, parse them. MaybeParseGNUAttributes(attrs); - SmallVector FieldDecls(TagDecl->field_begin(), - TagDecl->field_end()); + SmallVector FieldDecls(TagDecl->fields()); Actions.ActOnFields(getCurScope(), RecordLoc, TagDecl, FieldDecls, T.getOpenLocation(), T.getCloseLocation(), attrs); diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 6c2c616..fe84e30 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -3745,7 +3745,7 @@ static bool resolveBuiltinNewDeleteOverload(Sema &S, CallExpr *TheCall, // We do our own custom access checks below. R.suppressDiagnostics(); - SmallVector Args(TheCall->arg_begin(), TheCall->arg_end()); + SmallVector Args(TheCall->arguments()); OverloadCandidateSet Candidates(R.getNameLoc(), OverloadCandidateSet::CSK_Normal); for (LookupResult::iterator FnOvl = R.begin(), FnOvlEnd = R.end(); -- 2.7.4