diff --git a/include/llvm/Bitstream/BitstreamWriter.h b/include/llvm/Bitstream/BitstreamWriter.h index 3954df4897a..56ec99c58ea 100644 --- a/include/llvm/Bitstream/BitstreamWriter.h +++ b/include/llvm/Bitstream/BitstreamWriter.h @@ -302,10 +302,8 @@ public: // If there is a blockinfo for this BlockID, add all the predefined abbrevs // to the abbrev list. - if (BlockInfo *Info = getBlockInfo(BlockID)) { - CurAbbrevs.insert(CurAbbrevs.end(), Info->Abbrevs.begin(), - Info->Abbrevs.end()); - } + if (BlockInfo *Info = getBlockInfo(BlockID)) + append_range(CurAbbrevs, Info->Abbrevs); } void ExitBlock() { diff --git a/include/llvm/Support/GenericDomTree.h b/include/llvm/Support/GenericDomTree.h index 18e08dbcd17..21fd50763b1 100644 --- a/include/llvm/Support/GenericDomTree.h +++ b/include/llvm/Support/GenericDomTree.h @@ -564,8 +564,7 @@ protected: // made to the CFG), so the PreViewCFG needs all the updates reverse // applied. SmallVector AllUpdates(Updates.begin(), Updates.end()); - for (auto &Update : PostViewUpdates) - AllUpdates.push_back(Update); + append_range(AllUpdates, PostViewUpdates); GraphDiff PreViewCFG(AllUpdates, /*ReverseApplyUpdates=*/true); GraphDiff PostViewCFG(PostViewUpdates); diff --git a/tools/llvm-cov/CoverageExporterJson.cpp b/tools/llvm-cov/CoverageExporterJson.cpp index d1446f379f0..d341abe8dfc 100644 --- a/tools/llvm-cov/CoverageExporterJson.cpp +++ b/tools/llvm-cov/CoverageExporterJson.cpp @@ -123,8 +123,7 @@ collectNestedBranches(const coverage::CoverageMapping &Coverage, // Recursively collect branches from nested expansions. auto NestedExpansions = ExpansionCoverage.getExpansions(); auto NestedExBranches = collectNestedBranches(Coverage, NestedExpansions); - Branches.insert(Branches.end(), NestedExBranches.begin(), - NestedExBranches.end()); + append_range(Branches, NestedExBranches); // Add branches from this level of expansion. auto ExBranches = ExpansionCoverage.getBranches(); diff --git a/tools/llvm-cov/CoverageExporterLcov.cpp b/tools/llvm-cov/CoverageExporterLcov.cpp index 99ca037e7b5..6cf5d9285b9 100644 --- a/tools/llvm-cov/CoverageExporterLcov.cpp +++ b/tools/llvm-cov/CoverageExporterLcov.cpp @@ -91,8 +91,7 @@ collectNestedBranches(const coverage::CoverageMapping &Coverage, auto NestedExpansions = ExpansionCoverage.getExpansions(); auto NestedExBranches = collectNestedBranches(Coverage, NestedExpansions, ViewDepth + 1, SrcLine); - Branches.insert(Branches.end(), NestedExBranches.begin(), - NestedExBranches.end()); + append_range(Branches, NestedExBranches); // Add branches from this level of expansion. auto ExBranches = ExpansionCoverage.getBranches(); @@ -123,7 +122,7 @@ void renderBranchExecutionCounts(raw_ostream &OS, collectNestedBranches(Coverage, FileCoverage.getExpansions()); // Append Expansion Branches to Source Branches. - Branches.insert(Branches.end(), ExBranches.begin(), ExBranches.end()); + append_range(Branches, ExBranches); // Sort branches based on line number to ensure branches corresponding to the // same source line are counted together. diff --git a/tools/llvm-readobj/COFFDumper.cpp b/tools/llvm-readobj/COFFDumper.cpp index 684967f9339..2a77ebe34bc 100644 --- a/tools/llvm-readobj/COFFDumper.cpp +++ b/tools/llvm-readobj/COFFDumper.cpp @@ -593,8 +593,7 @@ void COFFDumper::cacheRelocations() { for (const SectionRef &S : Obj->sections()) { const coff_section *Section = Obj->getCOFFSection(S); - for (const RelocationRef &Reloc : S.relocations()) - RelocMap[Section].push_back(Reloc); + append_range(RelocMap[Section], S.relocations()); // Sort relocations by address. llvm::sort(RelocMap[Section], [](RelocationRef L, RelocationRef R) { diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index 688c7f275e1..e88cb473e95 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -564,8 +564,7 @@ void thinlto_debug_options(const char *const *options, int number) { // if options were requested, set them if (number && options) { std::vector CodegenArgv(1, "libLTO"); - for (auto Arg : ArrayRef(options, number)) - CodegenArgv.push_back(Arg); + append_range(CodegenArgv, ArrayRef(options, number)); cl::ParseCommandLineOptions(CodegenArgv.size(), CodegenArgv.data()); } } diff --git a/tools/obj2yaml/wasm2yaml.cpp b/tools/obj2yaml/wasm2yaml.cpp index 205ec1e0163..2d7ff3b2f9a 100644 --- a/tools/obj2yaml/wasm2yaml.cpp +++ b/tools/obj2yaml/wasm2yaml.cpp @@ -329,9 +329,7 @@ ErrorOr WasmDumper::dump() { WasmYAML::ElemSegment Seg; Seg.TableIndex = Segment.TableIndex; Seg.Offset = Segment.Offset; - for (auto &Func : Segment.Functions) { - Seg.Functions.push_back(Func); - } + append_range(Seg.Functions, Segment.Functions); ElemSec->Segments.push_back(Seg); } S = std::move(ElemSec); diff --git a/utils/FileCheck/FileCheck.cpp b/utils/FileCheck/FileCheck.cpp index be277566620..d59607a2b93 100644 --- a/utils/FileCheck/FileCheck.cpp +++ b/utils/FileCheck/FileCheck.cpp @@ -745,14 +745,11 @@ int main(int argc, char **argv) { } FileCheckRequest Req; - for (StringRef Prefix : CheckPrefixes) - Req.CheckPrefixes.push_back(Prefix); + append_range(Req.CheckPrefixes, CheckPrefixes); - for (StringRef Prefix : CommentPrefixes) - Req.CommentPrefixes.push_back(Prefix); + append_range(Req.CommentPrefixes, CommentPrefixes); - for (StringRef CheckNot : ImplicitCheckNot) - Req.ImplicitCheckNot.push_back(CheckNot); + append_range(Req.ImplicitCheckNot, ImplicitCheckNot); bool GlobalDefineError = false; for (StringRef G : GlobalDefines) {