Skip to content

Commit 7a8237b

Browse files
[llvm] Use llvm::copy (NFC) (#168182)
Identified with llvm-use-ranges.
1 parent 636e370 commit 7a8237b

File tree

15 files changed

+22
-26
lines changed

15 files changed

+22
-26
lines changed

llvm/include/llvm/CodeGen/MachineInstr.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ class MachineInstr
185185
HasHeapAllocMarker, HasPCSections, HasCFIType, HasMMRAs);
186186

187187
// Copy the actual data into the trailing objects.
188-
std::copy(MMOs.begin(), MMOs.end(),
189-
Result->getTrailingObjects<MachineMemOperand *>());
188+
llvm::copy(MMOs, Result->getTrailingObjects<MachineMemOperand *>());
190189

191190
unsigned MDNodeIdx = 0;
192191

llvm/include/llvm/CodeGen/RegAllocPBQP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class AllowedRegVector {
100100

101101
AllowedRegVector(const std::vector<MCRegister> &OptVec)
102102
: NumOpts(OptVec.size()), Opts(new MCRegister[NumOpts]) {
103-
std::copy(OptVec.begin(), OptVec.end(), Opts.get());
103+
llvm::copy(OptVec, Opts.get());
104104
}
105105

106106
unsigned size() const { return NumOpts; }

llvm/include/llvm/IR/PredIteratorCache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class PredIteratorCache {
4040

4141
SmallVector<BasicBlock *, 32> PredCache(predecessors(BB));
4242
BasicBlock **Data = Memory.Allocate<BasicBlock *>(PredCache.size());
43-
std::copy(PredCache.begin(), PredCache.end(), Data);
43+
llvm::copy(PredCache, Data);
4444
Entry = ArrayRef(Data, PredCache.size());
4545
return Entry;
4646
}

llvm/lib/ObjCopy/COFF/COFFObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct Section {
6969
struct AuxSymbol {
7070
AuxSymbol(ArrayRef<uint8_t> In) {
7171
assert(In.size() == sizeof(Opaque));
72-
std::copy(In.begin(), In.end(), Opaque);
72+
llvm::copy(In, Opaque);
7373
}
7474

7575
ArrayRef<uint8_t> getRef() const {

llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ static Error dumpSectionToFile(StringRef SecName, StringRef Filename,
198198
if (!BufferOrErr)
199199
return createFileError(Filename, BufferOrErr.takeError());
200200
std::unique_ptr<FileOutputBuffer> Buf = std::move(*BufferOrErr);
201-
std::copy(Sec.OriginalData.begin(), Sec.OriginalData.end(),
202-
Buf->getBufferStart());
201+
llvm::copy(Sec.OriginalData, Buf->getBufferStart());
203202
if (Error E = Buf->commit())
204203
return createFileError(Filename, std::move(E));
205204
return Error::success();

llvm/lib/ObjCopy/ELF/ELFObject.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ Error ELFSectionWriter<ELFT>::visit(const CompressedSection &Sec) {
536536
Elf_Chdr_Impl<ELFT> Chdr = {};
537537
switch (Sec.CompressionType) {
538538
case DebugCompressionType::None:
539-
std::copy(Sec.OriginalData.begin(), Sec.OriginalData.end(), Buf);
539+
llvm::copy(Sec.OriginalData, Buf);
540540
return Error::success();
541541
case DebugCompressionType::Zlib:
542542
Chdr.ch_type = ELF::ELFCOMPRESS_ZLIB;
@@ -550,7 +550,7 @@ Error ELFSectionWriter<ELFT>::visit(const CompressedSection &Sec) {
550550
memcpy(Buf, &Chdr, sizeof(Chdr));
551551
Buf += sizeof(Chdr);
552552

553-
std::copy(Sec.CompressedData.begin(), Sec.CompressedData.end(), Buf);
553+
llvm::copy(Sec.CompressedData, Buf);
554554
return Error::success();
555555
}
556556

llvm/lib/Object/COFFImportFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static void writeStringTable(std::vector<uint8_t> &B,
161161

162162
for (const auto &S : Strings) {
163163
B.resize(Pos + S.length() + 1);
164-
std::copy(S.begin(), S.end(), std::next(B.begin(), Pos));
164+
llvm::copy(S, std::next(B.begin(), Pos));
165165
B[Pos + S.length()] = 0;
166166
Pos += S.length() + 1;
167167
}

llvm/lib/ObjectYAML/COFFEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ struct COFFParser {
9999
// store it in the string table.
100100
StringRef Name = Sym.Name;
101101
if (Name.size() <= COFF::NameSize) {
102-
std::copy(Name.begin(), Name.end(), Sym.Header.Name);
102+
llvm::copy(Name, Sym.Header.Name);
103103
} else {
104104
// Add string to the string table and format the index for output.
105105
unsigned Index = getStringIndex(Name);

llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,8 +1232,7 @@ loadBinaryFormat(std::unique_ptr<Binary> Bin, StringRef Arch,
12321232
if (!CoverageRecordsOrErr)
12331233
return CoverageRecordsOrErr.takeError();
12341234
const auto &CoverageRecords = CoverageRecordsOrErr.get();
1235-
FuncRecordsBuffer = std::copy(CoverageRecords.begin(),
1236-
CoverageRecords.end(), FuncRecordsBuffer);
1235+
FuncRecordsBuffer = llvm::copy(CoverageRecords, FuncRecordsBuffer);
12371236
FuncRecordsBuffer =
12381237
std::fill_n(FuncRecordsBuffer,
12391238
alignAddr(FuncRecordsBuffer, RecordAlignment) -

llvm/lib/Support/Mustache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static Accessor splitMustacheString(StringRef Str, MustacheContext &Ctx) {
7575
// Now, allocate memory for the array of StringRefs in the arena.
7676
StringRef *ArenaTokens = Ctx.Allocator.Allocate<StringRef>(Tokens.size());
7777
// Copy the StringRefs from the stack vector to the arena.
78-
std::copy(Tokens.begin(), Tokens.end(), ArenaTokens);
78+
llvm::copy(Tokens, ArenaTokens);
7979
// Return an ArrayRef pointing to the stable arena memory.
8080
return ArrayRef<StringRef>(ArenaTokens, Tokens.size());
8181
}

0 commit comments

Comments
 (0)