[llvm] 96f14ea - [llvm] Use range-based for loops with llvm::drop_begin (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 13 18:18:58 PST 2024
Author: Kazu Hirata
Date: 2024-01-13T18:18:47-08:00
New Revision: 96f14ea61847da9b89732cd86ff2ba5ceac252d3
URL: https://github.com/llvm/llvm-project/commit/96f14ea61847da9b89732cd86ff2ba5ceac252d3
DIFF: https://github.com/llvm/llvm-project/commit/96f14ea61847da9b89732cd86ff2ba5ceac252d3.diff
LOG: [llvm] Use range-based for loops with llvm::drop_begin (NFC)
Added:
Modified:
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
llvm/lib/TextAPI/RecordsSlice.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index 998f629aaa4ea9..fccb2a606f7ed9 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -1108,8 +1108,8 @@ void ValueEnumerator::purgeFunction() {
/// Remove purged values from the ValueMap.
for (unsigned i = NumModuleValues, e = Values.size(); i != e; ++i)
ValueMap.erase(Values[i].first);
- for (unsigned i = NumModuleMDs, e = MDs.size(); i != e; ++i)
- MetadataMap.erase(MDs[i]);
+ for (const Metadata *MD : llvm::drop_begin(MDs, NumModuleMDs))
+ MetadataMap.erase(MD);
for (const BasicBlock *BB : BasicBlocks)
ValueMap.erase(BB);
diff --git a/llvm/lib/TextAPI/RecordsSlice.cpp b/llvm/lib/TextAPI/RecordsSlice.cpp
index 7ceffc7c928442..840fe1855da6a6 100644
--- a/llvm/lib/TextAPI/RecordsSlice.cpp
+++ b/llvm/lib/TextAPI/RecordsSlice.cpp
@@ -332,9 +332,8 @@ llvm::MachO::convertToInterfaceFile(const Records &Slices) {
}
File = createInterfaceFile(Slices, *InstallNames.begin());
- for (auto it = std::next(InstallNames.begin()); it != InstallNames.end();
- ++it)
- File->addDocument(createInterfaceFile(Slices, *it));
+ for (StringRef IN : llvm::drop_begin(InstallNames))
+ File->addDocument(createInterfaceFile(Slices, IN));
return File;
}
More information about the llvm-commits
mailing list