diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp index 594e7f11721c..826bfe2f447e 100644 --- a/lld/lib/Driver/WinLinkDriver.cpp +++ b/lld/lib/Driver/WinLinkDriver.cpp @@ -801,8 +801,9 @@ parseArgs(int argc, const char **argv, PECOFFLinkingContext &ctx, // graph. static bool hasLibrary(PECOFFLinkingContext &ctx, File *file) { StringRef path = file->path(); - for (std::unique_ptr &p : ctx.getNodes()) - if (auto *f = dyn_cast(p.get())) + std::vector> &nodes = ctx.getNodes(); + for (size_t i = 0; i < nodes.size(); ++i) + if (auto *f = dyn_cast(nodes[i].get())) if (f->getFile()->path() == path) return true; return false;