[PATCH] D113063: [lld-macho] Cache discovered framework paths
Keith Smiley via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 3 11:25:28 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG63e65de3ffc2: [lld-macho] Cache discovered framework paths (authored by keith).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113063/new/
https://reviews.llvm.org/D113063
Files:
lld/MachO/Driver.cpp
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -106,7 +106,13 @@
return path;
}
+static DenseMap<CachedHashStringRef, StringRef> resolvedFrameworks;
static Optional<StringRef> findFramework(StringRef name) {
+ CachedHashStringRef key(name);
+ auto entry = resolvedFrameworks.find(key);
+ if (entry != resolvedFrameworks.end())
+ return entry->second;
+
SmallString<260> symlink;
StringRef suffix;
std::tie(name, suffix) = name.split(",");
@@ -122,13 +128,13 @@
// only append suffix if realpath() succeeds
Twine suffixed = location + suffix;
if (fs::exists(suffixed))
- return saver.save(suffixed.str());
+ return resolvedFrameworks[key] = saver.save(suffixed.str());
}
// Suffix lookup failed, fall through to the no-suffix case.
}
if (Optional<StringRef> path = resolveDylibPath(symlink.str()))
- return path;
+ return resolvedFrameworks[key] = *path;
}
return {};
}
@@ -1090,6 +1096,7 @@
errorHandler().cleanupCallback = []() {
freeArena();
+ resolvedFrameworks.clear();
resolvedLibraries.clear();
concatOutputSections.clear();
inputFiles.clear();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113063.384533.patch
Type: text/x-patch
Size: 1291 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211103/f915b31f/attachment.bin>
More information about the llvm-commits
mailing list