diff options
Diffstat (limited to 'clang/test/Modules/Inputs')
98 files changed, 914 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h b/clang/test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h new file mode 100644 index 0000000..1417e0c --- /dev/null +++ b/clang/test/Modules/Inputs/AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h @@ -0,0 +1,2 @@ +#import <Module/Module.h> // expected-warning{{treating #import as an import of module 'Module'}} + diff --git a/clang/test/Modules/Inputs/CmdLine.framework/Headers/CmdLine.h b/clang/test/Modules/Inputs/CmdLine.framework/Headers/CmdLine.h new file mode 100644 index 0000000..46b8fc0 --- /dev/null +++ b/clang/test/Modules/Inputs/CmdLine.framework/Headers/CmdLine.h @@ -0,0 +1,6 @@ +#ifdef FOO_RETURNS_INT_PTR +int *foo(void); +#else +float *foo(void); +#endif + diff --git a/clang/test/Modules/Inputs/DependsOnModule.framework/Frameworks/SubFramework.framework/Headers/Other.h b/clang/test/Modules/Inputs/DependsOnModule.framework/Frameworks/SubFramework.framework/Headers/Other.h new file mode 100644 index 0000000..69f9e8e --- /dev/null +++ b/clang/test/Modules/Inputs/DependsOnModule.framework/Frameworks/SubFramework.framework/Headers/Other.h @@ -0,0 +1 @@ +double *sub_framework_other; diff --git a/clang/test/Modules/Inputs/DependsOnModule.framework/Frameworks/SubFramework.framework/Headers/SubFramework.h b/clang/test/Modules/Inputs/DependsOnModule.framework/Frameworks/SubFramework.framework/Headers/SubFramework.h new file mode 100644 index 0000000..e6e835e --- /dev/null +++ b/clang/test/Modules/Inputs/DependsOnModule.framework/Frameworks/SubFramework.framework/Headers/SubFramework.h @@ -0,0 +1,2 @@ +#include "SubFramework/Other.h" +float *sub_framework; diff --git a/clang/test/Modules/Inputs/DependsOnModule.framework/Headers/DependsOnModule.h b/clang/test/Modules/Inputs/DependsOnModule.framework/Headers/DependsOnModule.h new file mode 100644 index 0000000..9425f48 --- /dev/null +++ b/clang/test/Modules/Inputs/DependsOnModule.framework/Headers/DependsOnModule.h @@ -0,0 +1,5 @@ +#include <Module/Module.h> //expected-warning{{treating #include as an import of module 'Module'}} + +#define DEPENDS_ON_MODULE 1 +#__private_macro DEPENDS_ON_MODULE + diff --git a/clang/test/Modules/Inputs/DependsOnModule.framework/Headers/cxx_other.h b/clang/test/Modules/Inputs/DependsOnModule.framework/Headers/cxx_other.h new file mode 100644 index 0000000..724d798 --- /dev/null +++ b/clang/test/Modules/Inputs/DependsOnModule.framework/Headers/cxx_other.h @@ -0,0 +1,5 @@ +class CXXOnly { + public: + CXXOnly(); + ~CXXOnly(); +}; diff --git a/clang/test/Modules/Inputs/DependsOnModule.framework/Headers/other.h b/clang/test/Modules/Inputs/DependsOnModule.framework/Headers/other.h new file mode 100644 index 0000000..5ee3f92 --- /dev/null +++ b/clang/test/Modules/Inputs/DependsOnModule.framework/Headers/other.h @@ -0,0 +1 @@ +int depends_on_module_other; diff --git a/clang/test/Modules/Inputs/DependsOnModule.framework/PrivateHeaders/DependsOnModulePrivate.h b/clang/test/Modules/Inputs/DependsOnModule.framework/PrivateHeaders/DependsOnModulePrivate.h new file mode 100644 index 0000000..4b3c30c --- /dev/null +++ b/clang/test/Modules/Inputs/DependsOnModule.framework/PrivateHeaders/DependsOnModulePrivate.h @@ -0,0 +1,2 @@ +int depends_on_module_private; + diff --git a/clang/test/Modules/Inputs/DependsOnModule.framework/module.map b/clang/test/Modules/Inputs/DependsOnModule.framework/module.map new file mode 100644 index 0000000..2a3dd80 --- /dev/null +++ b/clang/test/Modules/Inputs/DependsOnModule.framework/module.map @@ -0,0 +1,19 @@ +framework module DependsOnModule { + umbrella header "DependsOnModule.h" + header "other.h" + module * { + export * + } + explicit module CXX { + requires cplusplus + header "cxx_other.h" + } + + explicit framework module SubFramework { + umbrella header "SubFramework.h" + + module * { + export * + } + } +} diff --git a/clang/test/Modules/Inputs/DependsOnModule.framework/module_private.map b/clang/test/Modules/Inputs/DependsOnModule.framework/module_private.map new file mode 100644 index 0000000..5ed0029 --- /dev/null +++ b/clang/test/Modules/Inputs/DependsOnModule.framework/module_private.map @@ -0,0 +1,6 @@ +explicit module DependsOnModule.Private { + explicit module DependsOnModule { + header "DependsOnModulePrivate.h" + } +} + diff --git a/clang/test/Modules/Inputs/MethodPoolA.h b/clang/test/Modules/Inputs/MethodPoolA.h new file mode 100644 index 0000000..6af24a9 --- /dev/null +++ b/clang/test/Modules/Inputs/MethodPoolA.h @@ -0,0 +1,8 @@ + + + + +@interface A ++ (int)method1; +- (int)method2:(int)param; +@end diff --git a/clang/test/Modules/Inputs/MethodPoolB.h b/clang/test/Modules/Inputs/MethodPoolB.h new file mode 100644 index 0000000..e1e86ed --- /dev/null +++ b/clang/test/Modules/Inputs/MethodPoolB.h @@ -0,0 +1,13 @@ + + + + + + + + + +@interface B +- (int)method1; +- (int)method2:(float)param; +@end diff --git a/clang/test/Modules/Inputs/Module.framework/Frameworks/SubFramework.framework/Headers/SubFramework.h b/clang/test/Modules/Inputs/Module.framework/Frameworks/SubFramework.framework/Headers/SubFramework.h new file mode 100644 index 0000000..f7f9fb6 --- /dev/null +++ b/clang/test/Modules/Inputs/Module.framework/Frameworks/SubFramework.framework/Headers/SubFramework.h @@ -0,0 +1,5 @@ +#ifndef MODULE_SUBFRAMEWORK_H +#define MODULE_SUBFRAMEWORK_H +#__private_macro MODULE_SUBFRAMEWORK_H +char *module_subframework; +#endif diff --git a/clang/test/Modules/Inputs/Module.framework/Headers/Buried/Treasure.h b/clang/test/Modules/Inputs/Module.framework/Headers/Buried/Treasure.h new file mode 100644 index 0000000..6e81adc --- /dev/null +++ b/clang/test/Modules/Inputs/Module.framework/Headers/Buried/Treasure.h @@ -0,0 +1 @@ +unsigned *Buried_Treasure; diff --git a/clang/test/Modules/Inputs/Module.framework/Headers/Module.h b/clang/test/Modules/Inputs/Module.framework/Headers/Module.h new file mode 100644 index 0000000..738b222 --- /dev/null +++ b/clang/test/Modules/Inputs/Module.framework/Headers/Module.h @@ -0,0 +1,22 @@ +// expected-warning{{umbrella header}} + +#ifndef MODULE_H +#define MODULE_H +const char *getModuleVersion(void); + +#ifdef FOO +# error Module should have been built without -DFOO +#endif + +@interface Module ++(const char *)version; // retrieve module version ++alloc; +@end + +#define MODULE_H_MACRO 1 +#__private_macro MODULE_H_MACRO + +#include <Module/Sub.h> +#include <Module/Buried/Treasure.h> + +#endif // MODULE_H diff --git a/clang/test/Modules/Inputs/Module.framework/Headers/NotInModule.h b/clang/test/Modules/Inputs/Module.framework/Headers/NotInModule.h new file mode 100644 index 0000000..6b15791 --- /dev/null +++ b/clang/test/Modules/Inputs/Module.framework/Headers/NotInModule.h @@ -0,0 +1 @@ +int not_in_module; diff --git a/clang/test/Modules/Inputs/Module.framework/Headers/Sub.h b/clang/test/Modules/Inputs/Module.framework/Headers/Sub.h new file mode 100644 index 0000000..dea76e7 --- /dev/null +++ b/clang/test/Modules/Inputs/Module.framework/Headers/Sub.h @@ -0,0 +1,3 @@ +#include <Module/Sub2.h> +int *Module_Sub; + diff --git a/clang/test/Modules/Inputs/Module.framework/Headers/Sub2.h b/clang/test/Modules/Inputs/Module.framework/Headers/Sub2.h new file mode 100644 index 0000000..beed4a8 --- /dev/null +++ b/clang/test/Modules/Inputs/Module.framework/Headers/Sub2.h @@ -0,0 +1 @@ +int *Module_Sub2; diff --git a/clang/test/Modules/Inputs/Module.framework/PrivateHeaders/ModulePrivate.h b/clang/test/Modules/Inputs/Module.framework/PrivateHeaders/ModulePrivate.h new file mode 100644 index 0000000..0782336 --- /dev/null +++ b/clang/test/Modules/Inputs/Module.framework/PrivateHeaders/ModulePrivate.h @@ -0,0 +1 @@ +int module_private; diff --git a/clang/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h b/clang/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h new file mode 100644 index 0000000..5142f56 --- /dev/null +++ b/clang/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h @@ -0,0 +1,3 @@ + +@__experimental_modules_import MutuallyRecursive2; + diff --git a/clang/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h b/clang/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h new file mode 100644 index 0000000..8a3cc33 --- /dev/null +++ b/clang/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h @@ -0,0 +1,6 @@ + + +@__experimental_modules_import MutuallyRecursive1; + + + diff --git a/clang/test/Modules/Inputs/NoUmbrella.framework/Headers/A.h b/clang/test/Modules/Inputs/NoUmbrella.framework/Headers/A.h new file mode 100644 index 0000000..73f32bf --- /dev/null +++ b/clang/test/Modules/Inputs/NoUmbrella.framework/Headers/A.h @@ -0,0 +1,8 @@ +int no_umbrella_A; + +inline int has_warning(int x) { + if (x > 0) + return x; + // Note: warning here is suppressed because this module is considered a + // "system" module. +} diff --git a/clang/test/Modules/Inputs/NoUmbrella.framework/Headers/B.h b/clang/test/Modules/Inputs/NoUmbrella.framework/Headers/B.h new file mode 100644 index 0000000..dc6770f --- /dev/null +++ b/clang/test/Modules/Inputs/NoUmbrella.framework/Headers/B.h @@ -0,0 +1 @@ +int no_umbrella_B; diff --git a/clang/test/Modules/Inputs/NoUmbrella.framework/Headers/Boom.h b/clang/test/Modules/Inputs/NoUmbrella.framework/Headers/Boom.h new file mode 100644 index 0000000..ac4a14a --- /dev/null +++ b/clang/test/Modules/Inputs/NoUmbrella.framework/Headers/Boom.h @@ -0,0 +1 @@ +this is gibberish diff --git a/clang/test/Modules/Inputs/NoUmbrella.framework/Headers/SubDir/C.h b/clang/test/Modules/Inputs/NoUmbrella.framework/Headers/SubDir/C.h new file mode 100644 index 0000000..4a9351a --- /dev/null +++ b/clang/test/Modules/Inputs/NoUmbrella.framework/Headers/SubDir/C.h @@ -0,0 +1 @@ +int no_umbrella_C; diff --git a/clang/test/Modules/Inputs/NoUmbrella.framework/PrivateHeaders/A_Private.h b/clang/test/Modules/Inputs/NoUmbrella.framework/PrivateHeaders/A_Private.h new file mode 100644 index 0000000..bd606d2 --- /dev/null +++ b/clang/test/Modules/Inputs/NoUmbrella.framework/PrivateHeaders/A_Private.h @@ -0,0 +1 @@ +int no_umbrella_A_private; diff --git a/clang/test/Modules/Inputs/NoUmbrella.framework/PrivateHeaders/B_Private.h b/clang/test/Modules/Inputs/NoUmbrella.framework/PrivateHeaders/B_Private.h new file mode 100644 index 0000000..442be2d --- /dev/null +++ b/clang/test/Modules/Inputs/NoUmbrella.framework/PrivateHeaders/B_Private.h @@ -0,0 +1 @@ +int no_umbrella_B_private; diff --git a/clang/test/Modules/Inputs/NoUmbrella.framework/module.map b/clang/test/Modules/Inputs/NoUmbrella.framework/module.map new file mode 100644 index 0000000..4a4d970 --- /dev/null +++ b/clang/test/Modules/Inputs/NoUmbrella.framework/module.map @@ -0,0 +1,9 @@ +framework module NoUmbrella [system] { + umbrella "Headers" + module * { } + + module unavailable { + requires unavailable + header "Boom.h" + } +} diff --git a/clang/test/Modules/Inputs/NoUmbrella.framework/module_private.map b/clang/test/Modules/Inputs/NoUmbrella.framework/module_private.map new file mode 100644 index 0000000..0507ba0 --- /dev/null +++ b/clang/test/Modules/Inputs/NoUmbrella.framework/module_private.map @@ -0,0 +1,4 @@ +explicit module NoUmbrella.Private { + umbrella "PrivateHeaders" + explicit module * { } +} diff --git a/clang/test/Modules/Inputs/System/usr/include/module.map b/clang/test/Modules/Inputs/System/usr/include/module.map new file mode 100644 index 0000000..884b59c --- /dev/null +++ b/clang/test/Modules/Inputs/System/usr/include/module.map @@ -0,0 +1,21 @@ +module cstd [system] { + // Only in compiler support directory + module float_constants { + header "float.h" + } + + // Only in system headers directory + module stdio { + header "stdio.h" + } + + // In both directories (compiler support version wins, does not forward) + module stdbool { + header "stdbool.h" + } + + // In both directories (compiler support version wins, forwards) + module stdint { + header "stdint.h" + } +} diff --git a/clang/test/Modules/Inputs/System/usr/include/stdbool.h b/clang/test/Modules/Inputs/System/usr/include/stdbool.h new file mode 100644 index 0000000..760d7dc --- /dev/null +++ b/clang/test/Modules/Inputs/System/usr/include/stdbool.h @@ -0,0 +1 @@ +// Testing hack: does not define bool/true/false. diff --git a/clang/test/Modules/Inputs/System/usr/include/stdint.h b/clang/test/Modules/Inputs/System/usr/include/stdint.h new file mode 100644 index 0000000..e8e50f9 --- /dev/null +++ b/clang/test/Modules/Inputs/System/usr/include/stdint.h @@ -0,0 +1 @@ +typedef int my_awesome_nonstandard_integer_type; diff --git a/clang/test/Modules/Inputs/System/usr/include/stdio.h b/clang/test/Modules/Inputs/System/usr/include/stdio.h new file mode 100644 index 0000000..9a7b106 --- /dev/null +++ b/clang/test/Modules/Inputs/System/usr/include/stdio.h @@ -0,0 +1,3 @@ +typedef struct { int id; } FILE; +int fprintf(FILE*restrict, const char* restrict format, ...); + diff --git a/clang/test/Modules/Inputs/category_bottom.h b/clang/test/Modules/Inputs/category_bottom.h new file mode 100644 index 0000000..b53d9c3 --- /dev/null +++ b/clang/test/Modules/Inputs/category_bottom.h @@ -0,0 +1,11 @@ +@__experimental_modules_import category_left; + +@interface Foo(Bottom) +-(void)bottom; +@end + +@__experimental_modules_import category_right; + +@interface LeftFoo(Bottom) +-(void)bottom; +@end diff --git a/clang/test/Modules/Inputs/category_left.h b/clang/test/Modules/Inputs/category_left.h new file mode 100644 index 0000000..736fa43 --- /dev/null +++ b/clang/test/Modules/Inputs/category_left.h @@ -0,0 +1,15 @@ +@__experimental_modules_import category_top; + +@interface Foo(Left) +-(void)left; +@end + +@interface LeftFoo +-(void)left; +@end + +@interface Foo(Duplicate) +@end + +@interface Foo(Duplicate) +@end diff --git a/clang/test/Modules/Inputs/category_other.h b/clang/test/Modules/Inputs/category_other.h new file mode 100644 index 0000000..1bb5a91 --- /dev/null +++ b/clang/test/Modules/Inputs/category_other.h @@ -0,0 +1,6 @@ +@__experimental_modules_import category_top; + +@interface Foo(Other) +-(void)other; +@end + diff --git a/clang/test/Modules/Inputs/category_right.h b/clang/test/Modules/Inputs/category_right.h new file mode 100644 index 0000000..d993b50 --- /dev/null +++ b/clang/test/Modules/Inputs/category_right.h @@ -0,0 +1,12 @@ +@__experimental_modules_import category_top; + +@interface Foo(Right1) +-(void)right1; +@end + +@interface Foo(Right2) +-(void)right2; +@end + +@interface Foo(Duplicate) // expected-warning {{duplicate definition of category}} +@end diff --git a/clang/test/Modules/Inputs/category_top.h b/clang/test/Modules/Inputs/category_top.h new file mode 100644 index 0000000..c9558b6 --- /dev/null +++ b/clang/test/Modules/Inputs/category_top.h @@ -0,0 +1,14 @@ +@interface Foo +@end + +@interface Foo(Top) +-(void)top; +@end + +@interface Foo(Top2) +-(void)top2; +@end + +@interface Foo(Top3) +-(void)top3; +@end diff --git a/clang/test/Modules/Inputs/decl.h b/clang/test/Modules/Inputs/decl.h new file mode 100644 index 0000000..8dbe11e --- /dev/null +++ b/clang/test/Modules/Inputs/decl.h @@ -0,0 +1,2 @@ +@class A; +typedef struct B B; diff --git a/clang/test/Modules/Inputs/decl2.h b/clang/test/Modules/Inputs/decl2.h new file mode 100644 index 0000000..decf6e0 --- /dev/null +++ b/clang/test/Modules/Inputs/decl2.h @@ -0,0 +1 @@ +@class A; diff --git a/clang/test/Modules/Inputs/def-include.h b/clang/test/Modules/Inputs/def-include.h new file mode 100644 index 0000000..9e0e575 --- /dev/null +++ b/clang/test/Modules/Inputs/def-include.h @@ -0,0 +1,13 @@ + + + + + + + + + + +struct B { + int b1; +}; diff --git a/clang/test/Modules/Inputs/def.h b/clang/test/Modules/Inputs/def.h new file mode 100644 index 0000000..6d06b08 --- /dev/null +++ b/clang/test/Modules/Inputs/def.h @@ -0,0 +1,11 @@ +#include "def-include.h" + + + +@interface A { +@public + int ivar; +} +@end + + diff --git a/clang/test/Modules/Inputs/diamond.h b/clang/test/Modules/Inputs/diamond.h new file mode 100644 index 0000000..15b5290 --- /dev/null +++ b/clang/test/Modules/Inputs/diamond.h @@ -0,0 +1 @@ +@__experimental_modules_import diamond_bottom; diff --git a/clang/test/Modules/Inputs/diamond_bottom.h b/clang/test/Modules/Inputs/diamond_bottom.h new file mode 100644 index 0000000..b45fa93 --- /dev/null +++ b/clang/test/Modules/Inputs/diamond_bottom.h @@ -0,0 +1,4 @@ +@__experimental_modules_import diamond_left; +@__experimental_modules_import diamond_right; + +char bottom(char *x); diff --git a/clang/test/Modules/Inputs/diamond_left.h b/clang/test/Modules/Inputs/diamond_left.h new file mode 100644 index 0000000..cc406ab --- /dev/null +++ b/clang/test/Modules/Inputs/diamond_left.h @@ -0,0 +1,9 @@ +@__experimental_modules_import diamond_top; + +float left(float *); + +int top_left(char *c); + +int left_and_right(int*); + + diff --git a/clang/test/Modules/Inputs/diamond_right.h b/clang/test/Modules/Inputs/diamond_right.h new file mode 100644 index 0000000..2ba1d77 --- /dev/null +++ b/clang/test/Modules/Inputs/diamond_right.h @@ -0,0 +1,7 @@ +@__experimental_modules_import diamond_top; + +double right(double *); + +struct left_and_right { + int left, right; +}; diff --git a/clang/test/Modules/Inputs/diamond_top.h b/clang/test/Modules/Inputs/diamond_top.h new file mode 100644 index 0000000..34998cd --- /dev/null +++ b/clang/test/Modules/Inputs/diamond_top.h @@ -0,0 +1,4 @@ +int top(int *); + +int top_left(char *c); + diff --git a/clang/test/Modules/Inputs/irgen.h b/clang/test/Modules/Inputs/irgen.h new file mode 100644 index 0000000..9936bf6 --- /dev/null +++ b/clang/test/Modules/Inputs/irgen.h @@ -0,0 +1 @@ +static inline int triple(int x) { return x * 3; } diff --git a/clang/test/Modules/Inputs/load_failure.h b/clang/test/Modules/Inputs/load_failure.h new file mode 100644 index 0000000..5bcb44d --- /dev/null +++ b/clang/test/Modules/Inputs/load_failure.h @@ -0,0 +1 @@ +int fail(int); diff --git a/clang/test/Modules/Inputs/lookup_left.h b/clang/test/Modules/Inputs/lookup_left.h new file mode 100644 index 0000000..01723d4 --- /dev/null +++ b/clang/test/Modules/Inputs/lookup_left.h @@ -0,0 +1,3 @@ +@interface A +- (int)method; +@end diff --git a/clang/test/Modules/Inputs/lookup_left.hpp b/clang/test/Modules/Inputs/lookup_left.hpp new file mode 100644 index 0000000..66d6206 --- /dev/null +++ b/clang/test/Modules/Inputs/lookup_left.hpp @@ -0,0 +1,5 @@ +int *f0(int*); + +#pragma weak weak_identifier // expected-warning{{weak identifier 'weak_identifier' never declared}} + + diff --git a/clang/test/Modules/Inputs/lookup_right.h b/clang/test/Modules/Inputs/lookup_right.h new file mode 100644 index 0000000..f8f0c97 --- /dev/null +++ b/clang/test/Modules/Inputs/lookup_right.h @@ -0,0 +1,5 @@ + +@interface B +- (double)method; +@end + diff --git a/clang/test/Modules/Inputs/lookup_right.hpp b/clang/test/Modules/Inputs/lookup_right.hpp new file mode 100644 index 0000000..8845347 --- /dev/null +++ b/clang/test/Modules/Inputs/lookup_right.hpp @@ -0,0 +1 @@ +float *f0(float*); diff --git a/clang/test/Modules/Inputs/macros.h b/clang/test/Modules/Inputs/macros.h new file mode 100644 index 0000000..4f53556 --- /dev/null +++ b/clang/test/Modules/Inputs/macros.h @@ -0,0 +1,10 @@ +#define MODULE +#define INTEGER(X) int +#define FLOAT float +#define DOUBLE double + +#__public_macro INTEGER +#__private_macro FLOAT +#__private_macro MODULE + +int (INTEGER); diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map new file mode 100644 index 0000000..e8d1f2c --- /dev/null +++ b/clang/test/Modules/Inputs/module.map @@ -0,0 +1,86 @@ +module diamond_top { header "diamond_top.h" } +module diamond_left { + header "diamond_left.h" + export diamond_top +} +module diamond_right { + header "diamond_right.h" + export diamond_top +} +module diamond_bottom { + header "diamond_bottom.h" + export * +} +module irgen { header "irgen.h" } +module lookup_left_objc { header "lookup_left.h" } +module lookup_right_objc { header "lookup_right.h" } +module lookup_left_cxx { header "lookup_left.hpp" } +module lookup_right_cxx { header "lookup_right.hpp" } +module module_private_left { header "module_private_left.h" } +module module_private_right { header "module_private_right.h" } +module macros { header "macros.h" } +module category_top { header "category_top.h" } +module category_left { + header "category_left.h" + export category_top +} +module category_right { + header "category_right.h" + export category_top +} +module category_bottom { + header "category_bottom.h" + export category_left + export category_right +} +module category_other { header "category_other.h" } +module redeclarations_left { header "redeclarations_left.h" } +module redeclarations_right { header "redeclarations_right.h" } +module redecl_namespaces_left { header "redecl_namespaces_left.h" } +module redecl_namespaces_right { header "redecl_namespaces_right.h" } +module load_failure { header "load_failure.h" } + +module decldef { + explicit module Decl { header "decl.h" } + explicit module Decl2 { header "decl2.h" } + explicit module Def { header "def.h" } +} + +module redecl_merge_top { + header "redecl-merge-top.h" + explicit module Explicit { header "redecl-merge-top-explicit.h" } +} +module redecl_merge_left { + header "redecl-merge-left.h" + export * +} +module redecl_merge_left_left { + header "redecl-merge-left-left.h" + export * +} +module redecl_merge_right { + header "redecl-merge-right.h" + export * +} +module redecl_merge_bottom { + header "redecl-merge-bottom.h" + export * +} +module namespaces_top { + header "namespaces-top.h" + export * +} +module namespaces_left { + header "namespaces-left.h" + export * +} +module namespaces_right { + header "namespaces-right.h" + export * +} +module MethodPoolA { + header "MethodPoolA.h" +} +module MethodPoolB { + header "MethodPoolB.h" +} diff --git a/clang/test/Modules/Inputs/module_private_left.h b/clang/test/Modules/Inputs/module_private_left.h new file mode 100644 index 0000000..ff33999 --- /dev/null +++ b/clang/test/Modules/Inputs/module_private_left.h @@ -0,0 +1,26 @@ +__module_private__ struct HiddenStruct; + +__module_private__ struct HiddenStruct { +}; + + +int &f0(int); + +template<typename T> +__module_private__ void f1(T*); + +template<typename T> +__module_private__ void f1(T*); + +template<typename T> +__module_private__ class vector; + +template<typename T> +__module_private__ class vector { +}; + +vector<float> vec_float; + +typedef __module_private__ int Integer; +typedef __module_private__ int Integer; + diff --git a/clang/test/Modules/Inputs/module_private_right.h b/clang/test/Modules/Inputs/module_private_right.h new file mode 100644 index 0000000..53efe25 --- /dev/null +++ b/clang/test/Modules/Inputs/module_private_right.h @@ -0,0 +1,13 @@ +__module_private__ double &f0(double); +__module_private__ double &f0(double); + +__module_private__ int hidden_var; + +inline void test_f0_in_right() { + double &dr = f0(hidden_var); +} + +struct VisibleStruct { + __module_private__ int field; + __module_private__ virtual void setField(int f); +}; diff --git a/clang/test/Modules/Inputs/namespaces-left.h b/clang/test/Modules/Inputs/namespaces-left.h new file mode 100644 index 0000000..d253fed --- /dev/null +++ b/clang/test/Modules/Inputs/namespaces-left.h @@ -0,0 +1,53 @@ +@__experimental_modules_import namespaces_top; + +namespace N1 { } + +namespace N1 { + float& f(float); +} + +namespace N2 { + float& f(float); +} + + + + + +namespace N5 { + int &f(int); +} + +namespace N6 { + int &f(int); +} + +namespace N7 { + int &f(int); +} + +namespace N8 { + int &f(int); +} + +namespace N9 { + int &f(int); +} + +namespace N10 { + int &f(int); +} + +namespace N11 { + namespace { + class Foo; + } + Foo *getFoo(); +} + +namespace N12 { + namespace { + class Foo; + } + Foo *getFoo(); +} diff --git a/clang/test/Modules/Inputs/namespaces-right.h b/clang/test/Modules/Inputs/namespaces-right.h new file mode 100644 index 0000000..7e7286e --- /dev/null +++ b/clang/test/Modules/Inputs/namespaces-right.h @@ -0,0 +1,61 @@ +@__experimental_modules_import namespaces_top; + +namespace N2 { } + +namespace N2 { } + +namespace N2 { } + +namespace N2 { } + +namespace N2 { + double& f(double); +} + +namespace N3 { + double& f(double); +} + +namespace N5 { + double &f(double); +} + +namespace N6 { + double &f(double); +} + +namespace N7 { + double &f(double); +} + +namespace N8 { + int &f(int); +} + +namespace N9 { + int &f(int); +} + +namespace N10 { + int &f(int); +} + + + + + + + +namespace N11 { + namespace { + class Foo; + } + void consumeFoo(Foo*); +} + +namespace N12 { + namespace { + class Foo; + } + void consumeFoo(Foo*); +} diff --git a/clang/test/Modules/Inputs/namespaces-top.h b/clang/test/Modules/Inputs/namespaces-top.h new file mode 100644 index 0000000..0c607f5 --- /dev/null +++ b/clang/test/Modules/Inputs/namespaces-top.h @@ -0,0 +1,14 @@ +namespace N1 { + int& f(int); +} + +namespace N2 { + int& f(int); +} + +namespace N3 { + int& f(int); +} + +namespace N12 { } + diff --git a/clang/test/Modules/Inputs/normal-module-map/Umbrella/Umbrella.h b/clang/test/Modules/Inputs/normal-module-map/Umbrella/Umbrella.h new file mode 100644 index 0000000..7462376 --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/Umbrella/Umbrella.h @@ -0,0 +1,4 @@ +int umbrella; + +#include "umbrella_sub.h" + diff --git a/clang/test/Modules/Inputs/normal-module-map/Umbrella/module.map b/clang/test/Modules/Inputs/normal-module-map/Umbrella/module.map new file mode 100644 index 0000000..611cf9f --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/Umbrella/module.map @@ -0,0 +1,3 @@ +module Umbrella { + umbrella header "Umbrella.h" +}
\ No newline at end of file diff --git a/clang/test/Modules/Inputs/normal-module-map/Umbrella/umbrella_sub.h b/clang/test/Modules/Inputs/normal-module-map/Umbrella/umbrella_sub.h new file mode 100644 index 0000000..9fdccd1 --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/Umbrella/umbrella_sub.h @@ -0,0 +1,2 @@ +int umbrella_sub; + diff --git a/clang/test/Modules/Inputs/normal-module-map/Umbrella2/Umbrella2.h b/clang/test/Modules/Inputs/normal-module-map/Umbrella2/Umbrella2.h new file mode 100644 index 0000000..36110d8 --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/Umbrella2/Umbrella2.h @@ -0,0 +1 @@ +int umbrella2; diff --git a/clang/test/Modules/Inputs/normal-module-map/Umbrella2/module.map b/clang/test/Modules/Inputs/normal-module-map/Umbrella2/module.map new file mode 100644 index 0000000..1e57704 --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/Umbrella2/module.map @@ -0,0 +1,3 @@ +module Umbrella2 { + umbrella header "Umbrella2.h" +} diff --git a/clang/test/Modules/Inputs/normal-module-map/a1.h b/clang/test/Modules/Inputs/normal-module-map/a1.h new file mode 100644 index 0000000..f2d5a49 --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/a1.h @@ -0,0 +1 @@ +int a1; diff --git a/clang/test/Modules/Inputs/normal-module-map/a2.h b/clang/test/Modules/Inputs/normal-module-map/a2.h new file mode 100644 index 0000000..5c4e7ff --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/a2.h @@ -0,0 +1 @@ +int a2; diff --git a/clang/test/Modules/Inputs/normal-module-map/b1.h b/clang/test/Modules/Inputs/normal-module-map/b1.h new file mode 100644 index 0000000..2ed1112 --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/b1.h @@ -0,0 +1,2 @@ +int b1; + diff --git a/clang/test/Modules/Inputs/normal-module-map/module.map b/clang/test/Modules/Inputs/normal-module-map/module.map new file mode 100644 index 0000000..e17f44a --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/module.map @@ -0,0 +1,13 @@ +module libA { + module a1 { header "a1.h" } + header "a2.h" +} + +module libB { + header "b1.h" +} + +module nested_umbrella { + umbrella "nested_umbrella" + module * { } +} diff --git a/clang/test/Modules/Inputs/normal-module-map/nested/module.map b/clang/test/Modules/Inputs/normal-module-map/nested/module.map new file mode 100644 index 0000000..fd463c2 --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/nested/module.map @@ -0,0 +1,4 @@ +module libNested { + header "nested1.h" + header "nested2.h" +}
\ No newline at end of file diff --git a/clang/test/Modules/Inputs/normal-module-map/nested/nested1.h b/clang/test/Modules/Inputs/normal-module-map/nested/nested1.h new file mode 100644 index 0000000..3790d1a --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/nested/nested1.h @@ -0,0 +1 @@ +int nested1; diff --git a/clang/test/Modules/Inputs/normal-module-map/nested/nested2.h b/clang/test/Modules/Inputs/normal-module-map/nested/nested2.h new file mode 100644 index 0000000..d56d601 --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/nested/nested2.h @@ -0,0 +1 @@ +int nested2; diff --git a/clang/test/Modules/Inputs/normal-module-map/nested_umbrella/a.h b/clang/test/Modules/Inputs/normal-module-map/nested_umbrella/a.h new file mode 100644 index 0000000..ab180fe --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/nested_umbrella/a.h @@ -0,0 +1,2 @@ +int nested_umbrella_a; + diff --git a/clang/test/Modules/Inputs/normal-module-map/nested_umbrella/b.h b/clang/test/Modules/Inputs/normal-module-map/nested_umbrella/b.h new file mode 100644 index 0000000..a903f5d --- /dev/null +++ b/clang/test/Modules/Inputs/normal-module-map/nested_umbrella/b.h @@ -0,0 +1,2 @@ +int nested_umbrella_b; + diff --git a/clang/test/Modules/Inputs/point.h b/clang/test/Modules/Inputs/point.h new file mode 100644 index 0000000..eab23d5 --- /dev/null +++ b/clang/test/Modules/Inputs/point.h @@ -0,0 +1,2 @@ +struct Point { int x, y; }; + diff --git a/clang/test/Modules/Inputs/redecl-merge-bottom.h b/clang/test/Modules/Inputs/redecl-merge-bottom.h new file mode 100644 index 0000000..40a9404 --- /dev/null +++ b/clang/test/Modules/Inputs/redecl-merge-bottom.h @@ -0,0 +1,28 @@ +@__experimental_modules_import redecl_merge_left; + +@class C4; +@class C4; +@protocol P4; +@protocol P4; +@protocol P4; +@__experimental_modules_import redecl_merge_right; + +@class B; + +@class A; + +@protocol P1; + +struct S1; +struct S3; + +void refers_to_C4(C4*); + +#ifdef __cplusplus +template<typename T> class Vector; + +template<typename T> class Vector; + +template<typename T> class Vector; +#endif + diff --git a/clang/test/Modules/Inputs/redecl-merge-left-left.h b/clang/test/Modules/Inputs/redecl-merge-left-left.h new file mode 100644 index 0000000..5f48883 --- /dev/null +++ b/clang/test/Modules/Inputs/redecl-merge-left-left.h @@ -0,0 +1,7 @@ +@__experimental_modules_import redecl_merge_left; + +@class C4; +void accept_a_C4(C4*); + +@class ClassWithDef; + diff --git a/clang/test/Modules/Inputs/redecl-merge-left.h b/clang/test/Modules/Inputs/redecl-merge-left.h new file mode 100644 index 0000000..b3a7ba8 --- /dev/null +++ b/clang/test/Modules/Inputs/redecl-merge-left.h @@ -0,0 +1,90 @@ +@__experimental_modules_import redecl_merge_top; + +@class A; + +@class A; + +@interface B ++ (B*) create_a_B; +@end + +@class A; + +@protocol P1; +@protocol P2 +- (void)protoMethod2; +@end + +struct S1; +struct S2 { + int field; +}; + +struct S1 *produce_S1(void); +void consume_S2(struct S2*); + +// Test declarations in different modules with no common initial +// declaration. +@class C; +void accept_a_C(C*); + +@class C2; +void accept_a_C2(C2*); + +@class C3; +void accept_a_C3(C3*); +@class C3; + +@class C4; + +@class Explicit; + +int *explicit_func(void); + +struct explicit_struct; + +@protocol P3, P4; + +@protocol P3; + +struct S3; +struct S3; +struct S4 { + int field; +}; + +struct S3 *produce_S3(void); +void consume_S4(struct S4*); + +typedef int T1; +typedef float T2; + +int func0(int); +int func1(int); +int func2(int); + + + + + + + + + + +// Spacing matters! +extern int var1; +extern float var2; + +extern double var3; + +#ifdef __cplusplus +template<typename T> class Vector; + +template<typename T> class Vector; +#endif + +// Make sure this doesn't introduce an ambiguity-creating 'id' at the +// top level. +typedef void funcptr_with_id(int id); + diff --git a/clang/test/Modules/Inputs/redecl-merge-right.h b/clang/test/Modules/Inputs/redecl-merge-right.h new file mode 100644 index 0000000..de7aa08 --- /dev/null +++ b/clang/test/Modules/Inputs/redecl-merge-right.h @@ -0,0 +1,94 @@ +@__experimental_modules_import redecl_merge_top; + +@interface Super +@end + +@interface A : Super +- (Super*)init; +@end + +@class B; + +@protocol P1 +- (void)protoMethod1; +@end + +@protocol P1; + +@protocol P2; + +@protocol P2; + +@protocol P2; + +struct S1; +struct S2; + +void consume_S1(struct S1*); +struct S2 *produce_S2(void); + +// Test declarations in different modules with no common initial +// declaration. +@class C; +C *get_a_C(void); +@class C2; +C2 *get_a_C2(void); +@class C3; +C3 *get_a_C3(void); + +@class C4; +@class C4; +@class C4; +@class C4; +C4 *get_a_C4(void); + +@class Explicit; + +int *explicit_func(void); + +struct explicit_struct; + +@protocol P4, P3; +@protocol P3; +@protocol P3; +@protocol P3; + +struct S3; +struct S4; + +void consume_S3(struct S3*); +struct S4 *produce_S4(void); + +typedef int T1; +typedef double T2; + +int func0(int); +int func1(int); +int func1(int); +int func1(int); +int func1(int); +static int func2(int); + + + + +// Spacing matters! +extern int var1; +extern int var2; + +static double var3; + +#ifdef __cplusplus +template<typename T> class Vector { +public: + void push_back(const T&); +}; +#endif + +int ONE; +@__experimental_modules_import redecl_merge_top.Explicit; +const int one = ONE; + +@interface ClassWithDef +- (void)method; +@end diff --git a/clang/test/Modules/Inputs/redecl-merge-top-explicit.h b/clang/test/Modules/Inputs/redecl-merge-top-explicit.h new file mode 100644 index 0000000..e06ff7a --- /dev/null +++ b/clang/test/Modules/Inputs/redecl-merge-top-explicit.h @@ -0,0 +1,9 @@ +@class Explicit; + +int *explicit_func(void); + +struct explicit_struct { int member; }; + +#define ONE 1 + +typedef struct my_struct_type *my_struct_ref; diff --git a/clang/test/Modules/Inputs/redecl-merge-top.h b/clang/test/Modules/Inputs/redecl-merge-top.h new file mode 100644 index 0000000..519254c --- /dev/null +++ b/clang/test/Modules/Inputs/redecl-merge-top.h @@ -0,0 +1,20 @@ +@class A; + +@class A; + +@class A; + +@class B; + +@protocol P1; + +@protocol P2; +@protocol P2; + +struct S1; +struct S2; +struct S2; + +#ifdef __cplusplus +template<typename T> class Vector; +#endif diff --git a/clang/test/Modules/Inputs/redecl_namespaces_left.h b/clang/test/Modules/Inputs/redecl_namespaces_left.h new file mode 100644 index 0000000..49595ea --- /dev/null +++ b/clang/test/Modules/Inputs/redecl_namespaces_left.h @@ -0,0 +1,3 @@ +namespace A { + int i; +} diff --git a/clang/test/Modules/Inputs/redecl_namespaces_right.h b/clang/test/Modules/Inputs/redecl_namespaces_right.h new file mode 100644 index 0000000..fdf65ba --- /dev/null +++ b/clang/test/Modules/Inputs/redecl_namespaces_right.h @@ -0,0 +1,3 @@ +namespace A { + int j; +} diff --git a/clang/test/Modules/Inputs/redeclarations_left.h b/clang/test/Modules/Inputs/redeclarations_left.h new file mode 100644 index 0000000..4dfbf1d --- /dev/null +++ b/clang/test/Modules/Inputs/redeclarations_left.h @@ -0,0 +1,2 @@ +@class NSObject; + diff --git a/clang/test/Modules/Inputs/redeclarations_right.h b/clang/test/Modules/Inputs/redeclarations_right.h new file mode 100644 index 0000000..d3861fe --- /dev/null +++ b/clang/test/Modules/Inputs/redeclarations_right.h @@ -0,0 +1,2 @@ +@interface NSObject +@end diff --git a/clang/test/Modules/Inputs/subdir/module.map b/clang/test/Modules/Inputs/subdir/module.map new file mode 100644 index 0000000..4cd0215 --- /dev/null +++ b/clang/test/Modules/Inputs/subdir/module.map @@ -0,0 +1,3 @@ +module subdir { + header "subdir.h" +} diff --git a/clang/test/Modules/Inputs/subdir/subdir.h b/clang/test/Modules/Inputs/subdir/subdir.h new file mode 100644 index 0000000..0fb3d21 --- /dev/null +++ b/clang/test/Modules/Inputs/subdir/subdir.h @@ -0,0 +1 @@ +const char *getSubdir(); diff --git a/clang/test/Modules/Inputs/submodules/hash_map.h b/clang/test/Modules/Inputs/submodules/hash_map.h new file mode 100644 index 0000000..ce85984 --- /dev/null +++ b/clang/test/Modules/Inputs/submodules/hash_map.h @@ -0,0 +1,4 @@ +template<typename Key, typename Data> class hash_map { }; + +#define HAVE_HASH_MAP + diff --git a/clang/test/Modules/Inputs/submodules/module.map b/clang/test/Modules/Inputs/submodules/module.map new file mode 100644 index 0000000..16cedac --- /dev/null +++ b/clang/test/Modules/Inputs/submodules/module.map @@ -0,0 +1,5 @@ +module std { + module vector { header "vector.h" } + module type_traits { header "type_traits.h" } + explicit module hash_map { header "hash_map.h" } +} diff --git a/clang/test/Modules/Inputs/submodules/type_traits.h b/clang/test/Modules/Inputs/submodules/type_traits.h new file mode 100644 index 0000000..4dad090 --- /dev/null +++ b/clang/test/Modules/Inputs/submodules/type_traits.h @@ -0,0 +1,12 @@ +template<typename T> +struct remove_reference { + typedef T type; +}; + +template<typename T> +struct remove_reference<T&> { + typedef T type; +}; + +#define HAVE_TYPE_TRAITS + diff --git a/clang/test/Modules/Inputs/submodules/vector.h b/clang/test/Modules/Inputs/submodules/vector.h new file mode 100644 index 0000000..8e1cdc8 --- /dev/null +++ b/clang/test/Modules/Inputs/submodules/vector.h @@ -0,0 +1,3 @@ +template<typename T> class vector { }; + +#define HAVE_VECTOR diff --git a/clang/test/Modules/Inputs/wildcard-submodule-exports/A_one.h b/clang/test/Modules/Inputs/wildcard-submodule-exports/A_one.h new file mode 100644 index 0000000..4a2c239 --- /dev/null +++ b/clang/test/Modules/Inputs/wildcard-submodule-exports/A_one.h @@ -0,0 +1 @@ +int *A1; diff --git a/clang/test/Modules/Inputs/wildcard-submodule-exports/A_two.h b/clang/test/Modules/Inputs/wildcard-submodule-exports/A_two.h new file mode 100644 index 0000000..1b08599 --- /dev/null +++ b/clang/test/Modules/Inputs/wildcard-submodule-exports/A_two.h @@ -0,0 +1 @@ +unsigned int *A2; diff --git a/clang/test/Modules/Inputs/wildcard-submodule-exports/B_one.h b/clang/test/Modules/Inputs/wildcard-submodule-exports/B_one.h new file mode 100644 index 0000000..0f44a56 --- /dev/null +++ b/clang/test/Modules/Inputs/wildcard-submodule-exports/B_one.h @@ -0,0 +1 @@ +short *B1; diff --git a/clang/test/Modules/Inputs/wildcard-submodule-exports/B_two.h b/clang/test/Modules/Inputs/wildcard-submodule-exports/B_two.h new file mode 100644 index 0000000..0e51242 --- /dev/null +++ b/clang/test/Modules/Inputs/wildcard-submodule-exports/B_two.h @@ -0,0 +1 @@ +unsigned short *B2; diff --git a/clang/test/Modules/Inputs/wildcard-submodule-exports/C_one.h b/clang/test/Modules/Inputs/wildcard-submodule-exports/C_one.h new file mode 100644 index 0000000..fb1c7de --- /dev/null +++ b/clang/test/Modules/Inputs/wildcard-submodule-exports/C_one.h @@ -0,0 +1,4 @@ +@__experimental_modules_import A.One; +@__experimental_modules_import B.One; + +long *C1; diff --git a/clang/test/Modules/Inputs/wildcard-submodule-exports/C_two.h b/clang/test/Modules/Inputs/wildcard-submodule-exports/C_two.h new file mode 100644 index 0000000..050a8f3 --- /dev/null +++ b/clang/test/Modules/Inputs/wildcard-submodule-exports/C_two.h @@ -0,0 +1,4 @@ +@__experimental_modules_import A.Two; +@__experimental_modules_import B.Two; + +unsigned long *C2; diff --git a/clang/test/Modules/Inputs/wildcard-submodule-exports/module.map b/clang/test/Modules/Inputs/wildcard-submodule-exports/module.map new file mode 100644 index 0000000..64b0d89 --- /dev/null +++ b/clang/test/Modules/Inputs/wildcard-submodule-exports/module.map @@ -0,0 +1,20 @@ +module A { + module One { header "A_one.h" } + module Two { header "A_two.h" } +} + +module B { + module One { header "B_one.h" } + module Two { header "B_two.h" } +} + +module C { + module One { + header "C_one.h" + export A.* + } + module Two { + header "C_two.h" + export * + } +} |