diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2021-12-25 22:30:44 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2021-12-25 22:30:44 +0000 |
commit | 77fc4c146f0870ffb09c1afb823ccbe742c5e6ff (patch) | |
tree | 5c0eb39553003b9c75a901af6bc4ddabd6f2f28c /llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | |
parent | f65dcba83ce5035ab88a85fe17628b447eb56e1b (diff) |
Diffstat (limited to 'llvm/lib/Bitcode/Writer/ValueEnumerator.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp index 07e0708e68c3..df4f1a1873d7 100644 --- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -310,8 +310,7 @@ static UseListOrderStack predictUseListOrder(const Module &M) { // We want to visit the functions backward now so we can list function-local // constants in the last Function they're used in. Module-level constants // have already been visited above. - for (auto I = M.rbegin(), E = M.rend(); I != E; ++I) { - const Function &F = *I; + for (const Function &F : llvm::reverse(M)) { if (F.isDeclaration()) continue; for (const BasicBlock &BB : F) @@ -541,9 +540,8 @@ void ValueEnumerator::print(raw_ostream &OS, const ValueMapType &Map, const char *Name) const { OS << "Map Name: " << Name << "\n"; OS << "Size: " << Map.size() << "\n"; - for (ValueMapType::const_iterator I = Map.begin(), - E = Map.end(); I != E; ++I) { - const Value *V = I->first; + for (const auto &I : Map) { + const Value *V = I.first; if (V->hasName()) OS << "Value: " << V->getName(); else @@ -569,10 +567,10 @@ void ValueEnumerator::print(raw_ostream &OS, const MetadataMapType &Map, const char *Name) const { OS << "Map Name: " << Name << "\n"; OS << "Size: " << Map.size() << "\n"; - for (auto I = Map.begin(), E = Map.end(); I != E; ++I) { - const Metadata *MD = I->first; - OS << "Metadata: slot = " << I->second.ID << "\n"; - OS << "Metadata: function = " << I->second.F << "\n"; + for (const auto &I : Map) { + const Metadata *MD = I.first; + OS << "Metadata: slot = " << I.second.ID << "\n"; + OS << "Metadata: function = " << I.second.F << "\n"; MD->print(OS); OS << "\n"; } |