Douglas Gregor | fba18aa | 2011-09-15 22:00:41 +0000 | [diff] [blame] | 1 | |
| 2 | // RUN: rm -rf %t |
Douglas Gregor | e487f42 | 2011-12-06 20:51:42 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fauto-module-import -F %S/Inputs %s -verify |
Douglas Gregor | fba18aa | 2011-09-15 22:00:41 +0000 | [diff] [blame] | 4 | |
Douglas Gregor | e3a8256 | 2011-11-30 18:02:36 +0000 | [diff] [blame] | 5 | #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] | 6 | |
| 7 | #ifdef MODULE_H_MACRO |
| 8 | # error MODULE_H_MACRO should have been hidden |
| 9 | #endif |
| 10 | |
| 11 | #ifdef DEPENDS_ON_MODULE |
| 12 | # error DEPENDS_ON_MODULE should have been hidden |
| 13 | #endif |
Douglas Gregor | ecc2c09 | 2011-12-01 22:20:10 +0000 | [diff] [blame] | 14 | |
Douglas Gregor | 209977c | 2011-12-05 17:40:25 +0000 | [diff] [blame] | 15 | Module *mod; // expected-error{{unknown type name 'Module'}} |
| 16 | |
| 17 | #import <AlsoDependsOnModule/AlsoDependsOnModule.h> // expected-warning{{treating #import as an import of module 'AlsoDependsOnModule'}} |
| 18 | Module *mod2; |
| 19 | |
Douglas Gregor | 8075ce6 | 2011-12-06 17:15:11 +0000 | [diff] [blame] | 20 | int getDependsOther() { return depends_on_module_other; } |
Douglas Gregor | 0983392 | 2011-12-06 17:31:28 +0000 | [diff] [blame] | 21 | |
| 22 | void testSubframeworkOther() { |
| 23 | double *sfo1 = sub_framework_other; // expected-error{{use of undeclared identifier 'sub_framework_other'}} |
| 24 | } |
| 25 | |
| 26 | // Test header cross-subframework include pattern. |
Douglas Gregor | ef85b56 | 2011-12-06 17:34:58 +0000 | [diff] [blame] | 27 | #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] | 28 | |
| 29 | void testSubframeworkOtherAgain() { |
| 30 | double *sfo1 = sub_framework_other; |
| 31 | } |
Douglas Gregor | ac252a3 | 2011-12-06 19:39:29 +0000 | [diff] [blame] | 32 | |
| 33 | void testModuleSubFramework() { |
| 34 | char *msf = module_subframework; |
| 35 | } |
| 36 | |
| 37 | #include <Module/../Frameworks/SubFramework.framework/Headers/SubFramework.h> // expected-warning{{treating #include as an import of module 'Module.SubFramework'}} |
| 38 | |
| 39 | void testModuleSubFrameworkAgain() { |
| 40 | char *msf = module_subframework; |
| 41 | } |
Douglas Gregor | 587986e | 2011-12-07 02:23:45 +0000 | [diff] [blame] | 42 | |
| 43 | // Test inclusion of private headers. |
| 44 | #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^] | 45 | |
| 46 | int getDependsOnModulePrivate() { return depends_on_module_private; } |