blob: 3703127f34acc7ebb9dbc9c8c547b21c1f3af03c [file] [log] [blame]
Douglas Gregorfba18aa2011-09-15 22:00:41 +00001
2// RUN: rm -rf %t
Douglas Gregore487f422011-12-06 20:51:42 +00003// RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fauto-module-import -F %S/Inputs %s -verify
Douglas Gregorfba18aa2011-09-15 22:00:41 +00004
Douglas Gregore3a82562011-11-30 18:02:36 +00005#include <DependsOnModule/DependsOnModule.h> // expected-warning{{treating #include as an import of module 'DependsOnModule'}}
Douglas Gregorfba18aa2011-09-15 22:00:41 +00006
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 Gregorecc2c092011-12-01 22:20:10 +000014
Douglas Gregor209977c2011-12-05 17:40:25 +000015Module *mod; // expected-error{{unknown type name 'Module'}}
16
17#import <AlsoDependsOnModule/AlsoDependsOnModule.h> // expected-warning{{treating #import as an import of module 'AlsoDependsOnModule'}}
18Module *mod2;
19
Douglas Gregor8075ce62011-12-06 17:15:11 +000020int getDependsOther() { return depends_on_module_other; }
Douglas Gregor09833922011-12-06 17:31:28 +000021
22void 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 Gregoref85b562011-12-06 17:34:58 +000027#include <DependsOnModule/../Frameworks/SubFramework.framework/Headers/Other.h> // expected-warning{{treating #include as an import of module 'DependsOnModule.SubFramework.Other'}}
Douglas Gregor09833922011-12-06 17:31:28 +000028
29void testSubframeworkOtherAgain() {
30 double *sfo1 = sub_framework_other;
31}
Douglas Gregorac252a32011-12-06 19:39:29 +000032
33void 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
39void testModuleSubFrameworkAgain() {
40 char *msf = module_subframework;
41}
Douglas Gregor587986e2011-12-07 02:23:45 +000042
43// Test inclusion of private headers.
44#include <DependsOnModule/DependsOnModulePrivate.h> // expected-warning{{treating #include as an import of module 'DependsOnModule.Private.DependsOnModule'}}
Douglas Gregor4813442c2011-12-07 21:25:07 +000045
46int getDependsOnModulePrivate() { return depends_on_module_private; }
Douglas Gregor23af6d52011-12-07 22:05:21 +000047
48#include <Module/ModulePrivate.h> // expected-warning{{treating #include as an import of module 'Module.Private.ModulePrivate'}}
49
50int getModulePrivate() { return module_private; }