diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp index 7dd06118e2a57..9d5b0f54f7f21 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::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.contains(Key)) + _symbols.push_back(Value); } }