本文整理汇总了C++中symbols::setDim方法的典型用法代码示例。如果您正苦于以下问题:C++ symbols::setDim方法的具体用法?C++ symbols::setDim怎么用?C++ symbols::setDim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类symbols
的用法示例。
在下文中一共展示了symbols::setDim方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: genobjfile
void Module::genobjfile(int multiobj)
{
//EEcontext *ee = env->getEEcontext();
//printf("Module::genobjfile(multiobj = %d) %s\n", multiobj, toChars());
lastmname = srcfile->toChars();
obj_initfile(lastmname, NULL, toPrettyChars());
eictor = NULL;
ictorlocalgot = NULL;
sctors.setDim(0);
ectorgates.setDim(0);
sdtors.setDim(0);
ssharedctors.setDim(0);
esharedctorgates.setDim(0);
sshareddtors.setDim(0);
stests.setDim(0);
dtorcount = 0;
shareddtorcount = 0;
if (doppelganger)
{
/* Generate a reference to the moduleinfo, so the module constructors
* and destructors get linked in.
*/
Module *m = aimports[0];
assert(m);
if (m->sictor || m->sctor || m->sdtor || m->ssharedctor || m->sshareddtor)
{
Symbol *s = m->toSymbol();
//objextern(s);
//if (!s->Sxtrnnum) objextdef(s->Sident);
if (!s->Sxtrnnum)
{
//printf("%s\n", s->Sident);
#if 0 /* This should work, but causes optlink to fail in common/newlib.asm */
objextdef(s->Sident);
#else
#if ELFOBJ || MACHOBJ
int nbytes = reftoident(DATA, Offset(DATA), s, 0, I64 ? (CFoff | CFoffset64) : CFoff);
#else
int nbytes = reftoident(DATA, Doffset, s, 0, CFoff);
Doffset += nbytes;
#endif
#endif
}
}
}
if (global.params.cov)
{
/* Create coverage identifier:
* private uint[numlines] __coverage;
*/
cov = symbol_calloc("__coverage");
cov->Stype = type_fake(TYint);
cov->Stype->Tmangle = mTYman_c;
cov->Stype->Tcount++;
cov->Sclass = SCstatic;
cov->Sfl = FLdata;
#if ELFOBJ || MACHOBJ
cov->Sseg = UDATA;
#endif
dtnzeros(&cov->Sdt, 4 * numlines);
outdata(cov);
slist_add(cov);
covb = (unsigned *)calloc((numlines + 32) / 32, sizeof(*covb));
}
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *member = (*members)[i];
member->toObjFile(multiobj);
}
if (global.params.cov)
{
/* Generate
* bit[numlines] __bcoverage;
*/
Symbol *bcov = symbol_calloc("__bcoverage");
bcov->Stype = type_fake(TYuint);
bcov->Stype->Tcount++;
bcov->Sclass = SCstatic;
bcov->Sfl = FLdata;
#if ELFOBJ || MACHOBJ
bcov->Sseg = DATA;
#endif
dtnbytes(&bcov->Sdt, (numlines + 32) / 32 * sizeof(*covb), (char *)covb);
outdata(bcov);
free(covb);
covb = NULL;
/* Generate:
* _d_cover_register(uint[] __coverage, BitArray __bcoverage, string filename);
* and prepend it to the static constructor.
//.........这里部分代码省略.........
示例2: genObjFile
void genObjFile(Module *m, bool multiobj)
{
//EEcontext *ee = env->getEEcontext();
//printf("Module::genobjfile(multiobj = %d) %s\n", multiobj, m->toChars());
if (m->ident == Id::entrypoint)
{
bool v = global.params.verbose;
global.params.verbose = false;
for (size_t i = 0; i < m->members->dim; i++)
{
Dsymbol *member = (*m->members)[i];
//printf("toObjFile %s %s\n", member->kind(), member->toChars());
toObjFile(member, global.params.multiobj);
}
global.params.verbose = v;
return;
}
lastmname = m->srcfile->toChars();
objmod->initfile(lastmname, NULL, m->toPrettyChars());
eictor = NULL;
ictorlocalgot = NULL;
sctors.setDim(0);
ectorgates.setDim(0);
sdtors.setDim(0);
ssharedctors.setDim(0);
esharedctorgates.setDim(0);
sshareddtors.setDim(0);
stests.setDim(0);
if (m->doppelganger)
{
/* Generate a reference to the moduleinfo, so the module constructors
* and destructors get linked in.
*/
Module *mod = m->aimports[0];
assert(mod);
if (mod->sictor || mod->sctor || mod->sdtor || mod->ssharedctor || mod->sshareddtor)
{
Symbol *s = toSymbol(mod);
//objextern(s);
//if (!s->Sxtrnnum) objextdef(s->Sident);
if (!s->Sxtrnnum)
{
//printf("%s\n", s->Sident);
#if 0 /* This should work, but causes optlink to fail in common/newlib.asm */
objextdef(s->Sident);
#else
Symbol *sref = symbol_generate(SCstatic, type_fake(TYnptr));
sref->Sfl = FLdata;
dtxoff(&sref->Sdt, s, 0, TYnptr);
outdata(sref);
#endif
}
}
}
if (global.params.cov)
{
/* Create coverage identifier:
* private uint[numlines] __coverage;
*/
m->cov = symbol_calloc("__coverage");
m->cov->Stype = type_fake(TYint);
m->cov->Stype->Tmangle = mTYman_c;
m->cov->Stype->Tcount++;
m->cov->Sclass = SCstatic;
m->cov->Sfl = FLdata;
dtnzeros(&m->cov->Sdt, 4 * m->numlines);
outdata(m->cov);
slist_add(m->cov);
m->covb = (unsigned *)calloc((m->numlines + 32) / 32, sizeof(*m->covb));
}
for (size_t i = 0; i < m->members->dim; i++)
{
Dsymbol *member = (*m->members)[i];
//printf("toObjFile %s %s\n", member->kind(), member->toChars());
toObjFile(member, multiobj);
}
if (global.params.cov)
{
/* Generate
* bit[numlines] __bcoverage;
*/
Symbol *bcov = symbol_calloc("__bcoverage");
bcov->Stype = type_fake(TYuint);
bcov->Stype->Tcount++;
bcov->Sclass = SCstatic;
bcov->Sfl = FLdata;
dtnbytes(&bcov->Sdt, (m->numlines + 32) / 32 * sizeof(*m->covb), (char *)m->covb);
outdata(bcov);
//.........这里部分代码省略.........
示例3: genobjfile
void Module::genobjfile(int multiobj)
{
//EEcontext *ee = env->getEEcontext();
//printf("Module::genobjfile(multiobj = %d) %s\n", multiobj, toChars());
lastmname = srcfile->toChars();
objmod->initfile(lastmname, NULL, toPrettyChars());
eictor = NULL;
ictorlocalgot = NULL;
sctors.setDim(0);
ectorgates.setDim(0);
sdtors.setDim(0);
ssharedctors.setDim(0);
esharedctorgates.setDim(0);
sshareddtors.setDim(0);
stests.setDim(0);
dtorcount = 0;
shareddtorcount = 0;
if (doppelganger)
{
/* Generate a reference to the moduleinfo, so the module constructors
* and destructors get linked in.
*/
Module *m = aimports[0];
assert(m);
if (m->sictor || m->sctor || m->sdtor || m->ssharedctor || m->sshareddtor)
{
Symbol *s = m->toSymbol();
//objextern(s);
//if (!s->Sxtrnnum) objextdef(s->Sident);
if (!s->Sxtrnnum)
{
//printf("%s\n", s->Sident);
#if 0 /* This should work, but causes optlink to fail in common/newlib.asm */
objextdef(s->Sident);
#else
Symbol *sref = symbol_generate(SCstatic, type_fake(TYnptr));
sref->Sfl = FLdata;
dtxoff(&sref->Sdt, s, 0, TYnptr);
outdata(sref);
#endif
}
}
}
if (global.params.cov)
{
/* Create coverage identifier:
* private uint[numlines] __coverage;
*/
cov = symbol_calloc("__coverage");
cov->Stype = type_fake(TYint);
cov->Stype->Tmangle = mTYman_c;
cov->Stype->Tcount++;
cov->Sclass = SCstatic;
cov->Sfl = FLdata;
dtnzeros(&cov->Sdt, 4 * numlines);
outdata(cov);
slist_add(cov);
covb = (unsigned *)calloc((numlines + 32) / 32, sizeof(*covb));
}
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *member = (*members)[i];
//printf("toObjFile %s %s\n", member->kind(), member->toChars());
member->toObjFile(multiobj);
}
if (global.params.cov)
{
/* Generate
* bit[numlines] __bcoverage;
*/
Symbol *bcov = symbol_calloc("__bcoverage");
bcov->Stype = type_fake(TYuint);
bcov->Stype->Tcount++;
bcov->Sclass = SCstatic;
bcov->Sfl = FLdata;
dtnbytes(&bcov->Sdt, (numlines + 32) / 32 * sizeof(*covb), (char *)covb);
outdata(bcov);
free(covb);
covb = NULL;
/* Generate:
* _d_cover_register(uint[] __coverage, BitArray __bcoverage, string filename);
* and prepend it to the static constructor.
*/
/* t will be the type of the functions generated:
* extern (C) void func();
*/
type *t = type_function(TYnfunc, NULL, 0, false, tsvoid);
t->Tmangle = mTYman_c;
//.........这里部分代码省略.........