2323#include " lld/Common/Timer.h"
2424#include " lld/Common/Version.h"
2525#include " llvm/ADT/IntrusiveRefCntPtr.h"
26+ #include " llvm/ADT/SmallSet.h"
2627#include " llvm/ADT/StringSwitch.h"
2728#include " llvm/BinaryFormat/Magic.h"
2829#include " llvm/Config/llvm-config.h"
@@ -715,7 +716,7 @@ std::optional<StringRef> LinkerDriver::findLibIfNew(StringRef filename) {
715716 return std::nullopt ;
716717
717718 StringRef path = findLib (filename);
718- if (ctx.config .noDefaultLibs .count (path.lower ()))
719+ if (ctx.config .noDefaultLibs .contains (path.lower ()))
719720 return std::nullopt ;
720721
721722 if (std::optional<sys::fs::UniqueID> id = getUniqueID (path))
@@ -864,9 +865,9 @@ void LinkerDriver::addWinSysRootLibSearchPaths() {
864865
865866 // Libraries specified by `/nodefaultlib:` may not be found in incomplete
866867 // search paths before lld infers a machine type from input files.
867- std::set<std::string > noDefaultLibs;
868- for (const std::string &path : ctx.config .noDefaultLibs )
869- noDefaultLibs.insert (findLib (path ).lower ());
868+ llvm::StringSet< > noDefaultLibs;
869+ for (auto &iter : ctx.config .noDefaultLibs )
870+ noDefaultLibs.insert (findLib (iter. first () ).lower ());
870871 ctx.config .noDefaultLibs = noDefaultLibs;
871872}
872873
@@ -1153,7 +1154,7 @@ void LinkerDriver::parseOrderFile(StringRef arg) {
11531154 if (ctx.config .machine == I386 && !isDecorated (s))
11541155 s = " _" + s;
11551156
1156- if (set.count (s) == 0 ) {
1157+ if (! set.contains (s)) {
11571158 if (ctx.config .warnMissingOrderSymbol )
11581159 Warn (ctx) << " /order:" << arg << " : missing symbol: " << s
11591160 << " [LNK4037]" ;
@@ -2284,7 +2285,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
22842285 if (errCount (ctx))
22852286 return ;
22862287
2287- std::set <sys::fs::UniqueID> wholeArchives;
2288+ SmallSet <sys::fs::UniqueID, 0 > wholeArchives;
22882289 for (auto *arg : args.filtered (OPT_wholearchive_file))
22892290 if (std::optional<StringRef> path = findFile (arg->getValue ()))
22902291 if (std::optional<sys::fs::UniqueID> id = getUniqueID (*path))
@@ -2298,7 +2299,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
22982299 if (args.hasArg (OPT_wholearchive_flag))
22992300 return true ;
23002301 if (std::optional<sys::fs::UniqueID> id = getUniqueID (path))
2301- return wholeArchives.count (*id);
2302+ return wholeArchives.contains (*id);
23022303 return false ;
23032304 };
23042305
0 commit comments