Home | History | Annotate | Download | only in Modules
      1 // RUN: rm -rf %t
      2 // RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify
      3 
      4 #include <DependsOnModule/DependsOnModule.h> // expected-warning{{treating #include as an import of module 'DependsOnModule'}}
      5 
      6 // expected-note@Inputs/NoUmbrella.framework/PrivateHeaders/A_Private.h:1{{'no_umbrella_A_private' declared here}}
      7 
      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
     15 
     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 
     21 int getDependsOther() { return depends_on_module_other; }
     22 
     23 void testSubframeworkOther() {
     24   double *sfo1 = sub_framework_other; // expected-error{{use of undeclared identifier 'sub_framework_other'}}
     25 }
     26 
     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 
     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 
     35 // Test header cross-subframework include pattern.
     36 #include <DependsOnModule/../Frameworks/SubFramework.framework/Headers/Other.h> // expected-warning{{treating #include as an import of module 'DependsOnModule.SubFramework.Other'}}
     37 
     38 void testSubframeworkOtherAgain() {
     39   double *sfo1 = sub_framework_other;
     40 }
     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 }
     51 
     52 // Test inclusion of private headers.
     53 #include <DependsOnModule/DependsOnModulePrivate.h> // expected-warning{{treating #include as an import of module 'DependsOnModule.Private.DependsOnModule'}}
     54 
     55 int getDependsOnModulePrivate() { return depends_on_module_private; }
     56 
     57 #include <Module/ModulePrivate.h> // includes the header
     58 
     59 int getModulePrivate() { return module_private; }
     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'?}}
     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 }
     74