[Modules] Be consistent about finding a module for framework headers
authorBen Langmuir <blangmuir@apple.com>
Thu, 2 Jul 2015 13:19:48 +0000 (13:19 +0000)
committerBen Langmuir <blangmuir@apple.com>
Thu, 2 Jul 2015 13:19:48 +0000 (13:19 +0000)
commita525400d37cf2920479862acafedc83e2d7c5fb6
tree490f393efa9e52609687560b83d2cd96d806b064
parent553a5b00412c34e2b9101a993a6e7368a03fca68
[Modules] Be consistent about finding a module for framework headers

We use findModuleForHeader() in several places, but in header search we
were not calling it when a framework module didn't show up with the
expected name, which would then lead to unexpected non-modular includes.
Now we will find the module unconditionally for frameworks.  For regular
frameworks, we use the spelling of the module name from the module map
file, and for inferred ones we use the canonical directory name.

In the future we might want to lock down framework modules sufficiently
that these name mismatches cannot happen.

rdar://problem/20465870

llvm-svn: 241258
clang/include/clang/Lex/ModuleMap.h
clang/lib/Lex/HeaderSearch.cpp
clang/lib/Lex/ModuleMap.cpp
clang/test/Modules/Inputs/ImportNameInDir.h [new file with mode: 0644]
clang/test/Modules/Inputs/NameInDir.framework/Headers/NameInDir.h [new file with mode: 0644]
clang/test/Modules/Inputs/NameInDir.framework/Modules/module.modulemap [new file with mode: 0644]
clang/test/Modules/Inputs/NameInDir2.framework/Headers/NameInDir2.h [new file with mode: 0644]
clang/test/Modules/Inputs/NameInDir2.framework/Modules/module.modulemap [new file with mode: 0644]
clang/test/Modules/Inputs/NameInDirInferred.framework/Headers/NameInDirInferred.h [new file with mode: 0644]
clang/test/Modules/Inputs/module.map
clang/test/Modules/framework-name.m [new file with mode: 0644]