# HG changeset patch # User Christian Kamm # Date 1242896164 -7200 # Node ID e5c5d354c64979ba35d7a29dcf9014102772e943 # Parent 1311dabc6a1f01b986d99b90c16bba01001695d3 Tentative fix for semantic3 on imported modules and unnecessary template function definition issue. Please test! Also change linkage of __interfaceInfos to external (same as __Class, __vtbl, __init). The other change might make this superfluous. diff -r 1311dabc6a1f -r e5c5d354c649 gen/llvmhelpers.cpp --- a/gen/llvmhelpers.cpp Wed May 20 21:13:41 2009 +0200 +++ b/gen/llvmhelpers.cpp Thu May 21 10:56:04 2009 +0200 @@ -1371,6 +1371,11 @@ { if (fd->isArrayOp) return true; + + // we can't (and probably shouldn't?) define functions + // that weren't semantic3'ed + if (fd->semanticRun < 4) + return false; } TemplateInstance* tinst = DtoIsTemplateInstance(s); diff -r 1311dabc6a1f -r e5c5d354c649 gen/main.cpp --- a/gen/main.cpp Wed May 20 21:13:41 2009 +0200 +++ b/gen/main.cpp Thu May 21 10:56:04 2009 +0200 @@ -811,7 +811,6 @@ */ if (!global.params.useArrayBounds && !global.params.useAssert) { -#endif // Do pass 3 semantic analysis on all imported modules, // since otherwise functions in them cannot be inlined for (int i = 0; i < Module::amodules.dim; i++) @@ -823,7 +822,6 @@ } if (global.errors) fatal(); -#if !IN_LLVM } for (int i = 0; i < modules.dim; i++) @@ -834,9 +832,9 @@ m->inlineScan(); } } -#endif if (global.errors) fatal(); +#endif // write module dependencies to file if requested if (global.params.moduleDepsFile != NULL) diff -r 1311dabc6a1f -r e5c5d354c649 ir/irclass.cpp --- a/ir/irclass.cpp Wed May 20 21:13:41 2009 +0200 +++ b/ir/irclass.cpp Thu May 21 10:56:04 2009 +0200 @@ -120,7 +120,9 @@ std::string name("_D"); name.append(cd->mangle()); name.append("16__interfaceInfosZ"); - classInterfacesArray = new llvm::GlobalVariable(array_type, true, DtoLinkage(cd), NULL, name, classInfo); + + llvm::GlobalValue::LinkageTypes _linkage = DtoExternalLinkage(aggrdecl); + classInterfacesArray = new llvm::GlobalVariable(array_type, true, _linkage, NULL, name, classInfo); return classInterfacesArray; }