本文整理汇总了C++中AggregateDeclaration::handleType方法的典型用法代码示例。如果您正苦于以下问题:C++ AggregateDeclaration::handleType方法的具体用法?C++ AggregateDeclaration::handleType怎么用?C++ AggregateDeclaration::handleType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AggregateDeclaration
的用法示例。
在下文中一共展示了AggregateDeclaration::handleType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeNested
void AggregateDeclaration::makeNested()
{
if (enclosing) // if already nested
return;
if (sizeok == SIZEOKdone)
return;
if (isUnionDeclaration() || isInterfaceDeclaration())
return;
if (storage_class & STCstatic)
return;
// If nested struct, add in hidden 'this' pointer to outer scope
Dsymbol *s = toParent2();
if (!s)
return;
AggregateDeclaration *ad = s->isAggregateDeclaration();
FuncDeclaration *fd = s->isFuncDeclaration();
Type *t = NULL;
if (fd)
{
enclosing = fd;
AggregateDeclaration *agg = fd->isMember2();
t = agg ? agg->handleType() : Type::tvoidptr;
}
else if (ad)
{
if (isClassDeclaration() && ad->isClassDeclaration())
{
enclosing = ad;
}
else if (isStructDeclaration())
{
if (TemplateInstance *ti = ad->parent->isTemplateInstance())
{
enclosing = ti->enclosing;
}
}
t = ad->handleType();
}
if (enclosing)
{
//printf("makeNested %s, enclosing = %s\n", toChars(), enclosing->toChars());
assert(t);
if (t->ty == Tstruct)
t = Type::tvoidptr; // t should not be a ref type
assert(!vthis);
vthis = new ThisDeclaration(loc, t);
//vthis->storage_class |= STCref;
members->push(vthis);
}
}
示例2: makeNested
void AggregateDeclaration::makeNested()
{
if (!enclosing && sizeok != SIZEOKdone && !isUnionDeclaration() && !isInterfaceDeclaration())
{
// If nested struct, add in hidden 'this' pointer to outer scope
if (!(storage_class & STCstatic))
{
Dsymbol *s = toParent2();
if (s)
{
AggregateDeclaration *ad = s->isAggregateDeclaration();
FuncDeclaration *fd = s->isFuncDeclaration();
if (fd)
{
enclosing = fd;
}
else if (isClassDeclaration() && ad && ad->isClassDeclaration())
{
enclosing = ad;
}
else if (isStructDeclaration() && ad)
{
if (TemplateInstance *ti = ad->parent->isTemplateInstance())
{
enclosing = ti->enclosing;
}
}
if (enclosing)
{
//printf("makeNested %s, enclosing = %s\n", toChars(), enclosing->toChars());
Type *t;
if (ad)
t = ad->handleType();
else if (fd)
{
AggregateDeclaration *ad2 = fd->isMember2();
if (ad2)
t = ad2->handleType();
else
t = Type::tvoidptr;
}
else
assert(0);
if (t->ty == Tstruct)
t = Type::tvoidptr; // t should not be a ref type
assert(!vthis);
vthis = new ThisDeclaration(loc, t);
//vthis->storage_class |= STCref;
members->push(vthis);
}
}
}
}
}
示例3: cv4_memfunctypidx
unsigned cv4_memfunctypidx(FuncDeclaration *fd)
{
//printf("cv4_memfunctypidx(fd = '%s')\n", fd->toChars());
type *t = Type_toCtype(fd->type);
AggregateDeclaration *ad = fd->isMember2();
if (ad)
{
// It's a member function, which gets a special type record
idx_t thisidx;
if (fd->isStatic())
thisidx = dttab4[TYvoid];
else
{
assert(ad->handleType());
thisidx = cv4_typidx(Type_toCtype(ad->handleType()));
}
unsigned nparam;
idx_t paramidx = cv4_arglist(t,&nparam);
unsigned char call = cv4_callconv(t);
debtyp_t *d;
switch (config.fulltypes)
{
case CV4:
{
d = debtyp_alloc(18);
unsigned char *p = d->data;
TOWORD(p,LF_MFUNCTION);
TOWORD(p + 2,cv4_typidx(t->Tnext));
TOWORD(p + 4,cv4_typidx(Type_toCtype(ad->type)));
TOWORD(p + 6,thisidx);
p[8] = call;
p[9] = 0; // reserved
TOWORD(p + 10,nparam);
TOWORD(p + 12,paramidx);
TOLONG(p + 14,0); // thisadjust
break;
}
case CV8:
{
d = debtyp_alloc(26);
unsigned char *p = d->data;
TOWORD(p,0x1009);
TOLONG(p + 2,cv4_typidx(t->Tnext));
TOLONG(p + 6,cv4_typidx(Type_toCtype(ad->type)));
TOLONG(p + 10,thisidx);
p[14] = call;
p[15] = 0; // reserved
TOWORD(p + 16,nparam);
TOLONG(p + 18,paramidx);
TOLONG(p + 22,0); // thisadjust
break;
}
default:
assert(0);
}
return cv_debtyp(d);
}
return cv4_typidx(t);
}