diff --git a/gen/irstate.cpp b/gen/irstate.cpp index 263b5162c3..6a4912351d 100644 --- a/gen/irstate.cpp +++ b/gen/irstate.cpp @@ -47,6 +47,7 @@ IRLoopScope::IRLoopScope(Statement* s, TryFinallyStatement* enclosingtryfinally, ////////////////////////////////////////////////////////////////////////////////////////// IRState::IRState() { + interfaceInfoType = NULL; dmodule = 0; module = 0; emitMain = false; diff --git a/gen/irstate.h b/gen/irstate.h index b276ac725a..5f4d60559d 100644 --- a/gen/irstate.h +++ b/gen/irstate.h @@ -77,6 +77,9 @@ struct IRState Module* dmodule; llvm::Module* module; + // interface info type, used in DtoInterfaceInfoType + llvm::StructType* interfaceInfoType; + // ir data associated with DMD Dsymbol nodes std::map irDsymbol; diff --git a/gen/tollvm.cpp b/gen/tollvm.cpp index 85290f6daf..e814677914 100644 --- a/gen/tollvm.cpp +++ b/gen/tollvm.cpp @@ -1789,9 +1789,8 @@ void DtoAnnotation(const char* str) const llvm::StructType* DtoInterfaceInfoType() { - static const llvm::StructType* t = NULL; - if (t) - return t; + if (gIR->interfaceInfoType) + return gIR->interfaceInfoType; // build interface info type std::vector types; @@ -1808,7 +1807,7 @@ const llvm::StructType* DtoInterfaceInfoType() // int offset types.push_back(llvm::Type::Int32Ty); // create type - t = llvm::StructType::get(types); + gIR->interfaceInfoType = llvm::StructType::get(types); - return t; + return gIR->interfaceInfoType; }