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

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 21 04:12:40 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());
----------------
mstorsjo wrote:

Given that `StringRef::lower()` returns a `std::string`, doesn't this just store a reference to the temporary `std::string` which is orphaned right after?

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


More information about the llvm-commits mailing list