[llvm] [llvm] Use range-based for loops (NFC) (PR #105861)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 23 14:40:28 PDT 2024
================
@@ -1808,9 +1808,9 @@ class ModuleSummaryIndex {
/// the ThinLTO backends.
TypeIdSummary &getOrInsertTypeIdSummary(StringRef TypeId) {
auto TidIter = TypeIdMap.equal_range(GlobalValue::getGUID(TypeId));
- for (auto It = TidIter.first; It != TidIter.second; ++It)
- if (It->second.first == TypeId)
- return It->second.second;
+ for (auto &KV : make_range(TidIter))
----------------
kazutakahirata wrote:
I avoided structured binding where one of the two variables is not used because I was afraid that the host compiler might issue an unused variable warning.
Now, I just tried Compiler Explorer. gcc-7.4 issues a warning, but gcc-8.1 doesn't. For clang, version 5 and later do not issue a warning. (I didn't go back any further).
https://github.com/llvm/llvm-project/pull/105861
More information about the llvm-commits
mailing list