mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Replace template symbol module fix with more localized hack.
This reverts commit c4adbedcc, which would have fixed the
problem at its roots, but caused strange template function
attribute inference failures in D-YAML, presumably due to
the different order of semantic3 execution on the templates.
This commit is contained in:
@@ -962,13 +962,18 @@ DValue* DtoPaintType(Loc& loc, DValue* val, Type* to)
|
||||
// TEMPLATE HELPERS
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
TemplateInstance* DtoIsTemplateInstance(Dsymbol* s)
|
||||
TemplateInstance* DtoIsTemplateInstance(Dsymbol* s, bool checkLiteralOwner)
|
||||
{
|
||||
if (!s) return NULL;
|
||||
if (s->isTemplateInstance() && !s->isTemplateMixin())
|
||||
return s->isTemplateInstance();
|
||||
else if (s->parent)
|
||||
return DtoIsTemplateInstance(s->parent);
|
||||
if (FuncLiteralDeclaration* fld = s->isFuncLiteralDeclaration())
|
||||
{
|
||||
if (checkLiteralOwner && fld->owningTemplate)
|
||||
return fld->owningTemplate;
|
||||
}
|
||||
if (s->parent)
|
||||
return DtoIsTemplateInstance(s->parent, checkLiteralOwner);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1676,7 +1681,7 @@ bool mustDefineSymbol(Dsymbol* s)
|
||||
return false;
|
||||
}
|
||||
|
||||
TemplateInstance* tinst = DtoIsTemplateInstance(s);
|
||||
TemplateInstance* tinst = DtoIsTemplateInstance(s, true);
|
||||
if (tinst)
|
||||
{
|
||||
if (!global.params.singleObj)
|
||||
|
||||
@@ -103,7 +103,7 @@ DValue* DtoCast(Loc& loc, DValue* val, Type* to);
|
||||
DValue* DtoPaintType(Loc& loc, DValue* val, Type* to);
|
||||
|
||||
// is template instance check, returns module where instantiated
|
||||
TemplateInstance* DtoIsTemplateInstance(Dsymbol* s);
|
||||
TemplateInstance* DtoIsTemplateInstance(Dsymbol* s, bool checkLiteralOwner = false);
|
||||
|
||||
/// Generate code for the symbol.
|
||||
/// Dispatches as appropriate.
|
||||
|
||||
@@ -35,7 +35,7 @@ using namespace llvm::dwarf;
|
||||
static Module* getDefinedModule(Dsymbol* s)
|
||||
{
|
||||
// templates are defined in current module
|
||||
if (DtoIsTemplateInstance(s))
|
||||
if (DtoIsTemplateInstance(s, true))
|
||||
{
|
||||
return gIR->dmodule;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user