diff options
author | Juergen Ributzka <juergen@apple.com> | 2015-11-13 19:08:07 +0000 |
---|---|---|
committer | Juergen Ributzka <juergen@apple.com> | 2015-11-13 19:08:07 +0000 |
commit | c52d1cea049ddd9225380d94defb72fcd081e88c (patch) | |
tree | a1af1a46bdaa2a5f50b2811105956f7e140d75c5 /lib/Lex/ModuleMap.cpp | |
parent | 2b9fa800d66f4072ff7f821113e51c9be0358905 (diff) |
Fix auto-link for text-based dynamic library SDKs.
When linking against text-based dynamic library SDKs the library name of a
framework has now more than one possible filename extensions. This fix tests for
both possible extensions (none, and .tbd).
This fixes rdar://problem/20609975
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253060 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/ModuleMap.cpp')
-rw-r--r-- | lib/Lex/ModuleMap.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index c66bd70487..a7524028a2 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -581,9 +581,18 @@ static void inferFrameworkLink(Module *Mod, const DirectoryEntry *FrameworkDir, SmallString<128> LibName; LibName += FrameworkDir->getName(); llvm::sys::path::append(LibName, Mod->Name); - if (FileMgr.getFile(LibName)) { - Mod->LinkLibraries.push_back(Module::LinkLibrary(Mod->Name, - /*IsFramework=*/true)); + + // The library name of a framework has more than one possible extension since + // the introduction of the text-based dynamic library format. We need to check + // for both before we give up. + static const char *frameworkExtensions[] = {"", ".tbd"}; + for (const auto *extension : frameworkExtensions) { + llvm::sys::path::replace_extension(LibName, extension); + if (FileMgr.getFile(LibName)) { + Mod->LinkLibraries.push_back(Module::LinkLibrary(Mod->Name, + /*IsFramework=*/true)); + return; + } } } |