diff options
Diffstat (limited to 'test/Modules')
125 files changed, 3123 insertions, 232 deletions
diff --git a/test/Modules/Inputs/Conflicts/conflict_a.h b/test/Modules/Inputs/Conflicts/conflict_a.h new file mode 100644 index 000000000000..c16b5f5ef226 --- /dev/null +++ b/test/Modules/Inputs/Conflicts/conflict_a.h @@ -0,0 +1 @@ +int conflict_a; diff --git a/test/Modules/Inputs/Conflicts/conflict_b.h b/test/Modules/Inputs/Conflicts/conflict_b.h new file mode 100644 index 000000000000..4baf16f88eaa --- /dev/null +++ b/test/Modules/Inputs/Conflicts/conflict_b.h @@ -0,0 +1 @@ +int conflict_b; diff --git a/test/Modules/Inputs/Conflicts/module.map b/test/Modules/Inputs/Conflicts/module.map new file mode 100644 index 000000000000..e6aafaccecc1 --- /dev/null +++ b/test/Modules/Inputs/Conflicts/module.map @@ -0,0 +1,10 @@ +module Conflicts { + explicit module A { + header "conflict_a.h" + conflict B, "we just don't like B" + } + + module B { + header "conflict_b.h" + } +} diff --git a/test/Modules/Inputs/DependsOnModule.framework/DependsOnModule b/test/Modules/Inputs/DependsOnModule.framework/DependsOnModule new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Modules/Inputs/DependsOnModule.framework/DependsOnModule diff --git a/test/Modules/Inputs/HasSubModules.framework/Frameworks/Sub.framework/Headers/Sub.h b/test/Modules/Inputs/HasSubModules.framework/Frameworks/Sub.framework/Headers/Sub.h new file mode 100644 index 000000000000..8a7eb8499cfd --- /dev/null +++ b/test/Modules/Inputs/HasSubModules.framework/Frameworks/Sub.framework/Headers/Sub.h @@ -0,0 +1 @@ +#include <Sub/Types.h> diff --git a/test/Modules/Inputs/HasSubModules.framework/Frameworks/Sub.framework/Headers/Types.h b/test/Modules/Inputs/HasSubModules.framework/Frameworks/Sub.framework/Headers/Types.h new file mode 100644 index 000000000000..7285c5ffa56a --- /dev/null +++ b/test/Modules/Inputs/HasSubModules.framework/Frameworks/Sub.framework/Headers/Types.h @@ -0,0 +1,4 @@ +struct FrameworkSubStruct { + const char * name; + unsigned version; +}; diff --git a/test/Modules/Inputs/HasSubModules.framework/Frameworks/Sub.framework/PrivateHeaders/SubPriv.h b/test/Modules/Inputs/HasSubModules.framework/Frameworks/Sub.framework/PrivateHeaders/SubPriv.h new file mode 100644 index 000000000000..cda5199f6371 --- /dev/null +++ b/test/Modules/Inputs/HasSubModules.framework/Frameworks/Sub.framework/PrivateHeaders/SubPriv.h @@ -0,0 +1,3 @@ +#include <Sub/Types.h> +// This comment ensures that this file is not identical to +// HasSubModules.framework/Frameworks/Sub.framework/Headers/Sub.h diff --git a/test/Modules/Inputs/HasSubModules.framework/Headers/HasSubModules.h b/test/Modules/Inputs/HasSubModules.framework/Headers/HasSubModules.h new file mode 100644 index 000000000000..a1bdc4621cc2 --- /dev/null +++ b/test/Modules/Inputs/HasSubModules.framework/Headers/HasSubModules.h @@ -0,0 +1 @@ +#import <Sub/Sub.h> diff --git a/test/Modules/Inputs/HasSubModules.framework/PrivateHeaders/HasSubModulesPriv.h b/test/Modules/Inputs/HasSubModules.framework/PrivateHeaders/HasSubModulesPriv.h new file mode 100644 index 000000000000..7b82058f42f9 --- /dev/null +++ b/test/Modules/Inputs/HasSubModules.framework/PrivateHeaders/HasSubModulesPriv.h @@ -0,0 +1,2 @@ +#import <Sub/SubPriv.h> + diff --git a/test/Modules/Inputs/MethodPoolA.h b/test/Modules/Inputs/MethodPoolA.h index 6af24a929116..ababb0200976 100644 --- a/test/Modules/Inputs/MethodPoolA.h +++ b/test/Modules/Inputs/MethodPoolA.h @@ -6,3 +6,9 @@ + (int)method1; - (int)method2:(int)param; @end + +@interface B : A +@end + +@interface C +@end diff --git a/test/Modules/Inputs/MethodPoolASub.h b/test/Modules/Inputs/MethodPoolASub.h new file mode 100644 index 000000000000..46fe0e11f231 --- /dev/null +++ b/test/Modules/Inputs/MethodPoolASub.h @@ -0,0 +1,6 @@ +@interface A (Sub) +- (char)method3; +- (char*)method4; +- (void)method5:(C*)obj; +@end + diff --git a/test/Modules/Inputs/MethodPoolASub2.h b/test/Modules/Inputs/MethodPoolASub2.h new file mode 100644 index 000000000000..cd0f78517f93 --- /dev/null +++ b/test/Modules/Inputs/MethodPoolASub2.h @@ -0,0 +1,3 @@ +@interface A (Sub2) +- (char*)method4; +@end diff --git a/test/Modules/Inputs/MethodPoolBSub.h b/test/Modules/Inputs/MethodPoolBSub.h new file mode 100644 index 000000000000..0a7899df81b7 --- /dev/null +++ b/test/Modules/Inputs/MethodPoolBSub.h @@ -0,0 +1,4 @@ +@interface B (Sub) +- (char *)method3; +- (char*)method4; +@end diff --git a/test/Modules/Inputs/Modified/B.h b/test/Modules/Inputs/Modified/B.h index d1c8bb5e8e15..52526b7f3ab0 100644 --- a/test/Modules/Inputs/Modified/B.h +++ b/test/Modules/Inputs/Modified/B.h @@ -1,2 +1,3 @@ -#include "A.h" +@import ModA; + int getB(); diff --git a/test/Modules/Inputs/Modified/module.map b/test/Modules/Inputs/Modified/module.map index d9aed01430c4..27b0d7062c76 100644 --- a/test/Modules/Inputs/Modified/module.map +++ b/test/Modules/Inputs/Modified/module.map @@ -1,2 +1,5 @@ -module A { header "A.h" } -module B { header "B.h" } +module ModA { header "A.h" } +module ModB { + header "B.h" + export * +} diff --git a/test/Modules/Inputs/Module.framework/Module b/test/Modules/Inputs/Module.framework/Module new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Modules/Inputs/Module.framework/Module diff --git a/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h b/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h index 5142f56e6015..156c22604f5a 100644 --- a/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h +++ b/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h @@ -1,3 +1,3 @@ -@__experimental_modules_import MutuallyRecursive2; +@import MutuallyRecursive2; diff --git a/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h b/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h index 8a3cc338c222..be3facd70ecc 100644 --- a/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h +++ b/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h @@ -1,6 +1,6 @@ -@__experimental_modules_import MutuallyRecursive1; +@import MutuallyRecursive1; diff --git a/test/Modules/Inputs/NoUmbrella.framework/NoUmbrella b/test/Modules/Inputs/NoUmbrella.framework/NoUmbrella new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Modules/Inputs/NoUmbrella.framework/NoUmbrella diff --git a/test/Modules/Inputs/StdDef/module.map b/test/Modules/Inputs/StdDef/module.map new file mode 100644 index 000000000000..69c69eac35b5 --- /dev/null +++ b/test/Modules/Inputs/StdDef/module.map @@ -0,0 +1,11 @@ +module StdDef { + module SizeT { + header "size_t.h" + export * + } + + module Other { + header "other.h" + export * + } +} diff --git a/test/Modules/Inputs/StdDef/other.h b/test/Modules/Inputs/StdDef/other.h new file mode 100644 index 000000000000..f29f6366cc69 --- /dev/null +++ b/test/Modules/Inputs/StdDef/other.h @@ -0,0 +1,2 @@ +#include <stddef.h> + diff --git a/test/Modules/Inputs/StdDef/size_t.h b/test/Modules/Inputs/StdDef/size_t.h new file mode 100644 index 000000000000..9ac61c5e0d7c --- /dev/null +++ b/test/Modules/Inputs/StdDef/size_t.h @@ -0,0 +1,4 @@ +#ifndef _SIZE_T +#define _SIZE_T +typedef __SIZE_TYPE__ size_t; +#endif diff --git a/test/Modules/Inputs/autolink-sub.h b/test/Modules/Inputs/autolink-sub.h new file mode 100644 index 000000000000..60f9aa037e9b --- /dev/null +++ b/test/Modules/Inputs/autolink-sub.h @@ -0,0 +1 @@ +int autolink_sub(void); diff --git a/test/Modules/Inputs/autolink-sub2.h b/test/Modules/Inputs/autolink-sub2.h new file mode 100644 index 000000000000..c3ea7021ab36 --- /dev/null +++ b/test/Modules/Inputs/autolink-sub2.h @@ -0,0 +1 @@ +int autolink_sub2(void); diff --git a/test/Modules/Inputs/autolink.h b/test/Modules/Inputs/autolink.h new file mode 100644 index 000000000000..1014e29dc653 --- /dev/null +++ b/test/Modules/Inputs/autolink.h @@ -0,0 +1 @@ +extern int autolink; diff --git a/test/Modules/Inputs/builtin.h b/test/Modules/Inputs/builtin.h new file mode 100644 index 000000000000..7be90177d194 --- /dev/null +++ b/test/Modules/Inputs/builtin.h @@ -0,0 +1,3 @@ +int i; +int *p = &i; + diff --git a/test/Modules/Inputs/builtin_sub.h b/test/Modules/Inputs/builtin_sub.h new file mode 100644 index 000000000000..79e3c0332597 --- /dev/null +++ b/test/Modules/Inputs/builtin_sub.h @@ -0,0 +1,4 @@ +int getBos1(void) { + return __builtin_object_size(p, 0); +} + diff --git a/test/Modules/Inputs/category_bottom.h b/test/Modules/Inputs/category_bottom.h index b53d9c30d6f6..ab4c01c3149c 100644 --- a/test/Modules/Inputs/category_bottom.h +++ b/test/Modules/Inputs/category_bottom.h @@ -1,10 +1,10 @@ -@__experimental_modules_import category_left; +@import category_left; @interface Foo(Bottom) -(void)bottom; @end -@__experimental_modules_import category_right; +@import category_right; @interface LeftFoo(Bottom) -(void)bottom; diff --git a/test/Modules/Inputs/category_left.h b/test/Modules/Inputs/category_left.h index 736fa4326908..05e2a1b96c52 100644 --- a/test/Modules/Inputs/category_left.h +++ b/test/Modules/Inputs/category_left.h @@ -1,4 +1,4 @@ -@__experimental_modules_import category_top; +@import category_top; @interface Foo(Left) -(void)left; diff --git a/test/Modules/Inputs/category_left_sub.h b/test/Modules/Inputs/category_left_sub.h new file mode 100644 index 000000000000..d92a873e1fb8 --- /dev/null +++ b/test/Modules/Inputs/category_left_sub.h @@ -0,0 +1,11 @@ +@interface Foo(LeftSub) <P1> +- (void)left_sub; +@end + +@protocol P3 +- (void)p3_method; +@property (retain) id p3_prop; +@end + +@interface Foo(LeftP3) <P3> +@end diff --git a/test/Modules/Inputs/category_other.h b/test/Modules/Inputs/category_other.h index 1bb5a91cbd78..2c3f4794c2a7 100644 --- a/test/Modules/Inputs/category_other.h +++ b/test/Modules/Inputs/category_other.h @@ -1,4 +1,4 @@ -@__experimental_modules_import category_top; +@import category_top; @interface Foo(Other) -(void)other; diff --git a/test/Modules/Inputs/category_right.h b/test/Modules/Inputs/category_right.h index 812a84078249..3c83624c7616 100644 --- a/test/Modules/Inputs/category_right.h +++ b/test/Modules/Inputs/category_right.h @@ -1,4 +1,4 @@ -@__experimental_modules_import category_top; +@import category_top; @interface Foo(Right1) -(void)right1; diff --git a/test/Modules/Inputs/category_right_sub.h b/test/Modules/Inputs/category_right_sub.h new file mode 100644 index 000000000000..231f65ffe0ad --- /dev/null +++ b/test/Modules/Inputs/category_right_sub.h @@ -0,0 +1,17 @@ +@interface Foo(RightSub) <P2> +@property id right_sub_prop; +@end + +@interface Foo() { +@public + int right_sub_ivar; +} +@end + +@protocol P4 +- (void)p4_method; +@property (retain) id p4_prop; +@end + +@interface Foo(LeftP4) <P4> +@end diff --git a/test/Modules/Inputs/category_top.h b/test/Modules/Inputs/category_top.h index c9558b6c295e..269edc9182e3 100644 --- a/test/Modules/Inputs/category_top.h +++ b/test/Modules/Inputs/category_top.h @@ -12,3 +12,12 @@ @interface Foo(Top3) -(void)top3; @end + +@protocol P1 +@end + +@protocol P2 +@end + +@protocol P3, P4; + diff --git a/test/Modules/Inputs/config.h b/test/Modules/Inputs/config.h new file mode 100644 index 000000000000..f2dfda64c3de --- /dev/null +++ b/test/Modules/Inputs/config.h @@ -0,0 +1,7 @@ +#ifdef WANT_FOO +int* foo(); +#endif + +#ifdef WANT_BAR +char *bar(); +#endif diff --git a/test/Modules/Inputs/cxx-inline-namespace.h b/test/Modules/Inputs/cxx-inline-namespace.h new file mode 100644 index 000000000000..2525ad3569c0 --- /dev/null +++ b/test/Modules/Inputs/cxx-inline-namespace.h @@ -0,0 +1,11 @@ +namespace std { + inline namespace __1 { + namespace __is_function_imp {} + } +} + +namespace std { + inline namespace __1 { + typedef int size_t; + } +} diff --git a/test/Modules/Inputs/cxx-linkage-cache.h b/test/Modules/Inputs/cxx-linkage-cache.h new file mode 100644 index 000000000000..df829279761a --- /dev/null +++ b/test/Modules/Inputs/cxx-linkage-cache.h @@ -0,0 +1,11 @@ +// Reduced from a crash encountered with a modularized libc++, where +// we would try to compute the linkage of a declaration before we +// finish loading the relevant pieces of it. +inline namespace D { + template<class> + struct U { + friend bool f(const U &); + }; + + template class U<int>; +} diff --git a/test/Modules/Inputs/cxx-many-overloads.h b/test/Modules/Inputs/cxx-many-overloads.h new file mode 100644 index 000000000000..890a86cbbd4f --- /dev/null +++ b/test/Modules/Inputs/cxx-many-overloads.h @@ -0,0 +1,2004 @@ +namespace N { + template<int> struct X {}; + void f(X<0>); + void f(X<1>); + void f(X<2>); + void f(X<3>); + void f(X<4>); + void f(X<5>); + void f(X<6>); + void f(X<7>); + void f(X<8>); + void f(X<9>); + void f(X<10>); + void f(X<11>); + void f(X<12>); + void f(X<13>); + void f(X<14>); + void f(X<15>); + void f(X<16>); + void f(X<17>); + void f(X<18>); + void f(X<19>); + void f(X<20>); + void f(X<21>); + void f(X<22>); + void f(X<23>); + void f(X<24>); + void f(X<25>); + void f(X<26>); + void f(X<27>); + void f(X<28>); + void f(X<29>); + void f(X<30>); + void f(X<31>); + void f(X<32>); + void f(X<33>); + void f(X<34>); + void f(X<35>); + void f(X<36>); + void f(X<37>); + void f(X<38>); + void f(X<39>); + void f(X<40>); + void f(X<41>); + void f(X<42>); + void f(X<43>); + void f(X<44>); + void f(X<45>); + void f(X<46>); + void f(X<47>); + void f(X<48>); + void f(X<49>); + void f(X<50>); + void f(X<51>); + void f(X<52>); + void f(X<53>); + void f(X<54>); + void f(X<55>); + void f(X<56>); + void f(X<57>); + void f(X<58>); + void f(X<59>); + void f(X<60>); + void f(X<61>); + void f(X<62>); + void f(X<63>); + void f(X<64>); + void f(X<65>); + void f(X<66>); + void f(X<67>); + void f(X<68>); + void f(X<69>); + void f(X<70>); + void f(X<71>); + void f(X<72>); + void f(X<73>); + void f(X<74>); + void f(X<75>); + void f(X<76>); + void f(X<77>); + void f(X<78>); + void f(X<79>); + void f(X<80>); + void f(X<81>); + void f(X<82>); + void f(X<83>); + void f(X<84>); + void f(X<85>); + void f(X<86>); + void f(X<87>); + void f(X<88>); + void f(X<89>); + void f(X<90>); + void f(X<91>); + void f(X<92>); + void f(X<93>); + void f(X<94>); + void f(X<95>); + void f(X<96>); + void f(X<97>); + void f(X<98>); + void f(X<99>); + void f(X<100>); + void f(X<101>); + void f(X<102>); + void f(X<103>); + void f(X<104>); + void f(X<105>); + void f(X<106>); + void f(X<107>); + void f(X<108>); + void f(X<109>); + void f(X<110>); + void f(X<111>); + void f(X<112>); + void f(X<113>); + void f(X<114>); + void f(X<115>); + void f(X<116>); + void f(X<117>); + void f(X<118>); + void f(X<119>); + void f(X<120>); + void f(X<121>); + void f(X<122>); + void f(X<123>); + void f(X<124>); + void f(X<125>); + void f(X<126>); + void f(X<127>); + void f(X<128>); + void f(X<129>); + void f(X<130>); + void f(X<131>); + void f(X<132>); + void f(X<133>); + void f(X<134>); + void f(X<135>); + void f(X<136>); + void f(X<137>); + void f(X<138>); + void f(X<139>); + void f(X<140>); + void f(X<141>); + void f(X<142>); + void f(X<143>); + void f(X<144>); + void f(X<145>); + void f(X<146>); + void f(X<147>); + void f(X<148>); + void f(X<149>); + void f(X<150>); + void f(X<151>); + void f(X<152>); + void f(X<153>); + void f(X<154>); + void f(X<155>); + void f(X<156>); + void f(X<157>); + void f(X<158>); + void f(X<159>); + void f(X<160>); + void f(X<161>); + void f(X<162>); + void f(X<163>); + void f(X<164>); + void f(X<165>); + void f(X<166>); + void f(X<167>); + void f(X<168>); + void f(X<169>); + void f(X<170>); + void f(X<171>); + void f(X<172>); + void f(X<173>); + void f(X<174>); + void f(X<175>); + void f(X<176>); + void f(X<177>); + void f(X<178>); + void f(X<179>); + void f(X<180>); + void f(X<181>); + void f(X<182>); + void f(X<183>); + void f(X<184>); + void f(X<185>); + void f(X<186>); + void f(X<187>); + void f(X<188>); + void f(X<189>); + void f(X<190>); + void f(X<191>); + void f(X<192>); + void f(X<193>); + void f(X<194>); + void f(X<195>); + void f(X<196>); + void f(X<197>); + void f(X<198>); + void f(X<199>); + void f(X<200>); + void f(X<201>); + void f(X<202>); + void f(X<203>); + void f(X<204>); + void f(X<205>); + void f(X<206>); + void f(X<207>); + void f(X<208>); + void f(X<209>); + void f(X<210>); + void f(X<211>); + void f(X<212>); + void f(X<213>); + void f(X<214>); + void f(X<215>); + void f(X<216>); + void f(X<217>); + void f(X<218>); + void f(X<219>); + void f(X<220>); + void f(X<221>); + void f(X<222>); + void f(X<223>); + void f(X<224>); + void f(X<225>); + void f(X<226>); + void f(X<227>); + void f(X<228>); + void f(X<229>); + void f(X<230>); + void f(X<231>); + void f(X<232>); + void f(X<233>); + void f(X<234>); + void f(X<235>); + void f(X<236>); + void f(X<237>); + void f(X<238>); + void f(X<239>); + void f(X<240>); + void f(X<241>); + void f(X<242>); + void f(X<243>); + void f(X<244>); + void f(X<245>); + void f(X<246>); + void f(X<247>); + void f(X<248>); + void f(X<249>); + void f(X<250>); + void f(X<251>); + void f(X<252>); + void f(X<253>); + void f(X<254>); + void f(X<255>); + void f(X<256>); + void f(X<257>); + void f(X<258>); + void f(X<259>); + void f(X<260>); + void f(X<261>); + void f(X<262>); + void f(X<263>); + void f(X<264>); + void f(X<265>); + void f(X<266>); + void f(X<267>); + void f(X<268>); + void f(X<269>); + void f(X<270>); + void f(X<271>); + void f(X<272>); + void f(X<273>); + void f(X<274>); + void f(X<275>); + void f(X<276>); + void f(X<277>); + void f(X<278>); + void f(X<279>); + void f(X<280>); + void f(X<281>); + void f(X<282>); + void f(X<283>); + void f(X<284>); + void f(X<285>); + void f(X<286>); + void f(X<287>); + void f(X<288>); + void f(X<289>); + void f(X<290>); + void f(X<291>); + void f(X<292>); + void f(X<293>); + void f(X<294>); + void f(X<295>); + void f(X<296>); + void f(X<297>); + void f(X<298>); + void f(X<299>); + void f(X<300>); + void f(X<301>); + void f(X<302>); + void f(X<303>); + void f(X<304>); + void f(X<305>); + void f(X<306>); + void f(X<307>); + void f(X<308>); + void f(X<309>); + void f(X<310>); + void f(X<311>); + void f(X<312>); + void f(X<313>); + void f(X<314>); + void f(X<315>); + void f(X<316>); + void f(X<317>); + void f(X<318>); + void f(X<319>); + void f(X<320>); + void f(X<321>); + void f(X<322>); + void f(X<323>); + void f(X<324>); + void f(X<325>); + void f(X<326>); + void f(X<327>); + void f(X<328>); + void f(X<329>); + void f(X<330>); + void f(X<331>); + void f(X<332>); + void f(X<333>); + void f(X<334>); + void f(X<335>); + void f(X<336>); + void f(X<337>); + void f(X<338>); + void f(X<339>); + void f(X<340>); + void f(X<341>); + void f(X<342>); + void f(X<343>); + void f(X<344>); + void f(X<345>); + void f(X<346>); + void f(X<347>); + void f(X<348>); + void f(X<349>); + void f(X<350>); + void f(X<351>); + void f(X<352>); + void f(X<353>); + void f(X<354>); + void f(X<355>); + void f(X<356>); + void f(X<357>); + void f(X<358>); + void f(X<359>); + void f(X<360>); + void f(X<361>); + void f(X<362>); + void f(X<363>); + void f(X<364>); + void f(X<365>); + void f(X<366>); + void f(X<367>); + void f(X<368>); + void f(X<369>); + void f(X<370>); + void f(X<371>); + void f(X<372>); + void f(X<373>); + void f(X<374>); + void f(X<375>); + void f(X<376>); + void f(X<377>); + void f(X<378>); + void f(X<379>); + void f(X<380>); + void f(X<381>); + void f(X<382>); + void f(X<383>); + void f(X<384>); + void f(X<385>); + void f(X<386>); + void f(X<387>); + void f(X<388>); + void f(X<389>); + void f(X<390>); + void f(X<391>); + void f(X<392>); + void f(X<393>); + void f(X<394>); + void f(X<395>); + void f(X<396>); + void f(X<397>); + void f(X<398>); + void f(X<399>); + void f(X<400>); + void f(X<401>); + void f(X<402>); + void f(X<403>); + void f(X<404>); + void f(X<405>); + void f(X<406>); + void f(X<407>); + void f(X<408>); + void f(X<409>); + void f(X<410>); + void f(X<411>); + void f(X<412>); + void f(X<413>); + void f(X<414>); + void f(X<415>); + void f(X<416>); + void f(X<417>); + void f(X<418>); + void f(X<419>); + void f(X<420>); + void f(X<421>); + void f(X<422>); + void f(X<423>); + void f(X<424>); + void f(X<425>); + void f(X<426>); + void f(X<427>); + void f(X<428>); + void f(X<429>); + void f(X<430>); + void f(X<431>); + void f(X<432>); + void f(X<433>); + void f(X<434>); + void f(X<435>); + void f(X<436>); + void f(X<437>); + void f(X<438>); + void f(X<439>); + void f(X<440>); + void f(X<441>); + void f(X<442>); + void f(X<443>); + void f(X<444>); + void f(X<445>); + void f(X<446>); + void f(X<447>); + void f(X<448>); + void f(X<449>); + void f(X<450>); + void f(X<451>); + void f(X<452>); + void f(X<453>); + void f(X<454>); + void f(X<455>); + void f(X<456>); + void f(X<457>); + void f(X<458>); + void f(X<459>); + void f(X<460>); + void f(X<461>); + void f(X<462>); + void f(X<463>); + void f(X<464>); + void f(X<465>); + void f(X<466>); + void f(X<467>); + void f(X<468>); + void f(X<469>); + void f(X<470>); + void f(X<471>); + void f(X<472>); + void f(X<473>); + void f(X<474>); + void f(X<475>); + void f(X<476>); + void f(X<477>); + void f(X<478>); + void f(X<479>); + void f(X<480>); + void f(X<481>); + void f(X<482>); + void f(X<483>); + void f(X<484>); + void f(X<485>); + void f(X<486>); + void f(X<487>); + void f(X<488>); + void f(X<489>); + void f(X<490>); + void f(X<491>); + void f(X<492>); + void f(X<493>); + void f(X<494>); + void f(X<495>); + void f(X<496>); + void f(X<497>); + void f(X<498>); + void f(X<499>); + void f(X<500>); + void f(X<501>); + void f(X<502>); + void f(X<503>); + void f(X<504>); + void f(X<505>); + void f(X<506>); + void f(X<507>); + void f(X<508>); + void f(X<509>); + void f(X<510>); + void f(X<511>); + void f(X<512>); + void f(X<513>); + void f(X<514>); + void f(X<515>); + void f(X<516>); + void f(X<517>); + void f(X<518>); + void f(X<519>); + void f(X<520>); + void f(X<521>); + void f(X<522>); + void f(X<523>); + void f(X<524>); + void f(X<525>); + void f(X<526>); + void f(X<527>); + void f(X<528>); + void f(X<529>); + void f(X<530>); + void f(X<531>); + void f(X<532>); + void f(X<533>); + void f(X<534>); + void f(X<535>); + void f(X<536>); + void f(X<537>); + void f(X<538>); + void f(X<539>); + void f(X<540>); + void f(X<541>); + void f(X<542>); + void f(X<543>); + void f(X<544>); + void f(X<545>); + void f(X<546>); + void f(X<547>); + void f(X<548>); + void f(X<549>); + void f(X<550>); + void f(X<551>); + void f(X<552>); + void f(X<553>); + void f(X<554>); + void f(X<555>); + void f(X<556>); + void f(X<557>); + void f(X<558>); + void f(X<559>); + void f(X<560>); + void f(X<561>); + void f(X<562>); + void f(X<563>); + void f(X<564>); + void f(X<565>); + void f(X<566>); + void f(X<567>); + void f(X<568>); + void f(X<569>); + void f(X<570>); + void f(X<571>); + void f(X<572>); + void f(X<573>); + void f(X<574>); + void f(X<575>); + void f(X<576>); + void f(X<577>); + void f(X<578>); + void f(X<579>); + void f(X<580>); + void f(X<581>); + void f(X<582>); + void f(X<583>); + void f(X<584>); + void f(X<585>); + void f(X<586>); + void f(X<587>); + void f(X<588>); + void f(X<589>); + void f(X<590>); + void f(X<591>); + void f(X<592>); + void f(X<593>); + void f(X<594>); + void f(X<595>); + void f(X<596>); + void f(X<597>); + void f(X<598>); + void f(X<599>); + void f(X<600>); + void f(X<601>); + void f(X<602>); + void f(X<603>); + void f(X<604>); + void f(X<605>); + void f(X<606>); + void f(X<607>); + void f(X<608>); + void f(X<609>); + void f(X<610>); + void f(X<611>); + void f(X<612>); + void f(X<613>); + void f(X<614>); + void f(X<615>); + void f(X<616>); + void f(X<617>); + void f(X<618>); + void f(X<619>); + void f(X<620>); + void f(X<621>); + void f(X<622>); + void f(X<623>); + void f(X<624>); + void f(X<625>); + void f(X<626>); + void f(X<627>); + void f(X<628>); + void f(X<629>); + void f(X<630>); + void f(X<631>); + void f(X<632>); + void f(X<633>); + void f(X<634>); + void f(X<635>); + void f(X<636>); + void f(X<637>); + void f(X<638>); + void f(X<639>); + void f(X<640>); + void f(X<641>); + void f(X<642>); + void f(X<643>); + void f(X<644>); + void f(X<645>); + void f(X<646>); + void f(X<647>); + void f(X<648>); + void f(X<649>); + void f(X<650>); + void f(X<651>); + void f(X<652>); + void f(X<653>); + void f(X<654>); + void f(X<655>); + void f(X<656>); + void f(X<657>); + void f(X<658>); + void f(X<659>); + void f(X<660>); + void f(X<661>); + void f(X<662>); + void f(X<663>); + void f(X<664>); + void f(X<665>); + void f(X<666>); + void f(X<667>); + void f(X<668>); + void f(X<669>); + void f(X<670>); + void f(X<671>); + void f(X<672>); + void f(X<673>); + void f(X<674>); + void f(X<675>); + void f(X<676>); + void f(X<677>); + void f(X<678>); + void f(X<679>); + void f(X<680>); + void f(X<681>); + void f(X<682>); + void f(X<683>); + void f(X<684>); + void f(X<685>); + void f(X<686>); + void f(X<687>); + void f(X<688>); + void f(X<689>); + void f(X<690>); + void f(X<691>); + void f(X<692>); + void f(X<693>); + void f(X<694>); + void f(X<695>); + void f(X<696>); + void f(X<697>); + void f(X<698>); + void f(X<699>); + void f(X<700>); + void f(X<701>); + void f(X<702>); + void f(X<703>); + void f(X<704>); + void f(X<705>); + void f(X<706>); + void f(X<707>); + void f(X<708>); + void f(X<709>); + void f(X<710>); + void f(X<711>); + void f(X<712>); + void f(X<713>); + void f(X<714>); + void f(X<715>); + void f(X<716>); + void f(X<717>); + void f(X<718>); + void f(X<719>); + void f(X<720>); + void f(X<721>); + void f(X<722>); + void f(X<723>); + void f(X<724>); + void f(X<725>); + void f(X<726>); + void f(X<727>); + void f(X<728>); + void f(X<729>); + void f(X<730>); + void f(X<731>); + void f(X<732>); + void f(X<733>); + void f(X<734>); + void f(X<735>); + void f(X<736>); + void f(X<737>); + void f(X<738>); + void f(X<739>); + void f(X<740>); + void f(X<741>); + void f(X<742>); + void f(X<743>); + void f(X<744>); + void f(X<745>); + void f(X<746>); + void f(X<747>); + void f(X<748>); + void f(X<749>); + void f(X<750>); + void f(X<751>); + void f(X<752>); + void f(X<753>); + void f(X<754>); + void f(X<755>); + void f(X<756>); + void f(X<757>); + void f(X<758>); + void f(X<759>); + void f(X<760>); + void f(X<761>); + void f(X<762>); + void f(X<763>); + void f(X<764>); + void f(X<765>); + void f(X<766>); + void f(X<767>); + void f(X<768>); + void f(X<769>); + void f(X<770>); + void f(X<771>); + void f(X<772>); + void f(X<773>); + void f(X<774>); + void f(X<775>); + void f(X<776>); + void f(X<777>); + void f(X<778>); + void f(X<779>); + void f(X<780>); + void f(X<781>); + void f(X<782>); + void f(X<783>); + void f(X<784>); + void f(X<785>); + void f(X<786>); + void f(X<787>); + void f(X<788>); + void f(X<789>); + void f(X<790>); + void f(X<791>); + void f(X<792>); + void f(X<793>); + void f(X<794>); + void f(X<795>); + void f(X<796>); + void f(X<797>); + void f(X<798>); + void f(X<799>); + void f(X<800>); + void f(X<801>); + void f(X<802>); + void f(X<803>); + void f(X<804>); + void f(X<805>); + void f(X<806>); + void f(X<807>); + void f(X<808>); + void f(X<809>); + void f(X<810>); + void f(X<811>); + void f(X<812>); + void f(X<813>); + void f(X<814>); + void f(X<815>); + void f(X<816>); + void f(X<817>); + void f(X<818>); + void f(X<819>); + void f(X<820>); + void f(X<821>); + void f(X<822>); + void f(X<823>); + void f(X<824>); + void f(X<825>); + void f(X<826>); + void f(X<827>); + void f(X<828>); + void f(X<829>); + void f(X<830>); + void f(X<831>); + void f(X<832>); + void f(X<833>); + void f(X<834>); + void f(X<835>); + void f(X<836>); + void f(X<837>); + void f(X<838>); + void f(X<839>); + void f(X<840>); + void f(X<841>); + void f(X<842>); + void f(X<843>); + void f(X<844>); + void f(X<845>); + void f(X<846>); + void f(X<847>); + void f(X<848>); + void f(X<849>); + void f(X<850>); + void f(X<851>); + void f(X<852>); + void f(X<853>); + void f(X<854>); + void f(X<855>); + void f(X<856>); + void f(X<857>); + void f(X<858>); + void f(X<859>); + void f(X<860>); + void f(X<861>); + void f(X<862>); + void f(X<863>); + void f(X<864>); + void f(X<865>); + void f(X<866>); + void f(X<867>); + void f(X<868>); + void f(X<869>); + void f(X<870>); + void f(X<871>); + void f(X<872>); + void f(X<873>); + void f(X<874>); + void f(X<875>); + void f(X<876>); + void f(X<877>); + void f(X<878>); + void f(X<879>); + void f(X<880>); + void f(X<881>); + void f(X<882>); + void f(X<883>); + void f(X<884>); + void f(X<885>); + void f(X<886>); + void f(X<887>); + void f(X<888>); + void f(X<889>); + void f(X<890>); + void f(X<891>); + void f(X<892>); + void f(X<893>); + void f(X<894>); + void f(X<895>); + void f(X<896>); + void f(X<897>); + void f(X<898>); + void f(X<899>); + void f(X<900>); + void f(X<901>); + void f(X<902>); + void f(X<903>); + void f(X<904>); + void f(X<905>); + void f(X<906>); + void f(X<907>); + void f(X<908>); + void f(X<909>); + void f(X<910>); + void f(X<911>); + void f(X<912>); + void f(X<913>); + void f(X<914>); + void f(X<915>); + void f(X<916>); + void f(X<917>); + void f(X<918>); + void f(X<919>); + void f(X<920>); + void f(X<921>); + void f(X<922>); + void f(X<923>); + void f(X<924>); + void f(X<925>); + void f(X<926>); + void f(X<927>); + void f(X<928>); + void f(X<929>); + void f(X<930>); + void f(X<931>); + void f(X<932>); + void f(X<933>); + void f(X<934>); + void f(X<935>); + void f(X<936>); + void f(X<937>); + void f(X<938>); + void f(X<939>); + void f(X<940>); + void f(X<941>); + void f(X<942>); + void f(X<943>); + void f(X<944>); + void f(X<945>); + void f(X<946>); + void f(X<947>); + void f(X<948>); + void f(X<949>); + void f(X<950>); + void f(X<951>); + void f(X<952>); + void f(X<953>); + void f(X<954>); + void f(X<955>); + void f(X<956>); + void f(X<957>); + void f(X<958>); + void f(X<959>); + void f(X<960>); + void f(X<961>); + void f(X<962>); + void f(X<963>); + void f(X<964>); + void f(X<965>); + void f(X<966>); + void f(X<967>); + void f(X<968>); + void f(X<969>); + void f(X<970>); + void f(X<971>); + void f(X<972>); + void f(X<973>); + void f(X<974>); + void f(X<975>); + void f(X<976>); + void f(X<977>); + void f(X<978>); + void f(X<979>); + void f(X<980>); + void f(X<981>); + void f(X<982>); + void f(X<983>); + void f(X<984>); + void f(X<985>); + void f(X<986>); + void f(X<987>); + void f(X<988>); + void f(X<989>); + void f(X<990>); + void f(X<991>); + void f(X<992>); + void f(X<993>); + void f(X<994>); + void f(X<995>); + void f(X<996>); + void f(X<997>); + void f(X<998>); + void f(X<999>); + void f(X<1000>); + void f(X<1001>); + void f(X<1002>); + void f(X<1003>); + void f(X<1004>); + void f(X<1005>); + void f(X<1006>); + void f(X<1007>); + void f(X<1008>); + void f(X<1009>); + void f(X<1010>); + void f(X<1011>); + void f(X<1012>); + void f(X<1013>); + void f(X<1014>); + void f(X<1015>); + void f(X<1016>); + void f(X<1017>); + void f(X<1018>); + void f(X<1019>); + void f(X<1020>); + void f(X<1021>); + void f(X<1022>); + void f(X<1023>); + void f(X<1024>); + void f(X<1025>); + void f(X<1026>); + void f(X<1027>); + void f(X<1028>); + void f(X<1029>); + void f(X<1030>); + void f(X<1031>); + void f(X<1032>); + void f(X<1033>); + void f(X<1034>); + void f(X<1035>); + void f(X<1036>); + void f(X<1037>); + void f(X<1038>); + void f(X<1039>); + void f(X<1040>); + void f(X<1041>); + void f(X<1042>); + void f(X<1043>); + void f(X<1044>); + void f(X<1045>); + void f(X<1046>); + void f(X<1047>); + void f(X<1048>); + void f(X<1049>); + void f(X<1050>); + void f(X<1051>); + void f(X<1052>); + void f(X<1053>); + void f(X<1054>); + void f(X<1055>); + void f(X<1056>); + void f(X<1057>); + void f(X<1058>); + void f(X<1059>); + void f(X<1060>); + void f(X<1061>); + void f(X<1062>); + void f(X<1063>); + void f(X<1064>); + void f(X<1065>); + void f(X<1066>); + void f(X<1067>); + void f(X<1068>); + void f(X<1069>); + void f(X<1070>); + void f(X<1071>); + void f(X<1072>); + void f(X<1073>); + void f(X<1074>); + void f(X<1075>); + void f(X<1076>); + void f(X<1077>); + void f(X<1078>); + void f(X<1079>); + void f(X<1080>); + void f(X<1081>); + void f(X<1082>); + void f(X<1083>); + void f(X<1084>); + void f(X<1085>); + void f(X<1086>); + void f(X<1087>); + void f(X<1088>); + void f(X<1089>); + void f(X<1090>); + void f(X<1091>); + void f(X<1092>); + void f(X<1093>); + void f(X<1094>); + void f(X<1095>); + void f(X<1096>); + void f(X<1097>); + void f(X<1098>); + void f(X<1099>); + void f(X<1100>); + void f(X<1101>); + void f(X<1102>); + void f(X<1103>); + void f(X<1104>); + void f(X<1105>); + void f(X<1106>); + void f(X<1107>); + void f(X<1108>); + void f(X<1109>); + void f(X<1110>); + void f(X<1111>); + void f(X<1112>); + void f(X<1113>); + void f(X<1114>); + void f(X<1115>); + void f(X<1116>); + void f(X<1117>); + void f(X<1118>); + void f(X<1119>); + void f(X<1120>); + void f(X<1121>); + void f(X<1122>); + void f(X<1123>); + void f(X<1124>); + void f(X<1125>); + void f(X<1126>); + void f(X<1127>); + void f(X<1128>); + void f(X<1129>); + void f(X<1130>); + void f(X<1131>); + void f(X<1132>); + void f(X<1133>); + void f(X<1134>); + void f(X<1135>); + void f(X<1136>); + void f(X<1137>); + void f(X<1138>); + void f(X<1139>); + void f(X<1140>); + void f(X<1141>); + void f(X<1142>); + void f(X<1143>); + void f(X<1144>); + void f(X<1145>); + void f(X<1146>); + void f(X<1147>); + void f(X<1148>); + void f(X<1149>); + void f(X<1150>); + void f(X<1151>); + void f(X<1152>); + void f(X<1153>); + void f(X<1154>); + void f(X<1155>); + void f(X<1156>); + void f(X<1157>); + void f(X<1158>); + void f(X<1159>); + void f(X<1160>); + void f(X<1161>); + void f(X<1162>); + void f(X<1163>); + void f(X<1164>); + void f(X<1165>); + void f(X<1166>); + void f(X<1167>); + void f(X<1168>); + void f(X<1169>); + void f(X<1170>); + void f(X<1171>); + void f(X<1172>); + void f(X<1173>); + void f(X<1174>); + void f(X<1175>); + void f(X<1176>); + void f(X<1177>); + void f(X<1178>); + void f(X<1179>); + void f(X<1180>); + void f(X<1181>); + void f(X<1182>); + void f(X<1183>); + void f(X<1184>); + void f(X<1185>); + void f(X<1186>); + void f(X<1187>); + void f(X<1188>); + void f(X<1189>); + void f(X<1190>); + void f(X<1191>); + void f(X<1192>); + void f(X<1193>); + void f(X<1194>); + void f(X<1195>); + void f(X<1196>); + void f(X<1197>); + void f(X<1198>); + void f(X<1199>); + void f(X<1200>); + void f(X<1201>); + void f(X<1202>); + void f(X<1203>); + void f(X<1204>); + void f(X<1205>); + void f(X<1206>); + void f(X<1207>); + void f(X<1208>); + void f(X<1209>); + void f(X<1210>); + void f(X<1211>); + void f(X<1212>); + void f(X<1213>); + void f(X<1214>); + void f(X<1215>); + void f(X<1216>); + void f(X<1217>); + void f(X<1218>); + void f(X<1219>); + void f(X<1220>); + void f(X<1221>); + void f(X<1222>); + void f(X<1223>); + void f(X<1224>); + void f(X<1225>); + void f(X<1226>); + void f(X<1227>); + void f(X<1228>); + void f(X<1229>); + void f(X<1230>); + void f(X<1231>); + void f(X<1232>); + void f(X<1233>); + void f(X<1234>); + void f(X<1235>); + void f(X<1236>); + void f(X<1237>); + void f(X<1238>); + void f(X<1239>); + void f(X<1240>); + void f(X<1241>); + void f(X<1242>); + void f(X<1243>); + void f(X<1244>); + void f(X<1245>); + void f(X<1246>); + void f(X<1247>); + void f(X<1248>); + void f(X<1249>); + void f(X<1250>); + void f(X<1251>); + void f(X<1252>); + void f(X<1253>); + void f(X<1254>); + void f(X<1255>); + void f(X<1256>); + void f(X<1257>); + void f(X<1258>); + void f(X<1259>); + void f(X<1260>); + void f(X<1261>); + void f(X<1262>); + void f(X<1263>); + void f(X<1264>); + void f(X<1265>); + void f(X<1266>); + void f(X<1267>); + void f(X<1268>); + void f(X<1269>); + void f(X<1270>); + void f(X<1271>); + void f(X<1272>); + void f(X<1273>); + void f(X<1274>); + void f(X<1275>); + void f(X<1276>); + void f(X<1277>); + void f(X<1278>); + void f(X<1279>); + void f(X<1280>); + void f(X<1281>); + void f(X<1282>); + void f(X<1283>); + void f(X<1284>); + void f(X<1285>); + void f(X<1286>); + void f(X<1287>); + void f(X<1288>); + void f(X<1289>); + void f(X<1290>); + void f(X<1291>); + void f(X<1292>); + void f(X<1293>); + void f(X<1294>); + void f(X<1295>); + void f(X<1296>); + void f(X<1297>); + void f(X<1298>); + void f(X<1299>); + void f(X<1300>); + void f(X<1301>); + void f(X<1302>); + void f(X<1303>); + void f(X<1304>); + void f(X<1305>); + void f(X<1306>); + void f(X<1307>); + void f(X<1308>); + void f(X<1309>); + void f(X<1310>); + void f(X<1311>); + void f(X<1312>); + void f(X<1313>); + void f(X<1314>); + void f(X<1315>); + void f(X<1316>); + void f(X<1317>); + void f(X<1318>); + void f(X<1319>); + void f(X<1320>); + void f(X<1321>); + void f(X<1322>); + void f(X<1323>); + void f(X<1324>); + void f(X<1325>); + void f(X<1326>); + void f(X<1327>); + void f(X<1328>); + void f(X<1329>); + void f(X<1330>); + void f(X<1331>); + void f(X<1332>); + void f(X<1333>); + void f(X<1334>); + void f(X<1335>); + void f(X<1336>); + void f(X<1337>); + void f(X<1338>); + void f(X<1339>); + void f(X<1340>); + void f(X<1341>); + void f(X<1342>); + void f(X<1343>); + void f(X<1344>); + void f(X<1345>); + void f(X<1346>); + void f(X<1347>); + void f(X<1348>); + void f(X<1349>); + void f(X<1350>); + void f(X<1351>); + void f(X<1352>); + void f(X<1353>); + void f(X<1354>); + void f(X<1355>); + void f(X<1356>); + void f(X<1357>); + void f(X<1358>); + void f(X<1359>); + void f(X<1360>); + void f(X<1361>); + void f(X<1362>); + void f(X<1363>); + void f(X<1364>); + void f(X<1365>); + void f(X<1366>); + void f(X<1367>); + void f(X<1368>); + void f(X<1369>); + void f(X<1370>); + void f(X<1371>); + void f(X<1372>); + void f(X<1373>); + void f(X<1374>); + void f(X<1375>); + void f(X<1376>); + void f(X<1377>); + void f(X<1378>); + void f(X<1379>); + void f(X<1380>); + void f(X<1381>); + void f(X<1382>); + void f(X<1383>); + void f(X<1384>); + void f(X<1385>); + void f(X<1386>); + void f(X<1387>); + void f(X<1388>); + void f(X<1389>); + void f(X<1390>); + void f(X<1391>); + void f(X<1392>); + void f(X<1393>); + void f(X<1394>); + void f(X<1395>); + void f(X<1396>); + void f(X<1397>); + void f(X<1398>); + void f(X<1399>); + void f(X<1400>); + void f(X<1401>); + void f(X<1402>); + void f(X<1403>); + void f(X<1404>); + void f(X<1405>); + void f(X<1406>); + void f(X<1407>); + void f(X<1408>); + void f(X<1409>); + void f(X<1410>); + void f(X<1411>); + void f(X<1412>); + void f(X<1413>); + void f(X<1414>); + void f(X<1415>); + void f(X<1416>); + void f(X<1417>); + void f(X<1418>); + void f(X<1419>); + void f(X<1420>); + void f(X<1421>); + void f(X<1422>); + void f(X<1423>); + void f(X<1424>); + void f(X<1425>); + void f(X<1426>); + void f(X<1427>); + void f(X<1428>); + void f(X<1429>); + void f(X<1430>); + void f(X<1431>); + void f(X<1432>); + void f(X<1433>); + void f(X<1434>); + void f(X<1435>); + void f(X<1436>); + void f(X<1437>); + void f(X<1438>); + void f(X<1439>); + void f(X<1440>); + void f(X<1441>); + void f(X<1442>); + void f(X<1443>); + void f(X<1444>); + void f(X<1445>); + void f(X<1446>); + void f(X<1447>); + void f(X<1448>); + void f(X<1449>); + void f(X<1450>); + void f(X<1451>); + void f(X<1452>); + void f(X<1453>); + void f(X<1454>); + void f(X<1455>); + void f(X<1456>); + void f(X<1457>); + void f(X<1458>); + void f(X<1459>); + void f(X<1460>); + void f(X<1461>); + void f(X<1462>); + void f(X<1463>); + void f(X<1464>); + void f(X<1465>); + void f(X<1466>); + void f(X<1467>); + void f(X<1468>); + void f(X<1469>); + void f(X<1470>); + void f(X<1471>); + void f(X<1472>); + void f(X<1473>); + void f(X<1474>); + void f(X<1475>); + void f(X<1476>); + void f(X<1477>); + void f(X<1478>); + void f(X<1479>); + void f(X<1480>); + void f(X<1481>); + void f(X<1482>); + void f(X<1483>); + void f(X<1484>); + void f(X<1485>); + void f(X<1486>); + void f(X<1487>); + void f(X<1488>); + void f(X<1489>); + void f(X<1490>); + void f(X<1491>); + void f(X<1492>); + void f(X<1493>); + void f(X<1494>); + void f(X<1495>); + void f(X<1496>); + void f(X<1497>); + void f(X<1498>); + void f(X<1499>); + void f(X<1500>); + void f(X<1501>); + void f(X<1502>); + void f(X<1503>); + void f(X<1504>); + void f(X<1505>); + void f(X<1506>); + void f(X<1507>); + void f(X<1508>); + void f(X<1509>); + void f(X<1510>); + void f(X<1511>); + void f(X<1512>); + void f(X<1513>); + void f(X<1514>); + void f(X<1515>); + void f(X<1516>); + void f(X<1517>); + void f(X<1518>); + void f(X<1519>); + void f(X<1520>); + void f(X<1521>); + void f(X<1522>); + void f(X<1523>); + void f(X<1524>); + void f(X<1525>); + void f(X<1526>); + void f(X<1527>); + void f(X<1528>); + void f(X<1529>); + void f(X<1530>); + void f(X<1531>); + void f(X<1532>); + void f(X<1533>); + void f(X<1534>); + void f(X<1535>); + void f(X<1536>); + void f(X<1537>); + void f(X<1538>); + void f(X<1539>); + void f(X<1540>); + void f(X<1541>); + void f(X<1542>); + void f(X<1543>); + void f(X<1544>); + void f(X<1545>); + void f(X<1546>); + void f(X<1547>); + void f(X<1548>); + void f(X<1549>); + void f(X<1550>); + void f(X<1551>); + void f(X<1552>); + void f(X<1553>); + void f(X<1554>); + void f(X<1555>); + void f(X<1556>); + void f(X<1557>); + void f(X<1558>); + void f(X<1559>); + void f(X<1560>); + void f(X<1561>); + void f(X<1562>); + void f(X<1563>); + void f(X<1564>); + void f(X<1565>); + void f(X<1566>); + void f(X<1567>); + void f(X<1568>); + void f(X<1569>); + void f(X<1570>); + void f(X<1571>); + void f(X<1572>); + void f(X<1573>); + void f(X<1574>); + void f(X<1575>); + void f(X<1576>); + void f(X<1577>); + void f(X<1578>); + void f(X<1579>); + void f(X<1580>); + void f(X<1581>); + void f(X<1582>); + void f(X<1583>); + void f(X<1584>); + void f(X<1585>); + void f(X<1586>); + void f(X<1587>); + void f(X<1588>); + void f(X<1589>); + void f(X<1590>); + void f(X<1591>); + void f(X<1592>); + void f(X<1593>); + void f(X<1594>); + void f(X<1595>); + void f(X<1596>); + void f(X<1597>); + void f(X<1598>); + void f(X<1599>); + void f(X<1600>); + void f(X<1601>); + void f(X<1602>); + void f(X<1603>); + void f(X<1604>); + void f(X<1605>); + void f(X<1606>); + void f(X<1607>); + void f(X<1608>); + void f(X<1609>); + void f(X<1610>); + void f(X<1611>); + void f(X<1612>); + void f(X<1613>); + void f(X<1614>); + void f(X<1615>); + void f(X<1616>); + void f(X<1617>); + void f(X<1618>); + void f(X<1619>); + void f(X<1620>); + void f(X<1621>); + void f(X<1622>); + void f(X<1623>); + void f(X<1624>); + void f(X<1625>); + void f(X<1626>); + void f(X<1627>); + void f(X<1628>); + void f(X<1629>); + void f(X<1630>); + void f(X<1631>); + void f(X<1632>); + void f(X<1633>); + void f(X<1634>); + void f(X<1635>); + void f(X<1636>); + void f(X<1637>); + void f(X<1638>); + void f(X<1639>); + void f(X<1640>); + void f(X<1641>); + void f(X<1642>); + void f(X<1643>); + void f(X<1644>); + void f(X<1645>); + void f(X<1646>); + void f(X<1647>); + void f(X<1648>); + void f(X<1649>); + void f(X<1650>); + void f(X<1651>); + void f(X<1652>); + void f(X<1653>); + void f(X<1654>); + void f(X<1655>); + void f(X<1656>); + void f(X<1657>); + void f(X<1658>); + void f(X<1659>); + void f(X<1660>); + void f(X<1661>); + void f(X<1662>); + void f(X<1663>); + void f(X<1664>); + void f(X<1665>); + void f(X<1666>); + void f(X<1667>); + void f(X<1668>); + void f(X<1669>); + void f(X<1670>); + void f(X<1671>); + void f(X<1672>); + void f(X<1673>); + void f(X<1674>); + void f(X<1675>); + void f(X<1676>); + void f(X<1677>); + void f(X<1678>); + void f(X<1679>); + void f(X<1680>); + void f(X<1681>); + void f(X<1682>); + void f(X<1683>); + void f(X<1684>); + void f(X<1685>); + void f(X<1686>); + void f(X<1687>); + void f(X<1688>); + void f(X<1689>); + void f(X<1690>); + void f(X<1691>); + void f(X<1692>); + void f(X<1693>); + void f(X<1694>); + void f(X<1695>); + void f(X<1696>); + void f(X<1697>); + void f(X<1698>); + void f(X<1699>); + void f(X<1700>); + void f(X<1701>); + void f(X<1702>); + void f(X<1703>); + void f(X<1704>); + void f(X<1705>); + void f(X<1706>); + void f(X<1707>); + void f(X<1708>); + void f(X<1709>); + void f(X<1710>); + void f(X<1711>); + void f(X<1712>); + void f(X<1713>); + void f(X<1714>); + void f(X<1715>); + void f(X<1716>); + void f(X<1717>); + void f(X<1718>); + void f(X<1719>); + void f(X<1720>); + void f(X<1721>); + void f(X<1722>); + void f(X<1723>); + void f(X<1724>); + void f(X<1725>); + void f(X<1726>); + void f(X<1727>); + void f(X<1728>); + void f(X<1729>); + void f(X<1730>); + void f(X<1731>); + void f(X<1732>); + void f(X<1733>); + void f(X<1734>); + void f(X<1735>); + void f(X<1736>); + void f(X<1737>); + void f(X<1738>); + void f(X<1739>); + void f(X<1740>); + void f(X<1741>); + void f(X<1742>); + void f(X<1743>); + void f(X<1744>); + void f(X<1745>); + void f(X<1746>); + void f(X<1747>); + void f(X<1748>); + void f(X<1749>); + void f(X<1750>); + void f(X<1751>); + void f(X<1752>); + void f(X<1753>); + void f(X<1754>); + void f(X<1755>); + void f(X<1756>); + void f(X<1757>); + void f(X<1758>); + void f(X<1759>); + void f(X<1760>); + void f(X<1761>); + void f(X<1762>); + void f(X<1763>); + void f(X<1764>); + void f(X<1765>); + void f(X<1766>); + void f(X<1767>); + void f(X<1768>); + void f(X<1769>); + void f(X<1770>); + void f(X<1771>); + void f(X<1772>); + void f(X<1773>); + void f(X<1774>); + void f(X<1775>); + void f(X<1776>); + void f(X<1777>); + void f(X<1778>); + void f(X<1779>); + void f(X<1780>); + void f(X<1781>); + void f(X<1782>); + void f(X<1783>); + void f(X<1784>); + void f(X<1785>); + void f(X<1786>); + void f(X<1787>); + void f(X<1788>); + void f(X<1789>); + void f(X<1790>); + void f(X<1791>); + void f(X<1792>); + void f(X<1793>); + void f(X<1794>); + void f(X<1795>); + void f(X<1796>); + void f(X<1797>); + void f(X<1798>); + void f(X<1799>); + void f(X<1800>); + void f(X<1801>); + void f(X<1802>); + void f(X<1803>); + void f(X<1804>); + void f(X<1805>); + void f(X<1806>); + void f(X<1807>); + void f(X<1808>); + void f(X<1809>); + void f(X<1810>); + void f(X<1811>); + void f(X<1812>); + void f(X<1813>); + void f(X<1814>); + void f(X<1815>); + void f(X<1816>); + void f(X<1817>); + void f(X<1818>); + void f(X<1819>); + void f(X<1820>); + void f(X<1821>); + void f(X<1822>); + void f(X<1823>); + void f(X<1824>); + void f(X<1825>); + void f(X<1826>); + void f(X<1827>); + void f(X<1828>); + void f(X<1829>); + void f(X<1830>); + void f(X<1831>); + void f(X<1832>); + void f(X<1833>); + void f(X<1834>); + void f(X<1835>); + void f(X<1836>); + void f(X<1837>); + void f(X<1838>); + void f(X<1839>); + void f(X<1840>); + void f(X<1841>); + void f(X<1842>); + void f(X<1843>); + void f(X<1844>); + void f(X<1845>); + void f(X<1846>); + void f(X<1847>); + void f(X<1848>); + void f(X<1849>); + void f(X<1850>); + void f(X<1851>); + void f(X<1852>); + void f(X<1853>); + void f(X<1854>); + void f(X<1855>); + void f(X<1856>); + void f(X<1857>); + void f(X<1858>); + void f(X<1859>); + void f(X<1860>); + void f(X<1861>); + void f(X<1862>); + void f(X<1863>); + void f(X<1864>); + void f(X<1865>); + void f(X<1866>); + void f(X<1867>); + void f(X<1868>); + void f(X<1869>); + void f(X<1870>); + void f(X<1871>); + void f(X<1872>); + void f(X<1873>); + void f(X<1874>); + void f(X<1875>); + void f(X<1876>); + void f(X<1877>); + void f(X<1878>); + void f(X<1879>); + void f(X<1880>); + void f(X<1881>); + void f(X<1882>); + void f(X<1883>); + void f(X<1884>); + void f(X<1885>); + void f(X<1886>); + void f(X<1887>); + void f(X<1888>); + void f(X<1889>); + void f(X<1890>); + void f(X<1891>); + void f(X<1892>); + void f(X<1893>); + void f(X<1894>); + void f(X<1895>); + void f(X<1896>); + void f(X<1897>); + void f(X<1898>); + void f(X<1899>); + void f(X<1900>); + void f(X<1901>); + void f(X<1902>); + void f(X<1903>); + void f(X<1904>); + void f(X<1905>); + void f(X<1906>); + void f(X<1907>); + void f(X<1908>); + void f(X<1909>); + void f(X<1910>); + void f(X<1911>); + void f(X<1912>); + void f(X<1913>); + void f(X<1914>); + void f(X<1915>); + void f(X<1916>); + void f(X<1917>); + void f(X<1918>); + void f(X<1919>); + void f(X<1920>); + void f(X<1921>); + void f(X<1922>); + void f(X<1923>); + void f(X<1924>); + void f(X<1925>); + void f(X<1926>); + void f(X<1927>); + void f(X<1928>); + void f(X<1929>); + void f(X<1930>); + void f(X<1931>); + void f(X<1932>); + void f(X<1933>); + void f(X<1934>); + void f(X<1935>); + void f(X<1936>); + void f(X<1937>); + void f(X<1938>); + void f(X<1939>); + void f(X<1940>); + void f(X<1941>); + void f(X<1942>); + void f(X<1943>); + void f(X<1944>); + void f(X<1945>); + void f(X<1946>); + void f(X<1947>); + void f(X<1948>); + void f(X<1949>); + void f(X<1950>); + void f(X<1951>); + void f(X<1952>); + void f(X<1953>); + void f(X<1954>); + void f(X<1955>); + void f(X<1956>); + void f(X<1957>); + void f(X<1958>); + void f(X<1959>); + void f(X<1960>); + void f(X<1961>); + void f(X<1962>); + void f(X<1963>); + void f(X<1964>); + void f(X<1965>); + void f(X<1966>); + void f(X<1967>); + void f(X<1968>); + void f(X<1969>); + void f(X<1970>); + void f(X<1971>); + void f(X<1972>); + void f(X<1973>); + void f(X<1974>); + void f(X<1975>); + void f(X<1976>); + void f(X<1977>); + void f(X<1978>); + void f(X<1979>); + void f(X<1980>); + void f(X<1981>); + void f(X<1982>); + void f(X<1983>); + void f(X<1984>); + void f(X<1985>); + void f(X<1986>); + void f(X<1987>); + void f(X<1988>); + void f(X<1989>); + void f(X<1990>); + void f(X<1991>); + void f(X<1992>); + void f(X<1993>); + void f(X<1994>); + void f(X<1995>); + void f(X<1996>); + void f(X<1997>); + void f(X<1998>); + void f(X<1999>); + void f(X<2000>); +} diff --git a/test/Modules/Inputs/def.h b/test/Modules/Inputs/def.h index 6d06b0812510..eb7eb7e59dc1 100644 --- a/test/Modules/Inputs/def.h +++ b/test/Modules/Inputs/def.h @@ -8,4 +8,13 @@ } @end +@interface Def +- defMethod; +@end +#ifdef __cplusplus +class Def2 { +public: + void func(); +}; +#endif diff --git a/test/Modules/Inputs/diag_pragma.h b/test/Modules/Inputs/diag_pragma.h new file mode 100644 index 000000000000..a8f958994ca5 --- /dev/null +++ b/test/Modules/Inputs/diag_pragma.h @@ -0,0 +1,3 @@ +#define DIAG_PRAGMA_MACRO 1 + +#pragma clang diagnostic ignored "-Wparentheses" diff --git a/test/Modules/Inputs/diamond.h b/test/Modules/Inputs/diamond.h index 15b529006160..1990b45b5f85 100644 --- a/test/Modules/Inputs/diamond.h +++ b/test/Modules/Inputs/diamond.h @@ -1 +1 @@ -@__experimental_modules_import diamond_bottom; +@import diamond_bottom; diff --git a/test/Modules/Inputs/diamond_bottom.h b/test/Modules/Inputs/diamond_bottom.h index b45fa936d1e9..2a0a84e3d7b3 100644 --- a/test/Modules/Inputs/diamond_bottom.h +++ b/test/Modules/Inputs/diamond_bottom.h @@ -1,4 +1,4 @@ -@__experimental_modules_import diamond_left; -@__experimental_modules_import diamond_right; +@import diamond_left; +@import diamond_right; char bottom(char *x); diff --git a/test/Modules/Inputs/diamond_left.h b/test/Modules/Inputs/diamond_left.h index cc406ab3891f..fce2e48882f8 100644 --- a/test/Modules/Inputs/diamond_left.h +++ b/test/Modules/Inputs/diamond_left.h @@ -1,4 +1,4 @@ -@__experimental_modules_import diamond_top; +@import diamond_top; float left(float *); diff --git a/test/Modules/Inputs/diamond_right.h b/test/Modules/Inputs/diamond_right.h index 2ba1d7744134..fa408ea5ba7f 100644 --- a/test/Modules/Inputs/diamond_right.h +++ b/test/Modules/Inputs/diamond_right.h @@ -1,4 +1,4 @@ -@__experimental_modules_import diamond_top; +@import diamond_top; double right(double *); diff --git a/test/Modules/Inputs/ignored_macros.h b/test/Modules/Inputs/ignored_macros.h new file mode 100644 index 000000000000..250b58c2f704 --- /dev/null +++ b/test/Modules/Inputs/ignored_macros.h @@ -0,0 +1,8 @@ +struct Point { + double x, y; +}; + +#ifdef IGNORED +int *has_ignored(void); +#endif + diff --git a/test/Modules/Inputs/linkage-merge-bar.h b/test/Modules/Inputs/linkage-merge-bar.h new file mode 100644 index 000000000000..cc528f77522b --- /dev/null +++ b/test/Modules/Inputs/linkage-merge-bar.h @@ -0,0 +1,3 @@ +#include <linkage-merge-foo.h> + +using ::g; diff --git a/test/Modules/Inputs/linkage-merge-foo.h b/test/Modules/Inputs/linkage-merge-foo.h new file mode 100644 index 000000000000..9cb62d2c0cb4 --- /dev/null +++ b/test/Modules/Inputs/linkage-merge-foo.h @@ -0,0 +1,2 @@ +int f(); +static int g(int); diff --git a/test/Modules/Inputs/linkage-merge-sub.h b/test/Modules/Inputs/linkage-merge-sub.h new file mode 100644 index 000000000000..725cdd378539 --- /dev/null +++ b/test/Modules/Inputs/linkage-merge-sub.h @@ -0,0 +1,11 @@ +extern int f0(int); +extern int f1(int); +static int f2(int); +static int f3(int); + +extern int v0; +extern int v1; +static int v2; +static int v3; + +typedef int T0; diff --git a/test/Modules/Inputs/macros_left.h b/test/Modules/Inputs/macros_left.h index cd0569389189..076b0464e6c6 100644 --- a/test/Modules/Inputs/macros_left.h +++ b/test/Modules/Inputs/macros_left.h @@ -1,4 +1,4 @@ -@__experimental_modules_import macros_top; +@import macros_top; #define LEFT unsigned long #undef TOP_LEFT_UNDEF @@ -12,3 +12,5 @@ #define LEFT_RIGHT_DIFFERENT3 float #define LEFT_RIGHT_DIFFERENT float + +#define FN_ADD(a,b) (a+b) diff --git a/test/Modules/Inputs/macros_right.h b/test/Modules/Inputs/macros_right.h index e16a64b50ad3..dbbd2c364350 100644 --- a/test/Modules/Inputs/macros_right.h +++ b/test/Modules/Inputs/macros_right.h @@ -1,4 +1,4 @@ -@__experimental_modules_import macros_top; +@import macros_top; #define RIGHT unsigned short @@ -15,3 +15,5 @@ #undef TOP_RIGHT_REDEF #define TOP_RIGHT_REDEF float + +#define FN_ADD(x, y) (x+y) diff --git a/test/Modules/Inputs/macros_top.h b/test/Modules/Inputs/macros_top.h index 9c3f3c071fd0..dd303ffee4e1 100644 --- a/test/Modules/Inputs/macros_top.h +++ b/test/Modules/Inputs/macros_top.h @@ -8,8 +8,8 @@ - - +#define TOP_RIGHT_REDEF float +// The last definition will be exported from the sub-module. #define TOP_RIGHT_REDEF int #define TOP_RIGHT_UNDEF int diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index 032241d6aa1e..d20521f9c764 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -37,10 +37,18 @@ module category_top { header "category_top.h" } module category_left { header "category_left.h" export category_top + + explicit module sub { + header "category_left_sub.h" + } } module category_right { header "category_right.h" export category_top + + explicit module sub { + header "category_right_sub.h" + } } module category_bottom { header "category_bottom.h" @@ -63,6 +71,7 @@ module decldef { module redecl_merge_top { header "redecl-merge-top.h" explicit module Explicit { header "redecl-merge-top-explicit.h" } + exclude header "nonexistent.h" } module redecl_merge_left { header "redecl-merge-left.h" @@ -77,6 +86,10 @@ module redecl_merge_right { export * } module redecl_merge_bottom { + explicit module prefix { + header "redecl-merge-bottom-prefix.h" + } + header "redecl-merge-bottom.h" export * } @@ -106,9 +119,21 @@ module templates_right { } module MethodPoolA { header "MethodPoolA.h" + + explicit module Sub2 { + header "MethodPoolASub2.h" + } + + explicit module Sub { + header "MethodPoolASub.h" + } } module MethodPoolB { header "MethodPoolB.h" + + explicit module Sub { + header "MethodPoolBSub.h" + } } module import_decl { header "import-decl.h" @@ -117,3 +142,70 @@ module import_decl { framework module * { exclude NotAModule } + +module linkage_merge_left { + explicit module sub { + header "linkage-merge-sub.h" + } +} + +module autolink { + header "autolink.h" + link "autolink" + + explicit module sub { + header "autolink-sub.h" + link "autolink_sub" + } + + explicit module sub2 { + header "autolink-sub2.h" + link framework "autolink_framework" + } +} + +module weird_objc { + header "weird_objc.h" +} + +module ignored_macros { + header "ignored_macros.h" +} + +module cxx_many_overloads { + header "cxx-many-overloads.h" +} + +module cxx_inline_namespace { + header "cxx-inline-namespace.h" +} + +module cxx_linkage_cache { + header "cxx-linkage-cache.h" +} + +module config { + header "config.h" + config_macros [exhaustive] WANT_FOO, WANT_BAR +} + +module diag_pragma { + header "diag_pragma.h" +} + +module builtin { + header "builtin.h" + explicit module sub { + header "builtin_sub.h" + } +} + +module linkage_merge { + explicit module foo { + header "linkage-merge-foo.h" + } + explicit module bar { + header "linkage-merge-bar.h" + } + +} diff --git a/test/Modules/Inputs/namespaces-left.h b/test/Modules/Inputs/namespaces-left.h index d253fed7c1b2..bd192afd2e89 100644 --- a/test/Modules/Inputs/namespaces-left.h +++ b/test/Modules/Inputs/namespaces-left.h @@ -1,4 +1,11 @@ -@__experimental_modules_import namespaces_top; +@import namespaces_top; + +float &global(float); +float &global2(float); + +namespace LookupBeforeImport { + float &f(float); +} namespace N1 { } diff --git a/test/Modules/Inputs/namespaces-right.h b/test/Modules/Inputs/namespaces-right.h index 7e7286e10b29..77f54ead65ab 100644 --- a/test/Modules/Inputs/namespaces-right.h +++ b/test/Modules/Inputs/namespaces-right.h @@ -1,4 +1,11 @@ -@__experimental_modules_import namespaces_top; +@import namespaces_top; + +double &global(double); +double &global2(double); + +namespace LookupBeforeImport { + double &f(double); +} namespace N2 { } diff --git a/test/Modules/Inputs/oldname/module.map b/test/Modules/Inputs/oldname/module.map new file mode 100644 index 000000000000..5812f869b342 --- /dev/null +++ b/test/Modules/Inputs/oldname/module.map @@ -0,0 +1,4 @@ +module NewName { + header "new_name.h" + export * +} diff --git a/test/Modules/Inputs/oldname/new_name.h b/test/Modules/Inputs/oldname/new_name.h new file mode 100644 index 000000000000..8bf2f1c8c312 --- /dev/null +++ b/test/Modules/Inputs/oldname/new_name.h @@ -0,0 +1 @@ +int same_api; diff --git a/test/Modules/Inputs/redecl-merge-bottom-prefix.h b/test/Modules/Inputs/redecl-merge-bottom-prefix.h new file mode 100644 index 000000000000..6501e1b65b7b --- /dev/null +++ b/test/Modules/Inputs/redecl-merge-bottom-prefix.h @@ -0,0 +1,4 @@ +// A class that is declared in the 'bottom' module, then loaded from +// one of the modules it depends on. It needs to be visible when this +// module is loaded. +@class DeclaredThenLoaded; diff --git a/test/Modules/Inputs/redecl-merge-bottom.h b/test/Modules/Inputs/redecl-merge-bottom.h index cfea7dc87da5..b8fb1794afae 100644 --- a/test/Modules/Inputs/redecl-merge-bottom.h +++ b/test/Modules/Inputs/redecl-merge-bottom.h @@ -1,11 +1,11 @@ -@__experimental_modules_import redecl_merge_left; +@import redecl_merge_left; @class C4; @class C4; @protocol P4; @protocol P4; @protocol P4; -@__experimental_modules_import redecl_merge_right; +@import redecl_merge_right; @class B; @@ -18,3 +18,8 @@ struct S3; void refers_to_C4(C4*); +@interface UnrelatedToDeclaredThenLoaded +- declaredThenLoadedMethod; +@end + +@class DeclaredThenLoaded; diff --git a/test/Modules/Inputs/redecl-merge-left-left.h b/test/Modules/Inputs/redecl-merge-left-left.h index 5f48883bf15f..79c4d620bee9 100644 --- a/test/Modules/Inputs/redecl-merge-left-left.h +++ b/test/Modules/Inputs/redecl-merge-left-left.h @@ -1,4 +1,4 @@ -@__experimental_modules_import redecl_merge_left; +@import redecl_merge_left; @class C4; void accept_a_C4(C4*); diff --git a/test/Modules/Inputs/redecl-merge-left.h b/test/Modules/Inputs/redecl-merge-left.h index 5e6d2e512b00..d66b4aa7803e 100644 --- a/test/Modules/Inputs/redecl-merge-left.h +++ b/test/Modules/Inputs/redecl-merge-left.h @@ -1,4 +1,4 @@ -@__experimental_modules_import redecl_merge_top; +@import redecl_merge_top; @class A; @@ -82,3 +82,12 @@ extern double var3; // top level. typedef void funcptr_with_id(int id); +// A class that is declared in the 'bottom' module, then loaded from +// one of the modules it depends on. +@interface DeclaredThenLoaded +- declaredThenLoadedMethod; +@end + +@class DeclaredThenLoaded; + +void eventually_noreturn2(void); diff --git a/test/Modules/Inputs/redecl-merge-right.h b/test/Modules/Inputs/redecl-merge-right.h index 20223083c31a..46a16d3b134c 100644 --- a/test/Modules/Inputs/redecl-merge-right.h +++ b/test/Modules/Inputs/redecl-merge-right.h @@ -1,4 +1,4 @@ -@__experimental_modules_import redecl_merge_top; +@import redecl_merge_top; @interface Super @end @@ -79,9 +79,12 @@ extern int var2; static double var3; int ONE; -@__experimental_modules_import redecl_merge_top.Explicit; +@import redecl_merge_top.Explicit; const int one = ONE; @interface ClassWithDef - (void)method; @end + +void eventually_noreturn(void) __attribute__((noreturn)); +void eventually_noreturn2(void) __attribute__((noreturn)); diff --git a/test/Modules/Inputs/redecl-merge-top.h b/test/Modules/Inputs/redecl-merge-top.h index 690e6df1c9e2..27e71a7383a2 100644 --- a/test/Modules/Inputs/redecl-merge-top.h +++ b/test/Modules/Inputs/redecl-merge-top.h @@ -16,3 +16,5 @@ struct S2; struct S2; int func1(int); + +void eventually_noreturn(void); diff --git a/test/Modules/Inputs/templates-left.h b/test/Modules/Inputs/templates-left.h index 57a8c85bf602..7451420c7482 100644 --- a/test/Modules/Inputs/templates-left.h +++ b/test/Modules/Inputs/templates-left.h @@ -1,4 +1,4 @@ -@__experimental_modules_import templates_top; +@import templates_top; template<typename T> class Vector; diff --git a/test/Modules/Inputs/templates-right.h b/test/Modules/Inputs/templates-right.h index 4ef4a32e8e27..d3524d34769b 100644 --- a/test/Modules/Inputs/templates-right.h +++ b/test/Modules/Inputs/templates-right.h @@ -1,4 +1,4 @@ -@__experimental_modules_import templates_top; +@import templates_top; template<typename T> class Vector { public: diff --git a/test/Modules/Inputs/weird_objc.h b/test/Modules/Inputs/weird_objc.h new file mode 100644 index 000000000000..8acaf746e855 --- /dev/null +++ b/test/Modules/Inputs/weird_objc.h @@ -0,0 +1 @@ +typedef struct objc_object { void *super; int wibble; } *id; diff --git a/test/Modules/Inputs/wildcard-submodule-exports/C_one.h b/test/Modules/Inputs/wildcard-submodule-exports/C_one.h index fb1c7de845bc..e3b7593b80c8 100644 --- a/test/Modules/Inputs/wildcard-submodule-exports/C_one.h +++ b/test/Modules/Inputs/wildcard-submodule-exports/C_one.h @@ -1,4 +1,4 @@ -@__experimental_modules_import A.One; -@__experimental_modules_import B.One; +@import A.One; +@import B.One; long *C1; diff --git a/test/Modules/Inputs/wildcard-submodule-exports/C_two.h b/test/Modules/Inputs/wildcard-submodule-exports/C_two.h index 050a8f3e8855..b65dcf612ebc 100644 --- a/test/Modules/Inputs/wildcard-submodule-exports/C_two.h +++ b/test/Modules/Inputs/wildcard-submodule-exports/C_two.h @@ -1,4 +1,4 @@ -@__experimental_modules_import A.Two; -@__experimental_modules_import B.Two; +@import A.Two; +@import B.Two; unsigned long *C2; diff --git a/test/Modules/auto-module-import.m b/test/Modules/auto-module-import.m index fbd0a541b608..4bd3c5279ceb 100644 --- a/test/Modules/auto-module-import.m +++ b/test/Modules/auto-module-import.m @@ -1,7 +1,7 @@ // other file: expected-note{{'no_umbrella_A_private' declared here}} // RUN: rm -rf %t -// RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify #include <DependsOnModule/DependsOnModule.h> // expected-warning{{treating #include as an import of module 'DependsOnModule'}} diff --git a/test/Modules/autolink.m b/test/Modules/autolink.m new file mode 100644 index 000000000000..7f75473cbbd9 --- /dev/null +++ b/test/Modules/autolink.m @@ -0,0 +1,40 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -emit-llvm -o - -fmodules-cache-path=%t -fmodules -fmodules-autolink -F %S/Inputs -I %S/Inputs %s | FileCheck %s + +@import autolink.sub2; + +int f() { + return autolink_sub2(); +} + +@import autolink; + +int g() { + return autolink; +} + +@import Module.SubFramework; +const char *get_module_subframework() { + return module_subframework; +} + +@import DependsOnModule.SubFramework; +float *get_module_subframework_dep() { + return sub_framework; +} + +@import NoUmbrella; +int use_no_umbrella() { + return no_umbrella_A; +} + +// NOTE: "autolink_sub" is intentionally not linked. + +// CHECK: !llvm.module.flags = !{!0, !1, !2, !3, !4} +// CHECK: !4 = metadata !{i32 6, metadata !"Linker Options", metadata ![[AUTOLINK_OPTIONS:[0-9]+]]} +// CHECK: ![[AUTOLINK_OPTIONS]] = metadata !{metadata ![[AUTOLINK_FRAMEWORK:[0-9]+]], metadata ![[AUTOLINK:[0-9]+]], metadata ![[DEPENDSONMODULE:[0-9]+]], metadata ![[MODULE:[0-9]+]], metadata ![[NOUMBRELLA:[0-9]+]]} +// CHECK: ![[AUTOLINK_FRAMEWORK]] = metadata !{metadata !"-framework", metadata !"autolink_framework"} +// CHECK: ![[AUTOLINK]] = metadata !{metadata !"-lautolink"} +// CHECK: ![[DEPENDSONMODULE]] = metadata !{metadata !"-framework", metadata !"DependsOnModule"} +// CHECK: ![[MODULE]] = metadata !{metadata !"-framework", metadata !"Module"} +// CHECK: ![[NOUMBRELLA]] = metadata !{metadata !"-framework", metadata !"NoUmbrella"} diff --git a/test/Modules/build-fail-notes.m b/test/Modules/build-fail-notes.m new file mode 100644 index 000000000000..8375788e817b --- /dev/null +++ b/test/Modules/build-fail-notes.m @@ -0,0 +1,31 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -F %S/Inputs -DgetModuleVersion="epic fail" %s 2>&1 | FileCheck %s + +@import DependsOnModule; + +// CHECK: While building module 'DependsOnModule' imported from +// CHECK: While building module 'Module' imported from +// CHECK: error: expected ';' after top level declarator +// CHECK: note: expanded from here +// CHECK: fatal error: could not build module 'Module' +// CHECK: fatal error: could not build module 'DependsOnModule' +// CHECK-NOT: error: + +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -fdiagnostics-show-note-include-stack 2>&1 | FileCheck -check-prefix=CHECK-REDEF %s +extern int Module; + +// CHECK-REDEF: In module 'DependsOnModule' imported from +// CHECK-REDEF: In module 'Module' imported from +// CHECK-REDEF: Module.h:15:12: note: previous definition is here + +// RUN: not %clang_cc1 -fmodules-cache-path=%t -fmodules -F %S/Inputs -DgetModuleVersion="epic fail" -serialize-diagnostic-file %t/tmp.diag %s 2>&1 +// RUN: c-index-test -read-diagnostics %t/tmp.diag 2>&1 | FileCheck -check-prefix=CHECK-SDIAG %s + +// CHECK-SDIAG: Module.h:9:13: error: expected ';' after top level declarator +// CHECK-SDIAG: build-fail-notes.m:4:9: note: while building module 'DependsOnModule' imported from +// CHECK-SDIAG: DependsOnModule.h:1:10: note: while building module 'Module' imported from +// CHECK-SDIAG: note: expanded from here +// CHECK-SDIAG: warning: umbrella header for module 'Module' does not include header 'NotInModule.h' [-Wincomplete-umbrella] +// CHECK-SDIAG: DependsOnModule.h:1:10: fatal: could not build module 'Module' +// CHECK-SDIAG: build-fail-notes.m:4:9: note: while building module 'DependsOnModule' imported from + diff --git a/test/Modules/builtins.m b/test/Modules/builtins.m new file mode 100644 index 000000000000..40b4f9c74395 --- /dev/null +++ b/test/Modules/builtins.m @@ -0,0 +1,16 @@ +@import builtin; + +int foo() { + return __builtin_object_size(p, 0); +} + +@import builtin.sub; + +int bar() { + return __builtin_object_size(p, 0); +} + + +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -I %S/Inputs %s -verify +// expected-no-diagnostics diff --git a/test/Modules/compiler_builtins.m b/test/Modules/compiler_builtins.m index dfa46c8a34f5..5ea7d795c73d 100644 --- a/test/Modules/compiler_builtins.m +++ b/test/Modules/compiler_builtins.m @@ -1,12 +1,13 @@ // RUN: rm -rf %t -// RUN: %clang -fsyntax-only -fmodules -fmodule-cache-path %t -D__need_wint_t %s -Xclang -verify -// RUN: %clang -fsyntax-only -std=c99 -fmodules -fmodule-cache-path %t -D__need_wint_t %s -Xclang -verify +// RUN: %clang -fsyntax-only -fmodules -fmodules-cache-path=%t -D__need_wint_t %s -Xclang -verify +// RUN: %clang -fsyntax-only -std=c99 -fmodules -fmodules-cache-path=%t -D__need_wint_t %s -Xclang -verify // expected-no-diagnostics +// XFAIL: win32 #ifdef __SSE__ -@__experimental_modules_import _Builtin_intrinsics.intel.sse; +@import _Builtin_intrinsics.intel.sse; #endif #ifdef __AVX2__ -@__experimental_modules_import _Builtin_intrinsics.intel.avx2; +@import _Builtin_intrinsics.intel.avx2; #endif diff --git a/test/Modules/config_macros.m b/test/Modules/config_macros.m new file mode 100644 index 000000000000..200744d614a7 --- /dev/null +++ b/test/Modules/config_macros.m @@ -0,0 +1,28 @@ +@import config; + +int *test_foo() { + return foo(); +} + +char *test_bar() { + return bar(); // expected-warning{{implicit declaration of function 'bar' is invalid in C99}} \ + // expected-warning{{incompatible integer to pointer conversion}} +} + +#undef WANT_FOO // expected-note{{macro was #undef'd here}} +@import config; // expected-warning{{#undef of configuration macro 'WANT_FOO' has no effect on the import of 'config'; pass '-UWANT_FOO' on the command line to configure the module}} + +#define WANT_FOO 2 // expected-note{{macro was defined here}} +@import config; // expected-warning{{definition of configuration macro 'WANT_FOO' has no effect on the import of 'config'; pass '-DWANT_FOO=...' on the command line to configure the module}} + +#undef WANT_FOO +#define WANT_FOO 1 +@import config; // okay + +#define WANT_BAR 1 // expected-note{{macro was defined here}} +@import config; // expected-warning{{definition of configuration macro 'WANT_BAR' has no effect on the import of 'config'; pass '-DWANT_BAR=...' on the command line to configure the module}} + +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -DWANT_FOO=1 -emit-module -fmodule-name=config %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -DWANT_FOO=1 %s -verify + diff --git a/test/Modules/conflicts.m b/test/Modules/conflicts.m new file mode 100644 index 000000000000..2388e6f1d1cf --- /dev/null +++ b/test/Modules/conflicts.m @@ -0,0 +1,7 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -I %S/Inputs/Conflicts %s -verify + +@import Conflicts; + +@import Conflicts.A; // expected-warning{{module 'Conflicts.A' conflicts with already-imported module 'Conflicts.B': we just don't like B}} + diff --git a/test/Modules/cstd.m b/test/Modules/cstd.m index e262c7e14429..6d896a915579 100644 --- a/test/Modules/cstd.m +++ b/test/Modules/cstd.m @@ -1,25 +1,25 @@ // RUN: rm -rf %t -// RUN: %clang -fsyntax-only -isystem %S/Inputs/System/usr/include -fmodules -fmodule-cache-path %t -D__need_wint_t -Werror=implicit-function-declaration %s +// RUN: %clang -fsyntax-only -isystem %S/Inputs/System/usr/include -fmodules -fmodules-cache-path=%t -D__need_wint_t -Werror=implicit-function-declaration %s // Supplied by compiler, but referenced from the "/usr/include" module map. -@__experimental_modules_import cstd.float_constants; +@import cstd.float_constants; float getFltMax() { return FLT_MAX; } // Supplied by the "/usr/include" module map. -@__experimental_modules_import cstd.stdio; +@import cstd.stdio; void test_fprintf(FILE *file) { fprintf(file, "Hello, modules\n"); } // Supplied by compiler, which forwards to the "/usr/include" version. -@__experimental_modules_import cstd.stdint; +@import cstd.stdint; my_awesome_nonstandard_integer_type value; // Supplied by the compiler; that version wins. -@__experimental_modules_import cstd.stdbool; +@import cstd.stdbool; #ifndef bool # error "bool was not defined!" diff --git a/test/Modules/cxx-inline-namespace.cpp b/test/Modules/cxx-inline-namespace.cpp new file mode 100644 index 000000000000..5b967901b338 --- /dev/null +++ b/test/Modules/cxx-inline-namespace.cpp @@ -0,0 +1,6 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 + +@import cxx_inline_namespace; + +T x; // expected-error {{unknown type name 'T'}} diff --git a/test/Modules/cxx-linkage-cache.cpp b/test/Modules/cxx-linkage-cache.cpp new file mode 100644 index 000000000000..296cc8034f5a --- /dev/null +++ b/test/Modules/cxx-linkage-cache.cpp @@ -0,0 +1,8 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 + +@import cxx_linkage_cache; + +T x; // expected-error {{unknown type name 'T'}} +D::U<int> u; +bool b = f(u); diff --git a/test/Modules/cxx-many-overloads.cpp b/test/Modules/cxx-many-overloads.cpp new file mode 100644 index 000000000000..205a79cdf9e1 --- /dev/null +++ b/test/Modules/cxx-many-overloads.cpp @@ -0,0 +1,9 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify + +// expected-no-diagnostics +@import cxx_many_overloads; + +void g() { + f(N::X<0>()); +} diff --git a/test/Modules/cycles.c b/test/Modules/cycles.c index 256f118cc025..4326e76a75fb 100644 --- a/test/Modules/cycles.c +++ b/test/Modules/cycles.c @@ -1,12 +1,13 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -F %S/Inputs %s 2>&1 | FileCheck %s +// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -F %S/Inputs %s 2>&1 | FileCheck %s // FIXME: When we have a syntax for modules in C, use that. -@__experimental_modules_import MutuallyRecursive1; +@import MutuallyRecursive1; -// FIXME: Lots of redundant diagnostics here, because the preprocessor -// can't currently tell the parser not to try to load the module again. - -// CHECK: MutuallyRecursive2.h:3:32: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1 -// CHECK: MutuallyRecursive1.h:2:32: fatal error: could not build module 'MutuallyRecursive2' -// CHECK: cycles.c:4:32: fatal error: could not build module 'MutuallyRecursive1' +// CHECK: While building module 'MutuallyRecursive1' imported from +// CHECK: While building module 'MutuallyRecursive2' imported from +// CHECK: MutuallyRecursive2.h:3:9: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1 +// CHECK: While building module 'MutuallyRecursive1' imported from +// CHECK: MutuallyRecursive1.h:2:9: fatal error: could not build module 'MutuallyRecursive2' +// CHECK: cycles.c:4:9: fatal error: could not build module 'MutuallyRecursive1' +// CHECK-NOT: error: diff --git a/test/Modules/decldef.m b/test/Modules/decldef.m new file mode 100644 index 000000000000..7fb8a61386e6 --- /dev/null +++ b/test/Modules/decldef.m @@ -0,0 +1,28 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify + + +// In other file: expected-note {{previous definition is here}} + +@class Def; +Def *def; + +@import decldef; +A *a1; // expected-error{{unknown type name 'A'}} +B *b1; // expected-error{{must use 'struct' tag to refer to type 'B'}} +@import decldef.Decl; + +A *a2; +struct B *b; + +void testA(A *a) { + a->ivar = 17; // expected-error{{definition of 'A' must be imported from module 'decldef.Def' before it is required}} +} + +void testB() { + B b; // Note: redundant error silenced +} + +void testDef() { + [def defMethod]; +} diff --git a/test/Modules/decldef.mm b/test/Modules/decldef.mm index 64a66d59d0e6..732c2a27e235 100644 --- a/test/Modules/decldef.mm +++ b/test/Modules/decldef.mm @@ -1,28 +1,38 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -I %S/Inputs -fmodule-cache-path %t %s -verify +// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -// in other file: expected-note{{previous definition is here}} +// In other file: expected-note {{previous definition is here}} +@class Def; +Def *def; +class Def2; +Def2 *def2; +@interface Unrelated +- defMethod; +@end - - -// in other file: expected-note{{previous definition is here}} - -@__experimental_modules_import decldef; +@import decldef; A *a1; // expected-error{{unknown type name 'A'}} B *b1; // expected-error{{unknown type name 'B'}} -@__experimental_modules_import decldef.Decl; +@import decldef.Decl; A *a2; B *b; void testA(A *a) { - a->ivar = 17; // expected-error{{definition of 'A' must be imported before it is required}} + a->ivar = 17; // expected-error{{definition of 'A' must be imported from module 'decldef.Def' before it is required}} } void testB() { - B b; // expected-error{{definition of 'B' must be imported before it is required}} - B b2; // Note: the reundant error was silenced. + B b; // Note: redundant error silenced +} + +void testDef() { + [def defMethod]; +} + +void testDef2() { + def2->func(); } diff --git a/test/Modules/diag-pragma.c b/test/Modules/diag-pragma.c new file mode 100644 index 000000000000..7ec3400bba24 --- /dev/null +++ b/test/Modules/diag-pragma.c @@ -0,0 +1,13 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diag_pragma %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -verify -fmodules-cache-path=%t %s +// FIXME: When we have a syntax for modules in C, use that. + +@import diag_pragma; + +int foo(int x) { + if (x = DIAG_PRAGMA_MACRO) // expected-warning {{using the result of an assignment as a condition without parentheses}} \ + // expected-note {{place parentheses}} expected-note {{use '=='}} + return 0; + return 1; +} diff --git a/test/Modules/diamond-pch.c b/test/Modules/diamond-pch.c index 4397c194c0ec..079f6afa9c79 100644 --- a/test/Modules/diamond-pch.c +++ b/test/Modules/diamond-pch.c @@ -19,10 +19,10 @@ void test_diamond(int i, float f, double d, char c) { } // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_top %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_left %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_right %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_bottom %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-pch -fmodule-cache-path %t -o %t.pch %S/Inputs/diamond.h -// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -include-pch %t.pch %s -verify +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -emit-pch -fmodules-cache-path=%t -o %t.pch %S/Inputs/diamond.h +// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -include-pch %t.pch %s -verify // FIXME: When we have a syntax for modules in C, use that. diff --git a/test/Modules/diamond.c b/test/Modules/diamond.c index 076eec4bf268..0bac1b7596a4 100644 --- a/test/Modules/diamond.c +++ b/test/Modules/diamond.c @@ -3,7 +3,7 @@ // in diamond-bottom.h: expected-note{{passing argument to parameter 'x' here}} -@__experimental_modules_import diamond_bottom; +@import diamond_bottom; void test_diamond(int i, float f, double d, char c) { top(&i); @@ -21,9 +21,9 @@ void test_diamond(int i, float f, double d, char c) { } // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_top %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_left %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_right %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_bottom %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t %s -verify +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_top %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_left %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_right %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diamond_bottom %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t %s -verify // FIXME: When we have a syntax for modules in C, use that. diff --git a/test/Modules/direct-module-import.m b/test/Modules/direct-module-import.m index 317d7aea164b..00c13faccf43 100644 --- a/test/Modules/direct-module-import.m +++ b/test/Modules/direct-module-import.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -F %S/Inputs -include Module/Module.h %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -F %S/Inputs -include Module/Module.h %s -emit-llvm -o - | FileCheck %s // CHECK: call i8* @getModuleVersion const char* getVer(void) { diff --git a/test/Modules/driver.c b/test/Modules/driver.c index de10cd0cecca..08fdaab44106 100644 --- a/test/Modules/driver.c +++ b/test/Modules/driver.c @@ -1,6 +1,6 @@ -// RUN: %clang %s -### 2>&1 | FileCheck -check-prefix NO_MODULE_CACHE %s -// RUN: %clang -fmodule-cache-path blarg %s -### 2>&1 | FileCheck -check-prefix WITH_MODULE_CACHE %s +// RUN: %clang -fmodules %s -### 2>&1 | FileCheck -check-prefix NO_MODULE_CACHE %s +// RUN: %clang -fmodules -fmodules-cache-path=blarg %s -### 2>&1 | FileCheck -check-prefix WITH_MODULE_CACHE %s -// CHECK-NO_MODULE_CACHE: {{clang.*"-fmodule-cache-path"}} +// CHECK-NO_MODULE_CACHE: {{clang.*"-fmodules-cache-path=.*ModuleCache"}} -// CHECK-WITH_MODULE_CACHE: {{clang.*"-fmodule-cache-path" "blarg"}} +// CHECK-WITH_MODULE_CACHE: {{clang.*"-fmodules-cache-path=blarg"}} diff --git a/test/Modules/epic-fail.m b/test/Modules/epic-fail.m new file mode 100644 index 000000000000..8969149f957a --- /dev/null +++ b/test/Modules/epic-fail.m @@ -0,0 +1,13 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -F %S/Inputs -DgetModuleVersion="epic fail" %s 2>&1 | FileCheck %s + +@import Module; +@import DependsOnModule; + +// CHECK: While building module 'Module' imported from +// CHECK: error: expected ';' after top level declarator +// CHECK: note: expanded from here +// CHECK: fatal error: could not build module 'Module' +// CHECK: While building module 'DependsOnModule' imported from +// CHECK: fatal error: could not build module 'Module' +// CHECK-NOT: error: diff --git a/test/Modules/global_index.m b/test/Modules/global_index.m new file mode 100644 index 000000000000..b255b6300077 --- /dev/null +++ b/test/Modules/global_index.m @@ -0,0 +1,19 @@ +// RUN: rm -rf %t +// Run without global module index +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fdisable-module-hash -fmodules -fno-modules-global-index -F %S/Inputs %s -verify +// RUN: ls %t|not grep modules.idx +// Run and create the global module index +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fdisable-module-hash -fmodules -F %S/Inputs %s -verify +// RUN: ls %t|grep modules.idx +// Run and use the global module index +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fdisable-module-hash -fmodules -F %S/Inputs %s -verify -print-stats 2>&1 | FileCheck %s + +// expected-no-diagnostics +@import DependsOnModule; +@import Module; + +// CHECK: *** Global Module Index Statistics: + +int *get_sub() { + return Module_Sub; +} diff --git a/test/Modules/header-import.m b/test/Modules/header-import.m index 49549d0c671a..baeb1d304dcf 100644 --- a/test/Modules/header-import.m +++ b/test/Modules/header-import.m @@ -1,8 +1,8 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -F %S/Inputs -I %S/Inputs -verify %s +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -F %S/Inputs -I %S/Inputs -verify %s // expected-no-diagnostics #import "point.h" -@__experimental_modules_import Module; +@import Module; #import "point.h" diff --git a/test/Modules/ignored_macros.m b/test/Modules/ignored_macros.m new file mode 100644 index 000000000000..e8ee50ace315 --- /dev/null +++ b/test/Modules/ignored_macros.m @@ -0,0 +1,49 @@ +// First trial: pass -DIGNORED=1 to both. This should obviously work. +// RUN: rm -rf %t.modules +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch %s -verify + +// Second trial: pass -DIGNORED=1 only to the second invocation. We +// should detect the failure. +// +// RUN: rm -rf %t.modules +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify +// RUN: not %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch %s > %t.err 2>&1 +// RUN: FileCheck -check-prefix=CHECK-CONFLICT %s < %t.err +// CHECK-CONFLICT: module 'ignored_macros' found in both + +// Third trial: pass -DIGNORED=1 only to the second invocation, but +// make it ignored. There should be no failure, IGNORED is defined in +// the translation unit but not the module. +// RUN: rm -rf %t.modules +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED %s -verify + +// Fourth trial: pass -DIGNORED=1 and -fmodules-ignore-macro=IGNORED +// to both invocations, so modules will be built without the IGNORED +// macro. +// RUN: rm -rf %t.modules +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules-ignore-macro=IGNORED -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED -DNO_IGNORED_ANYWHERE -fmodules-ignore-macro=NO_IGNORED_ANYWHERE %s -verify + +// Fifth trial: pass -DIGNORED=1 and -fmodules-ignore-macro=IGNORED=1 +// to both invocations, so modules will be built without the IGNORED +// macro. +// RUN: rm -rf %t.modules +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules-ignore-macro=IGNORED=1 -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch -fmodules-ignore-macro=IGNORED=1 -DNO_IGNORED_ANYWHERE -fmodules-ignore-macro=NO_IGNORED_ANYWHERE %s -verify + +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER +@import ignored_macros; +#endif + +@import ignored_macros; + +struct Point p; + +#ifdef NO_IGNORED_ANYWHERE +void *has_ignored(int, int, int); +#endif diff --git a/test/Modules/import-decl.cpp b/test/Modules/import-decl.cpp index 0f05f92708bc..900e090c0c5f 100644 --- a/test/Modules/import-decl.cpp +++ b/test/Modules/import-decl.cpp @@ -1,8 +1,8 @@ // RUN: rm -rf %t -// RUN: %clang -fmodule-cache-path %t -fmodules -x objective-c -I %S/Inputs -emit-ast -o %t.ast %s +// RUN: %clang -fmodules-cache-path=%t -fmodules -x objective-c -I %S/Inputs -emit-ast -o %t.ast %s // RUN: %clang_cc1 -ast-print -x ast - < %t.ast | FileCheck %s -@__experimental_modules_import import_decl; +@import import_decl; // CHECK: struct T int main() { diff --git a/test/Modules/inferred-frameworks.m b/test/Modules/inferred-frameworks.m index 916c900b6457..372e4f2a9250 100644 --- a/test/Modules/inferred-frameworks.m +++ b/test/Modules/inferred-frameworks.m @@ -1,8 +1,8 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify +// RUN: %clang_cc1 -x objective-c -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify #include <NotAModule/NotAModule.h> -@__experimental_modules_import NotAModule; // expected-error{{module 'NotAModule' not found}} +@import NotAModule; // expected-error{{module 'NotAModule' not found}} diff --git a/test/Modules/inferred-submodules.m b/test/Modules/inferred-submodules.m index 8c61bc081c2d..f801d04a0e78 100644 --- a/test/Modules/inferred-submodules.m +++ b/test/Modules/inferred-submodules.m @@ -1,14 +1,14 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify +// RUN: %clang_cc1 -x objective-c -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify // expected-no-diagnostics -@__experimental_modules_import Module.Sub; +@import Module.Sub; void test_Module_Sub() { int *ip = Module_Sub; } -@__experimental_modules_import Module.Buried.Treasure; +@import Module.Buried.Treasure; void dig() { unsigned *up = Buried_Treasure; diff --git a/test/Modules/irgen.c b/test/Modules/irgen.c index 4a080db5b2eb..9a7cf7eff08c 100644 --- a/test/Modules/irgen.c +++ b/test/Modules/irgen.c @@ -1,9 +1,9 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -emit-module -fmodule-name=irgen -triple x86_64-apple-darwin10 %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=irgen -triple x86_64-apple-darwin10 %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s // FIXME: When we have a syntax for modules in C, use that. -@__experimental_modules_import irgen; +@import irgen; // CHECK: define void @triple_value void triple_value(int *px) { diff --git a/test/Modules/linkage-merge.cpp b/test/Modules/linkage-merge.cpp new file mode 100644 index 000000000000..4e2ecef7d973 --- /dev/null +++ b/test/Modules/linkage-merge.cpp @@ -0,0 +1,13 @@ +// FIXME: we should be able to put these in the .h file :-( +// expected-note {{target of using declaration}} +// expected-note {{using declaration}} + +#include "linkage-merge-bar.h" + +static int f(int); +int f(int); + +static void g(int); // expected-error {{declaration conflicts with target of using declaration already in scope}} + +// RUN: rm -rf %t +// RUN: %clang_cc1 -verify -fmodules -fmodules-cache-path=%t -I %S/Inputs %s diff --git a/test/Modules/linkage-merge.m b/test/Modules/linkage-merge.m new file mode 100644 index 000000000000..16e220507831 --- /dev/null +++ b/test/Modules/linkage-merge.m @@ -0,0 +1,27 @@ +// In module: expected-note{{previous declaration}} + + + + +// In module: expected-note{{previous definition is here}} + +// Test redeclarations of functions where the original declaration is +// still hidden. + +@import linkage_merge_left; // excludes "sub" + +extern int f0(float); // expected-error{{conflicting types for 'f0'}} +static int f1(float); // okay: considered distinct +static int f2(float); // okay: considered distinct +extern int f3(float); // okay: considered distinct + +extern float v0; // expected-error{{redefinition of 'v0' with a different type: 'float' vs 'int'}} +static float v1; +static float v2; +extern float v3; + +typedef float T0; + +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=linkage_merge_left %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -w %s -verify diff --git a/test/Modules/load_failure.c b/test/Modules/load_failure.c index 3a963012b190..6f9426aa062b 100644 --- a/test/Modules/load_failure.c +++ b/test/Modules/load_failure.c @@ -1,17 +1,17 @@ #ifdef NONEXISTENT -@__experimental_modules_import load_nonexistent; +@import load_nonexistent; #endif #ifdef FAILURE -@__experimental_modules_import load_failure; +@import load_failure; #endif // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -fdisable-module-hash -emit-module -fmodule-name=load_failure %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -fdisable-module-hash %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s -// CHECK-NONEXISTENT: load_failure.c:2:32: fatal error: module 'load_nonexistent' not found +// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t -fdisable-module-hash -emit-module -fmodule-name=load_failure %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -fdisable-module-hash %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s +// CHECK-NONEXISTENT: load_failure.c:2:9: fatal error: module 'load_nonexistent' not found -// RUN: not %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -fdisable-module-hash %s -DFAILURE 2> %t.out +// RUN: not %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -fdisable-module-hash %s -DFAILURE 2> %t.out // RUN: FileCheck -check-prefix=CHECK-FAILURE %s < %t.out // FIXME: Clean up diagnostic text below and give it a location diff --git a/test/Modules/lookup.cpp b/test/Modules/lookup.cpp index 70d210750d94..002b6d15566e 100644 --- a/test/Modules/lookup.cpp +++ b/test/Modules/lookup.cpp @@ -1,8 +1,8 @@ -#define import @__experimental_modules_import +#define import @import import lookup_left_cxx; #undef import -#define IMPORT(X) @__experimental_modules_import X +#define IMPORT(X) @import X IMPORT(lookup_right_cxx); // in lookup_left.hpp: expected-warning@3 {{weak identifier 'weak_identifier' never declared}} @@ -24,10 +24,10 @@ void f() { } // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c++ -emit-module -fmodule-cache-path %t -fmodule-name=lookup_left_cxx %S/Inputs/module.map -verify -// RUN: %clang_cc1 -fmodules -x objective-c++ -emit-module -fmodule-cache-path %t -fmodule-name=lookup_right_cxx %S/Inputs/module.map -verify -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t %s -verify -// RUN: %clang_cc1 -fmodules -ast-print -x objective-c++ -fmodule-cache-path %t %s | FileCheck -check-prefix=CHECK-PRINT %s +// RUN: %clang_cc1 -fmodules -x objective-c++ -emit-module -fmodules-cache-path=%t -fmodule-name=lookup_left_cxx %S/Inputs/module.map -verify +// RUN: %clang_cc1 -fmodules -x objective-c++ -emit-module -fmodules-cache-path=%t -fmodule-name=lookup_right_cxx %S/Inputs/module.map -verify +// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t %s -verify +// RUN: %clang_cc1 -fmodules -ast-print -x objective-c++ -fmodules-cache-path=%t %s | FileCheck -check-prefix=CHECK-PRINT %s // FIXME: When we have a syntax for modules in C++, use that. // CHECK-PRINT: int *f0(int *); diff --git a/test/Modules/lookup.m b/test/Modules/lookup.m index c82503f79035..abe95420d4a5 100644 --- a/test/Modules/lookup.m +++ b/test/Modules/lookup.m @@ -1,18 +1,18 @@ // lookup_left.h: expected-note{{using}} // lookup_right.h: expected-note{{also found}} -@__experimental_modules_import lookup_left_objc; -@__experimental_modules_import lookup_right_objc; +@import lookup_left_objc; +@import lookup_right_objc; void test(id x) { [x method]; // expected-warning{{multiple methods named 'method' found}} } // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -emit-module -x objective-c -fmodule-name=lookup_left_objc %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -emit-module -x objective-c -fmodule-name=lookup_right_objc %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -verify %s -// RUN: %clang_cc1 -fmodules -ast-print -x objective-c -fmodule-cache-path %t %s | FileCheck -check-prefix=CHECK-PRINT %s +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_left_objc %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -emit-module -x objective-c -fmodule-name=lookup_right_objc %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -verify %s +// RUN: %clang_cc1 -fmodules -ast-print -x objective-c -fmodules-cache-path=%t %s | FileCheck -check-prefix=CHECK-PRINT %s // CHECK-PRINT: - (int) method; // CHECK-PRINT: - (double) method diff --git a/test/Modules/macros.c b/test/Modules/macros.c index 8db3915f24a9..fc448d998906 100644 --- a/test/Modules/macros.c +++ b/test/Modules/macros.c @@ -1,22 +1,22 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=macros_top %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=macros_left %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=macros_right %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=macros %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -verify -fmodule-cache-path %t %s -// RUN: %clang_cc1 -E -fmodules -x objective-c -fmodule-cache-path %t %s | FileCheck -check-prefix CHECK-PREPROCESSED %s +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=macros_top %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=macros_left %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=macros_right %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=macros %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -verify -fmodules-cache-path=%t %s +// RUN: %clang_cc1 -E -fmodules -x objective-c -fmodules-cache-path=%t %s | FileCheck -check-prefix CHECK-PREPROCESSED %s // FIXME: When we have a syntax for modules in C, use that. // These notes come from headers in modules, and are bogus. // FIXME: expected-note{{previous definition is here}} +// FIXME: expected-note{{previous definition is here}} expected-note{{expanding this definition of 'LEFT_RIGHT_DIFFERENT'}} +// expected-note{{other definition of 'TOP_RIGHT_REDEF'}} expected-note{{expanding this definition of 'LEFT_RIGHT_DIFFERENT2'}} // expected-note{{other definition of 'LEFT_RIGHT_DIFFERENT'}} -// expected-note{{expanding this definition of 'TOP_RIGHT_REDEF'}} -// FIXME: expected-note{{previous definition is here}} \ -// expected-note{{expanding this definition of 'LEFT_RIGHT_DIFFERENT'}} -// expected-note{{other definition of 'TOP_RIGHT_REDEF'}} -@__experimental_modules_import macros; +// expected-note{{expanding this definition of 'TOP_RIGHT_REDEF'}} + +@import macros; #ifndef INTEGER # error INTEGER macro should be visible @@ -65,7 +65,7 @@ void f() { #endif // Import left module (which also imports top) -@__experimental_modules_import macros_left; +@import macros_left; #ifndef LEFT # error LEFT should be visible @@ -79,8 +79,8 @@ void f() { # error TOP should be visible #endif -#ifdef TOP_LEFT_UNDEF -# error TOP_LEFT_UNDEF should not be visible +#ifndef TOP_LEFT_UNDEF +# error TOP_LEFT_UNDEF should still be defined #endif void test1() { @@ -88,10 +88,11 @@ void test1() { TOP_RIGHT_REDEF *ip = &i; } -#define LEFT_RIGHT_DIFFERENT2 double // FIXME: expected-warning{{'LEFT_RIGHT_DIFFERENT2' macro redefined}} +#define LEFT_RIGHT_DIFFERENT2 double // FIXME: expected-warning{{'LEFT_RIGHT_DIFFERENT2' macro redefined}} \ + // expected-note{{other definition of 'LEFT_RIGHT_DIFFERENT2'}} // Import right module (which also imports top) -@__experimental_modules_import macros_right; +@import macros_right; #undef LEFT_RIGHT_DIFFERENT3 @@ -111,11 +112,11 @@ void test2() { int i; float f; double d; - TOP_RIGHT_REDEF *ip = &i; // expected-warning{{ambiguous expansion of macro 'TOP_RIGHT_REDEF'}} + TOP_RIGHT_REDEF *fp = &f; // expected-warning{{ambiguous expansion of macro 'TOP_RIGHT_REDEF'}} - LEFT_RIGHT_IDENTICAL *ip2 = &i; - LEFT_RIGHT_DIFFERENT *fp = &f; // expected-warning{{ambiguous expansion of macro 'LEFT_RIGHT_DIFFERENT'}} - LEFT_RIGHT_DIFFERENT2 *dp = &d; + LEFT_RIGHT_IDENTICAL *ip = &i; + LEFT_RIGHT_DIFFERENT *ip2 = &i; // expected-warning{{ambiguous expansion of macro 'LEFT_RIGHT_DIFFERENT'}} + LEFT_RIGHT_DIFFERENT2 *ip3 = &i; // expected-warning{{ambiguous expansion of macro 'LEFT_RIGHT_DIFFERENT2}} int LEFT_RIGHT_DIFFERENT3; } @@ -124,14 +125,15 @@ void test2() { void test3() { double d; LEFT_RIGHT_DIFFERENT *dp = &d; // okay + int x = FN_ADD(1,2); } #ifndef TOP_RIGHT_UNDEF # error TOP_RIGHT_UNDEF should still be defined #endif -@__experimental_modules_import macros_right.undef; +@import macros_right.undef; -#ifdef TOP_RIGHT_UNDEF -# error TOP_RIGHT_UNDEF should not be defined +#ifndef TOP_RIGHT_UNDEF +# error TOP_RIGHT_UNDEF should still be defined #endif diff --git a/test/Modules/method_pool.m b/test/Modules/method_pool.m index 25582caec3a3..9a8897b38302 100644 --- a/test/Modules/method_pool.m +++ b/test/Modules/method_pool.m @@ -1,15 +1,15 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -I %S/Inputs %s -verify +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -I %S/Inputs %s -verify -@__experimental_modules_import MethodPoolA; +@import MethodPoolA; -// in other file: // expected-note{{using}} +@interface D +- (void)method5:(D*)obj; +@end - - - -// in other file: expected-note{{also found}} +// in other file: // expected-note@7{{using}} +// in other file: expected-note@12{{also found}} void testMethod1(id object) { [object method1]; @@ -19,7 +19,15 @@ void testMethod2(id object) { [object method2:1]; } -@__experimental_modules_import MethodPoolB; +void testMethod4(id object) { + [object method4]; // expected-warning{{instance method '-method4' not found (return type defaults to 'id')}} +} + +void testMethod5(id object, D* d) { + [object method5:d]; +} + +@import MethodPoolB; void testMethod1Again(id object) { [object method1]; @@ -28,3 +36,29 @@ void testMethod1Again(id object) { void testMethod2Again(id object) { [object method2:1]; // expected-warning{{multiple methods named 'method2:' found}} } + +void testMethod3(id object) { + [object method3]; // expected-warning{{instance method '-method3' not found (return type defaults to 'id')}} +} + +@import MethodPoolB.Sub; + +void testMethod3Again(id object) { + char *str = [object method3]; // okay: only found in MethodPoolB.Sub +} + +@import MethodPoolA.Sub; + +void testMethod3AgainAgain(id object) { + [object method3]; // expected-warning{{multiple methods named 'method3' found}} + // expected-note@2{{using}} + // expected-note@2{{also found}} +} + +void testMethod4Again(id object) { + [object method4]; +} + +void testMethod5Again(id object, D* d) { + [object method5:d]; +} diff --git a/test/Modules/modify-module.m b/test/Modules/modify-module.m index b630ac105874..953c917cddcc 100644 --- a/test/Modules/modify-module.m +++ b/test/Modules/modify-module.m @@ -6,14 +6,22 @@ // RUN: cp %S/Inputs/Modified/A.h %t/include // RUN: cp %S/Inputs/Modified/B.h %t/include // RUN: cp %S/Inputs/Modified/module.map %t/include -// RUN: %clang_cc1 -fmodule-cache-path %t/cache -fmodules -I %t/include %s -verify -// expected-no-diagnostics -// RUN: touch %t/include/B.h -// RUN: %clang_cc1 -fmodule-cache-path %t/cache -fmodules -I %t/include %s -verify +// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify +// RUN: echo '' >> %t/include/B.h +// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify // RUN: echo 'int getA(); int getA2();' > %t/include/A.h -// RUN: %clang_cc1 -fmodule-cache-path %t/cache -fmodules -I %t/include %s -verify +// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify +// RUN: rm %t/cache/ModA.pcm +// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify +// RUN: touch %t/cache/ModA.pcm +// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/cache -fmodules -I %t/include %s -verify + +// expected-no-diagnostics + +// FIXME: It is intended to suppress this on win32. +// REQUIRES: ansi-escape-sequences -@__experimental_modules_import B; +@import ModB; int getValue() { return getA() + getB(); } diff --git a/test/Modules/module-private.cpp b/test/Modules/module-private.cpp index 31a3410a03f8..d4e73b53968b 100644 --- a/test/Modules/module-private.cpp +++ b/test/Modules/module-private.cpp @@ -1,11 +1,11 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -fmodule-name=module_private_left -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -fmodule-name=module_private_right -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t %s -verify +// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t -fmodule-name=module_private_left -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t -fmodule-name=module_private_right -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t %s -verify // FIXME: When we have a syntax for modules in C++, use that. -@__experimental_modules_import module_private_left; -@__experimental_modules_import module_private_right; +@import module_private_left; +@import module_private_right; void test() { int &ir = f0(1.0); // okay: f0() from 'right' is not visible diff --git a/test/Modules/module_file_info.m b/test/Modules/module_file_info.m new file mode 100644 index 000000000000..09319d60fe80 --- /dev/null +++ b/test/Modules/module_file_info.m @@ -0,0 +1,34 @@ + +@import DependsOnModule; + +// RUN: rm -rf %t +// RUN: %clang_cc1 -w -fmodules -fdisable-module-hash -fmodules-cache-path=%t -F %S/Inputs -DBLARG -DWIBBLE=WOBBLE %s +// RUN: %clang_cc1 -module-file-info %t/DependsOnModule.pcm | FileCheck %s + +// CHECK: Generated by this Clang: + +// CHECK: Language options: +// CHECK: C99: Yes +// CHECK: Objective-C 1: Yes +// CHECK: modules extension to C: Yes + +// CHECK: Target options: +// CHECK: Triple: +// CHECK: CPU: +// CHECK: ABI: +// CHECK: C++ ABI: +// CHECK: Linker version: + +// CHECK: Header search options: +// CHECK: System root [-isysroot=]: '/' +// CHECK: Use builtin include directories [-nobuiltininc]: Yes +// CHECK: Use standard system include directories [-nostdinc]: Yes +// CHECK: Use standard C++ include directories [-nostdinc++]: Yes +// CHECK: Use libc++ (rather than libstdc++) [-stdlib=]: + +// CHECK: Preprocessor options: +// CHECK: Uses compiler/target-specific predefines [-undef]: Yes +// CHECK: Uses detailed preprocessing record (for indexing): No +// CHECK: Predefined macros: +// CHECK: -DBLARG +// CHECK: -DWIBBLE=WOBBLE diff --git a/test/Modules/namespaces.cpp b/test/Modules/namespaces.cpp index 19e0c5a991f9..0e9dbffcbb9e 100644 --- a/test/Modules/namespaces.cpp +++ b/test/Modules/namespaces.cpp @@ -1,9 +1,8 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodule-cache-path %t -I %S/Inputs %s -verify +// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -// Importing modules which add declarations to a pre-existing non-imported -// overload set does not currently work. -// XFAIL: * +int &global(int); +int &global2(int); namespace N6 { char &f(char); @@ -11,17 +10,32 @@ namespace N6 { namespace N8 { } -@__experimental_modules_import namespaces_left; -@__experimental_modules_import namespaces_right; +namespace LookupBeforeImport { + int &f(int); +} +void testEarly() { + int &r = LookupBeforeImport::f(1); +} + +@import namespaces_left; +@import namespaces_right; void test() { int &ir1 = N1::f(1); int &ir2 = N2::f(1); int &ir3 = N3::f(1); + int &ir4 = global(1); + int &ir5 = ::global2(1); float &fr1 = N1::f(1.0f); float &fr2 = N2::f(1.0f); + float &fr3 = global(1.0f); + float &fr4 = ::global2(1.0f); + float &fr5 = LookupBeforeImport::f(1.0f); double &dr1 = N2::f(1.0); double &dr2 = N3::f(1.0); + double &dr3 = global(1.0); + double &dr4 = ::global2(1.0); + double &dr5 = LookupBeforeImport::f(1.0); } // Test namespaces merged without a common first declaration. @@ -54,11 +68,10 @@ void testMergedMerged() { // Test merging when using anonymous namespaces, which does not // actually perform any merging. -// other file: expected-note{{passing argument to parameter here}} void testAnonymousNotMerged() { N11::consumeFoo(N11::getFoo()); // expected-error{{cannot initialize a parameter of type 'N11::<anonymous>::Foo *' with an rvalue of type 'N11::<anonymous>::Foo *'}} N12::consumeFoo(N12::getFoo()); // expected-error{{cannot initialize a parameter of type 'N12::<anonymous>::Foo *' with an rvalue of type 'N12::<anonymous>::Foo *'}} } - -// other file: expected-note{{passing argument to parameter here}} +// namespaces-right.h: expected-note@60 {{passing argument to parameter here}} +// namespaces-right.h: expected-note@67 {{passing argument to parameter here}} diff --git a/test/Modules/normal-module-map.cpp b/test/Modules/normal-module-map.cpp index 07ca5ed9330a..423e808bcabf 100644 --- a/test/Modules/normal-module-map.cpp +++ b/test/Modules/normal-module-map.cpp @@ -1,14 +1,14 @@ // Note: inside the module. expected-note{{'nested_umbrella_a' declared here}} // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c -fmodule-cache-path %t -fmodules -I %S/Inputs/normal-module-map %s -verify +// RUN: %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -I %S/Inputs/normal-module-map %s -verify #include "Umbrella/umbrella_sub.h" int getUmbrella() { return umbrella + umbrella_sub; } -@__experimental_modules_import Umbrella2; +@import Umbrella2; #include "a1.h" #include "b1.h" @@ -18,7 +18,7 @@ int test() { return a1 + b1 + nested2; } -@__experimental_modules_import nested_umbrella.a; +@import nested_umbrella.a; int testNestedUmbrellaA() { return nested_umbrella_a; @@ -28,17 +28,17 @@ int testNestedUmbrellaBFail() { return nested_umbrella_b; // expected-error{{use of undeclared identifier 'nested_umbrella_b'; did you mean 'nested_umbrella_a'?}} } -@__experimental_modules_import nested_umbrella.b; +@import nested_umbrella.b; int testNestedUmbrellaB() { return nested_umbrella_b; } -@__experimental_modules_import nested_umbrella.a_extras; +@import nested_umbrella.a_extras; -@__experimental_modules_import nested_umbrella._1; +@import nested_umbrella._1; -@__experimental_modules_import nested_umbrella.decltype_; +@import nested_umbrella.decltype_; int testSanitizedName() { return extra_a + one + decltype_val; diff --git a/test/Modules/objc-categories.m b/test/Modules/objc-categories.m index b26759239dda..d3ebcb752790 100644 --- a/test/Modules/objc-categories.m +++ b/test/Modules/objc-categories.m @@ -1,12 +1,12 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_top -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_left -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_right -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_bottom -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -x objective-c -fmodule-name=category_other -emit-module %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t %s -verify +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x objective-c -fmodule-name=category_top -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x objective-c -fmodule-name=category_left -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x objective-c -fmodule-name=category_right -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x objective-c -fmodule-name=category_bottom -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x objective-c -fmodule-name=category_other -emit-module %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t %s -verify -@__experimental_modules_import category_bottom; +@import category_bottom; @@ -34,8 +34,64 @@ void test(Foo *foo, LeftFoo *leftFoo) { // Load another module that also adds categories to Foo, verify that // we see those categories. -@__experimental_modules_import category_other; +@import category_other; void test_other(Foo *foo) { [foo other]; } + +// Make sure we don't see categories that should be hidden +void test_hidden_all_errors(Foo *foo) { + [foo left_sub]; // expected-warning{{instance method '-left_sub' not found (return type defaults to 'id')}} + foo.right_sub_prop = foo; // expected-error{{property 'right_sub_prop' not found on object of type 'Foo *'}} + int i = foo->right_sub_ivar; // expected-error{{'Foo' does not have a member named 'right_sub_ivar'}} + id<P1> p1 = foo; // expected-warning{{initializing 'id<P1>' with an expression of incompatible type 'Foo *'}} + id<P2> p2 = foo; // expected-warning{{initializing 'id<P2>' with an expression of incompatible type 'Foo *'}} + id<P3> p3; + [p3 p3_method]; // expected-warning{{instance method '-p3_method' not found (return type defaults to 'id')}} + id<P4> p4; + [p4 p4_method]; // expected-warning{{instance method '-p4_method' not found (return type defaults to 'id')}} + id p3p = p3.p3_prop; // expected-error{{property 'p3_prop' not found on object of type 'id<P3>'}} + p3p = foo.p3_prop; // expected-error{{property 'p3_prop' not found on object of type 'Foo *'}} + id p4p = p4.p4_prop; // expected-error{{property 'p4_prop' not found on object of type 'id<P4>'}} + p4p = foo.p4_prop; // expected-error{{property 'p4_prop' not found on object of type 'Foo *'}} +} + +@import category_left.sub; + +void test_hidden_right_errors(Foo *foo) { + // These are okay + [foo left_sub]; // okay + id<P1> p1 = foo; + id<P3> p3; + [p3 p3_method]; + id p3p = p3.p3_prop; + p3p = foo.p3_prop; + // These should fail + foo.right_sub_prop = foo; // expected-error{{property 'right_sub_prop' not found on object of type 'Foo *'}} + int i = foo->right_sub_ivar; // expected-error{{'Foo' does not have a member named 'right_sub_ivar'}} + id<P2> p2 = foo; // expected-warning{{initializing 'id<P2>' with an expression of incompatible type 'Foo *'}} + id<P4> p4; + [p4 p4_method]; // expected-warning{{instance method '-p4_method' not found (return type defaults to 'id')}} + id p4p = p4.p4_prop; // expected-error{{property 'p4_prop' not found on object of type 'id<P4>'}} + p4p = foo.p4_prop; // expected-error{{property 'p4_prop' not found on object of type 'Foo *'; did you mean 'p3_prop'?}} + // expected-note@7{{'p3_prop' declared here}} +} + +@import category_right.sub; + +void test_hidden_okay(Foo *foo) { + [foo left_sub]; + foo.right_sub_prop = foo; + int i = foo->right_sub_ivar; + id<P1> p1 = foo; + id<P2> p2 = foo; + id<P3> p3; + [p3 p3_method]; + id<P4> p4; + [p4 p4_method]; + id p3p = p3.p3_prop; + p3p = foo.p3_prop; + id p4p = p4.p4_prop; + p4p = foo.p4_prop; +} diff --git a/test/Modules/objc_redef.m b/test/Modules/objc_redef.m new file mode 100644 index 000000000000..f91124172f76 --- /dev/null +++ b/test/Modules/objc_redef.m @@ -0,0 +1,13 @@ +@import redeclarations_left; +@import weird_objc; + +int test(id x) { + return x->wibble; +} + +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=redeclarations_left %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=weird_objc %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t %s -verify +// expected-no-diagnostics + diff --git a/test/Modules/on-demand-build-warnings.m b/test/Modules/on-demand-build-warnings.m deleted file mode 100644 index 24975c01b781..000000000000 --- a/test/Modules/on-demand-build-warnings.m +++ /dev/null @@ -1,5 +0,0 @@ -// RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Wmodule-build -fmodule-cache-path %t -F %S/Inputs -verify %s - -@__experimental_modules_import Module; // expected-warning{{building module 'Module' from source}} - diff --git a/test/Modules/on-demand-build.m b/test/Modules/on-demand-build.m index 4ee6b58d96b4..31742f7e03a2 100644 --- a/test/Modules/on-demand-build.m +++ b/test/Modules/on-demand-build.m @@ -1,9 +1,9 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -fmodule-cache-path %t -F %S/Inputs -I %S/Inputs -verify %s -// RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -x objective-c++ -fmodule-cache-path %t -F %S/Inputs -I %S/Inputs -verify %s -// RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -fmodule-cache-path %t -F %S/Inputs -I %S/Inputs -verify %s +// RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -fmodules-cache-path=%t -F %S/Inputs -I %S/Inputs -verify %s +// RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -x objective-c++ -fmodules-cache-path=%t -F %S/Inputs -I %S/Inputs -verify %s +// RUN: %clang_cc1 -fmodules -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -fmodules-cache-path=%t -F %S/Inputs -I %S/Inputs -verify %s #define FOO -@__experimental_modules_import Module; +@import Module; @interface OtherClass @end @@ -19,6 +19,6 @@ void test_getModuleVersion() { # error MODULE_SUBFRAMEWORK_H should be hidden #endif -@__experimental_modules_import subdir; +@import subdir; const char *getSubdirTest() { return getSubdir(); } diff --git a/test/Modules/on-demand-macros.m b/test/Modules/on-demand-macros.m index 8b50529f1a28..3c16fa7055f8 100644 --- a/test/Modules/on-demand-macros.m +++ b/test/Modules/on-demand-macros.m @@ -1,9 +1,9 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -F %S/Inputs -DFOO_RETURNS_INT_PTR -verify %s -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -F %S/Inputs -verify %s +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -F %S/Inputs -DFOO_RETURNS_INT_PTR -verify %s +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -F %S/Inputs -verify %s // expected-no-diagnostics -@__experimental_modules_import CmdLine; +@import CmdLine; void test() { #ifdef FOO_RETURNS_INT_PTR diff --git a/test/Modules/prune.m b/test/Modules/prune.m new file mode 100644 index 000000000000..8af7e6c395ae --- /dev/null +++ b/test/Modules/prune.m @@ -0,0 +1,46 @@ +// Test the automatic pruning of module cache entries. +#ifdef IMPORT_DEPENDS_ON_MODULE +@import DependsOnModule; +#else +@import Module; +#endif + +// We need 'touch' and 'find' for this test to work. +// REQUIRES: shell + +// Clear out the module cache +// RUN: rm -rf %t +// Run Clang twice so we end up creating the timestamp file (the second time). +// RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -F %S/Inputs -fmodules-cache-path=%t %s -verify +// RUN: %clang_cc1 -DIMPORT_DEPENDS_ON_MODULE -fmodules-ignore-macro=DIMPORT_DEPENDS_ON_MODULE -fmodules -F %S/Inputs -fmodules-cache-path=%t %s -verify +// RUN: ls %t | grep modules.timestamp +// RUN: ls -R %t | grep ^Module.pcm +// RUN: ls -R %t | grep DependsOnModule.pcm + +// Set the timestamp back more than two days. We should try to prune, +// but nothing gets pruned because the module files are new enough. +// RUN: touch -m -a -t 201101010000 %t/modules.timestamp +// RUN: %clang_cc1 -fmodules -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify +// RUN: ls %t | grep modules.timestamp +// RUN: ls -R %t | grep ^Module.pcm +// RUN: ls -R %t | grep DependsOnModule.pcm + +// Set the DependsOnModule access time back more than four days. +// This shouldn't prune anything, because the timestamp has been updated, so +// the pruning mechanism won't fire. +// RUN: find %t -name DependsOnModule.pcm | xargs touch -a -t 201101010000 +// RUN: %clang_cc1 -fmodules -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify +// RUN: ls %t | grep modules.timestamp +// RUN: ls -R %t | grep ^Module.pcm +// RUN: ls -R %t | grep DependsOnModule.pcm + +// Set both timestamp and DependsOnModule.pcm back beyond the cutoff. +// This should trigger pruning, which will remove DependsOnModule but not Module. +// RUN: touch -m -a -t 201101010000 %t/modules.timestamp +// RUN: find %t -name DependsOnModule.pcm | xargs touch -a -t 201101010000 +// RUN: %clang_cc1 -fmodules -F %S/Inputs -fmodules-cache-path=%t -fmodules -fmodules-prune-interval=172800 -fmodules-prune-after=345600 %s -verify +// RUN: ls %t | grep modules.timestamp +// RUN: ls -R %t | grep ^Module.pcm +// RUN: ls -R %t | not grep DependsOnModule.pcm + +// expected-no-diagnostics diff --git a/test/Modules/redecl-merge.m b/test/Modules/redecl-merge.m index d7224149a282..e37366748d04 100644 --- a/test/Modules/redecl-merge.m +++ b/test/Modules/redecl-merge.m @@ -1,14 +1,35 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -I %S/Inputs %s -verify -Wno-objc-root-class +// RUN: %clang_cc1 -fmodules -Wreturn-type -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class + @class C2; @class C3; @class C3; -@__experimental_modules_import redecl_merge_left; +@import redecl_merge_left; typedef struct my_struct_type *my_struct_ref; @protocol P4; @class C3; @class C3; -@__experimental_modules_import redecl_merge_right; + +int *call_eventually_noreturn(void) { + eventually_noreturn(); +} // expected-warning{{control reaches end of non-void function}} + +int *call_eventually_noreturn2(void) { + eventually_noreturn2(); +} // expected-warning{{control reaches end of non-void function}} + +@import redecl_merge_right; + +int *call_eventually_noreturn_again(void) { + eventually_noreturn(); +} + +int *call_eventually_noreturn2_again(void) { + // noreturn and non-noreturn functions have different types + eventually_noreturn2(); // expected-error{{call to 'eventually_noreturn2' is ambiguous}} + // expected-note@93{{candidate function}} + // expected-note@90{{candidate function}} +} @implementation A - (Super*)init { return self; } @@ -112,7 +133,7 @@ C4 *global_C4; ClassWithDef *cwd1; -@__experimental_modules_import redecl_merge_left_left; +@import redecl_merge_left_left; void test_C4a(C4 *c4) { global_C4 = c4 = get_a_C4(); @@ -123,7 +144,7 @@ void test_ClassWithDef(ClassWithDef *cwd) { [cwd method]; } -@__experimental_modules_import redecl_merge_bottom; +@import redecl_merge_bottom; void test_C4b() { if (&refers_to_C4) { @@ -148,3 +169,5 @@ id<P3> p3; // Make sure we don't get conflicts with 'id'. funcptr_with_id fid; id id_global; + + diff --git a/test/Modules/redecl-merge2.m b/test/Modules/redecl-merge2.m new file mode 100644 index 000000000000..3431ecc90b39 --- /dev/null +++ b/test/Modules/redecl-merge2.m @@ -0,0 +1,8 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class +// expected-no-diagnostics + +@import redecl_merge_bottom.prefix; + +DeclaredThenLoaded *dtl; + diff --git a/test/Modules/redecl-namespaces.mm b/test/Modules/redecl-namespaces.mm index e33882156482..93102c04bc3a 100644 --- a/test/Modules/redecl-namespaces.mm +++ b/test/Modules/redecl-namespaces.mm @@ -1,5 +1,5 @@ -@__experimental_modules_import redecl_namespaces_left; -@__experimental_modules_import redecl_namespaces_right; +@import redecl_namespaces_left; +@import redecl_namespaces_right; void test() { A::i; @@ -8,6 +8,6 @@ void test() { } // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -emit-module -fmodule-name=redecl_namespaces_left %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -emit-module -fmodule-name=redecl_namespaces_right %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -w %s -verify +// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t -emit-module -fmodule-name=redecl_namespaces_left %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodules-cache-path=%t -emit-module -fmodule-name=redecl_namespaces_right %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -w %s -verify diff --git a/test/Modules/redeclarations.m b/test/Modules/redeclarations.m index 221e154cb274..f210f37f3ab8 100644 --- a/test/Modules/redeclarations.m +++ b/test/Modules/redeclarations.m @@ -1,12 +1,12 @@ -@__experimental_modules_import redeclarations_left; -@__experimental_modules_import redeclarations_right; +@import redeclarations_left; +@import redeclarations_right; @interface MyObject : NSObject @end // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -emit-module -fmodule-name=redeclarations_left %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -emit-module -fmodule-name=redeclarations_right %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t %s -verify +// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=redeclarations_left %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=redeclarations_right %S/Inputs/module.map +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t %s -verify // expected-no-diagnostics diff --git a/test/Modules/renamed.m b/test/Modules/renamed.m new file mode 100644 index 000000000000..4e8f5329bb0f --- /dev/null +++ b/test/Modules/renamed.m @@ -0,0 +1,8 @@ +@import NewName; + +int f() { return same_api; } + +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -I %S/Inputs -fmodules-cache-path=%t %s -verify + +// expected-no-diagnostics diff --git a/test/Modules/requires.m b/test/Modules/requires.m index ce2537c78b73..83b524d3935b 100644 --- a/test/Modules/requires.m +++ b/test/Modules/requires.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify -@__experimental_modules_import DependsOnModule.CXX; // expected-error{{module 'DependsOnModule.CXX' requires feature 'cplusplus'}} +@import DependsOnModule.CXX; // expected-error{{module 'DependsOnModule.CXX' requires feature 'cplusplus'}} diff --git a/test/Modules/stddef.m b/test/Modules/stddef.m new file mode 100644 index 000000000000..83f73f9d33ab --- /dev/null +++ b/test/Modules/stddef.m @@ -0,0 +1,7 @@ +@import StdDef.Other; + +size_t getSize(); + +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/StdDef %s -verify +// expected-no-diagnostics diff --git a/test/Modules/subframeworks.m b/test/Modules/subframeworks.m index 09298c493958..22dfcca3657a 100644 --- a/test/Modules/subframeworks.m +++ b/test/Modules/subframeworks.m @@ -1,14 +1,14 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify -// RUN: %clang_cc1 -x objective-c++ -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify +// RUN: %clang_cc1 -x objective-c++ -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify -@__experimental_modules_import DependsOnModule; +@import DependsOnModule; void testSubFramework() { float *sf1 = sub_framework; // expected-error{{use of undeclared identifier 'sub_framework'}} } -@__experimental_modules_import DependsOnModule.SubFramework; +@import DependsOnModule.SubFramework; void testSubFrameworkAgain() { float *sf2 = sub_framework; @@ -16,7 +16,14 @@ void testSubFrameworkAgain() { } #ifdef __cplusplus -@__experimental_modules_import DependsOnModule.CXX; +@import DependsOnModule.CXX; CXXOnly cxxonly; #endif + +@import HasSubModules; + +// expected-warning@1{{treating #include as an import of module 'HasSubModules.Sub.Types'}} +#import <HasSubModules/HasSubModulesPriv.h> + +struct FrameworkSubStruct ss; diff --git a/test/Modules/submodules-preprocess.cpp b/test/Modules/submodules-preprocess.cpp index 8d6c2cd70d84..7040b5111b76 100644 --- a/test/Modules/submodules-preprocess.cpp +++ b/test/Modules/submodules-preprocess.cpp @@ -1,8 +1,8 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -x objective-c++ -Eonly -fmodule-cache-path %t -I %S/Inputs/submodules %s -verify +// RUN: %clang_cc1 -fmodules -x objective-c++ -Eonly -fmodules-cache-path=%t -I %S/Inputs/submodules %s -verify // FIXME: When we have a syntax for modules in C++, use that. -@__experimental_modules_import std.vector; +@import std.vector; #ifndef HAVE_VECTOR # error HAVE_VECTOR macro is not available (but should be) @@ -16,7 +16,7 @@ # error HAVE_HASH_MAP macro is available (but shouldn't be) #endif -@__experimental_modules_import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}} +@import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}} #ifndef HAVE_VECTOR # error HAVE_VECTOR macro is not available (but should be) @@ -30,9 +30,9 @@ # error HAVE_HASH_MAP macro is available (but shouldn't be) #endif -@__experimental_modules_import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}} +@import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}} -@__experimental_modules_import std; // import everything in 'std' +@import std; // import everything in 'std' #ifndef HAVE_VECTOR # error HAVE_VECTOR macro is not available (but should be) @@ -46,7 +46,7 @@ # error HAVE_HASH_MAP macro is available (but shouldn't be) #endif -@__experimental_modules_import std.hash_map; +@import std.hash_map; #ifndef HAVE_VECTOR # error HAVE_VECTOR macro is not available (but should be) diff --git a/test/Modules/submodules.cpp b/test/Modules/submodules.cpp index 60d5ae0c22f4..1b4f5d886e3b 100644 --- a/test/Modules/submodules.cpp +++ b/test/Modules/submodules.cpp @@ -1,8 +1,8 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodule-cache-path %t -fmodules -I %S/Inputs/submodules %s -verify +// RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules %s -verify // FIXME: When we have a syntax for modules in C++, use that. -@__experimental_modules_import std.vector; +@import std.vector; vector<int> vi; @@ -10,20 +10,20 @@ vector<int> vi; remove_reference<int&>::type *int_ptr = 0; // expected-error{{unknown type name 'remove_reference'}} \ // expected-error{{expected unqualified-id}} -@__experimental_modules_import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}} +@import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}} vector<float> vf; remove_reference<int&>::type *int_ptr2 = 0; -@__experimental_modules_import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}} +@import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}} -@__experimental_modules_import std; // import everything in 'std' +@import std; // import everything in 'std' // hash_map still isn't available. hash_map<int, float> ints_to_floats; // expected-error{{unknown type name 'hash_map'}} \ // expected-error{{expected unqualified-id}} -@__experimental_modules_import std.hash_map; +@import std.hash_map; hash_map<int, float> ints_to_floats2; diff --git a/test/Modules/submodules.m b/test/Modules/submodules.m index a758abc248dd..7187e75f0dc5 100644 --- a/test/Modules/submodules.m +++ b/test/Modules/submodules.m @@ -1,10 +1,10 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify +// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -F %S/Inputs %s -verify // expected-no-diagnostics // Note: transitively imports Module.Sub2. -@__experimental_modules_import Module.Sub; +@import Module.Sub; int getValue() { return *Module_Sub + *Module_Sub2; diff --git a/test/Modules/templates.mm b/test/Modules/templates.mm index 45417401d86f..1fef967e400f 100644 --- a/test/Modules/templates.mm +++ b/test/Modules/templates.mm @@ -1,10 +1,10 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodule-cache-path %t -I %S/Inputs -verify %s -Wno-objc-root-class -// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodule-cache-path %t -I %S/Inputs -emit-llvm %s -o - -Wno-objc-root-class | grep Emit | FileCheck %s +// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs -verify %s -Wno-objc-root-class +// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs -emit-llvm %s -o - -Wno-objc-root-class | grep Emit | FileCheck %s // expected-no-diagnostics -@__experimental_modules_import templates_left; -@__experimental_modules_import templates_right; +@import templates_left; +@import templates_right; void testTemplateClasses() { diff --git a/test/Modules/wildcard-submodule-exports.cpp b/test/Modules/wildcard-submodule-exports.cpp index 6b4f02c6f236..f377dbecde86 100644 --- a/test/Modules/wildcard-submodule-exports.cpp +++ b/test/Modules/wildcard-submodule-exports.cpp @@ -1,8 +1,8 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -x objective-c++ -fmodule-cache-path %t -fmodules -I %S/Inputs/wildcard-submodule-exports %s -verify +// RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -I %S/Inputs/wildcard-submodule-exports %s -verify // FIXME: When we have a syntax for modules in C++, use that. -@__experimental_modules_import C.One; +@import C.One; void test_C_One() { int *A1_ptr = A1; @@ -10,7 +10,7 @@ void test_C_One() { (void)B1; // expected-error{{use of undeclared identifier 'B1'}} } -@__experimental_modules_import C.Two; +@import C.Two; void test_C_Two() { unsigned int *A2_ptr = A2; @@ -18,7 +18,7 @@ void test_C_Two() { unsigned long *C2_ptr = C2; } -@__experimental_modules_import B.One; +@import B.One; void test_B_One() { short *B1_ptr = B1; |