本文整理汇总了C++中Dsymbol::isTemplateMixin方法的典型用法代码示例。如果您正苦于以下问题:C++ Dsymbol::isTemplateMixin方法的具体用法?C++ Dsymbol::isTemplateMixin怎么用?C++ Dsymbol::isTemplateMixin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dsymbol
的用法示例。
在下文中一共展示了Dsymbol::isTemplateMixin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: foreach
int ScopeDsymbol::foreach(Dsymbols *members, ScopeDsymbol::ForeachDg dg, void *ctx, size_t *pn)
{
assert(dg);
if (!members)
return 0;
size_t n = pn ? *pn : 0; // take over index
int result = 0;
for (size_t i = 0; i < members->dim; i++)
{ Dsymbol *s = (*members)[i];
if (AttribDeclaration *a = s->isAttribDeclaration())
result = foreach(a->decl, dg, ctx, &n);
else if (TemplateMixin *tm = s->isTemplateMixin())
result = foreach(tm->members, dg, ctx, &n);
else if (s->isTemplateInstance())
;
else
result = dg(ctx, n++, s);
if (result)
break;
}
if (pn)
*pn = n; // update index
return result;
}
示例2: while
Dsymbol *Dsymbol::pastMixin()
{
Dsymbol *s = this;
//printf("Dsymbol::pastMixin() %s\n", toChars());
while (s && s->isTemplateMixin())
s = s->parent;
return s;
}
示例3: semantic
//.........这里部分代码省略.........
* work with things like XPCOM
*/
sc->linkage = LINKc;
}
sc->protection = PROTpublic;
sc->explicitProtection = 0;
sc->structalign = STRUCTALIGN_DEFAULT;
if (baseClass)
{ sc->offset = baseClass->structsize;
alignsize = baseClass->alignsize;
// if (enclosing)
// sc->offset += Target::ptrsize; // room for uplevel context pointer
}
else
{ sc->offset = Target::ptrsize * 2; // allow room for __vptr and __monitor
alignsize = Target::ptrsize;
}
sc->userAttributes = NULL;
structsize = sc->offset;
Scope scsave = *sc;
size_t members_dim = members->dim;
sizeok = SIZEOKnone;
/* Set scope so if there are forward references, we still might be able to
* resolve individual members like enums.
*/
for (size_t i = 0; i < members_dim; i++)
{ Dsymbol *s = (*members)[i];
/* There are problems doing this in the general case because
* Scope keeps track of things like 'offset'
*/
if (s->isEnumDeclaration() ||
(s->isAggregateDeclaration() && s->ident) ||
s->isTemplateMixin() ||
s->isAttribDeclaration() ||
s->isAliasDeclaration())
{
//printf("[%d] setScope %s %s, sc = %p\n", i, s->kind(), s->toChars(), sc);
s->setScope(sc);
}
}
for (size_t i = 0; i < members_dim; i++)
{ Dsymbol *s = (*members)[i];
s->semantic(sc);
}
// Set the offsets of the fields and determine the size of the class
unsigned offset = structsize;
bool isunion = isUnionDeclaration() != NULL;
for (size_t i = 0; i < members->dim; i++)
{ Dsymbol *s = (*members)[i];
s->setFieldOffset(this, &offset, false);
}
sc->offset = structsize;
if (global.errors != errors)
{ // The type is no good.
type = Type::terror;
}
if (sizeok == SIZEOKfwd) // failed due to forward references
{ // semantic() failed due to forward references
// Unwind what we did, and defer it for later
示例4: visit
void visit(VarDeclaration *vd)
{
//printf("VarDeclaration::toObjFile(%p '%s' type=%s) protection %d\n", vd, vd->toChars(), vd->type->toChars(), vd->protection);
//printf("\talign = %d\n", vd->alignment);
if (vd->type->ty == Terror)
{
vd->error("had semantic errors when compiling");
return;
}
if (vd->aliassym)
{
visitNoMultiObj(vd->toAlias());
return;
}
// Do not store variables we cannot take the address of
if (!vd->canTakeAddressOf())
{
return;
}
if (!vd->isDataseg() || vd->storage_class & STCextern)
return;
Symbol *s = toSymbol(vd);
unsigned sz = vd->type->size();
Dsymbol *parent = vd->toParent();
s->Sclass = SCglobal;
do
{
/* Global template data members need to be in comdat's
* in case multiple .obj files instantiate the same
* template with the same types.
*/
if (parent->isTemplateInstance() && !parent->isTemplateMixin())
{
s->Sclass = SCcomdat;
break;
}
parent = parent->parent;
} while (parent);
s->Sfl = FLdata;
if (vd->init)
{
s->Sdt = Initializer_toDt(vd->init);
// Look for static array that is block initialized
ExpInitializer *ie = vd->init->isExpInitializer();
Type *tb = vd->type->toBasetype();
if (tb->ty == Tsarray && ie &&
!tb->nextOf()->equals(ie->exp->type->toBasetype()->nextOf()) &&
ie->exp->implicitConvTo(tb->nextOf())
)
{
size_t dim = ((TypeSArray *)tb)->dim->toInteger();
// Duplicate Sdt 'dim-1' times, as we already have the first one
dt_t **pdt = &s->Sdt;
while (--dim > 0)
{
pdt = Expression_toDt(ie->exp, pdt);
}
}
}
else
{
Type_toDt(vd->type, &s->Sdt);
}
dt_optimize(s->Sdt);
// See if we can convert a comdat to a comdef,
// which saves on exe file space.
if (s->Sclass == SCcomdat &&
s->Sdt &&
dtallzeros(s->Sdt) &&
!vd->isThreadlocal())
{
s->Sclass = SCglobal;
dt2common(&s->Sdt);
}
if (!sz && vd->type->toBasetype()->ty != Tsarray)
assert(0); // this shouldn't be possible
if (sz || objmod->allowZeroSize())
{
outdata(s);
if (vd->isExport())
objmod->export_symbol(s, 0);
}
}
示例5: visit
void visit(VarDeclaration *vd)
{
//printf("VarDeclaration::toObjFile(%p '%s' type=%s) protection %d\n", vd, vd->toChars(), vd->type->toChars(), vd->protection);
//printf("\talign = %d\n", vd->alignment);
if (vd->type->ty == Terror)
{
vd->error("had semantic errors when compiling");
return;
}
if (vd->aliassym)
{
visitNoMultiObj(vd->toAlias());
return;
}
// Do not store variables we cannot take the address of
if (!vd->canTakeAddressOf())
{
return;
}
if (!vd->isDataseg() || vd->storage_class & STCextern)
return;
Symbol *s = toSymbol(vd);
d_uns64 sz64 = vd->type->size(vd->loc);
if (sz64 == SIZE_INVALID)
{
vd->error("size overflow");
return;
}
if (sz64 >= 0x1000000) // there has to be some 'reasonable' limit on the size
{
vd->error("size of x%llx exceeds max allowed size 0x100_0000", sz64);
}
unsigned sz = (unsigned)sz64;
Dsymbol *parent = vd->toParent();
s->Sclass = SCglobal;
do
{
/* Global template data members need to be in comdat's
* in case multiple .obj files instantiate the same
* template with the same types.
*/
if (parent->isTemplateInstance() && !parent->isTemplateMixin())
{
s->Sclass = SCcomdat;
break;
}
parent = parent->parent;
} while (parent);
s->Sfl = FLdata;
if (config.objfmt == OBJ_MACH && I64 && (s->ty() & mTYLINK) == mTYthread)
{
DtBuilder dtb;
tlsToDt(vd, s, dtb);
s->Sdt = dtb.finish();
}
else if (vd->_init)
{
DtBuilder dtb;
initializerToDt(vd, dtb);
s->Sdt = dtb.finish();
}
else
{
DtBuilder dtb;
Type_toDt(vd->type, &dtb);
s->Sdt = dtb.finish();
}
// See if we can convert a comdat to a comdef,
// which saves on exe file space.
if (s->Sclass == SCcomdat &&
s->Sdt &&
dtallzeros(s->Sdt) &&
!vd->isThreadlocal())
{
s->Sclass = SCglobal;
dt2common(&s->Sdt);
}
if (!sz && vd->type->toBasetype()->ty != Tsarray)
assert(0); // this shouldn't be possible
if (sz || objmod->allowZeroSize())
{
outdata(s);
if (vd->isExport())
objmod->export_symbol(s, 0);
}
}
示例6: toObjFile
void VarDeclaration::toObjFile(int multiobj)
{
Symbol *s;
unsigned sz;
Dsymbol *parent;
//printf("VarDeclaration::toObjFile(%p '%s' type=%s) protection %d\n", this, toChars(), type->toChars(), protection);
//printf("\talign = %d\n", alignment);
if (type->ty == Terror)
{ error("had semantic errors when compiling");
return;
}
if (aliassym)
{ toAlias()->toObjFile(0);
return;
}
// Do not store variables we cannot take the address of
if (!canTakeAddressOf())
{
return;
}
if (isDataseg() && !(storage_class & STCextern))
{
s = toSymbol();
sz = type->size();
parent = this->toParent();
{
if (storage_class & STCcomdat)
s->Sclass = SCcomdat;
else
s->Sclass = SCglobal;
do
{
/* Global template data members need to be in comdat's
* in case multiple .obj files instantiate the same
* template with the same types.
*/
if (parent->isTemplateInstance() && !parent->isTemplateMixin())
{
s->Sclass = SCcomdat;
break;
}
parent = parent->parent;
} while (parent);
}
s->Sfl = FLdata;
if (init)
{ s->Sdt = init->toDt();
// Look for static array that is block initialized
Type *tb;
ExpInitializer *ie = init->isExpInitializer();
tb = type->toBasetype();
if (tb->ty == Tsarray && ie &&
!tb->nextOf()->equals(ie->exp->type->toBasetype()->nextOf()) &&
ie->exp->implicitConvTo(tb->nextOf())
)
{
size_t dim = ((TypeSArray *)tb)->dim->toInteger();
// Duplicate Sdt 'dim-1' times, as we already have the first one
dt_t **pdt = &s->Sdt;
while (--dim > 0)
{
pdt = ie->exp->toDt(pdt);
}
}
}
else if (storage_class & STCextern)
{
s->Sclass = SCextern;
s->Sfl = FLextern;
s->Sdt = NULL;
// BUG: if isExport(), shouldn't we make it dllimport?
return;
}
else
{
type->toDt(&s->Sdt);
}
dt_optimize(s->Sdt);
// See if we can convert a comdat to a comdef,
// which saves on exe file space.
if (s->Sclass == SCcomdat &&
s->Sdt &&
dtallzeros(s->Sdt) &&
!isThreadlocal())
{
s->Sclass = SCglobal;
dt2common(&s->Sdt);
}
//.........这里部分代码省略.........