summaryrefslogtreecommitdiff
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-07-14 19:45:12 +0000
committerBen Langmuir <blangmuir@apple.com>2014-07-14 19:45:12 +0000
commit6b7f73451f7e83ff3c9e175ab47af444486fd2d7 (patch)
tree968f6b2bd1252ba185659475388f17b11dd45a4a /clang/lib/Lex
parent958027b698525787804ba5bf8ba45326a55dc274 (diff)
downloadllvm-6b7f73451f7e83ff3c9e175ab47af444486fd2d7.tar.gz
Fix case-sensitivity of inferred framework modules
Just because we can open a directory named "COcoa.framework" doesn't mean we should provide a "COcoa" module on a case-insensitive filesystem. llvm-svn: 212975
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index a6d1d82a3675..8fae9c933d33 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -624,6 +624,12 @@ ModuleMap::inferFrameworkModule(StringRef ModuleName,
StringRef FrameworkDirName
= SourceMgr.getFileManager().getCanonicalName(FrameworkDir);
+ // In case this is a case-insensitive filesystem, make sure the canonical
+ // directory name matches ModuleName exactly. Modules are case-sensitive.
+ // FIXME: we should be able to give a fix-it hint for the correct spelling.
+ if (llvm::sys::path::stem(FrameworkDirName) != ModuleName)
+ return nullptr;
+
bool canInfer = false;
if (llvm::sys::path::has_parent_path(FrameworkDirName)) {
// Figure out the parent path.