[llvm] Use llvm::append_range (NFC) (#133658)
This commit is contained in:
@@ -48,8 +48,7 @@ public:
|
||||
ColImm(InvalidImmShape) {
|
||||
assert(ShapesOperands.size() % 2 == 0 && "Miss row or col!");
|
||||
|
||||
for (auto *Shape : ShapesOperands)
|
||||
Shapes.push_back(Shape);
|
||||
llvm::append_range(Shapes, ShapesOperands);
|
||||
|
||||
if (MRI)
|
||||
deduceImm(MRI);
|
||||
|
||||
@@ -43,8 +43,7 @@ public:
|
||||
static ShuffleMask getIdentity(unsigned Sz) {
|
||||
IndicesVecT Indices;
|
||||
Indices.reserve(Sz);
|
||||
for (auto Idx : seq<int>(0, (int)Sz))
|
||||
Indices.push_back(Idx);
|
||||
llvm::append_range(Indices, seq<int>(0, (int)Sz));
|
||||
return ShuffleMask(std::move(Indices));
|
||||
}
|
||||
/// \Returns true if the mask is a perfect identity mask with consecutive
|
||||
|
||||
@@ -3339,10 +3339,8 @@ Error BitcodeReader::parseConstants() {
|
||||
if (Record.empty())
|
||||
return error("Invalid aggregate record");
|
||||
|
||||
unsigned Size = Record.size();
|
||||
SmallVector<unsigned, 16> Elts;
|
||||
for (unsigned i = 0; i != Size; ++i)
|
||||
Elts.push_back(Record[i]);
|
||||
llvm::append_range(Elts, Record);
|
||||
|
||||
if (isa<StructType>(CurTy)) {
|
||||
V = BitcodeConstant::create(
|
||||
|
||||
@@ -1209,8 +1209,7 @@ void ModuleBitcodeWriter::writeTypeTable() {
|
||||
TypeVals.push_back(TET->getNumTypeParameters());
|
||||
for (Type *InnerTy : TET->type_params())
|
||||
TypeVals.push_back(VE.getTypeID(InnerTy));
|
||||
for (unsigned IntParam : TET->int_params())
|
||||
TypeVals.push_back(IntParam);
|
||||
llvm::append_range(TypeVals, TET->int_params());
|
||||
break;
|
||||
}
|
||||
case Type::TypedPointerTyID:
|
||||
@@ -4303,10 +4302,8 @@ static void writeFunctionHeapProfileRecords(
|
||||
}
|
||||
for (auto Id : CI.StackIdIndices)
|
||||
Record.push_back(GetStackIndex(Id));
|
||||
if (!PerModule) {
|
||||
for (auto V : CI.Clones)
|
||||
Record.push_back(V);
|
||||
}
|
||||
if (!PerModule)
|
||||
llvm::append_range(Record, CI.Clones);
|
||||
Stream.EmitRecord(PerModule ? bitc::FS_PERMODULE_CALLSITE_INFO
|
||||
: bitc::FS_COMBINED_CALLSITE_INFO,
|
||||
Record, CallsiteAbbrev);
|
||||
@@ -4326,10 +4323,8 @@ static void writeFunctionHeapProfileRecords(
|
||||
assert(CallStackCount <= CallStackPos.size());
|
||||
Record.push_back(CallStackPos[CallStackCount++]);
|
||||
}
|
||||
if (!PerModule) {
|
||||
for (auto V : AI.Versions)
|
||||
Record.push_back(V);
|
||||
}
|
||||
if (!PerModule)
|
||||
llvm::append_range(Record, AI.Versions);
|
||||
assert(AI.ContextSizeInfos.empty() ||
|
||||
AI.ContextSizeInfos.size() == AI.MIBs.size());
|
||||
// Optionally emit the context size information if it exists.
|
||||
|
||||
@@ -445,8 +445,7 @@ void LVPatterns::addGenericPatterns(StringSet<> &Patterns) {
|
||||
}
|
||||
|
||||
void LVPatterns::addOffsetPatterns(const LVOffsetSet &Patterns) {
|
||||
for (const LVOffset &Entry : Patterns)
|
||||
OffsetMatchInfo.push_back(Entry);
|
||||
llvm::append_range(OffsetMatchInfo, Patterns);
|
||||
if (OffsetMatchInfo.size()) {
|
||||
options().setSelectOffsetPattern();
|
||||
options().setSelectExecute();
|
||||
|
||||
@@ -182,8 +182,7 @@ void LVSymbol::getLocations(LVLocations &LocationList) const {
|
||||
if (!Locations)
|
||||
return;
|
||||
|
||||
for (LVLocation *Location : *Locations)
|
||||
LocationList.push_back(Location);
|
||||
llvm::append_range(LocationList, *Locations);
|
||||
}
|
||||
|
||||
// Calculate coverage factor.
|
||||
|
||||
@@ -163,8 +163,7 @@ void LVCodeViewReader::cacheRelocations() {
|
||||
const coff_section *CoffSection = getObj().getCOFFSection(Section);
|
||||
|
||||
auto &RM = RelocMap[CoffSection];
|
||||
for (const RelocationRef &Relocacion : Section.relocations())
|
||||
RM.push_back(Relocacion);
|
||||
llvm::append_range(RM, Section.relocations());
|
||||
|
||||
// Sort relocations by address.
|
||||
llvm::sort(RM, [](RelocationRef L, RelocationRef R) {
|
||||
|
||||
@@ -1640,13 +1640,11 @@ static const char *DefaultCommentPrefixes[] = {"COM", "RUN"};
|
||||
|
||||
static void addDefaultPrefixes(FileCheckRequest &Req) {
|
||||
if (Req.CheckPrefixes.empty()) {
|
||||
for (const char *Prefix : DefaultCheckPrefixes)
|
||||
Req.CheckPrefixes.push_back(Prefix);
|
||||
llvm::append_range(Req.CheckPrefixes, DefaultCheckPrefixes);
|
||||
Req.IsDefaultCheckPrefix = true;
|
||||
}
|
||||
if (Req.CommentPrefixes.empty())
|
||||
for (const char *Prefix : DefaultCommentPrefixes)
|
||||
Req.CommentPrefixes.push_back(Prefix);
|
||||
llvm::append_range(Req.CommentPrefixes, DefaultCommentPrefixes);
|
||||
}
|
||||
|
||||
struct PrefixMatcher {
|
||||
|
||||
@@ -70,8 +70,7 @@ Error COFFReader::readSections(Object &Obj) const {
|
||||
return E;
|
||||
S.setContentsRef(Contents);
|
||||
ArrayRef<coff_relocation> Relocs = COFFObj.getRelocations(Sec);
|
||||
for (const coff_relocation &R : Relocs)
|
||||
S.Relocs.push_back(R);
|
||||
llvm::append_range(S.Relocs, Relocs);
|
||||
if (Expected<StringRef> NameOrErr = COFFObj.getSectionName(Sec))
|
||||
S.Name = *NameOrErr;
|
||||
else
|
||||
|
||||
@@ -38,8 +38,7 @@ Error XCOFFReader::readSections(Object &Obj) const {
|
||||
XCOFFObj.relocations<XCOFFSectionHeader32, XCOFFRelocation32>(Sec);
|
||||
if (!Relocations)
|
||||
return Relocations.takeError();
|
||||
for (const XCOFFRelocation32 &Rel : Relocations.get())
|
||||
ReadSec.Relocations.push_back(Rel);
|
||||
llvm::append_range(ReadSec.Relocations, Relocations.get());
|
||||
}
|
||||
|
||||
Obj.Sections.push_back(std::move(ReadSec));
|
||||
|
||||
@@ -735,9 +735,7 @@ Expected<std::shared_ptr<YAMLCoffSymbolRVASubsection>>
|
||||
YAMLCoffSymbolRVASubsection::fromCodeViewSubsection(
|
||||
const DebugSymbolRVASubsectionRef &Section) {
|
||||
auto Result = std::make_shared<YAMLCoffSymbolRVASubsection>();
|
||||
for (const auto &RVA : Section) {
|
||||
Result->RVAs.push_back(RVA);
|
||||
}
|
||||
llvm::append_range(Result->RVAs, Section);
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
@@ -2435,8 +2435,8 @@ protected:
|
||||
|
||||
// Collect registered option categories into vector in preparation for
|
||||
// sorting.
|
||||
for (OptionCategory *Category : GlobalParser->RegisteredOptionCategories)
|
||||
SortedCategories.push_back(Category);
|
||||
llvm::append_range(SortedCategories,
|
||||
GlobalParser->RegisteredOptionCategories);
|
||||
|
||||
// Sort the different option categories alphabetically.
|
||||
assert(SortedCategories.size() > 0 && "No option categories registered!");
|
||||
|
||||
@@ -73,8 +73,7 @@ void setCurrentDebugType(const char *Type) {
|
||||
|
||||
void setCurrentDebugTypes(const char **Types, unsigned Count) {
|
||||
CurrentDebugType->clear();
|
||||
for (size_t T = 0; T < Count; ++T)
|
||||
CurrentDebugType->push_back(Types[T]);
|
||||
llvm::append_range(*CurrentDebugType, ArrayRef(Types, Count));
|
||||
}
|
||||
} // namespace llvm
|
||||
|
||||
|
||||
@@ -348,8 +348,7 @@ void SuffixTree::RepeatedSubstringIterator::advance() {
|
||||
// Yes. Update the state to reflect this, and then bail out.
|
||||
N = Curr;
|
||||
RS.Length = Length;
|
||||
for (unsigned StartIdx : RepeatedSubstringStarts)
|
||||
RS.StartIndices.push_back(StartIdx);
|
||||
llvm::append_range(RS.StartIndices, RepeatedSubstringStarts);
|
||||
break;
|
||||
}
|
||||
// At this point, either NewRS is an empty RepeatedSubstring, or it was
|
||||
|
||||
@@ -1015,8 +1015,7 @@ const Init *UnOpInit::Fold(const Record *CurRec, bool IsFinal) const {
|
||||
const auto *InnerList = dyn_cast<ListInit>(InnerInit);
|
||||
if (!InnerList)
|
||||
return std::nullopt;
|
||||
for (const Init *InnerElem : InnerList->getValues())
|
||||
Flattened.push_back(InnerElem);
|
||||
llvm::append_range(Flattened, InnerList->getValues());
|
||||
};
|
||||
return Flattened;
|
||||
};
|
||||
|
||||
@@ -57,10 +57,7 @@ int main(int argc, const char **argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::vector<StringRef> Argv;
|
||||
Argv.reserve(argc);
|
||||
for (int i = 0; i < argc; ++i)
|
||||
Argv.push_back(argv[i]);
|
||||
SmallVector<StringRef> Argv(ArrayRef(argv, argc));
|
||||
std::string ErrMsg;
|
||||
int Result =
|
||||
sys::ExecuteAndWait(*Program, Argv, std::nullopt, {}, 0, 0, &ErrMsg);
|
||||
|
||||
Reference in New Issue
Block a user