Debian Codegraph @

clang/test/Modules/framework-name.m

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