[llvm] 7728cc0 - [llvm] Use append_range (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 29 23:23:57 PST 2021
Author: Kazu Hirata
Date: 2021-01-29T23:23:34-08:00
New Revision: 7728cc003a87b274ebd611070fe38f0e41fef2aa
URL: https://github.com/llvm/llvm-project/commit/7728cc003a87b274ebd611070fe38f0e41fef2aa
DIFF: https://github.com/llvm/llvm-project/commit/7728cc003a87b274ebd611070fe38f0e41fef2aa.diff
LOG: [llvm] Use append_range (NFC)
Added:
Modified:
llvm/include/llvm/Bitstream/BitstreamWriter.h
llvm/include/llvm/Support/GenericDomTree.h
llvm/tools/llvm-cov/CoverageExporterJson.cpp
llvm/tools/llvm-cov/CoverageExporterLcov.cpp
llvm/tools/llvm-readobj/COFFDumper.cpp
llvm/tools/lto/lto.cpp
llvm/tools/obj2yaml/wasm2yaml.cpp
llvm/utils/FileCheck/FileCheck.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Bitstream/BitstreamWriter.h b/llvm/include/llvm/Bitstream/BitstreamWriter.h
index 3954df4897ae..56ec99c58ea0 100644
--- a/llvm/include/llvm/Bitstream/BitstreamWriter.h
+++ b/llvm/include/llvm/Bitstream/BitstreamWriter.h
@@ -302,10 +302,8 @@ class BitstreamWriter {
// 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/llvm/include/llvm/Support/GenericDomTree.h b/llvm/include/llvm/Support/GenericDomTree.h
index 18e08dbcd175..21fd50763b1f 100644
--- a/llvm/include/llvm/Support/GenericDomTree.h
+++ b/llvm/include/llvm/Support/GenericDomTree.h
@@ -564,8 +564,7 @@ class DominatorTreeBase {
// made to the CFG), so the PreViewCFG needs all the updates reverse
// applied.
SmallVector<UpdateType> AllUpdates(Updates.begin(), Updates.end());
- for (auto &Update : PostViewUpdates)
- AllUpdates.push_back(Update);
+ append_range(AllUpdates, PostViewUpdates);
GraphDiff<NodePtr, IsPostDom> PreViewCFG(AllUpdates,
/*ReverseApplyUpdates=*/true);
GraphDiff<NodePtr, IsPostDom> PostViewCFG(PostViewUpdates);
diff --git a/llvm/tools/llvm-cov/CoverageExporterJson.cpp b/llvm/tools/llvm-cov/CoverageExporterJson.cpp
index d1446f379f00..d341abe8dfc8 100644
--- a/llvm/tools/llvm-cov/CoverageExporterJson.cpp
+++ b/llvm/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/llvm/tools/llvm-cov/CoverageExporterLcov.cpp b/llvm/tools/llvm-cov/CoverageExporterLcov.cpp
index 99ca037e7b5e..6cf5d9285b90 100644
--- a/llvm/tools/llvm-cov/CoverageExporterLcov.cpp
+++ b/llvm/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/llvm/tools/llvm-readobj/COFFDumper.cpp b/llvm/tools/llvm-readobj/COFFDumper.cpp
index 684967f93393..2a77ebe34bc6 100644
--- a/llvm/tools/llvm-readobj/COFFDumper.cpp
+++ b/llvm/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/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp
index 688c7f275e17..e88cb473e95b 100644
--- a/llvm/tools/lto/lto.cpp
+++ b/llvm/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<const char *> CodegenArgv(1, "libLTO");
- for (auto Arg : ArrayRef<const char *>(options, number))
- CodegenArgv.push_back(Arg);
+ append_range(CodegenArgv, ArrayRef<const char *>(options, number));
cl::ParseCommandLineOptions(CodegenArgv.size(), CodegenArgv.data());
}
}
diff --git a/llvm/tools/obj2yaml/wasm2yaml.cpp b/llvm/tools/obj2yaml/wasm2yaml.cpp
index 205ec1e01638..2d7ff3b2f9a5 100644
--- a/llvm/tools/obj2yaml/wasm2yaml.cpp
+++ b/llvm/tools/obj2yaml/wasm2yaml.cpp
@@ -329,9 +329,7 @@ ErrorOr<WasmYAML::Object *> 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/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp
index be277566620e..d59607a2b932 100644
--- a/llvm/utils/FileCheck/FileCheck.cpp
+++ b/llvm/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) {
More information about the llvm-commits
mailing list