Douglas Gregor | fba18aa | 2011-09-15 22:00:41 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
Douglas Gregor | 953a61f | 2013-02-07 19:01:24 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify |
Douglas Gregor | fba18aa | 2011-09-15 22:00:41 +0000 | [diff] [blame] | 3 | |
Douglas Gregor | e3a8256 | 2011-11-30 18:02:36 +0000 | [diff] [blame] | 4 | #include <DependsOnModule/DependsOnModule.h> // expected-warning{{treating #include as an import of module 'DependsOnModule'}} |
Douglas Gregor | fba18aa | 2011-09-15 22:00:41 +0000 | [diff] [blame] | 5 | |
Andy Gibbs | b42f200 | 2013-04-17 08:06:46 +0000 | [diff] [blame] | 6 | // expected-note@Inputs/NoUmbrella.framework/PrivateHeaders/A_Private.h:1{{'no_umbrella_A_private' declared here}} |
| 7 | |
Douglas Gregor | fba18aa | 2011-09-15 22:00:41 +0000 | [diff] [blame] | 8 | #ifdef MODULE_H_MACRO |
| 9 | # error MODULE_H_MACRO should have been hidden |
| 10 | #endif |
| 11 | |
| 12 | #ifdef DEPENDS_ON_MODULE |
| 13 | # error DEPENDS_ON_MODULE should have been hidden |
| 14 | #endif |
Douglas Gregor | ecc2c09 | 2011-12-01 22:20:10 +0000 | [diff] [blame] | 15 | |
Douglas Gregor | 209977c | 2011-12-05 17:40:25 +0000 | [diff] [blame] | 16 | Module *mod; // expected-error{{unknown type name 'Module'}} |
| 17 | |
| 18 | #import <AlsoDependsOnModule/AlsoDependsOnModule.h> // expected-warning{{treating #import as an import of module 'AlsoDependsOnModule'}} |
| 19 | Module *mod2; |
| 20 | |
Douglas Gregor | 8075ce6 | 2011-12-06 17:15:11 +0000 | [diff] [blame] | 21 | int getDependsOther() { return depends_on_module_other; } |
Douglas Gregor | 0983392 | 2011-12-06 17:31:28 +0000 | [diff] [blame] | 22 | |
| 23 | void testSubframeworkOther() { |
| 24 | double *sfo1 = sub_framework_other; // expected-error{{use of undeclared identifier 'sub_framework_other'}} |
| 25 | } |
| 26 | |
Douglas Gregor | 6a1db48 | 2011-12-09 02:04:43 +0000 | [diff] [blame] | 27 | // Test umbrella-less submodule includes |
| 28 | #include <NoUmbrella/A.h> // expected-warning{{treating #include as an import of module 'NoUmbrella.A'}} |
| 29 | int getNoUmbrellaA() { return no_umbrella_A; } |
| 30 | |
Douglas Gregor | 3b29bb9 | 2011-12-12 19:13:53 +0000 | [diff] [blame] | 31 | // Test umbrella-less submodule includes |
| 32 | #include <NoUmbrella/SubDir/C.h> // expected-warning{{treating #include as an import of module 'NoUmbrella.SubDir.C'}} |
| 33 | int getNoUmbrellaC() { return no_umbrella_C; } |
| 34 | |
Douglas Gregor | 0983392 | 2011-12-06 17:31:28 +0000 | [diff] [blame] | 35 | // Test header cross-subframework include pattern. |
Douglas Gregor | ef85b56 | 2011-12-06 17:34:58 +0000 | [diff] [blame] | 36 | #include <DependsOnModule/../Frameworks/SubFramework.framework/Headers/Other.h> // expected-warning{{treating #include as an import of module 'DependsOnModule.SubFramework.Other'}} |
Douglas Gregor | 0983392 | 2011-12-06 17:31:28 +0000 | [diff] [blame] | 37 | |
| 38 | void testSubframeworkOtherAgain() { |
| 39 | double *sfo1 = sub_framework_other; |
| 40 | } |
Douglas Gregor | ac252a3 | 2011-12-06 19:39:29 +0000 | [diff] [blame] | 41 | |
| 42 | void testModuleSubFramework() { |
| 43 | char *msf = module_subframework; |
| 44 | } |
| 45 | |
| 46 | #include <Module/../Frameworks/SubFramework.framework/Headers/SubFramework.h> // expected-warning{{treating #include as an import of module 'Module.SubFramework'}} |
| 47 | |
| 48 | void testModuleSubFrameworkAgain() { |
| 49 | char *msf = module_subframework; |
| 50 | } |
Douglas Gregor | 587986e | 2011-12-07 02:23:45 +0000 | [diff] [blame] | 51 | |
| 52 | // Test inclusion of private headers. |
| 53 | #include <DependsOnModule/DependsOnModulePrivate.h> // expected-warning{{treating #include as an import of module 'DependsOnModule.Private.DependsOnModule'}} |
Douglas Gregor | 4813442c | 2011-12-07 21:25:07 +0000 | [diff] [blame] | 54 | |
| 55 | int getDependsOnModulePrivate() { return depends_on_module_private; } |
Douglas Gregor | 23af6d5 | 2011-12-07 22:05:21 +0000 | [diff] [blame] | 56 | |
Douglas Gregor | 3a110f7 | 2012-01-13 16:54:27 +0000 | [diff] [blame] | 57 | #include <Module/ModulePrivate.h> // includes the header |
Douglas Gregor | 23af6d5 | 2011-12-07 22:05:21 +0000 | [diff] [blame] | 58 | |
| 59 | int getModulePrivate() { return module_private; } |
Douglas Gregor | 6a1db48 | 2011-12-09 02:04:43 +0000 | [diff] [blame] | 60 | |
| 61 | #include <NoUmbrella/A_Private.h> // expected-warning{{treating #include as an import of module 'NoUmbrella.Private.A_Private'}} |
| 62 | int getNoUmbrellaAPrivate() { return no_umbrella_A_private; } |
| 63 | |
| 64 | int getNoUmbrellaBPrivateFail() { return no_umbrella_B_private; } // expected-error{{use of undeclared identifier 'no_umbrella_B_private'; did you mean 'no_umbrella_A_private'?}} |
Douglas Gregor | 305dc3e | 2011-12-20 00:28:52 +0000 | [diff] [blame] | 65 | |
| 66 | // Test inclusion of headers that are under an umbrella directory but |
| 67 | // not actually part of the module. |
| 68 | #include <Module/NotInModule.h> // expected-warning{{treating #include as an import of module 'Module.NotInModule'}} \ |
| 69 | // expected-warning{{missing submodule 'Module.NotInModule'}} |
| 70 | |
| 71 | int getNotInModule() { |
| 72 | return not_in_module; |
| 73 | } |