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.
This commit is contained in:
Christian Kamm 2009-05-21 10:56:04 +02:00
parent 8e56fe69a4
commit f675d36cfb
3 changed files with 9 additions and 4 deletions

View file

@ -1371,6 +1371,11 @@ bool mustDefineSymbol(Dsymbol* s)
{ {
if (fd->isArrayOp) if (fd->isArrayOp)
return true; 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); TemplateInstance* tinst = DtoIsTemplateInstance(s);

View file

@ -811,7 +811,6 @@ int main(int argc, char** argv)
*/ */
if (!global.params.useArrayBounds && !global.params.useAssert) if (!global.params.useArrayBounds && !global.params.useAssert)
{ {
#endif
// Do pass 3 semantic analysis on all imported modules, // Do pass 3 semantic analysis on all imported modules,
// since otherwise functions in them cannot be inlined // since otherwise functions in them cannot be inlined
for (int i = 0; i < Module::amodules.dim; i++) for (int i = 0; i < Module::amodules.dim; i++)
@ -823,7 +822,6 @@ int main(int argc, char** argv)
} }
if (global.errors) if (global.errors)
fatal(); fatal();
#if !IN_LLVM
} }
for (int i = 0; i < modules.dim; i++) for (int i = 0; i < modules.dim; i++)
@ -834,9 +832,9 @@ int main(int argc, char** argv)
m->inlineScan(); m->inlineScan();
} }
} }
#endif
if (global.errors) if (global.errors)
fatal(); fatal();
#endif
// write module dependencies to file if requested // write module dependencies to file if requested
if (global.params.moduleDepsFile != NULL) if (global.params.moduleDepsFile != NULL)

View file

@ -120,7 +120,9 @@ LLGlobalVariable * IrStruct::getInterfaceArraySymbol()
std::string name("_D"); std::string name("_D");
name.append(cd->mangle()); name.append(cd->mangle());
name.append("16__interfaceInfosZ"); 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; return classInterfacesArray;
} }