int FuncDeclaration::cvMember(unsigned char *p) { char *id; idx_t typidx; unsigned attribute; int nwritten = 0; debtyp_t *d; //printf("FuncDeclaration::cvMember() '%s'\n", toChars()); if (!type) // if not compiled in, return 0; // skip it id = toChars(); if (!p) { nwritten = 6 + cv_stringbytes(id); } else { int count; int mlen; unsigned char *q; count = 0; mlen = 2; { if (introducing) mlen += 4; mlen += cgcv.sz_idx * 2; count++; } // Allocate and fill it in d = debtyp_alloc(mlen); q = d->data; TOWORD(q,LF_METHODLIST); q += 2; // for (s = sf; s; s = s->Sfunc->Foversym) { attribute = PROTtoATTR(prot()); /* 0*4 vanilla method * 1*4 virtual method * 2*4 static method * 3*4 friend method * 4*4 introducing virtual method * 5*4 pure virtual method * 6*4 pure introducing virtual method * 7*4 reserved */ if (isStatic()) attribute |= 2*4; else if (isVirtual()) { if (introducing) { if (isAbstract()) attribute |= 6*4; else attribute |= 4*4; } else { if (isAbstract()) attribute |= 5*4; else attribute |= 1*4; } } else attribute |= 0*4; TOIDX(q,attribute); q += cgcv.sz_idx; TOIDX(q, cv4_memfunctypidx(this)); q += cgcv.sz_idx; if (introducing) { TOLONG(q, vtblIndex * PTRSIZE); q += 4; } } assert(q - d->data == mlen); typidx = cv_debtyp(d); if (typidx) { TOWORD(p,LF_METHOD); TOWORD(p + 2,count); nwritten = 4; TOIDX(p + nwritten, typidx); nwritten += cgcv.sz_idx; nwritten += cv_namestring(p + nwritten, id); } } return nwritten; }
int FuncDeclaration::cvMember(unsigned char *p) { int nwritten = 0; //printf("FuncDeclaration::cvMember() '%s'\n", toChars()); if (!type) // if not compiled in, return 0; // skip it char *id = toChars(); if (!p) { nwritten = 2 + 2 + cgcv.sz_idx + cv_stringbytes(id); nwritten = cv_align(NULL, nwritten); return nwritten; } else { int count = 0; int mlen = 2; { if (introducing) mlen += 4; mlen += cgcv.sz_idx * 2; count++; } // Allocate and fill it in debtyp_t *d = debtyp_alloc(mlen); unsigned char *q = d->data; TOWORD(q,config.fulltypes == CV8 ? LF_METHODLIST_V2 : LF_METHODLIST); q += 2; // for (s = sf; s; s = s->Sfunc->Foversym) { unsigned attribute = PROTtoATTR(prot()); /* 0*4 vanilla method * 1*4 virtual method * 2*4 static method * 3*4 friend method * 4*4 introducing virtual method * 5*4 pure virtual method * 6*4 pure introducing virtual method * 7*4 reserved */ if (isStatic()) attribute |= 2*4; else if (isVirtual()) { if (introducing) { if (isAbstract()) attribute |= 6*4; else attribute |= 4*4; } else { if (isAbstract()) attribute |= 5*4; else attribute |= 1*4; } } else attribute |= 0*4; TOIDX(q,attribute); q += cgcv.sz_idx; TOIDX(q, cv4_memfunctypidx(this)); q += cgcv.sz_idx; if (introducing) { TOLONG(q, vtblIndex * Target::ptrsize); q += 4; } } assert(q - d->data == mlen); idx_t typidx = cv_debtyp(d); if (typidx) { switch (config.fulltypes) { case CV8: TOWORD(p,LF_METHOD_V3); goto Lmethod; case CV4: TOWORD(p,LF_METHOD); Lmethod: TOWORD(p + 2,count); nwritten = 4; TOIDX(p + nwritten, typidx); nwritten += cgcv.sz_idx; nwritten += cv_namestring(p + nwritten, id); break; default: assert(0); } } nwritten = cv_align(p + nwritten, nwritten); #ifdef DEBUG assert(nwritten == cvMember(NULL)); #endif } return nwritten; }