else if (ctype_isbitfield(ct->info))
rcl[(fofs >= 8)] |= CCALL_RCL_INT; /* NYI: unaligned bitfields? */
else if (ctype_isxattrib(ct->info, CTA_SUBTYPE))
- ccall_classify_struct(cts, ctype_child(cts, ct), rcl, fofs);
+ ccall_classify_struct(cts, ctype_rawchild(cts, ct), rcl, fofs);
}
return ((rcl[0]|rcl[1]) & CCALL_RCL_MEM); /* Memory class? */
}
} else if (ctype_isbitfield(ct->info)) {
goto noth;
} else if (ctype_isxattrib(ct->info, CTA_SUBTYPE)) {
- CType *sct = ctype_child(cts, ct);
+ CType *sct = ctype_rawchild(cts, ct);
if (sct->size > 0) {
unsigned int s = ccall_classify_struct(cts, sct, ctf);
if (s <= 1) goto noth;
lj_cconv_bf_tv(cts, df, dp+df->size, tv);
if ((d->info & CTF_UNION)) break;
} else if (ctype_isxattrib(df->info, CTA_SUBTYPE)) {
- cconv_substruct_tab(cts, ctype_child(cts, df), dp+df->size, t, ip, flags);
+ cconv_substruct_tab(cts, ctype_rawchild(cts, df),
+ dp+df->size, t, ip, flags);
} /* Ignore all other entries in the chain. */
}
}
lj_cconv_bf_tv(cts, df, dp+df->size, o + i);
if ((d->info & CTF_UNION)) break;
} else if (ctype_isxattrib(df->info, CTA_SUBTYPE)) {
- cconv_substruct_init(cts, ctype_child(cts, df), dp+df->size, o, len, ip);
+ cconv_substruct_init(cts, ctype_rawchild(cts, df),
+ dp+df->size, o, len, ip);
} /* Ignore all other entries in the chain. */
}
}
GCstr *name = strV(key);
if (ctype_isstruct(ct->info)) {
CTSize ofs;
- CType *fct = lj_ctype_getfield(cts, ct, name, &ofs);
+ CType *fct = lj_ctype_getfieldq(cts, ct, name, &ofs, qual);
if (fct) {
*pp = p + ofs;
return fct;
}
/* Get a struct/union/enum/function field by name. */
-CType *lj_ctype_getfield(CTState *cts, CType *ct, GCstr *name, CTSize *ofs)
+CType *lj_ctype_getfieldq(CTState *cts, CType *ct, GCstr *name, CTSize *ofs,
+ CTInfo *qual)
{
while (ct->sib) {
ct = ctype_get(cts, ct->sib);
return ct;
}
if (ctype_isxattrib(ct->info, CTA_SUBTYPE)) {
- CType *fct = lj_ctype_getfield(cts, ctype_child(cts, ct), name, ofs);
+ CType *fct, *cct = ctype_child(cts, ct);
+ CTInfo q = 0;
+ while (ctype_isattrib(cct->info)) {
+ if (ctype_attrib(cct->info) == CTA_QUAL) q |= cct->size;
+ cct = ctype_child(cts, cct);
+ }
+ fct = lj_ctype_getfieldq(cts, cct, name, ofs, qual);
if (fct) {
+ if (qual) *qual |= q;
*ofs += ct->size;
return fct;
}
LJ_FUNC void lj_ctype_addname(CTState *cts, CType *ct, CTypeID id);
LJ_FUNC CTypeID lj_ctype_getname(CTState *cts, CType **ctp, GCstr *name,
uint32_t tmask);
-LJ_FUNC CType *lj_ctype_getfield(CTState *cts, CType *ct, GCstr *name,
- CTSize *ofs);
+LJ_FUNC CType *lj_ctype_getfieldq(CTState *cts, CType *ct, GCstr *name,
+ CTSize *ofs, CTInfo *qual);
+#define lj_ctype_getfield(cts, ct, name, ofs) \
+ lj_ctype_getfieldq((cts), (ct), (name), (ofs), NULL)
LJ_FUNC CType *lj_ctype_rawref(CTState *cts, CTypeID id);
LJ_FUNC CTSize lj_ctype_size(CTState *cts, CTypeID id);
LJ_FUNC CTSize lj_ctype_vlsize(CTState *cts, CType *ct, CTSize nelem);