diff --git a/include/llvm/ADT/DirectedGraph.h b/include/llvm/ADT/DirectedGraph.h index ec7d754f6e0..e8bb9e6b229 100644 --- a/include/llvm/ADT/DirectedGraph.h +++ b/include/llvm/ADT/DirectedGraph.h @@ -229,7 +229,7 @@ public: if (*Node == N) continue; Node->findEdgesTo(N, TempList); - EL.insert(EL.end(), TempList.begin(), TempList.end()); + llvm::append_range(EL, TempList); TempList.clear(); } return !EL.empty(); diff --git a/include/llvm/IR/InstrTypes.h b/include/llvm/IR/InstrTypes.h index 8a702e3c9c5..631665e3fc5 100644 --- a/include/llvm/IR/InstrTypes.h +++ b/include/llvm/IR/InstrTypes.h @@ -1126,7 +1126,7 @@ public: explicit OperandBundleDefT(const OperandBundleUse &OBU) { Tag = std::string(OBU.getTagName()); - Inputs.insert(Inputs.end(), OBU.Inputs.begin(), OBU.Inputs.end()); + llvm::append_range(Inputs, OBU.Inputs); } ArrayRef inputs() const { return Inputs; } diff --git a/include/llvm/Support/CFGDiff.h b/include/llvm/Support/CFGDiff.h index a4a4b2ca44b..c90b9aca78b 100644 --- a/include/llvm/Support/CFGDiff.h +++ b/include/llvm/Support/CFGDiff.h @@ -152,7 +152,7 @@ public: // Add children present in the snapshot for not in the real CFG. auto &AddedChildren = It->second.DI[1]; - Res.insert(Res.end(), AddedChildren.begin(), AddedChildren.end()); + llvm::append_range(Res, AddedChildren); return Res; } diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index b2bb6728c67..28493dd070d 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -6358,8 +6358,7 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) { } case bitc::FS_TYPE_TESTS: assert(PendingTypeTests.empty()); - PendingTypeTests.insert(PendingTypeTests.end(), Record.begin(), - Record.end()); + llvm::append_range(PendingTypeTests, Record); break; case bitc::FS_TYPE_TEST_ASSUME_VCALLS: diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 4b81ccde4ab..9f62cce028f 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -3629,7 +3629,7 @@ static void writeFunctionTypeMetadataRecords(BitstreamWriter &Stream, Record.clear(); Record.push_back(VC.VFunc.GUID); Record.push_back(VC.VFunc.Offset); - Record.insert(Record.end(), VC.Args.begin(), VC.Args.end()); + llvm::append_range(Record, VC.Args); Stream.EmitRecord(Ty, Record); } }; @@ -3703,7 +3703,7 @@ static void writeWholeProgramDevirtResolutionByArg( SmallVector &NameVals, const std::vector &args, const WholeProgramDevirtResolution::ByArg &ByArg) { NameVals.push_back(args.size()); - NameVals.insert(NameVals.end(), args.begin(), args.end()); + llvm::append_range(NameVals, args); NameVals.push_back(ByArg.TheKind); NameVals.push_back(ByArg.Info); diff --git a/lib/Bitstream/Reader/BitstreamReader.cpp b/lib/Bitstream/Reader/BitstreamReader.cpp index 1d4f045efee..28adfe6268f 100644 --- a/lib/Bitstream/Reader/BitstreamReader.cpp +++ b/lib/Bitstream/Reader/BitstreamReader.cpp @@ -27,8 +27,7 @@ Error BitstreamCursor::EnterSubBlock(unsigned BlockID, unsigned *NumWordsP) { if (BlockInfo) { if (const BitstreamBlockInfo::BlockInfo *Info = BlockInfo->getBlockInfo(BlockID)) { - CurAbbrevs.insert(CurAbbrevs.end(), Info->Abbrevs.begin(), - Info->Abbrevs.end()); + llvm::append_range(CurAbbrevs, Info->Abbrevs); } } diff --git a/lib/DWARFLinker/DWARFLinker.cpp b/lib/DWARFLinker/DWARFLinker.cpp index 7acf9023c08..e285773dfd5 100644 --- a/lib/DWARFLinker/DWARFLinker.cpp +++ b/lib/DWARFLinker/DWARFLinker.cpp @@ -1575,7 +1575,7 @@ static void insertLineSequence(std::vector &Seq, return; if (!Rows.empty() && Rows.back().Address < Seq.front().Address) { - Rows.insert(Rows.end(), Seq.begin(), Seq.end()); + llvm::append_range(Rows, Seq); Seq.clear(); return; } diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index cb1b35d6238..3aa77557862 100644 --- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -419,7 +419,7 @@ static GenericValue lle_X_printf(FunctionType *FT, char Buffer[10000]; std::vector NewArgs; NewArgs.push_back(PTOGV((void*)&Buffer[0])); - NewArgs.insert(NewArgs.end(), Args.begin(), Args.end()); + llvm::append_range(NewArgs, Args); GenericValue GV = lle_X_sprintf(FT, NewArgs); outs() << Buffer; return GV; diff --git a/lib/ExecutionEngine/Orc/Core.cpp b/lib/ExecutionEngine/Orc/Core.cpp index 659dd9a1d3e..7d61a7d6edd 100644 --- a/lib/ExecutionEngine/Orc/Core.cpp +++ b/lib/ExecutionEngine/Orc/Core.cpp @@ -1241,8 +1241,7 @@ void JITDylib::setLinkOrder(JITDylibSearchOrder NewLinkOrder, if (NewLinkOrder.empty() || NewLinkOrder.front().first != this) LinkOrder.push_back( std::make_pair(this, JITDylibLookupFlags::MatchAllSymbols)); - LinkOrder.insert(LinkOrder.end(), NewLinkOrder.begin(), - NewLinkOrder.end()); + llvm::append_range(LinkOrder, NewLinkOrder); } else LinkOrder = std::move(NewLinkOrder); }); diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp index d39cdf7db04..ec2b83f614d 100644 --- a/lib/IR/Attributes.cpp +++ b/lib/IR/Attributes.cpp @@ -1200,7 +1200,7 @@ AttributeList AttributeList::get(LLVMContext &C, AttributeSet FnAttrs, if (NumSets > 2) { // Drop the empty argument attribute sets at the end. ArgAttrs = ArgAttrs.take_front(NumSets - 2); - AttrSets.insert(AttrSets.end(), ArgAttrs.begin(), ArgAttrs.end()); + llvm::append_range(AttrSets, ArgAttrs); } return getImpl(C, AttrSets); diff --git a/lib/IR/IRBuilder.cpp b/lib/IR/IRBuilder.cpp index 51e28916559..e3aa9b3cf1f 100644 --- a/lib/IR/IRBuilder.cpp +++ b/lib/IR/IRBuilder.cpp @@ -578,7 +578,7 @@ getStatepointArgs(IRBuilderBase &B, uint64_t ID, uint32_t NumPatchBytes, Args.push_back(ActualCallee); Args.push_back(B.getInt32(CallArgs.size())); Args.push_back(B.getInt32(Flags)); - Args.insert(Args.end(), CallArgs.begin(), CallArgs.end()); + llvm::append_range(Args, CallArgs); // GC Transition and Deopt args are now always handled via operand bundle. // They will be removed from the signature of gc.statepoint shortly. Args.push_back(B.getInt32(0)); @@ -595,18 +595,17 @@ getStatepointBundles(Optional> TransitionArgs, std::vector Rval; if (DeoptArgs) { SmallVector DeoptValues; - DeoptValues.insert(DeoptValues.end(), DeoptArgs->begin(), DeoptArgs->end()); + llvm::append_range(DeoptValues, *DeoptArgs); Rval.emplace_back("deopt", DeoptValues); } if (TransitionArgs) { SmallVector TransitionValues; - TransitionValues.insert(TransitionValues.end(), - TransitionArgs->begin(), TransitionArgs->end()); + llvm::append_range(TransitionValues, *TransitionArgs); Rval.emplace_back("gc-transition", TransitionValues); } if (GCArgs.size()) { SmallVector LiveValues; - LiveValues.insert(LiveValues.end(), GCArgs.begin(), GCArgs.end()); + llvm::append_range(LiveValues, GCArgs); Rval.emplace_back("gc-live", LiveValues); } return Rval; diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 5b9039d9a78..98241bc76ed 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -5975,7 +5975,7 @@ bool AsmParser::parseMSInlineAsm( // Consider implicit defs to be clobbers. Think of cpuid and push. ArrayRef ImpDefs(Desc.getImplicitDefs(), Desc.getNumImplicitDefs()); - ClobberRegs.insert(ClobberRegs.end(), ImpDefs.begin(), ImpDefs.end()); + llvm::append_range(ClobberRegs, ImpDefs); } // Set the number of Outputs and Inputs. diff --git a/lib/MC/MCParser/MasmParser.cpp b/lib/MC/MCParser/MasmParser.cpp index e5d8039f5f3..4957ee7a032 100644 --- a/lib/MC/MCParser/MasmParser.cpp +++ b/lib/MC/MCParser/MasmParser.cpp @@ -4044,8 +4044,7 @@ bool MasmParser::parseStructInstList( return true; for (int i = 0; i < Repetitions; ++i) - Initializers.insert(Initializers.end(), DuplicatedValues.begin(), - DuplicatedValues.end()); + llvm::append_range(Initializers, DuplicatedValues); } else { Initializers.emplace_back(); if (parseStructInitializer(Structure, Initializers.back())) @@ -7119,7 +7118,7 @@ bool MasmParser::parseMSInlineAsm( // Consider implicit defs to be clobbers. Think of cpuid and push. ArrayRef ImpDefs(Desc.getImplicitDefs(), Desc.getNumImplicitDefs()); - ClobberRegs.insert(ClobberRegs.end(), ImpDefs.begin(), ImpDefs.end()); + llvm::append_range(ClobberRegs, ImpDefs); } // Set the number of Outputs and Inputs. diff --git a/lib/MC/WasmObjectWriter.cpp b/lib/MC/WasmObjectWriter.cpp index 112c5b3f120..fb41c3763c1 100644 --- a/lib/MC/WasmObjectWriter.cpp +++ b/lib/MC/WasmObjectWriter.cpp @@ -649,11 +649,11 @@ static void addData(SmallVectorImpl &DataBytes, Fill->getValue()); } else if (auto *LEB = dyn_cast(&Frag)) { const SmallVectorImpl &Contents = LEB->getContents(); - DataBytes.insert(DataBytes.end(), Contents.begin(), Contents.end()); + llvm::append_range(DataBytes, Contents); } else { const auto &DataFrag = cast(Frag); const SmallVectorImpl &Contents = DataFrag.getContents(); - DataBytes.insert(DataBytes.end(), Contents.begin(), Contents.end()); + llvm::append_range(DataBytes, Contents); } } diff --git a/lib/MCA/HardwareUnits/Scheduler.cpp b/lib/MCA/HardwareUnits/Scheduler.cpp index 8730336c666..31ea751f1c4 100644 --- a/lib/MCA/HardwareUnits/Scheduler.cpp +++ b/lib/MCA/HardwareUnits/Scheduler.cpp @@ -241,7 +241,7 @@ void Scheduler::updateIssuedSet(SmallVectorImpl &Executed) { } uint64_t Scheduler::analyzeResourcePressure(SmallVectorImpl &Insts) { - Insts.insert(Insts.end(), ReadySet.begin(), ReadySet.end()); + llvm::append_range(Insts, ReadySet); return BusyResourceUnits; } diff --git a/lib/ProfileData/Coverage/CoverageMapping.cpp b/lib/ProfileData/Coverage/CoverageMapping.cpp index 4c90eaafcc3..a8cc308b4e3 100644 --- a/lib/ProfileData/Coverage/CoverageMapping.cpp +++ b/lib/ProfileData/Coverage/CoverageMapping.cpp @@ -616,8 +616,7 @@ public: std::vector CoverageMapping::getUniqueSourceFiles() const { std::vector Filenames; for (const auto &Function : getCoveredFunctions()) - Filenames.insert(Filenames.end(), Function.Filenames.begin(), - Function.Filenames.end()); + llvm::append_range(Filenames, Function.Filenames); llvm::sort(Filenames); auto Last = std::unique(Filenames.begin(), Filenames.end()); Filenames.erase(Last, Filenames.end()); diff --git a/lib/ProfileData/SampleProfReader.cpp b/lib/ProfileData/SampleProfReader.cpp index ebae9cee955..a8ffb378fb3 100644 --- a/lib/ProfileData/SampleProfReader.cpp +++ b/lib/ProfileData/SampleProfReader.cpp @@ -1349,7 +1349,7 @@ std::error_code SampleProfileReaderGCC::readOneFunctionProfile( InlineCallStack NewStack; NewStack.push_back(FProfile); - NewStack.insert(NewStack.end(), InlineStack.begin(), InlineStack.end()); + llvm::append_range(NewStack, InlineStack); if (Update) { // Walk up the inline stack, adding the samples on this line to // the total sample count of the callers in the chain. @@ -1397,7 +1397,7 @@ std::error_code SampleProfileReaderGCC::readOneFunctionProfile( return sampleprof_error::truncated; InlineCallStack NewStack; NewStack.push_back(FProfile); - NewStack.insert(NewStack.end(), InlineStack.begin(), InlineStack.end()); + llvm::append_range(NewStack, InlineStack); if (std::error_code EC = readOneFunctionProfile(NewStack, Update, Offset)) return EC; } diff --git a/lib/Support/Windows/Program.inc b/lib/Support/Windows/Program.inc index 36840016db3..91df4488850 100644 --- a/lib/Support/Windows/Program.inc +++ b/lib/Support/Windows/Program.inc @@ -212,7 +212,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program, return false; } - EnvBlock.insert(EnvBlock.end(), EnvString.begin(), EnvString.end()); + llvm::append_range(EnvBlock, EnvString); EnvBlock.push_back(0); } EnvBlock.push_back(0); diff --git a/lib/Support/YAMLParser.cpp b/lib/Support/YAMLParser.cpp index d037cdf850e..17321177105 100644 --- a/lib/Support/YAMLParser.cpp +++ b/lib/Support/YAMLParser.cpp @@ -715,7 +715,7 @@ std::string yaml::escape(StringRef Input, bool EscapePrintable) { // Found invalid char. SmallString<4> Val; encodeUTF8(0xFFFD, Val); - EscapedInput.insert(EscapedInput.end(), Val.begin(), Val.end()); + llvm::append_range(EscapedInput, Val); // FIXME: Error reporting. return EscapedInput; } @@ -1984,11 +1984,11 @@ StringRef ScalarNode::getValue(SmallVectorImpl &Storage) const { Storage.reserve(UnquotedValue.size()); for (; i != StringRef::npos; i = UnquotedValue.find('\'')) { StringRef Valid(UnquotedValue.begin(), i); - Storage.insert(Storage.end(), Valid.begin(), Valid.end()); + llvm::append_range(Storage, Valid); Storage.push_back('\''); UnquotedValue = UnquotedValue.substr(i + 2); } - Storage.insert(Storage.end(), UnquotedValue.begin(), UnquotedValue.end()); + llvm::append_range(Storage, UnquotedValue); return StringRef(Storage.begin(), Storage.size()); } return UnquotedValue; @@ -2007,7 +2007,7 @@ StringRef ScalarNode::unescapeDoubleQuoted( StringRef UnquotedValue for (; i != StringRef::npos; i = UnquotedValue.find_first_of("\\\r\n")) { // Insert all previous chars into Storage. StringRef Valid(UnquotedValue.begin(), i); - Storage.insert(Storage.end(), Valid.begin(), Valid.end()); + llvm::append_range(Storage, Valid); // Chop off inserted chars. UnquotedValue = UnquotedValue.substr(i); @@ -2139,7 +2139,7 @@ StringRef ScalarNode::unescapeDoubleQuoted( StringRef UnquotedValue UnquotedValue = UnquotedValue.substr(1); } } - Storage.insert(Storage.end(), UnquotedValue.begin(), UnquotedValue.end()); + llvm::append_range(Storage, UnquotedValue); return StringRef(Storage.begin(), Storage.size()); } diff --git a/lib/TableGen/Record.cpp b/lib/TableGen/Record.cpp index afd72549d69..6b19454e95d 100644 --- a/lib/TableGen/Record.cpp +++ b/lib/TableGen/Record.cpp @@ -905,8 +905,8 @@ Init *BinOpInit::getStrConcat(Init *I0, Init *I1) { static ListInit *ConcatListInits(const ListInit *LHS, const ListInit *RHS) { SmallVector Args; - Args.insert(Args.end(), LHS->begin(), LHS->end()); - Args.insert(Args.end(), RHS->begin(), RHS->end()); + llvm::append_range(Args, *LHS); + llvm::append_range(Args, *RHS); return ListInit::get(Args, LHS->getElementType()); } @@ -959,8 +959,8 @@ Init *BinOpInit::Fold(Record *CurRec) const { ListInit *RHSs = dyn_cast(RHS); if (LHSs && RHSs) { SmallVector Args; - Args.insert(Args.end(), LHSs->begin(), LHSs->end()); - Args.insert(Args.end(), RHSs->begin(), RHSs->end()); + llvm::append_range(Args, *LHSs); + llvm::append_range(Args, *RHSs); return ListInit::get(Args, LHSs->getElementType()); } break;