1// REQUIRES: shell
2// RUN: rm -rf %t.mcp %t
3// RUN: mkdir -p %t
4// RUN: ln -s %S/Inputs/NameInDir2.framework %t/NameInImport.framework
5// RUN: ln -s %S/Inputs/NameInDirInferred.framework %t/NameInImportInferred.framework
6// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.mcp -fimplicit-module-maps -I %S/Inputs -F %S/Inputs -F %t -Wauto-import -verify %s
7
8// Sanity check that we won't somehow find non-canonical module names or
9// modules where we shouldn't search the framework.
10// RUN: echo '@import NameInModMap' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
11// RUN: echo '@import NameInDir' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
12// RUN: echo '@import NameInImport' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
13// RUN: echo '@import NameInImportInferred' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
14// CHECK: module '{{.*}}' not found
15
16// FIXME: We might want to someday lock down framework modules so that these
17// name mismatches are disallowed. However, as long as we *don't* prevent them
18// it's important that they map correctly to module imports.
19
20// The module map name doesn't match the directory name.
21#import <NameInDir/NameInDir.h> // expected-warning {{import of module 'NameInModMap'}}
22
23// The name in the import doesn't match the module name.
24#import <NameInImport/NameInDir2.h> // expected-warning {{import of module 'NameInDir2'}}
25@import NameInDir2;                 // OK
26
27// The name in the import doesn't match the module name (inferred framework module).
28#import <NameInImportInferred/NameInDirInferred.h> // expected-warning {{import of module 'NameInDirInferred'}}
29
30@import ImportNameInDir;
31#ifdef NAME_IN_DIR
32#error NAME_IN_DIR should be undef'd
33#endif
34