[lld] [lld] handle re-exports for full framework paths (PR #137989)
Richard Howell via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 30 14:04:02 PDT 2025
================
@@ -1566,6 +1566,25 @@ static DylibFile *loadDylib(StringRef path, DylibFile *umbrella) {
return loadDylib(*mbref, umbrella);
}
+static StringRef findFramework(StringRef path, StringRef frameworkName) {
+ // Framework names can be in multiple formats:
+ // - Foo.framework/Foo
+ // - Foo.framework/Versions/A/Foo
+ size_t start;
+ size_t end = path.size();
+ while (true) {
+ start = path.rfind('/', end);
+ if (start == StringRef::npos)
+ return StringRef();
+
+ StringRef component = path.substr(start + 1, end - start - 1);
+ if (component == frameworkName)
+ return path.substr(start + 1);
+
+ end = start;
+ }
----------------
rmaz wrote:
Not sure why I didn't do that, think because I was using path iterators and then gave up on the approach.
One issue with this is it would incorrectly return a substring for `Foo.framework` if path was `/Some/Path/OtherFoo.framework/...`, but could be handled by checking the previous char. Either that or check if the string starts with the pattern or has `/Foo.framework/`
https://github.com/llvm/llvm-project/pull/137989
More information about the llvm-commits
mailing list