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
This commit is contained in:
Ben Langmuir 2014-07-14 19:45:12 +00:00
parent 958027b698
commit 6b7f73451f
2 changed files with 11 additions and 0 deletions

View File

@ -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.

View File

@ -0,0 +1,5 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify -DA
@import MOdule; // expected-error{{module 'MOdule' not found}}
@import Module;