xref: /aosp_15_r20/external/clang/test/Modules/framework-name.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// REQUIRES: shell
2*67e74705SXin Li// RUN: rm -rf %t.mcp %t
3*67e74705SXin Li// RUN: mkdir -p %t
4*67e74705SXin Li// RUN: ln -s %S/Inputs/NameInDir2.framework %t/NameInImport.framework
5*67e74705SXin Li// RUN: ln -s %S/Inputs/NameInDirInferred.framework %t/NameInImportInferred.framework
6*67e74705SXin Li// 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*67e74705SXin Li
8*67e74705SXin Li// Sanity check that we won't somehow find non-canonical module names or
9*67e74705SXin Li// modules where we shouldn't search the framework.
10*67e74705SXin Li// 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*67e74705SXin Li// 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*67e74705SXin Li// 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*67e74705SXin Li// 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*67e74705SXin Li// CHECK: module '{{.*}}' not found
15*67e74705SXin Li
16*67e74705SXin Li// FIXME: We might want to someday lock down framework modules so that these
17*67e74705SXin Li// name mismatches are disallowed. However, as long as we *don't* prevent them
18*67e74705SXin Li// it's important that they map correctly to module imports.
19*67e74705SXin Li
20*67e74705SXin Li// The module map name doesn't match the directory name.
21*67e74705SXin Li#import <NameInDir/NameInDir.h> // expected-warning {{import of module 'NameInModMap'}}
22*67e74705SXin Li
23*67e74705SXin Li// The name in the import doesn't match the module name.
24*67e74705SXin Li#import <NameInImport/NameInDir2.h> // expected-warning {{import of module 'NameInDir2'}}
25*67e74705SXin Li@import NameInDir2;                 // OK
26*67e74705SXin Li
27*67e74705SXin Li// The name in the import doesn't match the module name (inferred framework module).
28*67e74705SXin Li#import <NameInImportInferred/NameInDirInferred.h> // expected-warning {{import of module 'NameInDirInferred'}}
29*67e74705SXin Li
30*67e74705SXin Li@import ImportNameInDir;
31*67e74705SXin Li#ifdef NAME_IN_DIR
32*67e74705SXin Li#error NAME_IN_DIR should be undef'd
33*67e74705SXin Li#endif
34