本文整理汇总了C++中StructDeclaration::finalizeSize方法的典型用法代码示例。如果您正苦于以下问题:C++ StructDeclaration::finalizeSize方法的具体用法?C++ StructDeclaration::finalizeSize怎么用?C++ StructDeclaration::finalizeSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StructDeclaration
的用法示例。
在下文中一共展示了StructDeclaration::finalizeSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: size
unsigned AggregateDeclaration::size(Loc loc)
{
//printf("AggregateDeclaration::size() %s, scope = %p\n", toChars(), scope);
if (loc.linnum == 0)
loc = this->loc;
if (sizeok != SIZEOKdone && scope)
semantic(NULL);
StructDeclaration *sd = isStructDeclaration();
if (sizeok != SIZEOKdone && sd && sd->members)
{
/* See if enough is done to determine the size,
* meaning all the fields are done.
*/
struct SV
{
/* Returns:
* 0 this member doesn't need further processing to determine struct size
* 1 this member does
*/
static int func(Dsymbol *s, void *param)
{
VarDeclaration *v = s->isVarDeclaration();
if (v)
{
if (v->scope)
v->semantic(NULL);
if (v->storage_class & (STCstatic | STCextern | STCtls | STCgshared | STCmanifest | STCctfe | STCtemplateparameter))
return 0;
if (v->isField() && v->sem >= SemanticDone)
return 0;
return 1;
}
return 0;
}
};
SV sv;
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *s = (*members)[i];
if (s->apply(&SV::func, &sv))
goto L1;
}
sd->finalizeSize(NULL);
L1: ;
}
if (!members)
{
error(loc, "unknown size");
}
else if (sizeok != SIZEOKdone)
{
error(loc, "no size yet for forward reference");
//*(char*)0=0;
}
return structsize;
}