summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2015-11-13 19:08:07 +0000
committerJuergen Ributzka <juergen@apple.com>2015-11-13 19:08:07 +0000
commit8aaae5a911827be4730c2a95fd649af2d929fa19 (patch)
treecdc82fab981fdb2ca08a3bab0290ac0e43b003f7 /clang/lib/Lex/ModuleMap.cpp
parent94b57065c67c9d578bcff2c4b8d08f22e6c3fe81 (diff)
downloadbcm5719-llvm-8aaae5a911827be4730c2a95fd649af2d929fa19.tar.gz
bcm5719-llvm-8aaae5a911827be4730c2a95fd649af2d929fa19.zip
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 llvm-svn: 253060
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index c66bd70487f..a7524028a22 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/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;
+ }
}
}
OpenPOWER on IntegriCloud