Skip to content

Commit

Permalink
[clang] Construct SmallVector with iterator ranges (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Jun 11, 2022
1 parent f5ef2c5 commit 2e603c6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion clang/lib/AST/ExprConstant.cpp
Expand Up @@ -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<FieldDecl*, 16> Fields(RD->field_begin(), RD->field_end());
SmallVector<FieldDecl*, 16> Fields(RD->fields());
for (const FieldDecl *FD : llvm::reverse(Fields)) {
if (FD->isUnnamedBitfield())
continue;
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/AST/ItaniumMangle.cpp
Expand Up @@ -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<const FieldDecl *, 16> Fields(RD->field_begin(),
RD->field_end());
llvm::SmallVector<const FieldDecl *, 16> Fields(RD->fields());
while (
!Fields.empty() &&
(Fields.back()->isUnnamedBitfield() ||
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/Parse/ParseDecl.cpp
Expand Up @@ -4490,8 +4490,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
// If attributes exist after struct contents, parse them.
MaybeParseGNUAttributes(attrs);

SmallVector<Decl *, 32> FieldDecls(TagDecl->field_begin(),
TagDecl->field_end());
SmallVector<Decl *, 32> FieldDecls(TagDecl->fields());

Actions.ActOnFields(getCurScope(), RecordLoc, TagDecl, FieldDecls,
T.getOpenLocation(), T.getCloseLocation(), attrs);
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaExprCXX.cpp
Expand Up @@ -3745,7 +3745,7 @@ static bool resolveBuiltinNewDeleteOverload(Sema &S, CallExpr *TheCall,
// We do our own custom access checks below.
R.suppressDiagnostics();

SmallVector<Expr *, 8> Args(TheCall->arg_begin(), TheCall->arg_end());
SmallVector<Expr *, 8> Args(TheCall->arguments());
OverloadCandidateSet Candidates(R.getNameLoc(),
OverloadCandidateSet::CSK_Normal);
for (LookupResult::iterator FnOvl = R.begin(), FnOvlEnd = R.end();
Expand Down

0 comments on commit 2e603c6

Please sign in to comment.