48
48
// instantiation for v<int> in one of the two headers, because we will only
49
49
// parse one of the two get() functions.
50
50
51
+ #ifdef NS
51
52
#pragma clang module build m
52
53
module m {
53
54
module a {
@@ -60,9 +61,7 @@ module m {
60
61
#pragma clang module begin m.a
61
62
inline int non_trivial () { return 3 ; }
62
63
63
- #ifdef NS
64
64
namespace ns {
65
- #endif
66
65
67
66
int a = non_trivial();
68
67
inline int b = non_trivial();
@@ -102,12 +101,64 @@ inline void use(bool b, ...) {
102
101
X<int >::e<int >, X<int >::f<int >, X<int >::g<int >, X<int >::h<int >);
103
102
}
104
103
105
- #ifdef NS
106
104
}
107
- #endif
108
105
109
106
#pragma clang module end
110
107
#pragma clang module endbuild
108
+ #else
109
+ #pragma clang module build m
110
+ module m {
111
+ module a {
112
+ header " foo.h" { size 123 mtime 456789 }
113
+ }
114
+ module b {}
115
+ }
116
+
117
+ #pragma clang module contents
118
+ #pragma clang module begin m.a
119
+ inline int non_trivial () { return 3 ; }
120
+
121
+ int a = non_trivial();
122
+ inline int b = non_trivial();
123
+ thread_local int c = non_trivial();
124
+ inline thread_local int d = non_trivial();
125
+
126
+ template <typename U> int e = non_trivial();
127
+ template <typename U> inline int f = non_trivial();
128
+ template <typename U> thread_local int g = non_trivial();
129
+ template <typename U> inline thread_local int h = non_trivial();
130
+
131
+ inline int unused = 123 ; // should not be emitted
132
+
133
+ template <typename T> struct X {
134
+ static int a;
135
+ static inline int b = non_trivial();
136
+ static thread_local int c;
137
+ static inline thread_local int d = non_trivial();
138
+
139
+ template <typename U> static int e;
140
+ template <typename U> static inline int f = non_trivial();
141
+ template <typename U> static thread_local int g;
142
+ template <typename U> static inline thread_local int h = non_trivial();
143
+
144
+ static inline int unused = 123 ; // should not be emitted
145
+ };
146
+
147
+ template <typename T> int X<T>::a = non_trivial();
148
+ template <typename T> thread_local int X<T>::c = non_trivial();
149
+ template <typename T> template <typename U> int X<T>::e = non_trivial();
150
+ template <typename T> template <typename U> thread_local int X<T>::g = non_trivial();
151
+
152
+ inline void use (bool b, ...) {
153
+ if (b) return ;
154
+ use (true , e<int >, f<int >, g<int >, h<int >,
155
+ X<int >::a, X<int >::b, X<int >::c, X<int >::d,
156
+ X<int >::e<int >, X<int >::f<int >, X<int >::g<int >, X<int >::h<int >);
157
+ }
158
+
159
+ #pragma clang module end
160
+ #pragma clang module endbuild
161
+ #endif
111
162
112
163
#if IMPORT == 1
113
164
// Import the module and the m.a submodule; runs the ordered initializers and
0 commit comments