diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
| commit | bfef399519ca9b8a4b4c6b563253bad7e0eeffe0 (patch) | |
| tree | df8df0b0067b381eab470a3b8f28d14a552a6340 /test/Modules/Inputs | |
| parent | 6a0372513edbc473b538d2f724efac50405d6fef (diff) | |
Notes
Diffstat (limited to 'test/Modules/Inputs')
75 files changed, 620 insertions, 1 deletions
diff --git a/test/Modules/Inputs/DependsOnModule.framework/Headers/not_cxx.h b/test/Modules/Inputs/DependsOnModule.framework/Headers/not_cxx.h new file mode 100644 index 000000000000..c29a9219c64c --- /dev/null +++ b/test/Modules/Inputs/DependsOnModule.framework/Headers/not_cxx.h @@ -0,0 +1 @@ +extern int template; diff --git a/test/Modules/Inputs/DependsOnModule.framework/Headers/not_objc.h b/test/Modules/Inputs/DependsOnModule.framework/Headers/not_objc.h new file mode 100644 index 000000000000..f63975a25d16 --- /dev/null +++ b/test/Modules/Inputs/DependsOnModule.framework/Headers/not_objc.h @@ -0,0 +1 @@ +int NSObject; diff --git a/test/Modules/Inputs/DependsOnModule.framework/module.map b/test/Modules/Inputs/DependsOnModule.framework/module.map index 2a3dd8038bd1..5a1cacaad2a3 100644 --- a/test/Modules/Inputs/DependsOnModule.framework/module.map +++ b/test/Modules/Inputs/DependsOnModule.framework/module.map @@ -8,6 +8,14 @@ framework module DependsOnModule { requires cplusplus header "cxx_other.h" } + explicit module NotCXX { + requires !cplusplus + header "not_cxx.h" + } + explicit module NotObjC { + requires !objc + header "not_objc.h" + } explicit framework module SubFramework { umbrella header "SubFramework.h" diff --git a/test/Modules/Inputs/MethodPoolBSub.h b/test/Modules/Inputs/MethodPoolBSub.h index 0a7899df81b7..fbfc0aa14392 100644 --- a/test/Modules/Inputs/MethodPoolBSub.h +++ b/test/Modules/Inputs/MethodPoolBSub.h @@ -1,4 +1,5 @@ @interface B (Sub) - (char *)method3; - (char*)method4; +- (id)method6; @end diff --git a/test/Modules/Inputs/MethodPoolBSub2.h b/test/Modules/Inputs/MethodPoolBSub2.h new file mode 100644 index 000000000000..8bc369f73e85 --- /dev/null +++ b/test/Modules/Inputs/MethodPoolBSub2.h @@ -0,0 +1,3 @@ +@interface TotallyUnrelated +- (id)method6; +@end diff --git a/test/Modules/Inputs/System/usr/include/stdio.h b/test/Modules/Inputs/System/usr/include/stdio.h index 9a7b1063032c..f41e09c35a41 100644 --- a/test/Modules/Inputs/System/usr/include/stdio.h +++ b/test/Modules/Inputs/System/usr/include/stdio.h @@ -1,3 +1,3 @@ typedef struct { int id; } FILE; int fprintf(FILE*restrict, const char* restrict format, ...); - +extern FILE *__stderrp; diff --git a/test/Modules/Inputs/cxx-decls-imported.h b/test/Modules/Inputs/cxx-decls-imported.h new file mode 100644 index 000000000000..b94368614dfb --- /dev/null +++ b/test/Modules/Inputs/cxx-decls-imported.h @@ -0,0 +1,5 @@ +class HasFriends { + friend void friend_1(HasFriends); + friend void friend_2(HasFriends); + void private_thing(); +}; diff --git a/test/Modules/Inputs/cxx-decls-unimported.h b/test/Modules/Inputs/cxx-decls-unimported.h new file mode 100644 index 000000000000..0431e324616e --- /dev/null +++ b/test/Modules/Inputs/cxx-decls-unimported.h @@ -0,0 +1 @@ +void operator delete(void*); diff --git a/test/Modules/Inputs/cxx-templates-a.h b/test/Modules/Inputs/cxx-templates-a.h new file mode 100644 index 000000000000..0b1614d3d9e6 --- /dev/null +++ b/test/Modules/Inputs/cxx-templates-a.h @@ -0,0 +1,50 @@ +@import cxx_templates_common; + +template<typename T> T f() { return T(); } +template<typename T> T f(T); +namespace N { + template<typename T> T f() { return T(); } + template<typename T> T f(T); +} + +template<int N> int template_param_kinds_1(); +template<template<typename T, int, int> class> int template_param_kinds_2(); +template<template<typename T, typename U, T> class> int template_param_kinds_3(); + +template<typename T> struct SomeTemplate<T*>; +template<typename T> struct SomeTemplate<T*> {}; +typedef SomeTemplate<int*> SomeTemplateIntPtr; + +template<typename T> void PerformDelayedLookup(T &t) { + t.f(); + typename T::Inner inner; + FoundByADL(t); +} + +template<typename T> void PerformDelayedLookupInDefaultArgument(T &t, int a = (FoundByADL(T()), 0)) {} + +template<typename T> struct RedeclaredAsFriend {}; + +void use_some_template_a() { + SomeTemplate<char[2]> a; + SomeTemplate<char[1]> b, c; + b = c; +} + +template<int> struct MergeTemplates; +MergeTemplates<0> *merge_templates_a; + +auto enum_a_from_a = CommonTemplate<int>::a; +const auto enum_c_from_a = CommonTemplate<int>::c; + +template<int> struct UseInt; +template<typename T> void UseRedeclaredEnum(UseInt<T() + CommonTemplate<char>::a>); +constexpr void (*UseRedeclaredEnumA)(UseInt<1>) = UseRedeclaredEnum<int>; + +template<typename> struct MergeSpecializations; +template<typename T> struct MergeSpecializations<T*> { + typedef int partially_specialized_in_a; +}; +template<> struct MergeSpecializations<char> { + typedef int explicitly_specialized_in_a; +}; diff --git a/test/Modules/Inputs/cxx-templates-b-impl.h b/test/Modules/Inputs/cxx-templates-b-impl.h new file mode 100644 index 000000000000..fdf4a4fbc4d4 --- /dev/null +++ b/test/Modules/Inputs/cxx-templates-b-impl.h @@ -0,0 +1,5 @@ +struct DefinedInBImpl { + void f(); + struct Inner {}; + friend void FoundByADL(DefinedInBImpl); +}; diff --git a/test/Modules/Inputs/cxx-templates-b.h b/test/Modules/Inputs/cxx-templates-b.h new file mode 100644 index 000000000000..6cd83faf1a1b --- /dev/null +++ b/test/Modules/Inputs/cxx-templates-b.h @@ -0,0 +1,69 @@ +@import cxx_templates_common; + +template<typename T> T f(); +template<typename T> T f(T t) { return t; } +namespace N { + template<typename T> T f(); + template<typename T> T f(T t) { return t; } +} + +template<typename> int template_param_kinds_1(); +template<template<typename, int, int...> class> int template_param_kinds_2(); +template<template<typename T, typename U, U> class> int template_param_kinds_3(); + +template<typename T> struct SomeTemplate<T&> {}; +template<typename T> struct SomeTemplate<T&>; +typedef SomeTemplate<int&> SomeTemplateIntRef; + +extern DefinedInCommon &defined_in_common; + +template<int> struct MergeTemplates; +MergeTemplates<0> *merge_templates_b; + +@import cxx_templates_b_impl; + +template<typename T, typename> struct Identity { typedef T type; }; +template<typename T> void UseDefinedInBImpl() { + typename Identity<DefinedInBImpl, T>::type dependent; + FoundByADL(dependent); + typename Identity<DefinedInBImpl, T>::type::Inner inner; + dependent.f(); +} + +extern DefinedInBImpl &defined_in_b_impl; + +template<typename T> +struct RedeclareTemplateAsFriend { + template<typename U> + friend struct RedeclaredAsFriend; +}; + +void use_some_template_b() { + SomeTemplate<char[1]> a; + SomeTemplate<char[2]> b, c; + b = c; +} + +auto enum_b_from_b = CommonTemplate<int>::b; +const auto enum_c_from_b = CommonTemplate<int>::c; + +template<int> struct UseInt; +template<typename T> void UseRedeclaredEnum(UseInt<T() + CommonTemplate<char>::a>); +constexpr void (*UseRedeclaredEnumB)(UseInt<1>) = UseRedeclaredEnum<int>; + +template<typename> struct MergeSpecializations; +template<typename T> struct MergeSpecializations<T&> { + typedef int partially_specialized_in_b; +}; +template<> struct MergeSpecializations<double> { + typedef int explicitly_specialized_in_b; +}; + +@import cxx_templates_a; +template<typename T> void UseDefinedInBImplIndirectly(T &v) { + PerformDelayedLookup(v); +} + +void TriggerInstantiation() { + UseDefinedInBImpl<void>(); +} diff --git a/test/Modules/Inputs/cxx-templates-c.h b/test/Modules/Inputs/cxx-templates-c.h new file mode 100644 index 000000000000..4c0fc8a4a825 --- /dev/null +++ b/test/Modules/Inputs/cxx-templates-c.h @@ -0,0 +1,7 @@ +template<typename> struct MergeSpecializations; +template<typename T> struct MergeSpecializations<T[]> { + typedef int partially_specialized_in_c; +}; +template<> struct MergeSpecializations<bool> { + typedef int explicitly_specialized_in_c; +}; diff --git a/test/Modules/Inputs/cxx-templates-common.h b/test/Modules/Inputs/cxx-templates-common.h new file mode 100644 index 000000000000..40a11e20b4f0 --- /dev/null +++ b/test/Modules/Inputs/cxx-templates-common.h @@ -0,0 +1,11 @@ +template<typename T> struct SomeTemplate {}; + +struct DefinedInCommon { + void f(); + struct Inner {}; + friend void FoundByADL(DefinedInCommon); +}; + +template<typename T> struct CommonTemplate { + enum E { a = 1, b = 2, c = 3 }; +}; diff --git a/test/Modules/Inputs/declare-use/a.h b/test/Modules/Inputs/declare-use/a.h new file mode 100644 index 000000000000..a36dc1b59d6f --- /dev/null +++ b/test/Modules/Inputs/declare-use/a.h @@ -0,0 +1,4 @@ +#ifndef A_H +#define A_H +const int a = 2; +#endif diff --git a/test/Modules/Inputs/declare-use/b.h b/test/Modules/Inputs/declare-use/b.h new file mode 100644 index 000000000000..55daf7286801 --- /dev/null +++ b/test/Modules/Inputs/declare-use/b.h @@ -0,0 +1,4 @@ +#ifndef B_H +#define B_H +const int b = 3; +#endif diff --git a/test/Modules/Inputs/declare-use/c.h b/test/Modules/Inputs/declare-use/c.h new file mode 100644 index 000000000000..a24cd5ae44c0 --- /dev/null +++ b/test/Modules/Inputs/declare-use/c.h @@ -0,0 +1,6 @@ +#ifndef C_H +#define C_H +#include "a.h" +#include "b.h" +const int c = a+b; +#endif diff --git a/test/Modules/Inputs/declare-use/d.h b/test/Modules/Inputs/declare-use/d.h new file mode 100644 index 000000000000..a597b01c5d04 --- /dev/null +++ b/test/Modules/Inputs/declare-use/d.h @@ -0,0 +1,6 @@ +#ifndef D_H +#define D_H +#include "a.h" +#include "b.h" +const int d = a+b; +#endif diff --git a/test/Modules/Inputs/declare-use/e.h b/test/Modules/Inputs/declare-use/e.h new file mode 100644 index 000000000000..ed8d843f9a85 --- /dev/null +++ b/test/Modules/Inputs/declare-use/e.h @@ -0,0 +1,6 @@ +#ifndef E_H +#define E_H +#include "a.h" +#include "b.h" +const int e = a*b; +#endif diff --git a/test/Modules/Inputs/declare-use/f.h b/test/Modules/Inputs/declare-use/f.h new file mode 100644 index 000000000000..1d8e2fd2881e --- /dev/null +++ b/test/Modules/Inputs/declare-use/f.h @@ -0,0 +1,6 @@ +#ifndef F_H +#define F_H +#include "a.h" +#include "b.h" +const int f = a+b; +#endif diff --git a/test/Modules/Inputs/declare-use/g.h b/test/Modules/Inputs/declare-use/g.h new file mode 100644 index 000000000000..2a590177f8c3 --- /dev/null +++ b/test/Modules/Inputs/declare-use/g.h @@ -0,0 +1,6 @@ +#ifndef G_H +#define G_H +#include "c.h" +#include "g1.h" +const int g1 = aux_g*c*7; +#endif diff --git a/test/Modules/Inputs/declare-use/g1.h b/test/Modules/Inputs/declare-use/g1.h new file mode 100644 index 000000000000..78a072451f81 --- /dev/null +++ b/test/Modules/Inputs/declare-use/g1.h @@ -0,0 +1 @@ +int aux_g = 11; diff --git a/test/Modules/Inputs/declare-use/h.h b/test/Modules/Inputs/declare-use/h.h new file mode 100644 index 000000000000..df99a6dd10ae --- /dev/null +++ b/test/Modules/Inputs/declare-use/h.h @@ -0,0 +1,7 @@ +#ifndef H_H +#define H_H +#include "c.h" +#include "d.h" // expected-error {{use of a module not declared used}} +#include "h1.h" +const int h1 = aux_h*c*7*d; +#endif diff --git a/test/Modules/Inputs/declare-use/h1.h b/test/Modules/Inputs/declare-use/h1.h new file mode 100644 index 000000000000..a9275d555c34 --- /dev/null +++ b/test/Modules/Inputs/declare-use/h1.h @@ -0,0 +1 @@ +int aux_h = 13; diff --git a/test/Modules/Inputs/declare-use/module.map b/test/Modules/Inputs/declare-use/module.map new file mode 100644 index 000000000000..774fc37760c9 --- /dev/null +++ b/test/Modules/Inputs/declare-use/module.map @@ -0,0 +1,43 @@ +module XA { + header "a.h" +} + +module XB { + header "b.h" +} + +module XC { + header "c.h" + use XA +} + +module XD { + header "d.h" + use XA +} + +module XE { + header "e.h" + use XA + use XB +} + +module XF { + header "f.h" + use XA + use XB +} + +module XG { + header "g.h" + header "g1.h" + use XC + use XE +} + +module XH { + header "h.h" + header "h1.h" + use XC + use XE +} diff --git a/test/Modules/Inputs/def.h b/test/Modules/Inputs/def.h index eb7eb7e59dc1..6fa83d3eec75 100644 --- a/test/Modules/Inputs/def.h +++ b/test/Modules/Inputs/def.h @@ -17,4 +17,11 @@ class Def2 { public: void func(); }; + +namespace Def3NS { + class Def3 { + public: + void func(); + }; +} #endif diff --git a/test/Modules/Inputs/dummy.h b/test/Modules/Inputs/dummy.h new file mode 100644 index 000000000000..6e1ac74e44fb --- /dev/null +++ b/test/Modules/Inputs/dummy.h @@ -0,0 +1,3 @@ +// This module only exists to make local decl IDs and global decl IDs different. + +struct Dummy {} extern *dummy1, *dummy2, *dummy3; diff --git a/test/Modules/Inputs/incomplete_mod.h b/test/Modules/Inputs/incomplete_mod.h new file mode 100644 index 000000000000..f08be7244136 --- /dev/null +++ b/test/Modules/Inputs/incomplete_mod.h @@ -0,0 +1 @@ +#include "incomplete_mod_missing.h" diff --git a/test/Modules/Inputs/incomplete_mod_missing.h b/test/Modules/Inputs/incomplete_mod_missing.h new file mode 100644 index 000000000000..ffc85d5e7305 --- /dev/null +++ b/test/Modules/Inputs/incomplete_mod_missing.h @@ -0,0 +1,2 @@ +extern int *missing; + diff --git a/test/Modules/Inputs/initializer_list b/test/Modules/Inputs/initializer_list new file mode 100644 index 000000000000..6058f803a3dd --- /dev/null +++ b/test/Modules/Inputs/initializer_list @@ -0,0 +1,9 @@ +namespace std { + using size_t = decltype(sizeof(0)); + + template<typename T> struct initializer_list { + initializer_list(T*, size_t); + }; + + template<typename T> int min(initializer_list<T>); +} diff --git a/test/Modules/Inputs/modular_maps/a.h b/test/Modules/Inputs/modular_maps/a.h new file mode 100644 index 000000000000..a36dc1b59d6f --- /dev/null +++ b/test/Modules/Inputs/modular_maps/a.h @@ -0,0 +1,4 @@ +#ifndef A_H +#define A_H +const int a = 2; +#endif diff --git a/test/Modules/Inputs/modular_maps/b.h b/test/Modules/Inputs/modular_maps/b.h new file mode 100644 index 000000000000..55daf7286801 --- /dev/null +++ b/test/Modules/Inputs/modular_maps/b.h @@ -0,0 +1,4 @@ +#ifndef B_H +#define B_H +const int b = 3; +#endif diff --git a/test/Modules/Inputs/modular_maps/common.h b/test/Modules/Inputs/modular_maps/common.h new file mode 100644 index 000000000000..f690bcbd399b --- /dev/null +++ b/test/Modules/Inputs/modular_maps/common.h @@ -0,0 +1,4 @@ +#ifndef COMMON_H +#define COMMON_H +const int c = 2; +#endif diff --git a/test/Modules/Inputs/modular_maps/modulea.map b/test/Modules/Inputs/modular_maps/modulea.map new file mode 100644 index 000000000000..58c5f6464e40 --- /dev/null +++ b/test/Modules/Inputs/modular_maps/modulea.map @@ -0,0 +1,7 @@ +module A { + header "common.h" + header "a.h" +} + +extern module B "moduleb.map" + diff --git a/test/Modules/Inputs/modular_maps/moduleb.map b/test/Modules/Inputs/modular_maps/moduleb.map new file mode 100644 index 000000000000..7b35e8f91e44 --- /dev/null +++ b/test/Modules/Inputs/modular_maps/moduleb.map @@ -0,0 +1,4 @@ +module B { + header "common.h" + private header "b.h" +} diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index d20521f9c764..cf8a298ccee7 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -131,6 +131,10 @@ module MethodPoolA { module MethodPoolB { header "MethodPoolB.h" + explicit module Sub2 { + header "MethodPoolBSub2.h" + } + explicit module Sub { header "MethodPoolBSub.h" } @@ -184,6 +188,35 @@ module cxx_linkage_cache { header "cxx-linkage-cache.h" } +module cxx_templates_common { + header "cxx-templates-common.h" +} + +module cxx_templates_a { + header "cxx-templates-a.h" +} + +module cxx_templates_b_impl { + header "cxx-templates-b-impl.h" +} + +module cxx_templates_b { + header "cxx-templates-b.h" +} + +module cxx_templates_c { + header "cxx-templates-c.h" +} + +module cxx_decls { + module unimported { + header "cxx-decls-unimported.h" + } + module imported { + header "cxx-decls-imported.h" + } +} + module config { header "config.h" config_macros [exhaustive] WANT_FOO, WANT_BAR @@ -193,6 +226,10 @@ module diag_pragma { header "diag_pragma.h" } +module dummy { + header "dummy.h" +} + module builtin { header "builtin.h" explicit module sub { @@ -209,3 +246,38 @@ module linkage_merge { } } + +module incomplete_mod { + header "incomplete_mod.h" +} + +module warning { + header "warning.h" +} + +module initializer_list { + header "initializer_list" +} + +module using_decl { + module a { header "using-decl-a.h" export * } + module b { header "using-decl-b.h" export * } +} + +module recursive_visibility_a1 { + module inner { header "recursive_visibility_a1_inner.h" } +} +module recursive_visibility_a2 { + module inner { + module more_inner { + header "recursive_visibility_a2_more_inner.h" + } + } +} +module recursive_visibility_b { + header "recursive_visibility_b.h" + export * +} +module recursive_visibility_c { + header "recursive_visibility_c.h" +} diff --git a/test/Modules/Inputs/namespaces-top.h b/test/Modules/Inputs/namespaces-top.h index 0c607f528516..7aa8490eb7e1 100644 --- a/test/Modules/Inputs/namespaces-top.h +++ b/test/Modules/Inputs/namespaces-top.h @@ -12,3 +12,8 @@ namespace N3 { namespace N12 { } +namespace N13 { + void f(); + int f(int); + void (*p)() = &f; +} diff --git a/test/Modules/Inputs/odr/a.h b/test/Modules/Inputs/odr/a.h new file mode 100644 index 000000000000..26144b86e8d1 --- /dev/null +++ b/test/Modules/Inputs/odr/a.h @@ -0,0 +1,13 @@ +extern struct Y { + int n; + float f; +} y1; +enum E { e1 }; + +struct X { + int n; +} x1; + +int f() { + return y1.n + e1 + y1.f + x1.n; +} diff --git a/test/Modules/Inputs/odr/b.h b/test/Modules/Inputs/odr/b.h new file mode 100644 index 000000000000..b4063979474f --- /dev/null +++ b/test/Modules/Inputs/odr/b.h @@ -0,0 +1,9 @@ +struct Y { + int m; + double f; +} y2; +enum E { e2 }; + +int g() { + return y2.m + e2 + y2.f; +} diff --git a/test/Modules/Inputs/odr/module.map b/test/Modules/Inputs/odr/module.map new file mode 100644 index 000000000000..81f396342fac --- /dev/null +++ b/test/Modules/Inputs/odr/module.map @@ -0,0 +1,6 @@ +module a { + header "a.h" +} +module b { + header "b.h" +} diff --git a/test/Modules/Inputs/pch-used.h b/test/Modules/Inputs/pch-used.h new file mode 100644 index 000000000000..60e0097ea909 --- /dev/null +++ b/test/Modules/Inputs/pch-used.h @@ -0,0 +1,2 @@ +@import cstd.stdio; +static inline void SPXTrace() { fprintf(__stderrp, ""); } diff --git a/test/Modules/Inputs/private/common.h b/test/Modules/Inputs/private/common.h new file mode 100644 index 000000000000..17d5444b650f --- /dev/null +++ b/test/Modules/Inputs/private/common.h @@ -0,0 +1,6 @@ +#ifndef COMMON_H +#define COMMON_H + +typedef int common; + +#endif diff --git a/test/Modules/Inputs/private/module.map b/test/Modules/Inputs/private/module.map new file mode 100644 index 000000000000..9da44354be14 --- /dev/null +++ b/test/Modules/Inputs/private/module.map @@ -0,0 +1,9 @@ +module libPrivate1 { + header "public1.h" + private header "private1.h" +} + +module libPrivate2 { + header "public2.h" + private header "private2.h" +} diff --git a/test/Modules/Inputs/private/private1.h b/test/Modules/Inputs/private/private1.h new file mode 100644 index 000000000000..3f41cc0181d5 --- /dev/null +++ b/test/Modules/Inputs/private/private1.h @@ -0,0 +1,9 @@ +#ifndef PRIVATE1_H +#define PRIVATE1_H + +#include "common.h" + +struct mitts_off1 { common field; }; +struct mitts_off1 hidden_variable1; + +#endif diff --git a/test/Modules/Inputs/private/private2.h b/test/Modules/Inputs/private/private2.h new file mode 100644 index 000000000000..3b6cddc4d902 --- /dev/null +++ b/test/Modules/Inputs/private/private2.h @@ -0,0 +1,9 @@ +#ifndef PRIVATE2_H +#define PRIVATE2_H + +#include "common.h" + +struct mitts_off2 { common field; }; +struct mitts_off2 hidden_variable2; + +#endif diff --git a/test/Modules/Inputs/private/public1.h b/test/Modules/Inputs/private/public1.h new file mode 100644 index 000000000000..3af596a98d08 --- /dev/null +++ b/test/Modules/Inputs/private/public1.h @@ -0,0 +1,9 @@ +#ifndef PUBLIC1_H +#define PUBLIC1_H + +#include "private1.h" + +struct use_this1 { struct mitts_off1 field; }; +struct use_this1 public_variable1; + +#endif diff --git a/test/Modules/Inputs/private/public2.h b/test/Modules/Inputs/private/public2.h new file mode 100644 index 000000000000..03d0a858e10e --- /dev/null +++ b/test/Modules/Inputs/private/public2.h @@ -0,0 +1,9 @@ +#ifndef PUBLIC2_H +#define PUBLIC2_H + +#include "private2.h" + +struct use_this2 { struct mitts_off2 field; }; +struct use_this2 public_variable2; + +#endif diff --git a/test/Modules/Inputs/private0/common.h b/test/Modules/Inputs/private0/common.h new file mode 100644 index 000000000000..17d5444b650f --- /dev/null +++ b/test/Modules/Inputs/private0/common.h @@ -0,0 +1,6 @@ +#ifndef COMMON_H +#define COMMON_H + +typedef int common; + +#endif diff --git a/test/Modules/Inputs/private1/module.map b/test/Modules/Inputs/private1/module.map new file mode 100644 index 000000000000..0904fe68a62c --- /dev/null +++ b/test/Modules/Inputs/private1/module.map @@ -0,0 +1,4 @@ +module libPrivate { + header "public1.h" + private header "private1.h" +} diff --git a/test/Modules/Inputs/private1/private1.h b/test/Modules/Inputs/private1/private1.h new file mode 100644 index 000000000000..3f41cc0181d5 --- /dev/null +++ b/test/Modules/Inputs/private1/private1.h @@ -0,0 +1,9 @@ +#ifndef PRIVATE1_H +#define PRIVATE1_H + +#include "common.h" + +struct mitts_off1 { common field; }; +struct mitts_off1 hidden_variable1; + +#endif diff --git a/test/Modules/Inputs/private1/public1.h b/test/Modules/Inputs/private1/public1.h new file mode 100644 index 000000000000..3af596a98d08 --- /dev/null +++ b/test/Modules/Inputs/private1/public1.h @@ -0,0 +1,9 @@ +#ifndef PUBLIC1_H +#define PUBLIC1_H + +#include "private1.h" + +struct use_this1 { struct mitts_off1 field; }; +struct use_this1 public_variable1; + +#endif diff --git a/test/Modules/Inputs/private2/module.map b/test/Modules/Inputs/private2/module.map new file mode 100644 index 000000000000..3d2a5786f9b1 --- /dev/null +++ b/test/Modules/Inputs/private2/module.map @@ -0,0 +1,4 @@ +module libPrivateN2 { + header "public2.h" + private header "private2.h" +} diff --git a/test/Modules/Inputs/private2/private2.h b/test/Modules/Inputs/private2/private2.h new file mode 100644 index 000000000000..3b6cddc4d902 --- /dev/null +++ b/test/Modules/Inputs/private2/private2.h @@ -0,0 +1,9 @@ +#ifndef PRIVATE2_H +#define PRIVATE2_H + +#include "common.h" + +struct mitts_off2 { common field; }; +struct mitts_off2 hidden_variable2; + +#endif diff --git a/test/Modules/Inputs/private2/public2.h b/test/Modules/Inputs/private2/public2.h new file mode 100644 index 000000000000..03d0a858e10e --- /dev/null +++ b/test/Modules/Inputs/private2/public2.h @@ -0,0 +1,9 @@ +#ifndef PUBLIC2_H +#define PUBLIC2_H + +#include "private2.h" + +struct use_this2 { struct mitts_off2 field; }; +struct use_this2 public_variable2; + +#endif diff --git a/test/Modules/Inputs/recursive_visibility_a1_inner.h b/test/Modules/Inputs/recursive_visibility_a1_inner.h new file mode 100644 index 000000000000..0f9fdf709ba5 --- /dev/null +++ b/test/Modules/Inputs/recursive_visibility_a1_inner.h @@ -0,0 +1,4 @@ +namespace A1_Inner { + struct X {}; + void f(X); +} diff --git a/test/Modules/Inputs/recursive_visibility_a2_more_inner.h b/test/Modules/Inputs/recursive_visibility_a2_more_inner.h new file mode 100644 index 000000000000..a9ff9d90af1b --- /dev/null +++ b/test/Modules/Inputs/recursive_visibility_a2_more_inner.h @@ -0,0 +1,4 @@ +namespace A2_More_Inner { + struct X {}; + void f(X); +} diff --git a/test/Modules/Inputs/recursive_visibility_b.h b/test/Modules/Inputs/recursive_visibility_b.h new file mode 100644 index 000000000000..2c5d4effe330 --- /dev/null +++ b/test/Modules/Inputs/recursive_visibility_b.h @@ -0,0 +1,2 @@ +@import recursive_visibility_a1.inner; +@import recursive_visibility_a2; diff --git a/test/Modules/Inputs/recursive_visibility_c.h b/test/Modules/Inputs/recursive_visibility_c.h new file mode 100644 index 000000000000..a978a3c0a562 --- /dev/null +++ b/test/Modules/Inputs/recursive_visibility_c.h @@ -0,0 +1,5 @@ +@import recursive_visibility_b; +template<template<typename T> class Y> void g() { + f(typename Y<A1_Inner::X>::type{}); + f(typename Y<A2_More_Inner::X>::type{}); +} diff --git a/test/Modules/Inputs/separate_map_tree/maps/modulea.map b/test/Modules/Inputs/separate_map_tree/maps/modulea.map new file mode 100644 index 000000000000..736503ecaebe --- /dev/null +++ b/test/Modules/Inputs/separate_map_tree/maps/modulea.map @@ -0,0 +1,12 @@ +module D { + header "../src/common.h" +} + +module A { + header "../src/common.h" + use C +} + +extern module B "moduleb.map" +extern module C "modulec.map" + diff --git a/test/Modules/Inputs/separate_map_tree/maps/moduleb.map b/test/Modules/Inputs/separate_map_tree/maps/moduleb.map new file mode 100644 index 000000000000..d3877965c71e --- /dev/null +++ b/test/Modules/Inputs/separate_map_tree/maps/moduleb.map @@ -0,0 +1,4 @@ +module B { + header "../src/public-in-b.h" + private header "../src/public-in-c.h" +} diff --git a/test/Modules/Inputs/separate_map_tree/maps/modulec.map b/test/Modules/Inputs/separate_map_tree/maps/modulec.map new file mode 100644 index 000000000000..91063b65f378 --- /dev/null +++ b/test/Modules/Inputs/separate_map_tree/maps/modulec.map @@ -0,0 +1,5 @@ +module C { + header "../src/public-in-c.h" + private header "../src/public-in-b.h" + private header "../src/private-in-c.h" +} diff --git a/test/Modules/Inputs/separate_map_tree/src/common.h b/test/Modules/Inputs/separate_map_tree/src/common.h new file mode 100644 index 000000000000..1d2ecb5a194d --- /dev/null +++ b/test/Modules/Inputs/separate_map_tree/src/common.h @@ -0,0 +1,4 @@ +#ifndef COMMON_H +#define COMMON_H +const int common = 2; +#endif diff --git a/test/Modules/Inputs/separate_map_tree/src/private-in-c.h b/test/Modules/Inputs/separate_map_tree/src/private-in-c.h new file mode 100644 index 000000000000..bc9e2c1bb342 --- /dev/null +++ b/test/Modules/Inputs/separate_map_tree/src/private-in-c.h @@ -0,0 +1,4 @@ +#ifndef PRIVATE_IN_C_H +#define PRIVATE_IN_C_H +const int c_ = 2; +#endif diff --git a/test/Modules/Inputs/separate_map_tree/src/public-in-b.h b/test/Modules/Inputs/separate_map_tree/src/public-in-b.h new file mode 100644 index 000000000000..9ea6c1b4410d --- /dev/null +++ b/test/Modules/Inputs/separate_map_tree/src/public-in-b.h @@ -0,0 +1,4 @@ +#ifndef PUBLIC_IN_B_H +#define PUBLIC_IN_B_H +const int b = 3; +#endif diff --git a/test/Modules/Inputs/separate_map_tree/src/public-in-c.h b/test/Modules/Inputs/separate_map_tree/src/public-in-c.h new file mode 100644 index 000000000000..fa3d2fd2cb73 --- /dev/null +++ b/test/Modules/Inputs/separate_map_tree/src/public-in-c.h @@ -0,0 +1,4 @@ +#ifndef PUBLIC_IN_C_H +#define PUBLIC_IN_C_H +const int c = 2; +#endif diff --git a/test/Modules/Inputs/submodules/import-self-a.h b/test/Modules/Inputs/submodules/import-self-a.h new file mode 100644 index 000000000000..adb070abf362 --- /dev/null +++ b/test/Modules/Inputs/submodules/import-self-a.h @@ -0,0 +1 @@ +typedef int MyTypeA; diff --git a/test/Modules/Inputs/submodules/import-self-b.h b/test/Modules/Inputs/submodules/import-self-b.h new file mode 100644 index 000000000000..f88b56d5f082 --- /dev/null +++ b/test/Modules/Inputs/submodules/import-self-b.h @@ -0,0 +1,10 @@ +@import import_self.c; +#include "import-self-d.h" + +// FIXME: This should not work; names from 'a' should not be visible here. +MyTypeA import_self_test_a; + +// FIXME: This should work but does not; names from 'b' are not actually visible here. +//MyTypeC import_self_test_c; + +MyTypeD import_self_test_d; diff --git a/test/Modules/Inputs/submodules/import-self-c.h b/test/Modules/Inputs/submodules/import-self-c.h new file mode 100644 index 000000000000..f4b86c5656e1 --- /dev/null +++ b/test/Modules/Inputs/submodules/import-self-c.h @@ -0,0 +1 @@ +typedef int MyTypeC; diff --git a/test/Modules/Inputs/submodules/import-self-d.h b/test/Modules/Inputs/submodules/import-self-d.h new file mode 100644 index 000000000000..e32a6f51957c --- /dev/null +++ b/test/Modules/Inputs/submodules/import-self-d.h @@ -0,0 +1 @@ +typedef int MyTypeD; diff --git a/test/Modules/Inputs/submodules/module.map b/test/Modules/Inputs/submodules/module.map index 16cedac231e7..c91e94f47d23 100644 --- a/test/Modules/Inputs/submodules/module.map +++ b/test/Modules/Inputs/submodules/module.map @@ -3,3 +3,10 @@ module std { module type_traits { header "type_traits.h" } explicit module hash_map { header "hash_map.h" } } + +module import_self { + module a { header "import-self-a.h" } + module b { header "import-self-b.h" export * } + module c { header "import-self-c.h" } + module d { header "import-self-d.h" } +} diff --git a/test/Modules/Inputs/templates-left.h b/test/Modules/Inputs/templates-left.h index 7451420c7482..e76598d6bd5c 100644 --- a/test/Modules/Inputs/templates-left.h +++ b/test/Modules/Inputs/templates-left.h @@ -19,6 +19,10 @@ namespace N { }; } +constexpr unsigned List<int>::*size_left = &List<int>::size; +List<int> list_left = { 0, 8 }; +typedef List<int> ListInt_left; + template <typename T> void pendingInstantiationEmit(T) {} void triggerPendingInstantiation() { @@ -27,3 +31,5 @@ void triggerPendingInstantiation() { } void redeclDefinitionEmit(){} + +typedef Outer<int>::Inner OuterIntInner_left; diff --git a/test/Modules/Inputs/templates-right.h b/test/Modules/Inputs/templates-right.h index d3524d34769b..16d0a714d90e 100644 --- a/test/Modules/Inputs/templates-right.h +++ b/test/Modules/Inputs/templates-right.h @@ -18,6 +18,10 @@ namespace N { }; } +constexpr unsigned List<int>::*size_right = &List<int>::size; +List<int> list_right = { 0, 12 }; +typedef List<int> ListInt_right; + template <typename T> void pendingInstantiationEmit(T) {} void triggerPendingInstantiationToo() { @@ -25,3 +29,5 @@ void triggerPendingInstantiationToo() { } void redeclDefinitionEmit(){} + +typedef Outer<int>::Inner OuterIntInner_right; diff --git a/test/Modules/Inputs/templates-top.h b/test/Modules/Inputs/templates-top.h index 5985ee8820d6..87dcd8b7f465 100644 --- a/test/Modules/Inputs/templates-top.h +++ b/test/Modules/Inputs/templates-top.h @@ -3,6 +3,10 @@ template<typename T> class Vector; template<typename T> class List { public: void push_back(T); + + struct node {}; + node *head; + unsigned size; }; namespace A { @@ -15,3 +19,7 @@ template <typename T> class A::WhereAmI { public: static void func() {} }; + +template<typename T> struct Outer { + struct Inner {}; +}; diff --git a/test/Modules/Inputs/using-decl-a.h b/test/Modules/Inputs/using-decl-a.h new file mode 100644 index 000000000000..85a4788e7647 --- /dev/null +++ b/test/Modules/Inputs/using-decl-a.h @@ -0,0 +1,10 @@ +typedef int using_decl_type; +int using_decl_var; + +namespace UsingDecl { + using ::using_decl_type; + using ::using_decl_var; + + namespace A { typedef int inner; } + using A::inner; +} diff --git a/test/Modules/Inputs/using-decl-b.h b/test/Modules/Inputs/using-decl-b.h new file mode 100644 index 000000000000..b82526f39ff4 --- /dev/null +++ b/test/Modules/Inputs/using-decl-b.h @@ -0,0 +1,11 @@ +namespace UsingDecl { + namespace B { typedef int inner; } + using B::inner; +} + +#include "using-decl-a.h" + +namespace UsingDecl { + using ::using_decl_type; + using ::using_decl_var; +} diff --git a/test/Modules/Inputs/warning.h b/test/Modules/Inputs/warning.h new file mode 100644 index 000000000000..a90c62886749 --- /dev/null +++ b/test/Modules/Inputs/warning.h @@ -0,0 +1 @@ +enum { bigger_than_int = 0x80000000 }; |
