本文整理汇总了C++中DtBuilder::length方法的典型用法代码示例。如果您正苦于以下问题:C++ DtBuilder::length方法的具体用法?C++ DtBuilder::length怎么用?C++ DtBuilder::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DtBuilder
的用法示例。
在下文中一共展示了DtBuilder::length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: genModuleInfo
//.........这里部分代码省略.........
#define MIstandalone 0x4
#define MItlsctor 0x8
#define MItlsdtor 0x10
#define MIctor 0x20
#define MIdtor 0x40
#define MIxgetMembers 0x80
#define MIictor 0x100
#define MIunitTest 0x200
#define MIimportedModules 0x400
#define MIlocalClasses 0x800
#define MIname 0x1000
unsigned flags = 0;
if (!m->needmoduleinfo)
flags |= MIstandalone;
if (m->sctor)
flags |= MItlsctor;
if (m->sdtor)
flags |= MItlsdtor;
if (m->ssharedctor)
flags |= MIctor;
if (m->sshareddtor)
flags |= MIdtor;
if (sgetmembers)
flags |= MIxgetMembers;
if (m->sictor)
flags |= MIictor;
if (m->stest)
flags |= MIunitTest;
if (aimports_dim)
flags |= MIimportedModules;
if (aclasses.dim)
flags |= MIlocalClasses;
flags |= MIname;
dtb.dword(flags); // _flags
dtb.dword(0); // _index
if (flags & MItlsctor)
dtb.xoff(m->sctor, 0, TYnptr);
if (flags & MItlsdtor)
dtb.xoff(m->sdtor, 0, TYnptr);
if (flags & MIctor)
dtb.xoff(m->ssharedctor, 0, TYnptr);
if (flags & MIdtor)
dtb.xoff(m->sshareddtor, 0, TYnptr);
if (flags & MIxgetMembers)
dtb.xoff(toSymbol(sgetmembers), 0, TYnptr);
if (flags & MIictor)
dtb.xoff(m->sictor, 0, TYnptr);
if (flags & MIunitTest)
dtb.xoff(m->stest, 0, TYnptr);
if (flags & MIimportedModules)
{
dtb.size(aimports_dim);
for (size_t i = 0; i < m->aimports.dim; i++)
{
Module *mod = m->aimports[i];
if (!mod->needmoduleinfo)
continue;
Symbol *s = toSymbol(mod);
/* Weak references don't pull objects in from the library,
* they resolve to 0 if not pulled in by something else.
* Don't pull in a module just because it was imported.
*/
s->Sflags |= SFLweak;
dtb.xoff(s, 0, TYnptr);
}
}
if (flags & MIlocalClasses)
{
dtb.size(aclasses.dim);
for (size_t i = 0; i < aclasses.dim; i++)
{
ClassDeclaration *cd = aclasses[i];
dtb.xoff(toSymbol(cd), 0, TYnptr);
}
}
if (flags & MIname)
{
// Put out module name as a 0-terminated string, to save bytes
m->nameoffset = dtb.length();
const char *name = m->toPrettyChars();
m->namelen = strlen(name);
dtb.nbytes(m->namelen + 1, name);
//printf("nameoffset = x%x\n", nameoffset);
}
objc_Module_genmoduleinfo_classes();
m->csym->Sdt = dtb.finish();
out_readonly(m->csym);
outdata(m->csym);
//////////////////////////////////////////////
objmod->moduleinfo(msym);
}