[llvm] [LTO] Use a range-based for loop (NFC) (PR #169000)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 21 07:51:03 PST 2025
https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/169000
>From e4915114b472f5797e00e22b130b8dc6502545ff Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 20 Nov 2025 09:11:37 -0800
Subject: [PATCH 1/2] [LTO] Use a range-based for loop (NFC)
Identified with modernize-loop-convert.
---
llvm/lib/LTO/LTOModule.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index 7dd06118e2a57..cce509639b499 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -620,13 +620,11 @@ void LTOModule::parseSymbols() {
}
// make symbols for all undefines
- for (StringMap<NameAndAttributes>::iterator u =_undefines.begin(),
- e = _undefines.end(); u != e; ++u) {
+ for (const auto &[Key, Value] : _undefines) {
// If this symbol also has a definition, then don't make an undefine because
// it is a tentative definition.
- if (_defines.count(u->getKey())) continue;
- NameAndAttributes info = u->getValue();
- _symbols.push_back(info);
+ if (!_defines.count(Key))
+ _symbols.push_back(Value);
}
}
>From 2b5f78c7eaf18af115e7837e8e90bedfeeb80b80 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 21 Nov 2025 07:50:37 -0800
Subject: [PATCH 2/2] Address a comment.
---
llvm/lib/LTO/LTOModule.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index cce509639b499..9d5b0f54f7f21 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -623,7 +623,7 @@ void LTOModule::parseSymbols() {
for (const auto &[Key, Value] : _undefines) {
// If this symbol also has a definition, then don't make an undefine because
// it is a tentative definition.
- if (!_defines.count(Key))
+ if (!_defines.contains(Key))
_symbols.push_back(Value);
}
}
More information about the llvm-commits
mailing list