@@ -168,6 +168,18 @@ static LLType* rt_dg2()
168
168
return LLStructType::get (gIR ->context (), types, false );
169
169
}
170
170
171
+ template <typename DECL>
172
+ static void ensureDecl (DECL *decl, const char *msg)
173
+ {
174
+ if (!decl || !decl->type )
175
+ {
176
+ Logger::println (" Missing class declaration: %s\n " , msg);
177
+ error (Loc (), " Missing class declaration: %s" , msg);
178
+ errorSupplemental (Loc (), " Please check that object.di is included and valid" );
179
+ fatal ();
180
+ }
181
+ }
182
+
171
183
static void LLVM_D_BuildRuntimeModule ()
172
184
{
173
185
Logger::println (" building runtime module" );
@@ -187,10 +199,16 @@ static void LLVM_D_BuildRuntimeModule()
187
199
LLType* wstringTy = DtoType (Type::twchar->arrayOf ());
188
200
LLType* dstringTy = DtoType (Type::tdchar->arrayOf ());
189
201
202
+ ensureDecl (ClassDeclaration::object, " Object" );
190
203
LLType* objectTy = DtoType (ClassDeclaration::object->type );
204
+ ensureDecl (ClassDeclaration::classinfo, " ClassInfo" );
191
205
LLType* classInfoTy = DtoType (ClassDeclaration::classinfo->type );
206
+ ensureDecl (Type::typeinfo, " TypeInfo" );
192
207
LLType* typeInfoTy = DtoType (Type::typeinfo->type );
208
+ ensureDecl (Type::typeinfoassociativearray, " TypeInfo_AssociativeArray" );
193
209
LLType* aaTypeInfoTy = DtoType (Type::typeinfoassociativearray->type );
210
+ ensureDecl (Module::moduleinfo, " ModuleInfo" );
211
+ LLType* moduleInfoPtr = getPtrToType (DtoType (Module::moduleinfo->type ));
194
212
195
213
LLType* aaTy = rt_ptr (LLStructType::get (gIR ->context ()));
196
214
@@ -306,7 +324,7 @@ static void LLVM_D_BuildRuntimeModule()
306
324
llvm::StringRef fname (" _d_array_bounds" );
307
325
llvm::StringRef fname2 (" _d_switch_error" );
308
326
LLType *types[] = {
309
- getPtrToType ( DtoType (Module::moduleinfo-> type )) ,
327
+ moduleInfoPtr ,
310
328
intTy
311
329
};
312
330
LLFunctionType* fty = llvm::FunctionType::get (voidTy, types, false );
0 commit comments