[lld] [lld][COFF] Use `.contains` rather than `.count` for set membership. NFC (PR #177067)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 21 09:58:35 PST 2026


================
@@ -864,9 +865,9 @@ void LinkerDriver::addWinSysRootLibSearchPaths() {
 
   // Libraries specified by `/nodefaultlib:` may not be found in incomplete
   // search paths before lld infers a machine type from input files.
-  std::set<std::string> noDefaultLibs;
-  for (const std::string &path : ctx.config.noDefaultLibs)
-    noDefaultLibs.insert(findLib(path).lower());
+  llvm::StringSet<> noDefaultLibs;
+  for (auto &iter : ctx.config.noDefaultLibs)
+    noDefaultLibs.insert(findLib(iter.first()).lower());
----------------
sbc100 wrote:

Sure, sorry I didn't mean to be glib.   Here you can see how the enties in the StringMap copy the string data for the keys being inserted: https://github.com/llvm/llvm-project/blob/86a2486bff5b9633c59f0b7e5f4486edcc3a736a/llvm/include/llvm/ADT/StringMapEntry.h#L58-L63

https://github.com/llvm/llvm-project/pull/177067


More information about the llvm-commits mailing list