Replace DtoIsTemplateInstance() by Dsymbol::isInstantiated()

The semantics were almost identical, except for DtoIsTemplateInstance()
checking the specified Dsymbol and its parents, while isInstantiated()
starts from its parent and ignores the symbol itself.

After a quick glance, we seem to have fed it with {Aggregate,Func,Var}
Declarations only, so should be fine with the default front-end variant.
This commit is contained in:
Martin Kinkelin 2020-10-26 03:34:31 +01:00
parent ad9f9b51a2
commit ec9caae7fc
9 changed files with 24 additions and 33 deletions

View file

@ -795,18 +795,8 @@ DValue *DtoPaintType(Loc &loc, DValue *val, Type *to) {
* TEMPLATE HELPERS
******************************************************************************/
TemplateInstance *DtoIsTemplateInstance(Dsymbol *s) {
for (; s; s = s->parent) {
if (auto ti = s->isTemplateInstance()) {
if (!ti->isTemplateMixin())
return ti;
}
}
return nullptr;
}
bool defineOnDeclare(Dsymbol* s) {
return global.params.linkonceTemplates && DtoIsTemplateInstance(s);
return global.params.linkonceTemplates && s->isInstantiated();
}
/******************************************************************************