Skip to content

Commit d2f0d99

Browse files
[TextAPI] Use range-based for loops (NFC) (#103530)
1 parent efe3db2 commit d2f0d99

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/TextAPI/RecordsSlice.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,18 @@ ObjCCategoryRecord *RecordsSlice::addObjCCategory(StringRef ClassToExtend,
243243

244244
std::vector<ObjCIVarRecord *> ObjCContainerRecord::getObjCIVars() const {
245245
std::vector<ObjCIVarRecord *> Records;
246-
llvm::for_each(IVars,
247-
[&](auto &Record) { Records.push_back(Record.second.get()); });
246+
Records.reserve(IVars.size());
247+
for (const auto &Record : IVars)
248+
Records.push_back(Record.second.get());
248249
return Records;
249250
}
250251

251252
std::vector<ObjCCategoryRecord *>
252253
ObjCInterfaceRecord::getObjCCategories() const {
253254
std::vector<ObjCCategoryRecord *> Records;
254-
llvm::for_each(Categories,
255-
[&](auto &Record) { Records.push_back(Record.second); });
255+
Records.reserve(Categories.size());
256+
for (const auto &Record : Categories)
257+
Records.push_back(Record.second);
256258
return Records;
257259
}
258260

0 commit comments

Comments
 (0)