diff options
52 files changed, 1009 insertions, 1039 deletions
diff --git a/compiler_and_linker/FrontEnd/C/CPrep.c b/compiler_and_linker/FrontEnd/C/CPrep.c index cf2a4cd..a2ac9e2 100644 --- a/compiler_and_linker/FrontEnd/C/CPrep.c +++ b/compiler_and_linker/FrontEnd/C/CPrep.c @@ -2836,13 +2836,13 @@ static void pragma_on_off_reset(UInt32 bits) { macrocheck = 1; if ((bits & OPT_OFFSET_MASK) == OPT_OFFSET(cfm_internal)) - imex_flags = OBJECT_FLAGS_10; + imex_flags = OBJECT_INTERNAL; else if ((bits & OPT_OFFSET_MASK) == OPT_OFFSET(cfm_import)) - imex_flags = OBJECT_FLAGS_20; + imex_flags = OBJECT_IMPORT; else if ((bits & OPT_OFFSET_MASK) == OPT_OFFSET(cfm_export)) - imex_flags = OBJECT_FLAGS_40; + imex_flags = OBJECT_EXPORT; else if ((bits & OPT_OFFSET_MASK) == OPT_OFFSET(cfm_lib_export)) - imex_flags = OBJECT_FLAGS_60; + imex_flags = OBJECT_LIB_EXPORT; else CError_FATAL(3610); CPrep_PragmaImExport(imex_flags); @@ -2952,7 +2952,7 @@ static void CPrep_PragmaUnused(void) { list = CScope_GetLocalObject(nspace, tkidentifier); if (list && list->object->otype == OT_OBJECT && OBJECT(list->object)->datatype == DLOCAL) { - OBJECT(list->object)->flags = OBJECT(list->object)->flags | OBJECT_FLAGS_1; + OBJECT(list->object)->flags = OBJECT(list->object)->flags | OBJECT_USED; if (notendofline()) { t = plex(); if (t == ')') @@ -3157,7 +3157,7 @@ static void pragma_overload(void) { if ((obj = CParser_ParseObject())) { if (obj->sclass && obj->sclass != 0x103) CPrep_Error(CErrorStr177); - obj->qual |= Q_OVERLOAD; + obj->qual |= Q_WEAK; } else { CPrep_Error(CErrorStr186); } diff --git a/compiler_and_linker/FrontEnd/C/CScope.c b/compiler_and_linker/FrontEnd/C/CScope.c index 6049ad0..a4fdd5c 100644 --- a/compiler_and_linker/FrontEnd/C/CScope.c +++ b/compiler_and_linker/FrontEnd/C/CScope.c @@ -96,10 +96,10 @@ void CScope_SetFunctionScope(Object *function, CScopeSave *save) { cscope_currentclass = NULL; cscope_is_member_func = 0; - if (TYPE_FUNC(function->type)->flags & FUNC_FLAGS_METHOD) { + if (TYPE_FUNC(function->type)->flags & FUNC_METHOD) { cscope_currentclass = TYPE_METHOD(function->type)->theclass; cscope_current = cscope_currentclass->nspace; - cscope_is_member_func = TYPE_METHOD(function->type)->x26 == 0; + cscope_is_member_func = TYPE_METHOD(function->type)->is_static == 0; } else { cscope_current = function->nspace; } @@ -377,7 +377,7 @@ NameSpaceObjectList *CScope_ArgumentDependentNameLookup(NameSpaceObjectList *lis continue; if (!IS_TYPE_FUNC(OBJECT(iscan->object)->type)) continue; - if (flag && (TYPE_FUNC(OBJECT(iscan->object)->type)->flags & FUNC_FLAGS_METHOD)) + if (flag && (TYPE_FUNC(OBJECT(iscan->object)->type)->flags & FUNC_METHOD)) continue; for (iiscan = list; iiscan; iiscan = iiscan->next) { @@ -480,14 +480,14 @@ void CScope_AddObject(NameSpace *nspace, HashNameNode *name, ObjBase *obj) { newlist = lalloc(sizeof(NameSpaceObjectList)); if (obj->otype == OT_NAMESPACE || objlist->object->otype == OT_NAMESPACE) { - CError_Error(CErrorStr322/*, objlist->object*/); + CError_Error(CErrorStr322); return; } if (obj->otype == OT_TYPETAG) { do { if (objlist->object->otype == OT_TYPETAG) { - CError_Error(CErrorStr322/*, objlist->object*/); + CError_Error(CErrorStr322); return; } @@ -549,7 +549,7 @@ void CScope_AddObject(NameSpace *nspace, HashNameNode *name, ObjBase *obj) { objlist = objlist->next; } while (1); - } else if (nspace->theclass && TYPE_CLASS(nspace->theclass)->flags & CLASS_FLAGS_900) { + } else if (nspace->theclass && TYPE_CLASS(nspace->theclass)->flags & CLASS_IS_TEMPL_ANY) { CScope_AppendName(nspace, name)->object = obj; } else { CScope_InsertName(nspace, name)->object = obj; @@ -744,7 +744,7 @@ restart: } } -static BClassList *CScope_RecFindClassMember(CScopeParseResult *result, TypeClass *tclass, SInt32 offset) { +static BClassList *CScope_RecFindClassMember(NameResult *result, TypeClass *tclass, SInt32 offset) { Boolean fail; NameSpace *nspace; NameSpaceObjectList *list; @@ -798,8 +798,8 @@ static BClassList *CScope_RecFindClassMember(CScopeParseResult *result, TypeClas && result->nsol_14->object->otype == OT_TYPETAG && IS_TYPE_CLASS(OBJ_TYPE_TAG(list->object)->type) && IS_TYPE_CLASS(OBJ_TYPE_TAG(result->nsol_14->object)->type) - && (TYPE_CLASS(OBJ_TYPE_TAG(list->object)->type)->flags & CLASS_FLAGS_800) - && (TYPE_CLASS(OBJ_TYPE_TAG(result->nsol_14->object)->type)->flags & CLASS_FLAGS_800) + && (TYPE_CLASS(OBJ_TYPE_TAG(list->object)->type)->flags & CLASS_IS_TEMPL_INST) + && (TYPE_CLASS(OBJ_TYPE_TAG(result->nsol_14->object)->type)->flags & CLASS_IS_TEMPL_INST) && TEMPL_CLASS_INST(OBJ_TYPE_TAG(list->object)->type)->templ == TEMPL_CLASS_INST(OBJ_TYPE_TAG(result->nsol_14->object)->type)->templ ) { cscope_foundtemplate = TEMPL_CLASS_INST(OBJ_TYPE_TAG(result->nsol_14->object)->type)->templ; @@ -837,7 +837,7 @@ static BClassList *CScope_RecFindClassMember(CScopeParseResult *result, TypeClas cscope_foundclass = tclass; cscope_foundclassoffset = offset; - result->x8 = OBJ_TYPE_TAG(list->object)->type; + result->type = OBJ_TYPE_TAG(list->object)->type; newlist = lalloc(sizeof(BClassList)); newlist->next = NULL; newlist->type = TYPE(tclass); @@ -869,7 +869,7 @@ static BClassList *CScope_RecFindClassMember(CScopeParseResult *result, TypeClas return bestBase; } -static Boolean CScope_FindClassMember(CScopeParseResult *result, NameSpace *nspace, HashNameNode *name, ELookupType lookupType) { +static Boolean CScope_FindClassMember(NameResult *result, NameSpace *nspace, HashNameNode *name, ELookupType lookupType) { BClassList *bcl; BClassList *scan; @@ -1195,22 +1195,22 @@ static NameSpace *CScope_NSIteratorFindNameSpace(CScopeNSIterator *iterator, Has return NULL; } -static Boolean CScope_SetupParseNameResult(CScopeParseResult *result, NameSpaceObjectList *list, HashNameNode *name) { +static Boolean CScope_SetupParseNameResult(NameResult *result, NameSpaceObjectList *list, HashNameNode *name) { if (!list->next || list->next->object->otype == OT_TYPETAG) { switch (list->object->otype) { case OT_NAMESPACE: CError_Error(CErrorStr321); return 0; case OT_TYPE: - result->x8 = OBJ_TYPE(list->object)->type; - result->xC = OBJ_TYPE(list->object)->qual; + result->type = OBJ_TYPE(list->object)->type; + result->qual = OBJ_TYPE(list->object)->qual; result->obj_10 = list->object; result->name_4 = name; result->x20 = 1; break; case OT_TYPETAG: - result->x8 = OBJ_TYPE_TAG(list->object)->type; - result->xC = 0; + result->type = OBJ_TYPE_TAG(list->object)->type; + result->qual = 0; result->obj_10 = list->object; result->name_4 = name; result->x20 = 1; @@ -1225,10 +1225,10 @@ static Boolean CScope_SetupParseNameResult(CScopeParseResult *result, NameSpaceO return 1; } -Boolean CScope_FindQualifiedClassMember(CScopeParseResult *result, TypeClass *tclass, HashNameNode *name) { +Boolean CScope_FindQualifiedClassMember(NameResult *result, TypeClass *tclass, HashNameNode *name) { NameSpaceObjectList *list; - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); CDecl_CompleteType(TYPE(tclass)); if (CScope_FindClassMember(result, tclass->nspace, name, Lookup_0)) { @@ -1236,7 +1236,7 @@ Boolean CScope_FindQualifiedClassMember(CScopeParseResult *result, TypeClass *tc CError_ASSERT(1780, list); result->nsol_14 = NULL; - if (CScope_SetupParseNameResult(result, list, name) && !result->x8) + if (CScope_SetupParseNameResult(result, list, name) && !result->type) return 1; else CError_Error(CErrorStr340, name->name); @@ -1245,7 +1245,7 @@ Boolean CScope_FindQualifiedClassMember(CScopeParseResult *result, TypeClass *tc return 0; } -static NameSpace *CScope_FindQualifiedNameSpace(CScopeParseResult *result, NameSpace *nspace, HashNameNode *name) { +static NameSpace *CScope_FindQualifiedNameSpace(NameResult *result, NameSpace *nspace, HashNameNode *name) { NameSpaceObjectList *list; NameSpace *cand; NameSpace *found; @@ -1288,7 +1288,7 @@ static NameSpace *CScope_FindQualifiedNameSpace(CScopeParseResult *result, NameS return NULL; } -static NameSpaceObjectList *CScope_FindQualifiedName(CScopeParseResult *result, NameSpace *nspace, HashNameNode *name, NameSpace **foundnspace) { +static NameSpaceObjectList *CScope_FindQualifiedName(NameResult *result, NameSpace *nspace, HashNameNode *name, NameSpace **foundnspace) { NameSpaceObjectList *list; NameSpaceLookupList *lookup; @@ -1318,7 +1318,7 @@ static NameSpaceObjectList *CScope_FindQualifiedName(CScopeParseResult *result, return NULL; } -static Boolean CScope_FindQualifiedTag(CScopeParseResult *result, NameSpace *nspace, HashNameNode *name) { +static Boolean CScope_FindQualifiedTag(NameResult *result, NameSpace *nspace, HashNameNode *name) { NameSpaceObjectList *list; NameSpaceLookupList *lookup; Type *best; @@ -1333,7 +1333,7 @@ static Boolean CScope_FindQualifiedTag(CScopeParseResult *result, NameSpace *nsp if ((list = CScope_FindQualName(nspace, name))) { for (; list; list = list->next) { if (list->object->otype == OT_TYPETAG) { - result->x8 = OBJ_TYPE_TAG(list->object)->type; + result->type = OBJ_TYPE_TAG(list->object)->type; return 1; } } @@ -1355,7 +1355,7 @@ static Boolean CScope_FindQualifiedTag(CScopeParseResult *result, NameSpace *nsp } if (best) { - result->x8 = best; + result->type = best; return 1; } } @@ -1364,7 +1364,7 @@ static Boolean CScope_FindQualifiedTag(CScopeParseResult *result, NameSpace *nsp return 0; } -CW_INLINE void CScope_NSIteratorInit(CScopeNSIterator *iterator, NameSpace *nspace, CScopeParseResult *result) { +CW_INLINE void CScope_NSIteratorInit(CScopeNSIterator *iterator, NameSpace *nspace, NameResult *result) { // assumed name if (nspace->usings) { iterator->nspace = NULL; @@ -1395,7 +1395,7 @@ CW_INLINE Boolean CScope_NSIteratorNext(CScopeNSIterator *iterator) { } Type *CScope_GetType(NameSpace *nspace, HashNameNode *name, UInt32 *qual) { - CScopeParseResult result; + NameResult result; CScopeNSIterator iterator; NameSpaceObjectList *list; Boolean ok; @@ -1422,7 +1422,7 @@ Type *CScope_GetType(NameSpace *nspace, HashNameNode *name, UInt32 *qual) { } Type *CScope_GetTagType(NameSpace *nspace, HashNameNode *name) { - CScopeParseResult result; + NameResult result; CScopeNSIterator iterator; NameSpaceObjectList *list; Boolean ok; @@ -1440,7 +1440,7 @@ Type *CScope_GetTagType(NameSpace *nspace, HashNameNode *name) { return NULL; } -static Boolean CScope_DependentTemplateMember(CScopeParseResult *result, TypeTemplDep *ttempldep, Boolean flag1, Boolean flag2) { +static Boolean CScope_DependentTemplateMember(NameResult *result, TypeTemplDep *ttempldep, Boolean flag1, Boolean flag2) { SInt32 streamstate; int token; TypeTemplDep *newtype; @@ -1461,7 +1461,7 @@ static Boolean CScope_DependentTemplateMember(CScopeParseResult *result, TypeTem CPrep_TokenStreamSetState(&streamstate); lex(); tk = lex(); - result->x8 = TYPE(newtype); + result->type = TYPE(newtype); return 1; } @@ -1489,7 +1489,7 @@ static Boolean CScope_DependentTemplateMember(CScopeParseResult *result, TypeTem continue; } else { CPrep_TokenStreamSetState(&streamstate); - result->x8 = TYPE(newtype2); + result->type = TYPE(newtype2); return 1; } } @@ -1523,12 +1523,12 @@ static Boolean CScope_DependentTemplateMember(CScopeParseResult *result, TypeTem } CPrep_TokenStreamSetState(&streamstate); - result->x8 = TYPE(newtype); + result->type = TYPE(newtype); return 1; } CPrep_TokenStreamSetState(&streamstate); - result->x8 = TYPE(ttempldep); + result->type = TYPE(ttempldep); return 1; } } @@ -1547,7 +1547,7 @@ static Boolean CScope_CheckDtorName(TypeClass *tclass, Boolean *flag) { { if (!CClass_Destructor(tclass)) *flag = 1; - if ((tclass->flags & CLASS_FLAGS_800) && (lookahead() == '<')) { + if ((tclass->flags & CLASS_IS_TEMPL_INST) && (lookahead() == '<')) { tk = lex(); if (!CTemplTool_EqualArgs(TEMPL_CLASS_INST(tclass)->inst_args, CTempl_ParseUncheckTemplArgs(NULL, 0))) CError_Error(CErrorStr374); @@ -1560,7 +1560,7 @@ static Boolean CScope_CheckDtorName(TypeClass *tclass, Boolean *flag) { return 0; } -static Boolean CScope_ParseQualifiedName(CScopeParseResult *result, NameSpace *nspace) { +static Boolean CScope_ParseQualifiedName(NameResult *result, NameSpace *nspace) { NameSpaceObjectList *list; HashNameNode *saveidentifier; TypeClass *tclass; @@ -1602,33 +1602,37 @@ static Boolean CScope_ParseQualifiedName(CScopeParseResult *result, NameSpace *n return 0; } - if (!(list = CScope_FindQualifiedName(result, nspace, saveidentifier, &result->nspace_0)) || !CScope_SetupParseNameResult(result, list, saveidentifier)) { + if ( + !(list = CScope_FindQualifiedName(result, nspace, saveidentifier, &result->nspace_0)) || + !CScope_SetupParseNameResult(result, list, saveidentifier) + ) + { if (flag) { result->x1C = 1; return 1; } - if (nspace->theclass && !(nspace->theclass->flags & CLASS_FLAGS_2)) + if (nspace->theclass && !(nspace->theclass->flags & CLASS_COMPLETED)) CError_Error(CErrorStr136, nspace->theclass, 0); else CError_Error(CErrorStr140, saveidentifier->name); return 0; } - if (result->x8 && IS_TYPE_CLASS(result->x8) && (lookahead() == '<')) { - tclass = TYPE_CLASS(result->x8); - if (tclass->flags & CLASS_FLAGS_800) + if (result->type && IS_TYPE_CLASS(result->type) && (lookahead() == '<')) { + tclass = TYPE_CLASS(result->type); + if (tclass->flags & CLASS_IS_TEMPL_INST) tclass = TYPE_CLASS(TEMPL_CLASS_INST(tclass)->templ); - else if (!(tclass->flags & CLASS_FLAGS_100)) + else if (!(tclass->flags & CLASS_IS_TEMPL)) return 1; tk = lex(); - result->x8 = CTempl_ClassGetType(TEMPL_CLASS(tclass)); - if (IS_TYPE_CLASS(result->x8) && (lookahead() == TK_COLON_COLON)) { + result->type = CTempl_ClassGetType(TEMPL_CLASS(tclass)); + if (IS_TYPE_CLASS(result->type) && (lookahead() == TK_COLON_COLON)) { lex(); tk = lex(); result->x1D = 1; - nspace = TYPE_CLASS(result->x8)->nspace; - result->x8 = NULL; + nspace = TYPE_CLASS(result->type)->nspace; + result->type = NULL; result->obj_10 = NULL; continue; } @@ -1638,14 +1642,14 @@ static Boolean CScope_ParseQualifiedName(CScopeParseResult *result, NameSpace *n } while (1); } -Boolean CScope_ParseExprName(CScopeParseResult *result) { +Boolean CScope_ParseExprName(NameResult *result) { CScopeNSIterator iterator; HashNameNode *name; NameSpaceObjectList *list; Boolean flag; if (!copts.cplusplus) { - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); if (tk != TK_IDENTIFIER) { CError_Error(CErrorStr107); return 0; @@ -1665,11 +1669,11 @@ Boolean CScope_ParseExprName(CScopeParseResult *result) { return 1; } else { if ((tk == TK_COLON_COLON || tk == TK_IDENTIFIER) && CScope_ParseQualifiedNameSpace(result, 1, 1)) { - if (result->x8) + if (result->type) return 1; CError_ASSERT(2313, result->nspace_0); } else { - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); result->nspace_0 = cscope_current; } @@ -1733,7 +1737,7 @@ Boolean CScope_ParseExprName(CScopeParseResult *result) { } } -Boolean CScope_ParseDeclName(CScopeParseResult *result) { +Boolean CScope_ParseDeclName(NameResult *result) { CScopeNSIterator iterator; HashNameNode *name; NameSpaceObjectList *list; @@ -1748,7 +1752,7 @@ Boolean CScope_ParseDeclName(CScopeParseResult *result) { CError_Error(CErrorStr107); return 0; } - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); name = tkidentifier; CScope_NSIteratorInit(&iterator, cscope_current, result); @@ -1771,7 +1775,7 @@ Boolean CScope_ParseDeclName(CScopeParseResult *result) { if (!CScope_ParseQualifiedNameSpace(result, 0, 0)) goto non_cpp_mode; - if (result->x8) + if (result->type) return 1; nspace = result->nspace_0; @@ -1835,7 +1839,7 @@ Boolean CScope_ParseDeclName(CScopeParseResult *result) { } } -Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1, Boolean flag2) { +Boolean CScope_ParseQualifiedNameSpace(NameResult *result, Boolean flag1, Boolean flag2) { // mostly matches, some registers are awkwardly swapped HashNameNode *name; // r25 NameSpace *nspace; // r24 @@ -1845,7 +1849,7 @@ Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1, NameSpaceObjectList *list; // r21 CScopeNSIterator iterator; - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); nspace = NULL; if (tk == TK_COLON_COLON) { result->nspace_0 = nspace = cscope_root; @@ -1894,7 +1898,7 @@ Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1, type = OBJ_TYPE_TAG(list->object)->type; if (type->type != TYPECLASS) { if (t == '<') { - result->x8 = type; + result->type = type; return 1; } else { CError_Error(CErrorStr121); @@ -1903,19 +1907,19 @@ Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1, } parse_thing: if (t == '<') { - if (TYPE_CLASS(type)->flags & CLASS_FLAGS_800) { + if (TYPE_CLASS(type)->flags & CLASS_IS_TEMPL_INST) { type = TYPE(TEMPL_CLASS_INST(type)->templ); - } else if (!(TYPE_CLASS(type)->flags & CLASS_FLAGS_100)) { - result->x8 = type; + } else if (!(TYPE_CLASS(type)->flags & CLASS_IS_TEMPL)) { + result->type = type; return 1; } } if ((tk = lex()) == '<') { - CError_ASSERT(2609, TYPE_CLASS(type)->flags & CLASS_FLAGS_100); + CError_ASSERT(2609, TYPE_CLASS(type)->flags & CLASS_IS_TEMPL); type2 = CTempl_ClassGetType(TEMPL_CLASS(type)); if (IS_TYPE_TEMPLATE(type2)) { if (lookahead() != TK_COLON_COLON) { - result->x8 = type2; + result->type = type2; return 1; } return CScope_DependentTemplateMember(result, TYPE_TEMPLATE(type2), flag1, flag2); @@ -1925,14 +1929,14 @@ Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1, result->nspace_0 = nspace = TYPE_CLASS(type2)->nspace; if (lookahead() != TK_COLON_COLON) { - result->x8 = type2; + result->type = type2; return 1; } tk = lex(); CDecl_CompleteType(type2); } else { CError_ASSERT(2632, tk == TK_COLON_COLON); - if (!(TYPE_CLASS(type)->flags & CLASS_FLAGS_100) || CParser_CheckTemplateClassUsage(TEMPL_CLASS(type), 1)) + if (!(TYPE_CLASS(type)->flags & CLASS_IS_TEMPL) || CParser_CheckTemplateClassUsage(TEMPL_CLASS(type), 1)) result->nspace_0 = nspace = TYPE_CLASS(type)->nspace; CDecl_CompleteType(type); } @@ -1948,7 +1952,7 @@ Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1, if (TYPE_TEMPLATE(type2)->dtype == TEMPLDEP_ARGUMENT && TYPE_TEMPLATE(type2)->u.pid.type == TPT_TEMPLATE) { type2 = CTempl_ParseTemplTemplParam(TYPE_TEMPLATE(type2)); if ((type2->type != TYPETEMPLATE) || ((t = lookahead()) != TK_COLON_COLON)) { - result->x8 = type2; + result->type = type2; return 1; } } @@ -1956,19 +1960,19 @@ Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1, return CScope_DependentTemplateMember(result, TYPE_TEMPLATE(type2), flag1, flag2); } if (t == '<') { - result->x8 = type2; + result->type = type2; return 1; } else { CError_Error(CErrorStr121); return 0; } } else { - if ((t == '<') && (TYPE_CLASS(type2)->flags & CLASS_FLAGS_100)) { + if ((t == '<') && (TYPE_CLASS(type2)->flags & CLASS_IS_TEMPL)) { type = type2; goto parse_thing; } if ((tk = lex()) == '<') { - result->x8 = type2; + result->type = type2; return 1; } CError_ASSERT(2686, tk == TK_COLON_COLON); @@ -1989,14 +1993,14 @@ Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1, return 0; } -Boolean CScope_ParseElaborateName(CScopeParseResult *result) { +Boolean CScope_ParseElaborateName(NameResult *result) { CScopeNSIterator iterator; HashNameNode *name; NameSpaceObjectList *list; Boolean flag; if (!copts.cplusplus) { - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); if (tk != TK_IDENTIFIER) { CError_Error(CErrorStr107); return 0; @@ -2029,7 +2033,7 @@ Boolean CScope_ParseElaborateName(CScopeParseResult *result) { } name = tkidentifier; } else { - if (result->x8) + if (result->type) return 1; CError_ASSERT(2760, result->nspace_0); @@ -2062,11 +2066,11 @@ Boolean CScope_ParseElaborateName(CScopeParseResult *result) { } } -Boolean CScope_FindObject(NameSpace *nspace, CScopeParseResult *result, HashNameNode *name) { +Boolean CScope_FindObject(NameSpace *nspace, NameResult *result, HashNameNode *name) { CScopeNSIterator iterator; NameSpaceObjectList *list; - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); CScope_NSIteratorInit(&iterator, nspace, result); do { for (list = CScope_NSIteratorFind(&iterator, name); list; list = list->next) { @@ -2080,11 +2084,11 @@ Boolean CScope_FindObject(NameSpace *nspace, CScopeParseResult *result, HashName return 0; } -Boolean CScope_FindNonClassObject(NameSpace *nspace, CScopeParseResult *result, HashNameNode *name) { +Boolean CScope_FindNonClassObject(NameSpace *nspace, NameResult *result, HashNameNode *name) { CScopeNSIterator iterator; NameSpaceObjectList *list; - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); CScope_NSIteratorInit(&iterator, nspace, result); do { for (list = CScope_NSIteratorNonClassFind(&iterator, name); list; list = list->next) { @@ -2098,11 +2102,11 @@ Boolean CScope_FindNonClassObject(NameSpace *nspace, CScopeParseResult *result, return 0; } -NameSpaceObjectList *CScope_FindObjectList(CScopeParseResult *result, HashNameNode *name) { +NameSpaceObjectList *CScope_FindObjectList(NameResult *result, HashNameNode *name) { CScopeNSIterator iterator; NameSpaceObjectList *list; - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); CScope_NSIteratorInit(&iterator, cscope_current, result); do { for (list = CScope_NSIteratorFind(&iterator, name); list; list = list->next) { @@ -2117,11 +2121,11 @@ NameSpaceObjectList *CScope_FindObjectList(CScopeParseResult *result, HashNameNo } Boolean CScope_PossibleTypeName(HashNameNode *name) { - CScopeParseResult result; + NameResult result; CScopeNSIterator iterator; NameSpaceObjectList *list; - memclrw(&result, sizeof(CScopeParseResult)); + memclrw(&result, sizeof(NameResult)); CScope_NSIteratorInit(&iterator, cscope_current, &result); do { if ((list = CScope_NSIteratorFind(&iterator, name))) { @@ -2142,10 +2146,10 @@ Boolean CScope_PossibleTypeName(HashNameNode *name) { return 0; } -Boolean CScope_FindClassMemberObject(TypeClass *tclass, CScopeParseResult *result, HashNameNode *name) { +Boolean CScope_FindClassMemberObject(TypeClass *tclass, NameResult *result, HashNameNode *name) { NameSpaceObjectList *list; - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); if (CScope_FindClassMember(result, tclass->nspace, name, Lookup_0)) { list = result->nsol_14; @@ -2228,12 +2232,12 @@ Type *CScope_GetLocalTagType(NameSpace *nspace, HashNameNode *name) { return NULL; } -Boolean CScope_FindTypeName(NameSpace *nspace, HashNameNode *name, CScopeParseResult *result) { +Boolean CScope_FindTypeName(NameSpace *nspace, HashNameNode *name, NameResult *result) { CScopeNSIterator iterator; NameSpaceObjectList *list; NameSpaceObjectList *scan; - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); CScope_NSIteratorInit(&iterator, nspace, result); do { @@ -2342,7 +2346,7 @@ BClassList *CScope_GetClassAccessPath(BClassList *list, TypeClass *tclass) { return NULL; } -static Boolean CScope_FixMemberResult(TypeClass *tclass, CScopeParseResult *result) { +static Boolean CScope_FixMemberResult(TypeClass *tclass, NameResult *result) { if (!(result->bcl_18 = CScope_GetClassAccessPath(result->bcl_18, tclass))) { if (result->name_4) CError_Error(CErrorStr150, result->name_4->name); @@ -2354,7 +2358,7 @@ static Boolean CScope_FixMemberResult(TypeClass *tclass, CScopeParseResult *resu } } -Boolean CScope_ParseMemberName(TypeClass *tclass, CScopeParseResult *result, Boolean flag) { +Boolean CScope_ParseMemberName(TypeClass *tclass, NameResult *result, Boolean flag) { HashNameNode *name; NameSpaceObjectList *list; short t; @@ -2365,11 +2369,11 @@ Boolean CScope_ParseMemberName(TypeClass *tclass, CScopeParseResult *result, Boo if (!CScope_ParseExprName(result)) return 0; - if (result->x8 && IS_TYPE_TEMPLATE(result->x8) && TYPE_TEMPLATE(result->x8)->dtype == TEMPLDEP_QUALNAME) { + if (result->type && IS_TYPE_TEMPLATE(result->type) && TYPE_TEMPLATE(result->type)->dtype == TEMPLDEP_QUALNAME) { if (flag) return 1; - CError_Error(CErrorStr340, TYPE_TEMPLATE(result->x8)->u.qual.name->name); - result->x8 = NULL; + CError_Error(CErrorStr340, TYPE_TEMPLATE(result->type)->u.qual.name->name); + result->type = NULL; return 0; } @@ -2385,7 +2389,7 @@ Boolean CScope_ParseMemberName(TypeClass *tclass, CScopeParseResult *result, Boo tkidentifier = name; switch (t) { case TK_COLON_COLON: - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); if (!CScope_FindClassMember(result, tclass->nspace, name, Lookup_2)) goto restart; break; @@ -2395,7 +2399,7 @@ Boolean CScope_ParseMemberName(TypeClass *tclass, CScopeParseResult *result, Boo break; } } else if (tk == '~') { - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); if (CScope_CheckDtorName(tclass, &dtorflag)) { if (dtorflag) { result->x1C = 1; @@ -2412,7 +2416,7 @@ Boolean CScope_ParseMemberName(TypeClass *tclass, CScopeParseResult *result, Boo return 0; } - memclrw(result, sizeof(CScopeParseResult)); + memclrw(result, sizeof(NameResult)); return CScope_ParseQualifiedName(result, tclass->nspace); } @@ -2508,10 +2512,10 @@ static void CScope_AddUsingObject(BClassList *bcl, NameSpace *nspace, ObjBase *o } void CScope_AddClassUsingDeclaration(TypeClass *tclass, TypeClass *tclass2, HashNameNode *name, AccessType access) { - CScopeParseResult result; + NameResult result; NameSpaceObjectList *scan; - memclrw(&result, sizeof(CScopeParseResult)); + memclrw(&result, sizeof(NameResult)); if (!CScope_FindClassMember(&result, tclass2->nspace, name, Lookup_0) || !CScope_FixMemberResult(tclass, &result)) { CError_Error(CErrorStr340, name->name); return; @@ -2540,10 +2544,10 @@ void CScope_ParseUsingDeclaration(NameSpace *nspace, AccessType access, Boolean Boolean isTemplate; Boolean isTypename; NameSpaceObjectList *scan; - CScopeParseResult result; + NameResult result; if (nspace->theclass) { - isTemplate = (TYPE_CLASS(nspace->theclass)->flags & CLASS_FLAGS_100) != 0; + isTemplate = (TYPE_CLASS(nspace->theclass)->flags & CLASS_IS_TEMPL) != 0; isTypename = 0; if (tk == TK_TYPENAME) { if (!isTemplate) @@ -2557,7 +2561,7 @@ void CScope_ParseUsingDeclaration(NameSpace *nspace, AccessType access, Boolean return; } - if (result.x8 && IS_TYPE_TEMPLATE(result.x8) && TYPE_TEMPLATE(result.x8)->dtype == TEMPLDEP_QUALNAME) { + if (result.type && IS_TYPE_TEMPLATE(result.type) && TYPE_TEMPLATE(result.type)->dtype == TEMPLDEP_QUALNAME) { CError_ASSERT(3578, isTemplate); if (isTypename) { @@ -2565,12 +2569,12 @@ void CScope_ParseUsingDeclaration(NameSpace *nspace, AccessType access, Boolean memclrw(objtype, sizeof(ObjType)); objtype->otype = OT_TYPE; objtype->access = access; - objtype->type = result.x8; - CScope_AddObject(nspace, TYPE_TEMPLATE(result.x8)->u.qual.name, OBJ_BASE(objtype)); + objtype->type = result.type; + CScope_AddObject(nspace, TYPE_TEMPLATE(result.type)->u.qual.name, OBJ_BASE(objtype)); } else { CTemplClass_RegisterUsingDecl( TEMPL_CLASS(nspace->theclass), - TYPE_TEMPLATE(result.x8), + TYPE_TEMPLATE(result.type), access); } @@ -2612,11 +2616,11 @@ void CScope_ParseUsingDeclaration(NameSpace *nspace, AccessType access, Boolean } static NameSpace *CScope_ParseQualifiedNamespaceSpecifier(NameSpace *nspace) { - CScopeParseResult result; + NameResult result; CScopeNSIterator iterator; NameSpaceObjectList *list; - memclrw(&result, sizeof(CScopeParseResult)); + memclrw(&result, sizeof(NameResult)); if (tk == TK_COLON_COLON) { nspace = cscope_root; result.x1D = 1; diff --git a/compiler_and_linker/unsorted/CABI.c b/compiler_and_linker/unsorted/CABI.c index 0b898c2..2a88de1 100644 --- a/compiler_and_linker/unsorted/CABI.c +++ b/compiler_and_linker/unsorted/CABI.c @@ -70,9 +70,9 @@ void CABI_ReverseBitField(TypeBitfield *tbitfield) { CError_FATAL(172); } - b = tbitfield->unkB; - a = tbitfield->unkA; - tbitfield->unkA = (bits - a) - b; + b = tbitfield->bitlength; + a = tbitfield->offset; + tbitfield->offset = (bits - a) - b; } static void CABI_AllocateZeroVTablePointer(void *unk, TypeClass *tclass) { @@ -95,7 +95,7 @@ static SInt32 CABI_GetBaseSize(TypeClass *tclass) { return size; } -static void CABI_AllocateBases(DeclE *decle, TypeClass *tclass) { +static void CABI_AllocateBases(ClassLayout *layout, TypeClass *tclass) { Boolean flag; TypeClass *baseclass; ClassList *base; @@ -108,7 +108,7 @@ static void CABI_AllocateBases(DeclE *decle, TypeClass *tclass) { for (base = tclass->bases; base; base = base->next) { if (!base->is_virtual) { baseclass = base->base; - if (!(baseclass->flags & CLASS_FLAGS_1000)) { + if (!(baseclass->flags & CLASS_EMPTY)) { base->offset = size + CMach_MemberAlignValue(TYPE(baseclass), size); if (copts.vbase_abi_v2) { size = base->offset + CABI_GetBaseSize(baseclass); @@ -131,7 +131,7 @@ static void CABI_AllocateBases(DeclE *decle, TypeClass *tclass) { tclass->size = size; } -static void CABI_AllocateVirtualBasePointers(DeclE *decle, TypeClass *tclass) { +static void CABI_AllocateVirtualBasePointers(ClassLayout *layout, TypeClass *tclass) { ClassList *base; SInt32 size; @@ -163,7 +163,7 @@ static SInt32 CABI_GetMemberOffset(TypeClass *tclass, HashNameNode *name) { } } -static void CABI_AllocateMembers(DeclE *decle, TypeClass *tclass) { +static void CABI_AllocateMembers(ClassLayout *layout, TypeClass *tclass) { ObjMemberVar *ivar; SInt32 initialSize; SInt32 maxSize; @@ -180,7 +180,7 @@ static void CABI_AllocateMembers(DeclE *decle, TypeClass *tclass) { for (ivar = tclass->ivars; ivar; ivar = ivar->next) { if (!ivar->anonunion) { if (!(ivar->offset & 0x80000000)) { - if (tclass->mode == CLASS_MODE_1) + if (tclass->mode == CLASS_MODE_UNION) CMach_StructLayoutInitOffset(initialSize); if (IS_TYPE_BITFIELD(ivar->type)) @@ -188,7 +188,7 @@ static void CABI_AllocateMembers(DeclE *decle, TypeClass *tclass) { else ivar->offset = CMach_StructLayoutGetOffset(ivar->type, ivar->qual); - if (tclass->mode == CLASS_MODE_1) { + if (tclass->mode == CLASS_MODE_UNION) { SInt32 tmp = CMach_StructLayoutGetCurSize(); if (tmp > maxSize) maxSize = tmp; @@ -208,14 +208,14 @@ static void CABI_AllocateMembers(DeclE *decle, TypeClass *tclass) { } else { CError_ASSERT(422, IS_TYPE_CLASS(ivar->type)); - if (tclass->mode == CLASS_MODE_1) + if (tclass->mode == CLASS_MODE_UNION) CMach_StructLayoutInitOffset(initialSize); unionStart = CMach_StructLayoutGetOffset(ivar->type, ivar->qual); unionClass = TYPE_CLASS(ivar->type); inAnonUnion = 1; - if (tclass->mode == CLASS_MODE_1) { + if (tclass->mode == CLASS_MODE_UNION) { SInt32 tmp = CMach_StructLayoutGetCurSize(); if (tmp > maxSize) maxSize = tmp; @@ -224,7 +224,7 @@ static void CABI_AllocateMembers(DeclE *decle, TypeClass *tclass) { removeNoNameIvars = 1; } - if (decle->vtable_ivar == ivar) + if (layout->vtable_ivar == ivar) tclass->vtable->offset = ivar->offset; } @@ -238,7 +238,7 @@ static void CABI_AllocateMembers(DeclE *decle, TypeClass *tclass) { } } - if (tclass->mode == CLASS_MODE_1) + if (tclass->mode == CLASS_MODE_UNION) tclass->size = maxSize; else tclass->size = CMach_StructLayoutGetCurSize(); @@ -251,7 +251,7 @@ static void CABI_AllocateMembers(DeclE *decle, TypeClass *tclass) { } } -static void CABI_AllocateVirtualBases(DeclE *decle, TypeClass *tclass) { +static void CABI_AllocateVirtualBases(ClassLayout *layout, TypeClass *tclass) { VClassList *vbase; SInt32 size; @@ -331,14 +331,14 @@ static SInt32 CABI_GetBaseVTableSize(TypeClass *tclass) { static void CABI_ApplyClassFlags(Object *obj, UInt8 flags, Boolean unused) { if (flags & CLASS_EFLAGS_INTERNAL) - obj->flags = obj->flags | OBJECT_FLAGS_10; + obj->flags = obj->flags | OBJECT_INTERNAL; if (flags & CLASS_EFLAGS_IMPORT) - obj->flags = obj->flags | OBJECT_FLAGS_20; + obj->flags = obj->flags | OBJECT_IMPORT; if (flags & CLASS_EFLAGS_EXPORT) - obj->flags = obj->flags | OBJECT_FLAGS_40; + obj->flags = obj->flags | OBJECT_EXPORT; } -static void CABI_AllocateVTable(DeclE *decle, TypeClass *tclass) { +static void CABI_AllocateVTable(ClassLayout *layout, TypeClass *tclass) { SInt32 size; ObjBase *objbase; Object *obj; @@ -351,7 +351,7 @@ static void CABI_AllocateVTable(DeclE *decle, TypeClass *tclass) { if (!tclass->vtable) { CABI_AddVTable(tclass); - decle->xA = decle->x8 - 1; + layout->xA = layout->lex_order_count - 1; } if (!CABI_FindZeroDeltaVPtr(tclass)) { @@ -362,30 +362,30 @@ static void CABI_AllocateVTable(DeclE *decle, TypeClass *tclass) { ivar->access = ACCESSPUBLIC; ivar->name = vptr_name_node; ivar->type = TYPE(&void_ptr); - decle->vtable_ivar = ivar; + layout->vtable_ivar = ivar; - for (i = decle->xA; ; i--) { + for (i = layout->xA; ; i--) { if (i < 0) { ivar->next = tclass->ivars; tclass->ivars = ivar; break; } - CError_ASSERT(666, decle->objlist[i]); + CError_ASSERT(666, layout->objlist[i]); - if (decle->objlist[i]->otype == OT_MEMBERVAR) { - ivar->next = OBJ_MEMBER_VAR(decle->objlist[i])->next; - OBJ_MEMBER_VAR(decle->objlist[i])->next = ivar; + if (layout->objlist[i]->otype == OT_MEMBERVAR) { + ivar->next = OBJ_MEMBER_VAR(layout->objlist[i])->next; + OBJ_MEMBER_VAR(layout->objlist[i])->next = ivar; break; } } - if (tclass->flags & (CLASS_FLAGS_10 | CLASS_FLAGS_2000)) + if (tclass->flags & (CLASS_SINGLE_OBJECT | CLASS_COM_OBJECT)) size = void_ptr.size; else size = 8; } else { - decle->vtable_ivar = NULL; + layout->vtable_ivar = NULL; } for (base = tclass->bases; base; base = base->next) { @@ -403,17 +403,17 @@ static void CABI_AllocateVTable(DeclE *decle, TypeClass *tclass) { } } - for (i = 0; i < decle->x8; i++) { - CError_ASSERT(714, objbase = decle->objlist[i]); + for (i = 0; i < layout->lex_order_count; i++) { + CError_ASSERT(714, objbase = layout->objlist[i]); if (objbase->otype == OT_OBJECT && OBJECT(objbase)->datatype == DVFUNC) { TypeMemberFunc *tmethod = TYPE_METHOD(OBJECT(objbase)->type); Object *baseobj = CABI_FindZeroVirtualBaseMember(tclass, OBJECT(objbase)); if (baseobj) { - tmethod->x1E = TYPE_METHOD(baseobj->type)->x1E; + tmethod->vtbl_index = TYPE_METHOD(baseobj->type)->vtbl_index; } else { - tmethod->x1E = size; + tmethod->vtbl_index = size; size += 4; } } @@ -450,34 +450,34 @@ static void CABI_AllocateVTable(DeclE *decle, TypeClass *tclass) { tclass->vtable->size = size; } -void CABI_LayoutClass(DeclE *decle, TypeClass *tclass) { +void CABI_LayoutClass(ClassLayout *layout, TypeClass *tclass) { char saveAlignMode = copts.structalignment; tclass->size = 0; if (!tclass->sominfo) { if (tclass->bases) - CABI_AllocateBases(decle, tclass); - if (tclass->flags & CLASS_FLAGS_20) - CABI_AllocateVirtualBasePointers(decle, tclass); - if (decle->xC) - CABI_AllocateVTable(decle, tclass); - CABI_AllocateMembers(decle, tclass); - if (tclass->flags & CLASS_FLAGS_20) - CABI_AllocateVirtualBases(decle, tclass); + CABI_AllocateBases(layout, tclass); + if (tclass->flags & CLASS_HAS_VBASES) + CABI_AllocateVirtualBasePointers(layout, tclass); + if (layout->has_vtable) + CABI_AllocateVTable(layout, tclass); + CABI_AllocateMembers(layout, tclass); + if (tclass->flags & CLASS_HAS_VBASES) + CABI_AllocateVirtualBases(layout, tclass); } else { copts.structalignment = AlignMode2_PPC; - CABI_AllocateMembers(decle, tclass); + CABI_AllocateMembers(layout, tclass); } tclass->align = CMach_GetClassAlign(tclass); if (tclass->size == 0) { tclass->size = 1; - tclass->flags = tclass->flags | CLASS_FLAGS_1000; + tclass->flags = tclass->flags | CLASS_EMPTY; } else { tclass->size += CABI_StructSizeAlignValue(TYPE(tclass), tclass->size); } - tclass->flags = tclass->flags | CLASS_FLAGS_2; + tclass->flags = tclass->flags | CLASS_COMPLETED; copts.structalignment = saveAlignMode; } @@ -510,7 +510,7 @@ void CABI_MakeDefaultArgConstructor(TypeClass *tclass, Object *func) { CFunc_SetupNewFuncArgs(func, TYPE_FUNC(func->type)->args); - if (tclass->flags & CLASS_FLAGS_20) + if (tclass->flags & CLASS_HAS_VBASES) arguments->next->object->name = no_name_node; firstStmt.next = &returnStmt; @@ -531,7 +531,7 @@ void CABI_MakeDefaultArgConstructor(TypeClass *tclass, Object *func) { argexprs->node = create_objectnode(arguments->object); - if (tclass->flags & CLASS_FLAGS_20) { + if (tclass->flags & CLASS_HAS_VBASES) { args = args->next; argexprs->next = lalloc(sizeof(ENodeList)); argexprs = argexprs->next; @@ -571,7 +571,7 @@ ENode *CABI_MakeThisExpr(TypeClass *tclass, SInt32 offset) { if (tclass) { if (!tclass->sominfo) { expr = create_objectnode(CABI_ThisArg()); - if (tclass->flags & CLASS_FLAGS_1) + if (tclass->flags & CLASS_HANDLEOBJECT) expr = makemonadicnode(expr, EINDIRECT); } else { expr = CSOM_SOMSelfObjectExpr(tclass); @@ -601,7 +601,7 @@ static ENode *CABI_MakeCopyConArgExpr(TypeClass *tclass, Boolean flag) { CError_ASSERT(1000, args = arguments); CError_ASSERT(1001, args = args->next); - if (flag && (tclass->flags & CLASS_FLAGS_20)) + if (flag && (tclass->flags & CLASS_HAS_VBASES)) CError_ASSERT(1002, args = args->next); CError_ASSERT(1003, IS_TYPE_POINTER_ONLY(args->object->type)); @@ -878,9 +878,9 @@ static Boolean CABI_IsOperatorNew(ObjBase *obj) { Object *CABI_ConstructorCallsNew(TypeClass *tclass) { NameSpaceObjectList *nsol; - CScopeParseResult pr; + NameResult pr; - if (!tclass->sominfo && (tclass->flags & CLASS_FLAGS_1)) { + if (!tclass->sominfo && (tclass->flags & CLASS_HANDLEOBJECT)) { if (CScope_FindClassMemberObject(tclass, &pr, CMangler_OperatorName(TK_NEW))) { if (pr.obj_10) { if (CABI_IsOperatorNew(pr.obj_10)) @@ -946,7 +946,7 @@ void CABI_TransConstructor(Object *obj, Statement *firstStmt, TypeClass *tclass, } if (!tclass->sominfo) { - if (tclass->flags & CLASS_FLAGS_20) { + if (tclass->flags & CLASS_HAS_VBASES) { label = newlabel(); stmt = CFunc_InsertStatement(ST_IFGOTO, stmt); @@ -1185,7 +1185,7 @@ void CABI_MakeDefaultConstructor(TypeClass *tclass, Object *func) { CFunc_SetupNewFuncArgs(func, TYPE_FUNC(func->type)->args); ctor_chain = NULL; - if (tclass->flags & CLASS_FLAGS_20) + if (tclass->flags & CLASS_HAS_VBASES) arguments->next->object->name = CParser_GetUniqueName(); firstStmt.next = &returnStmt; @@ -1333,7 +1333,7 @@ static Statement *CABI_CopyConAssignCB(Statement *stmt, TypeClass *tclass, TypeC Object *tmpfunc; if (baseclass) { - if (baseclass->flags & CLASS_FLAGS_1000) { + if (baseclass->flags & CLASS_EMPTY) { if ( (flag && !CClass_CopyConstructor(baseclass)) || (!flag && !CClass_AssignmentOperator(baseclass)) @@ -1556,7 +1556,7 @@ void CABI_MakeDefaultCopyConstructor(TypeClass *tclass, Object *func) { CFunc_SetupNewFuncArgs(func, TYPE_FUNC(func->type)->args); ctor_chain = NULL; - if (tclass->flags & CLASS_FLAGS_20) + if (tclass->flags & CLASS_HAS_VBASES) arguments->next->object->name = CParser_GetUniqueName(); firstStmt.next = &returnStmt; @@ -1599,7 +1599,7 @@ void CABI_MakeDefaultAssignmentOperator(TypeClass *tclass, Object *func) { stmt = curstmt; - if (tclass->mode == CLASS_MODE_1) { + if (tclass->mode == CLASS_MODE_UNION) { expr1 = makemonadicnode(CABI_MakeThisExpr(tclass, 0), EINDIRECT); expr1->rtype = TYPE(tclass); @@ -1803,13 +1803,13 @@ void CABI_TransDestructor(Object *obj1, Object *obj2, Statement *stmt, TypeClass scan->dobjstack = NULL; label->stmt = scan; - if (flag23 && !(tclass->flags & CLASS_FLAGS_1)) + if (flag23 && !(tclass->flags & CLASS_HANDLEOBJECT)) scan = CABI_DestroyMembers(scan, tclass->ivars, tclass); if (flag25 && tclass->bases) scan = CABI_DestroyBases(scan, tclass->bases); - if (flag24 && (tclass->flags & CLASS_FLAGS_20)) { + if (flag24 && (tclass->flags & CLASS_HAS_VBASES)) { label3 = newlabel(); scan = CFunc_InsertStatement(ST_IFNGOTO, scan); scan->expr = CABI_MakeVArgExpr(); @@ -1957,12 +1957,12 @@ static void CABI_AddLayeredDestructor(TypeClass *tclass, Object *dtor, HashNameN func->nspace = dtor->nspace; func->name = name; func->type = TYPE(CDecl_MakeDefaultDtorType(tclass, is_virtual)); - func->qual = Q_20000 | Q_80000; + func->qual = Q_20000 | Q_MANGLE_NAME; func->qual |= Q_INLINE; CABI_ApplyClassFlags(func, tclass->eflags, 1); CError_ASSERT(2678, IS_TYPE_FUNC(func->type)); - TYPE_FUNC(func->type)->flags |= FUNC_FLAGS_100; + TYPE_FUNC(func->type)->flags |= FUNC_AUTO_GENERATED; if (dtor->datatype == DVFUNC) { func->datatype = DVFUNC; @@ -2018,7 +2018,7 @@ ENode *CABI_DestroyObject(Object *dtor, ENode *objexpr, CABIDestroyMode mode, Bo if (flag1) expr->data.funccall.funcref->flags = expr->data.funccall.funcref->flags | ENODE_FLAG_80; expr->data.funccall.functype = TYPE_FUNC(dtor->type); - dtor->flags = dtor->flags | OBJECT_FLAGS_1; + dtor->flags = dtor->flags | OBJECT_USED; list = lalloc(sizeof(ENodeList)); list->node = objexpr; diff --git a/compiler_and_linker/unsorted/CBrowse.c b/compiler_and_linker/unsorted/CBrowse.c index a776a70..12ea4c8 100644 --- a/compiler_and_linker/unsorted/CBrowse.c +++ b/compiler_and_linker/unsorted/CBrowse.c @@ -202,7 +202,7 @@ void CBrowse_BeginClass(DeclInfo *di, GList *gl) { !di->file->recordbrowseinfo || !di->file2 || !di->file2->fileID || - di->x60 <= 0 + di->sourceoffset <= 0 ) { memclrw(&gClassData, sizeof(gClassData)); @@ -218,9 +218,9 @@ void CBrowse_BeginClass(DeclInfo *di, GList *gl) { AppendGListByte(&gClassData, browseClass); AppendGListWord(&gClassData, di->file->fileID); AppendGListWord(&gClassData, di->file2->fileID); - AppendGListLong(&gClassData, di->x60 - 1); + AppendGListLong(&gClassData, di->sourceoffset - 1); CError_ASSERT(270, gClassData.size == 9); - AppendGListLong(&gClassData, di->x60 - 1); + AppendGListLong(&gClassData, di->sourceoffset - 1); AppendGListLong(&gClassData, 0); RecordName(&gClassData, TYPE_CLASS(di->thetype)->classname->name, TYPE_CLASS(di->thetype)->classname->id); @@ -254,7 +254,7 @@ void CBrowse_BeginClass(DeclInfo *di, GList *gl) { AppendGListByte(&gClassData, base->is_virtual); tclass = base->base; - if ((tclass->flags & CLASS_FLAGS_800) && !TEMPL_CLASS_INST(tclass)->is_specialized) + if ((tclass->flags & CLASS_IS_TEMPL_INST) && !TEMPL_CLASS_INST(tclass)->is_specialized) tclass = TYPE_CLASS(TEMPL_CLASS_INST(tclass)->templ); CMangler_MangleType(TYPE(tclass), 0); @@ -315,30 +315,30 @@ void CBrowse_AddClassMemberFunction(Object *object, SInt32 startOffset, SInt32 e CError_ASSERT(391, object->type && IS_TYPE_FUNC(object->type)); tfunc = TYPE_METHOD(object->type); - if (tfunc->flags & FUNC_FLAGS_100) + if (tfunc->flags & FUNC_AUTO_GENERATED) return; if (object->datatype == DVFUNC) flags |= kVirtual; - if (tfunc->flags & FUNC_FLAGS_8) + if (tfunc->flags & FUNC_PURE) flags |= kAbstract; - if (tfunc->x26) + if (tfunc->is_static) flags |= kStatic; - if (tfunc->flags & FUNC_FLAGS_1000) + if (tfunc->flags & FUNC_IS_CTOR) flags |= kCtor; - if (tfunc->flags & FUNC_FLAGS_2000) + if (tfunc->flags & FUNC_IS_DTOR) flags |= kDtor; AppendGListByte(&gClassData, memberFunction); AppendGListByte(&gClassData, gFromAccessType[object->access]); AppendGListLong(&gClassData, flags); - id = tfunc->x22; + id = tfunc->funcid; if (id <= 0) { // TODO: this is not 64-bit safe - if (!(tfunc->flags & FUNC_FLAGS_2) || id == -1) + if (!(tfunc->flags & FUNC_DEFINED) || id == -1) AppendGListLong(&gMemberFuncList, (SInt32) object); - tfunc->x22 = id = gNextMemberFuncID++; + tfunc->funcid = id = gNextMemberFuncID++; } AppendGListLong(&gClassData, id); @@ -398,7 +398,7 @@ void CBrowse_BeginStruct(DeclInfo *di, TypeStruct *tstruct, GList *gl) { !di->file->recordbrowseinfo || !di->file2 || !di->file2->fileID || - di->x60 <= 0 + di->sourceoffset <= 0 ) { memclrw(&gClassData, sizeof(gClassData)); @@ -415,9 +415,9 @@ void CBrowse_BeginStruct(DeclInfo *di, TypeStruct *tstruct, GList *gl) { AppendGListByte(&gClassData, browseClass); AppendGListWord(&gClassData, di->file->fileID); AppendGListWord(&gClassData, di->file2->fileID); - AppendGListLong(&gClassData, di->x60 - 1); + AppendGListLong(&gClassData, di->sourceoffset - 1); CError_ASSERT(521, gClassData.size == 9); - AppendGListLong(&gClassData, di->x60 - 1); + AppendGListLong(&gClassData, di->sourceoffset - 1); AppendGListLong(&gClassData, 0); RecordName(&gClassData, name->name, name->id); AppendGListWord(&gClassData, 0); @@ -540,7 +540,7 @@ static void RecordFunction(Object *object, int fileID1, int fileID2, SInt32 star return; tfunc = TYPE_FUNC(object->type); - if ((tfunc->flags & (FUNC_FLAGS_100 | FUNC_FLAGS_200)) && (!fileID2 || startOffset < 0)) + if ((tfunc->flags & (FUNC_AUTO_GENERATED | FUNC_INTRINSIC)) && (!fileID2 || startOffset < 0)) return; linkname = object->name; @@ -566,7 +566,7 @@ static void RecordFunction(Object *object, int fileID1, int fileID2, SInt32 star } } else { flag = 1; - if (tfunc->flags & (FUNC_FLAGS_1000 | FUNC_FLAGS_2000)) { + if (tfunc->flags & (FUNC_IS_CTOR | FUNC_IS_DTOR)) { tmp = TYPE_METHOD(tfunc)->theclass->classname->name; while (*tmp >= '0' && *tmp <= '9') tmp++; @@ -576,7 +576,7 @@ static void RecordFunction(Object *object, int fileID1, int fileID2, SInt32 star if ((tmp = strrchr(str29, ':'))) str29 = tmp + 1; - if (tfunc->flags & FUNC_FLAGS_2000) { + if (tfunc->flags & FUNC_IS_DTOR) { buf2[0] = '~'; strncpy(&buf2[1], str29, sizeof(buf2) - 1); namestr = buf2; @@ -623,15 +623,15 @@ static void RecordFunction(Object *object, int fileID1, int fileID2, SInt32 star flags |= kAsm; if (object->sclass == TK_STATIC) flags |= kStatic; - if (tfunc->flags & FUNC_FLAGS_METHOD) + if (tfunc->flags & FUNC_METHOD) flags |= kMember; AppendGListLong(&gBrowseData, flags); funcid = 0; - if (tfunc->flags & FUNC_FLAGS_METHOD) { - funcid = TYPE_METHOD(tfunc)->x22; + if (tfunc->flags & FUNC_METHOD) { + funcid = TYPE_METHOD(tfunc)->funcid; if (funcid <= 0) { - TYPE_METHOD(tfunc)->x22 = funcid = gNextMemberFuncID++; + TYPE_METHOD(tfunc)->funcid = funcid = gNextMemberFuncID++; } } AppendGListLong(&gBrowseData, funcid); @@ -729,7 +729,7 @@ static void RecordUndefinedMemberFunctions(void) { count = gMemberFuncList.size / sizeof(Object *); array = (Object **) *gMemberFuncList.data; for (i = 0; i < count; i++, array++) { - if (IS_TYPE_FUNC((*array)->type) && !(TYPE_FUNC((*array)->type)->flags & FUNC_FLAGS_2)) + if (IS_TYPE_FUNC((*array)->type) && !(TYPE_FUNC((*array)->type)->flags & FUNC_DEFINED)) RecordFunction(*array, 0, 0, -1, -1); } diff --git a/compiler_and_linker/unsorted/CClass.c b/compiler_and_linker/unsorted/CClass.c index 93aa66c..fad276e 100644 --- a/compiler_and_linker/unsorted/CClass.c +++ b/compiler_and_linker/unsorted/CClass.c @@ -83,7 +83,7 @@ void CClass_GenThunks(void) { ThunkList *list; for (list = cclass_thunklist; list; list = list->next) { - list->thunkobj->flags |= OBJECT_FLAGS_4; + list->thunkobj->flags |= OBJECT_DEFINED; CodeGen_GenVDispatchThunk(list->thunkobj, list->obj, list->a, list->b, list->c); } } @@ -160,7 +160,7 @@ UInt8 CClass_GetOverrideKind(TypeFunc *a, TypeFunc *b, Boolean errorflag) { return 0; if ( - (a->flags & (FUNC_FLAGS_PASCAL | FUNC_FLAGS_F0000000)) != (b->flags & (FUNC_FLAGS_PASCAL | FUNC_FLAGS_F0000000)) || + (a->flags & FUNC_CALL_CONV_MASK) != (b->flags & FUNC_CALL_CONV_MASK) || !is_arglistsame(a->args->next, b->args->next) || a->args->qual != b->args->qual ) @@ -209,7 +209,7 @@ Object *CClass_DefaultConstructor(TypeClass *tclass) { for (nsol = CScope_FindName(tclass->nspace, constructor_name_node); nsol; nsol = nsol->next) { object = OBJECT(nsol->object); if (object->otype == OT_OBJECT && IS_TYPE_FUNC(object->type)) { - if ((tclass->flags & CLASS_FLAGS_20) && !tclass->sominfo) { + if ((tclass->flags & CLASS_HAS_VBASES) && !tclass->sominfo) { if (TYPE_FUNC(object->type)->args->next && !TYPE_FUNC(object->type)->args->next->next) return object; } else { @@ -238,7 +238,7 @@ Object *CClass_DummyDefaultConstructor(TypeClass *tclass) { if (object->otype == OT_OBJECT && IS_TYPE_FUNC(object->type)) { CError_ASSERT(305, args = TYPE_FUNC(object->type)->args); args = args->next; - if ((tclass->flags & CLASS_FLAGS_20) && !tclass->sominfo) { + if ((tclass->flags & CLASS_HAS_VBASES) && !tclass->sominfo) { CError_ASSERT(309, args); args = args->next; } @@ -272,18 +272,18 @@ Object *CClass_DummyDefaultConstructor(TypeClass *tclass) { tmethod->type = TYPEFUNC; tmethod->functype = TYPE(&void_ptr); - tmethod->flags = FUNC_FLAGS_METHOD; + tmethod->flags = FUNC_METHOD; tmethod->theclass = tclass; CDecl_SetFuncFlags(TYPE_FUNC(tmethod), 0); - if ((tclass->flags & CLASS_FLAGS_20) && !tclass->sominfo) + if ((tclass->flags & CLASS_HAS_VBASES) && !tclass->sominfo) CDecl_AddArgument(TYPE_FUNC(tmethod), TYPE(&stsignedshort)); CDecl_AddThisPointerArgument(TYPE_FUNC(tmethod), tclass); object = CParser_NewCompilerDefFunctionObject(); object->type = TYPE(tmethod); - object->qual = Q_INLINE | Q_80000; + object->qual = Q_INLINE | Q_MANGLE_NAME; object->nspace = tclass->nspace; object->name = name; @@ -319,7 +319,7 @@ ENode *CClass_DefaultConstructorCall(TypeClass *tclass, TypeClass *b, ENode *obj args = args->next; - if ((tclass->flags & CLASS_FLAGS_20) && !tclass->sominfo) { + if ((tclass->flags & CLASS_HAS_VBASES) && !tclass->sominfo) { CError_ASSERT(401, args); args = args->next; } @@ -362,7 +362,7 @@ ENode *CClass_DefaultConstructorCall(TypeClass *tclass, TypeClass *b, ENode *obj } skipCheck: - if ((tclass->flags & CLASS_FLAGS_20) && !tclass->sominfo) { + if ((tclass->flags & CLASS_HAS_VBASES) && !tclass->sominfo) { argexprs = lalloc(sizeof(ENodeList)); argexprs->next = NULL; argexprs->node = intconstnode(TYPE(&stsignedshort), varg); @@ -443,7 +443,7 @@ Object *CClass_CopyConstructor(TypeClass *tclass) { args = args->next; - if (tclass->flags & CLASS_FLAGS_20) { + if (tclass->flags & CLASS_HAS_VBASES) { CError_ASSERT(536, args); args = args->next; } @@ -499,11 +499,11 @@ Object *CClass_Destructor(TypeClass *tclass) { } Boolean CClass_IsConstructor(Object *obj) { - return obj && IS_TYPE_FUNC(obj->type) && (TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_1000); + return obj && IS_TYPE_FUNC(obj->type) && (TYPE_FUNC(obj->type)->flags & FUNC_IS_CTOR); } Boolean CClass_IsDestructor(Object *obj) { - return obj && IS_TYPE_FUNC(obj->type) && (TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_2000); + return obj && IS_TYPE_FUNC(obj->type) && (TYPE_FUNC(obj->type)->flags & FUNC_IS_DTOR); } Boolean CClass_IsPODClass(TypeClass *tclass) { @@ -519,13 +519,13 @@ Boolean CClass_IsPODClass(TypeClass *tclass) { if ( nsol->object->otype == OT_OBJECT && IS_TYPE_FUNC(OBJECT(nsol->object)->type) && - !(TYPE_FUNC(OBJECT(nsol->object)->type)->flags & FUNC_FLAGS_100) + !(TYPE_FUNC(OBJECT(nsol->object)->type)->flags & FUNC_AUTO_GENERATED) ) return 0; } object = CClass_AssignmentOperator(tclass); - if (object && !(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100)) + if (object && !(TYPE_FUNC(object->type)->flags & FUNC_AUTO_GENERATED)) return 0; for (ivar = tclass->ivars; ivar; ivar = ivar->next) { @@ -563,7 +563,7 @@ Boolean CClass_IsTrivialCopyClass(TypeClass *tclass) { return 0; object = CClass_CopyConstructor(tclass); - if (object && IS_TYPE_FUNC(object->type) && !(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100)) + if (object && IS_TYPE_FUNC(object->type) && !(TYPE_FUNC(object->type)->flags & FUNC_AUTO_GENERATED)) return 0; for (base = tclass->bases; base; base = base->next) { @@ -592,7 +592,7 @@ Boolean CClass_IsTrivialCopyAssignClass(TypeClass *tclass) { return 0; object = CClass_AssignmentOperator(tclass); - if (object && !(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100)) + if (object && !(TYPE_FUNC(object->type)->flags & FUNC_AUTO_GENERATED)) return 0; for (ivar = tclass->ivars; ivar; ivar = ivar->next) { @@ -612,7 +612,7 @@ Boolean CClass_IsTrivialCopyAssignClass(TypeClass *tclass) { } Boolean CClass_ReferenceArgument(TypeClass *tclass) { - if ((tclass->flags & (CLASS_FLAGS_2 | CLASS_FLAGS_800)) == CLASS_FLAGS_800) + if ((tclass->flags & (CLASS_COMPLETED | CLASS_IS_TEMPL_INST)) == CLASS_IS_TEMPL_INST) CDecl_CompleteType(TYPE(tclass)); if (copts.simple_class_byval) @@ -778,9 +778,9 @@ BClassList *CClass_GetBasePath(TypeClass *a, TypeClass *b, short *founddepth, Bo BClassList *path; BClassList *result; - if ((a->flags & (CLASS_FLAGS_2 | CLASS_FLAGS_800)) == CLASS_FLAGS_800) + if ((a->flags & (CLASS_COMPLETED | CLASS_IS_TEMPL_INST)) == CLASS_IS_TEMPL_INST) CDecl_CompleteType(TYPE(a)); - if ((b->flags & (CLASS_FLAGS_2 | CLASS_FLAGS_800)) == CLASS_FLAGS_800) + if ((b->flags & (CLASS_COMPLETED | CLASS_IS_TEMPL_INST)) == CLASS_IS_TEMPL_INST) CDecl_CompleteType(TYPE(b)); cclass_founddepth = 0; @@ -903,7 +903,7 @@ ENode *CClass_ClassPointerCast(ENode *expr, TypeClass *a, TypeClass *b, Boolean CError_Error(CErrorStr188); if (pathcheckflag) CClass_CheckPathAccess(path, NULL, ACCESSPUBLIC); - if (!(a->flags & CLASS_FLAGS_10) && !b->sominfo) + if (!(a->flags & CLASS_SINGLE_OBJECT) && !b->sominfo) expr = CClass_AccessPathCast(path, expr, reverse); } } @@ -1362,7 +1362,7 @@ static void CClass_AllocVTableRec(OVClass *ovclass) { return; for (ovfunc = ovclass->vfuncs; ovfunc; ovfunc = ovfunc->next) { - offset27 = ovclass->voffset + TYPE_METHOD(ovfunc->obj->type)->x1E + CABI_GetVTableOffset(ovclass->tclass); + offset27 = ovclass->voffset + TYPE_METHOD(ovfunc->obj->type)->vtbl_index + CABI_GetVTableOffset(ovclass->tclass); CError_ASSERT(1867, offset27 < vtable_data_size); if (!(vtable_object_data[offset27])) { @@ -1382,7 +1382,7 @@ static void CClass_AllocVTableRec(OVClass *ovclass) { } if ((offset26 = ovfunc->ovc8->offset - ovclass->offset)) { - if (!(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_8)) { + if (!(TYPE_FUNC(object->type)->flags & FUNC_PURE)) { cclass_ovbase = NULL; CError_ASSERT(1899, CClass_IsBaseOf(ovclass, ovfunc->ovc8)); @@ -1400,7 +1400,7 @@ static void CClass_AllocVTableRec(OVClass *ovclass) { object = ovfunc->obj; } - if (!(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_8)) { + if (!(TYPE_FUNC(object->type)->flags & FUNC_PURE)) { link = lalloc(sizeof(OLinkList)); link->next = vtable_object_links; link->obj = object; @@ -1432,7 +1432,7 @@ static Object *CClass_CheckClass(OVClass *ovclass, Boolean errorflag) { if (!object) { check = ovfunc->ovfC ? ovfunc->ovfC->obj : ovfunc->obj; - if (TYPE_FUNC(check->type)->flags & FUNC_FLAGS_8) + if (TYPE_FUNC(check->type)->flags & FUNC_PURE) object = check; } } @@ -1567,7 +1567,7 @@ void CClass_CheckOverrides(TypeClass *tclass) { CClass_OverrideOVClassTree(tree); if (CClass_CheckClass(tree, 0)) - tclass->flags |= CLASS_FLAGS_ABSTRACT; + tclass->flags |= CLASS_ABSTRACT; if (copts.warn_hidevirtual) CClass_CheckHideVirtual(tree, tree); @@ -1677,7 +1677,7 @@ static void CClass_ConstructVTable(TypeClass *tclass, SInt32 voffset, SInt32 off break; if (object->datatype == DVFUNC) { - newoffset = voffset + TYPE_METHOD(object->type)->x1E + CABI_GetVTableOffset(tclass); + newoffset = voffset + TYPE_METHOD(object->type)->vtbl_index + CABI_GetVTableOffset(tclass); CError_ASSERT(2288, newoffset < vtable_data_size); if (!vtable_object_data[newoffset]) { @@ -1697,7 +1697,7 @@ static void CClass_ConstructVTable(TypeClass *tclass, SInt32 voffset, SInt32 off vtable_object_data[newoffset] = 1; - if (!(TYPE_FUNC(cclass_dominator_oobject->type)->flags & FUNC_FLAGS_8)) { + if (!(TYPE_FUNC(cclass_dominator_oobject->type)->flags & FUNC_PURE)) { if (!check_pures) { thunkobject = cclass_dominator_oobject; if ((thunkoffset = cclass_dominator_ooffset - offset)) { @@ -1765,7 +1765,7 @@ void CClass_ClassAction(TypeClass *tclass) { CClass_AllocVTable(tclass); memclrw(vtable_object_data, vtable_data_size); - if (copts.RTTI && !(tclass->flags & (CLASS_FLAGS_10 | CLASS_FLAGS_2000))) + if (copts.RTTI && !(tclass->flags & (CLASS_SINGLE_OBJECT | CLASS_COM_OBJECT))) vtable_object_links = CRTTI_ConstructVTableHeaders(tclass, vtable_object_data, vtable_object_links); CError_ASSERT(2492, tclass->vtable->object->type->size == tclass->vtable->size); @@ -2155,8 +2155,8 @@ static void CClass_OptimizeBitFieldAccess(Type **ptype, SInt32 *poffset) { short i; innertype = TYPE_BITFIELD(*ptype)->bitfieldtype; - if (TYPE_BITFIELD(*ptype)->unkB == 8) { - switch (TYPE_BITFIELD(*ptype)->unkA) { + if (TYPE_BITFIELD(*ptype)->bitlength == 8) { + switch (TYPE_BITFIELD(*ptype)->offset) { case 0: i = 0; break; @@ -2188,8 +2188,8 @@ static void CClass_OptimizeBitFieldAccess(Type **ptype, SInt32 *poffset) { } } - if (TYPE_BITFIELD(*ptype)->unkB == 16) { - switch (TYPE_BITFIELD(*ptype)->unkA) { + if (TYPE_BITFIELD(*ptype)->bitlength == 16) { + switch (TYPE_BITFIELD(*ptype)->offset) { case 0: i = 0; break; @@ -2215,7 +2215,7 @@ static void CClass_OptimizeBitFieldAccess(Type **ptype, SInt32 *poffset) { } } - if (TYPE_BITFIELD(*ptype)->unkB == 32 && TYPE_BITFIELD(*ptype)->unkA == 0) { + if (TYPE_BITFIELD(*ptype)->bitlength == 32 && TYPE_BITFIELD(*ptype)->offset == 0) { if (innertype->size != stsignedlong.size) { if (is_unsigned(innertype)) *ptype = TYPE(&stunsignedlong); @@ -2228,22 +2228,22 @@ static void CClass_OptimizeBitFieldAccess(Type **ptype, SInt32 *poffset) { } if ((*ptype)->size != stsignedchar.size) { - i = TYPE_BITFIELD(*ptype)->unkA + TYPE_BITFIELD(*ptype)->unkB - 1; + i = TYPE_BITFIELD(*ptype)->offset + TYPE_BITFIELD(*ptype)->bitlength - 1; - if (TYPE_BITFIELD(*ptype)->unkB < 8 && (TYPE_BITFIELD(*ptype)->unkA & 0xFFF8) == (i & 0xFFF8)) { + if (TYPE_BITFIELD(*ptype)->bitlength < 8 && (TYPE_BITFIELD(*ptype)->offset & 0xFFF8) == (i & 0xFFF8)) { newtype = galloc(sizeof(TypeBitfield)); *newtype = *TYPE_BITFIELD(*ptype); *ptype = TYPE(newtype); i = 0; - if (newtype->unkA >= 8) + if (newtype->offset >= 8) i = 1; - if (newtype->unkA >= 16) + if (newtype->offset >= 16) i = 2; - if (newtype->unkA >= 24) + if (newtype->offset >= 24) i = 3; *poffset += i; - newtype->unkA -= 8 * i; + newtype->offset -= 8 * i; newtype->bitfieldtype = is_unsigned(innertype) ? TYPE(&stunsignedchar) : TYPE(&stsignedchar); newtype->size = newtype->bitfieldtype->size; @@ -2251,16 +2251,16 @@ static void CClass_OptimizeBitFieldAccess(Type **ptype, SInt32 *poffset) { } if ((*ptype)->size != stsignedshort.size) { - if (TYPE_BITFIELD(*ptype)->unkB < 16 && (TYPE_BITFIELD(*ptype)->unkA & 0xFFF0) == (i & 0xFFF0)) { + if (TYPE_BITFIELD(*ptype)->bitlength < 16 && (TYPE_BITFIELD(*ptype)->offset & 0xFFF0) == (i & 0xFFF0)) { newtype = galloc(sizeof(TypeBitfield)); *newtype = *TYPE_BITFIELD(*ptype); *ptype = TYPE(newtype); i = 0; - if (newtype->unkA >= 16) + if (newtype->offset >= 16) i = stsignedshort.size; *poffset += i; - newtype->unkA -= 8 * i; + newtype->offset -= 8 * i; newtype->bitfieldtype = is_unsigned(innertype) ? TYPE(&stunsignedshort) : TYPE(&stsignedshort); newtype->size = newtype->bitfieldtype->size; @@ -2276,7 +2276,7 @@ ENode *CClass_AccessMember(ENode *classexpr, Type *type, UInt32 qual, SInt32 off innertype = NULL; - if (IS_TYPE_CLASS(classexpr->rtype) && (TYPE_CLASS(classexpr->rtype)->flags & CLASS_FLAGS_1)) { + if (IS_TYPE_CLASS(classexpr->rtype) && (TYPE_CLASS(classexpr->rtype)->flags & CLASS_HANDLEOBJECT)) { classexpr = makemonadicnode(classexpr, EINDIRECT); classexpr->data.monadic->rtype = CDecl_NewPointerType(classexpr->rtype); } diff --git a/compiler_and_linker/unsorted/CDecl.c b/compiler_and_linker/unsorted/CDecl.c index bc30347..43ca92e 100644 --- a/compiler_and_linker/unsorted/CDecl.c +++ b/compiler_and_linker/unsorted/CDecl.c @@ -103,14 +103,14 @@ void CDecl_SetFuncFlags(TypeFunc *tfunc, UInt32 flags) { static void CDecl_ParseCPPFuncDecl(TypeFunc *tfunc) { for (;;) { if (tk == TK_CONST) { - if (tfunc->flags & FUNC_FLAGS_CONST) + if (tfunc->flags & FUNC_CONST) CError_Warning(CErrorStr313, "const"); - tfunc->flags |= FUNC_FLAGS_CONST; + tfunc->flags |= FUNC_CONST; tk = lex(); } else if (tk == TK_VOLATILE) { - if (tfunc->flags & FUNC_FLAGS_VOLATILE) + if (tfunc->flags & FUNC_VOLATILE) CError_Warning(CErrorStr313, "volatile"); - tfunc->flags |= FUNC_FLAGS_VOLATILE; + tfunc->flags |= FUNC_VOLATILE; tk = lex(); } else { break; @@ -143,7 +143,7 @@ void CDecl_NewConvFuncType(DeclInfo *declinfo) { tfunc->type = TYPEFUNC; tfunc->functype = declinfo->thetype; tfunc->qual = declinfo->qual & (Q_CONST | Q_VOLATILE); - tfunc->flags = FUNC_FLAGS_40; + tfunc->flags = FUNC_CONVERSION; declinfo->x49 = 0; CDecl_SetFuncFlags(tfunc, 1); CDecl_ParseCPPFuncDecl(tfunc); @@ -174,7 +174,7 @@ void CDecl_CompleteType(Type *type) { return; } - if ((TYPE_CLASS(type)->flags & (CLASS_FLAGS_2 | CLASS_FLAGS_800)) == CLASS_FLAGS_800) + if ((TYPE_CLASS(type)->flags & (CLASS_COMPLETED | CLASS_IS_TEMPL_INST)) == CLASS_IS_TEMPL_INST) CTempl_InstantiateTemplateClass(TYPE_CLASS(type)); } @@ -194,9 +194,9 @@ Boolean IsCompleteType(Type *type) { return 1; case TYPECLASS: if ( - !(TYPE_CLASS(type)->flags & CLASS_FLAGS_2) && + !(TYPE_CLASS(type)->flags & CLASS_COMPLETED) && ( - !(TYPE_CLASS(type)->flags & CLASS_FLAGS_800) || + !(TYPE_CLASS(type)->flags & CLASS_IS_TEMPL_INST) || !CTempl_InstantiateTemplateClass(TYPE_CLASS(type)) ) ) @@ -223,7 +223,7 @@ Boolean CanAllocObject(Type *type) { CError_Error(CErrorStr146); return 0; case TYPECLASS: - if (TYPE_CLASS(type)->flags & CLASS_FLAGS_ABSTRACT) { + if (TYPE_CLASS(type)->flags & CLASS_ABSTRACT) { CError_AbstractClassError(TYPE_CLASS(type)); return 0; } @@ -237,7 +237,7 @@ Boolean CanCreateObject(Type *type) { return 0; if (IS_TYPE_CLASS(type)) { - if (TYPE_CLASS(type)->flags & CLASS_FLAGS_1) { + if (TYPE_CLASS(type)->flags & CLASS_HANDLEOBJECT) { CError_Error(CErrorStr191); return 0; } @@ -282,9 +282,9 @@ void CDecl_AddThisPointerArgument(TypeFunc *tfunc, TypeClass *tclass) { arg = CParser_NewFuncArg(); arg->name = this_name_node; arg->type = ptype; - if (tfunc->flags & FUNC_FLAGS_CONST) + if (tfunc->flags & FUNC_CONST) arg->qual |= Q_CONST; - if (tfunc->flags & FUNC_FLAGS_VOLATILE) + if (tfunc->flags & FUNC_VOLATILE) arg->qual |= Q_VOLATILE; arg->next = tfunc->args; tfunc->args = arg; @@ -301,9 +301,9 @@ void CDecl_MakePTMFuncType(TypeFunc *tfunc) { arg1 = CParser_NewFuncArg(); arg1->name = this_name_node; arg1->type = cvoidp; - if (tfunc->flags & FUNC_FLAGS_CONST) + if (tfunc->flags & FUNC_CONST) arg1->qual |= Q_CONST; - if (tfunc->flags & FUNC_FLAGS_VOLATILE) + if (tfunc->flags & FUNC_VOLATILE) arg1->qual |= Q_VOLATILE; arg2 = CParser_NewFuncArg(); @@ -381,7 +381,7 @@ void CDecl_ParseDirectFuncDecl(DeclInfo *declinfo) { tfunc->args = list; if (declinfo->qual & Q_PASCAL) { declinfo->qual &= ~Q_PASCAL; - tfunc->flags = FUNC_FLAGS_PASCAL; + tfunc->flags = FUNC_PASCAL; } if (copts.cplusplus) { @@ -580,16 +580,16 @@ static void scandecl(DeclInfo *declinfo) { } static Boolean CDecl_ParseOperatorDecl(DeclInfo *declinfo) { - if (declinfo->x3E) { + if (declinfo->operator_token) { CError_Error(CErrorStr121); return 0; } - declinfo->x3E = 0; - if (!CParser_ParseOperatorName(&declinfo->x3E, declinfo->x4A && cscope_current->theclass, 0)) + declinfo->operator_token = 0; + if (!CParser_ParseOperatorName(&declinfo->operator_token, declinfo->x4A && cscope_current->theclass, 0)) return 0; - if (!declinfo->x3E) { + if (!declinfo->operator_token) { conversion_type_name(declinfo); tkidentifier = CMangler_ConversionFuncName(declinfo->thetype, declinfo->qual); declinfo->x54 = 1; @@ -624,7 +624,7 @@ static Boolean CDecl_CheckOperatorType(DeclInfo *declinfo, Boolean flag) { if (args != &elipsis && args != &oldstyle) { argCount = 1; if (args->dexpr) { - switch (declinfo->x3E) { + switch (declinfo->operator_token) { case TK_NEW: case TK_DELETE: case TK_NEW_ARRAY: @@ -639,7 +639,7 @@ static Boolean CDecl_CheckOperatorType(DeclInfo *declinfo, Boolean flag) { if (secondarg) { argCount = ((secondarg != &elipsis && !secondarg->next) != 0) ? 2 : 3; if (secondarg->dexpr) { - switch (declinfo->x3E) { + switch (declinfo->operator_token) { case '(': case TK_NEW: case TK_DELETE: @@ -661,9 +661,9 @@ static Boolean CDecl_CheckOperatorType(DeclInfo *declinfo, Boolean flag) { isMethod = flag && IS_TYPEFUNC_METHOD(TYPE_FUNC(declinfo->thetype)) && - !TYPE_METHOD(declinfo->thetype)->x26; + !TYPE_METHOD(declinfo->thetype)->is_static; - switch (declinfo->x3E) { + switch (declinfo->operator_token) { case TK_NEW: case TK_NEW_ARRAY: if (isMethod || !is_typesame(functype, TYPE(&void_ptr)) || argCount < 1 || args->type != CABI_GetSizeTType()) { @@ -716,7 +716,7 @@ static Boolean CDecl_CheckOperatorType(DeclInfo *declinfo, Boolean flag) { return 0; } - switch (declinfo->x3E) { + switch (declinfo->operator_token) { case '&': case '*': case '+': @@ -845,7 +845,7 @@ static void scandirectdeclarator(DeclInfo *declinfo, NameSpace *nspace) { tk = lex(); CDecl_ParseDirectFuncDecl(declinfo); if (IS_TYPE_FUNC(declinfo->thetype)) - TYPE_FUNC(declinfo->thetype)->flags |= FUNC_FLAGS_40; + TYPE_FUNC(declinfo->thetype)->flags |= FUNC_CONVERSION; else CError_Error(CErrorStr121); } else { @@ -901,7 +901,7 @@ void makememberpointertype(DeclInfo *declinfo, TypeClass *tclass, UInt32 qual) { TypeMemberPointer *tmemp; TypeFunc *tfunc; - if (tclass->flags & CLASS_FLAGS_1) { + if (tclass->flags & CLASS_HANDLEOBJECT) { CError_Error(CErrorStr191); declinfo->thetype = (Type *) &stsignedint; return; @@ -932,7 +932,7 @@ void makememberpointertype(DeclInfo *declinfo, TypeClass *tclass, UInt32 qual) { } void CDecl_ScanPointer(DeclInfo *declinfo, NameSpace *nspace, Boolean flag) { - CScopeParseResult pr; + NameResult pr; UInt32 qual; while (1) { @@ -997,11 +997,11 @@ void CDecl_ScanPointer(DeclInfo *declinfo, NameSpace *nspace, Boolean flag) { if (nspace->theclass && tk == '*') continue; } else { - if (pr.x8 && IS_TYPE_TEMPLATE(pr.x8) && declinfo->x30) { - if (CTempl_IsQualifiedMember(declinfo, pr.x8, &nspace)) + if (pr.type && IS_TYPE_TEMPLATE(pr.type) && declinfo->x30) { + if (CTempl_IsQualifiedMember(declinfo, pr.type, &nspace)) scandirectdeclarator(declinfo, nspace); else - declinfo->x20 = pr.x8; + declinfo->x20 = pr.type; return; } CError_Error(CErrorStr121); @@ -1033,7 +1033,7 @@ static void CDecl_TemplatePTM(DeclInfo *declinfo, Type *type) { } void scandeclarator(DeclInfo *declinfo) { - CScopeParseResult pr; + NameResult pr; NameSpace *nspace; switch (tk) { @@ -1058,19 +1058,19 @@ void scandeclarator(DeclInfo *declinfo) { scandirectdeclarator(declinfo, nspace); return; } - if (pr.x8 && IS_TYPE_TEMPLATE(pr.x8)) { - if (declinfo->x30 && CTempl_IsQualifiedMember(declinfo, pr.x8, &nspace)) { + if (pr.type && IS_TYPE_TEMPLATE(pr.type)) { + if (declinfo->x30 && CTempl_IsQualifiedMember(declinfo, pr.type, &nspace)) { scandirectdeclarator(declinfo, nspace); return; } else if (declinfo->x30 && tk == TK_OPERATOR) { - declinfo->x20 = pr.x8; + declinfo->x20 = pr.type; return; } else if ((tk = lex()) == TK_COLON_COLON && (tk = lex()) == '*') { - CDecl_TemplatePTM(declinfo, pr.x8); + CDecl_TemplatePTM(declinfo, pr.type); tk = lex(); break; } else if (declinfo->x30) { - declinfo->x20 = pr.x8; + declinfo->x20 = pr.type; return; } } @@ -1085,7 +1085,7 @@ void scandeclarator(DeclInfo *declinfo) { } void conversion_type_name(DeclInfo *declinfo) { - CScopeParseResult pr; + NameResult pr; DeclInfo subdeclinfo; memclrw(&subdeclinfo, sizeof(DeclInfo)); @@ -1185,7 +1185,7 @@ static Object *CDecl_OverloadFunctionObject(NameSpaceObjectList *list, DeclInfo continue; scanargs = scanfunc->args; - if (scanfunc->flags & FUNC_FLAGS_100000) + if (scanfunc->flags & FUNC_IS_TEMPL) r24 = 1; if (IS_TYPEFUNC_METHOD(scanfunc)) { @@ -1194,16 +1194,16 @@ static Object *CDecl_OverloadFunctionObject(NameSpaceObjectList *list, DeclInfo CError_Error(CErrorStr197); break; case OverloadMode1: - if (!TYPE_METHOD(scanfunc)->x26) + if (!TYPE_METHOD(scanfunc)->is_static) continue; break; case OverloadMode2: - if (TYPE_METHOD(scanfunc)->x26) + if (TYPE_METHOD(scanfunc)->is_static) continue; break; case OverloadMode3: - if (!TYPE_METHOD(scanfunc)->x26) { - if (scanargs->qual & (Q_CONST | Q_VOLATILE)) + if (!TYPE_METHOD(scanfunc)->is_static) { + if (scanargs->qual & Q_CV) continue; scanargs = scanargs->next; } @@ -1216,16 +1216,16 @@ static Object *CDecl_OverloadFunctionObject(NameSpaceObjectList *list, DeclInfo compareresult = CParser_CompareArgLists(args, scanargs); if (compareresult == 1) { - if (scanfunc->flags & FUNC_FLAGS_40) { - if (!(tfunc->flags & FUNC_FLAGS_40)) { + if (scanfunc->flags & FUNC_CONVERSION) { + if (!(tfunc->flags & FUNC_CONVERSION)) { CError_Error(CErrorStr197); break; } if (!is_typesame(tfunc->functype, scanfunc->functype)) continue; - if ((tfunc->qual & (Q_CONST | Q_PASCAL)) != (scanfunc->qual & (Q_CONST | Q_PASCAL))) + if ((tfunc->qual & Q_CV) != (scanfunc->qual & Q_CV)) continue; - if ((tfunc->flags & (FUNC_FLAGS_F0000000 | FUNC_FLAGS_PASCAL)) != (scanfunc->flags & (FUNC_FLAGS_F0000000 | FUNC_FLAGS_PASCAL))) { + if ((tfunc->flags & FUNC_CALL_CONV_MASK) != (scanfunc->flags & FUNC_CALL_CONV_MASK)) { CError_Error(CErrorStr197); break; } @@ -1234,12 +1234,17 @@ static Object *CDecl_OverloadFunctionObject(NameSpaceObjectList *list, DeclInfo return obj; } - if (tfunc->flags & FUNC_FLAGS_40) { + if (tfunc->flags & FUNC_CONVERSION) { CError_Error(CErrorStr197); break; } - if (!is_typesame(tfunc->functype, scanfunc->functype) || ((tfunc->qual & (Q_CONST | Q_PASCAL)) != (scanfunc->qual & (Q_CONST | Q_PASCAL))) || ((tfunc->flags & (FUNC_FLAGS_F0000000 | FUNC_FLAGS_PASCAL)) != (scanfunc->flags & (FUNC_FLAGS_F0000000 | FUNC_FLAGS_PASCAL)))) { + if ( + !is_typesame(tfunc->functype, scanfunc->functype) || + ((tfunc->qual & (Q_CONST | Q_PASCAL)) != (scanfunc->qual & (Q_CONST | Q_PASCAL))) || + ((tfunc->flags & FUNC_CALL_CONV_MASK) != (scanfunc->flags & FUNC_CALL_CONV_MASK)) + ) + { CError_Error(CErrorStr197); break; } @@ -1273,25 +1278,25 @@ static Object *CDecl_OverloadFunctionObject(NameSpaceObjectList *list, DeclInfo obj = CParser_NewFunctionObject(declinfo); CheckDefaultArgs(TYPE_FUNC(obj->type)->args); - if (tfunc->flags & FUNC_FLAGS_PASCAL) { + if (tfunc->flags & FUNC_PASCAL) { for (scan = list; scan; scan = scan->next) { if (scan->object->otype == OT_OBJECT && IS_TYPE_FUNC(OBJECT(scan->object)->type)) { - if (TYPE_FUNC(OBJECT(scan->object)->type)->flags & FUNC_FLAGS_PASCAL) + if (TYPE_FUNC(OBJECT(scan->object)->type)->flags & FUNC_PASCAL) CError_Error(CErrorStr226); } } } - if (copts.cplusplus && declinfo->x4E) { + if (copts.cplusplus && declinfo->is_extern_c) { for (scan = list; scan; scan = scan->next) { - if (scan->object->otype == OT_OBJECT && !(OBJECT(scan->object)->qual & Q_80000)) + if (scan->object->otype == OT_OBJECT && !(OBJECT(scan->object)->qual & Q_MANGLE_NAME)) CError_Error(CErrorStr197); } } CScope_AddObject(cscope_current, declinfo->name, OBJ_BASE(obj)); - if (cscope_current->theclass && (cscope_current->theclass->flags & CLASS_FLAGS_100) && - CTemplTool_IsTemplateArgumentDependentType(declinfo->thetype)) + if (cscope_current->theclass && (cscope_current->theclass->flags & CLASS_IS_TEMPL) && + CTemplTool_IsTemplateArgumentDependentType(declinfo->thetype)) CTemplClass_RegisterObjectDef(TEMPL_CLASS(cscope_current->theclass), OBJ_BASE(obj)); return obj; @@ -1415,7 +1420,7 @@ Object *CDecl_GetFunctionObject(DeclInfo *declinfo, NameSpace *nspace, Boolean * if (!nspace2) nspace2 = cscope_current; - CError_QualifierCheck(declinfo->qual & ~(Q_ALIGNED_MASK | Q_OVERLOAD | Q_20000 | Q_INLINE | Q_PASCAL | Q_ASM | Q_VOLATILE | Q_CONST)); + CError_QualifierCheck(declinfo->qual & ~(Q_ALIGNED_MASK | Q_WEAK | Q_20000 | Q_INLINE | Q_PASCAL | Q_ASM | Q_VOLATILE | Q_CONST)); switch (TYPE_FUNC(declinfo->thetype)->functype->type) { case TYPEFUNC: case TYPEARRAY: @@ -1444,7 +1449,7 @@ Object *CDecl_GetFunctionObject(DeclInfo *declinfo, NameSpace *nspace, Boolean * return CTempl_TemplateFunctionCheck(declinfo, list); if (declinfo->x3C || (list->next && list->next->object->otype == OT_OBJECT)) { - if (TYPE_FUNC(declinfo->thetype)->flags & (FUNC_FLAGS_CONST | FUNC_FLAGS_VOLATILE)) { + if (TYPE_FUNC(declinfo->thetype)->flags & (FUNC_CONST | FUNC_VOLATILE)) { CDecl_AddThisPointerArgument(TYPE_FUNC(declinfo->thetype), nspace2->theclass); obj = CDecl_OverloadFunctionObject(list, declinfo, NULL, OverloadMode2, someotherflag); if (!obj) @@ -1453,11 +1458,11 @@ Object *CDecl_GetFunctionObject(DeclInfo *declinfo, NameSpace *nspace, Boolean * obj = CDecl_OverloadFunctionObject(list, declinfo, NULL, OverloadMode3, someotherflag); if (!obj) return NULL; - if (!TYPE_METHOD(obj->type)->x26) + if (!TYPE_METHOD(obj->type)->is_static) CDecl_AddThisPointerArgument(TYPE_FUNC(declinfo->thetype), nspace2->theclass); } } else { - if (TYPE_METHOD(type)->x26) { + if (TYPE_METHOD(type)->is_static) { if (nspace2->theclass->sominfo) CSOM_FixNewDeleteFunctype(TYPE_FUNC(declinfo->thetype)); } else { @@ -1473,7 +1478,7 @@ Object *CDecl_GetFunctionObject(DeclInfo *declinfo, NameSpace *nspace, Boolean * if (!is_typesame(declinfo->thetype, obj->type) || (declinfo->qual & (Q_PASCAL | Q_CONST)) != (obj->qual & (Q_PASCAL | Q_CONST))) { tmp = *TYPE_METHOD(obj->type); *(TYPE_FUNC(&tmp)) = *TYPE_FUNC(declinfo->thetype); - tmp.flags |= FUNC_FLAGS_METHOD; + tmp.flags |= FUNC_METHOD; CError_Error(CErrorStr249, CError_GetObjectName(obj), obj->type, obj->qual, &tmp, declinfo->qual); } @@ -1483,15 +1488,15 @@ Object *CDecl_GetFunctionObject(DeclInfo *declinfo, NameSpace *nspace, Boolean * CDecl_FuncRedeclCheck(obj, declinfo, 0); if (declinfo->x3C) { - if (obj->nspace->theclass && !(obj->nspace->theclass->flags & CLASS_FLAGS_800)) + if (obj->nspace->theclass && !(obj->nspace->theclass->flags & CLASS_IS_TEMPL_INST)) CError_Error(CErrorStr335); declinfo->x3C = 0; } } else { - if (TYPE_FUNC(declinfo->thetype)->flags & (FUNC_FLAGS_VOLATILE | FUNC_FLAGS_CONST)) + if (TYPE_FUNC(declinfo->thetype)->flags & (FUNC_VOLATILE | FUNC_CONST)) CError_Error(CErrorStr384); - if (declinfo->x3E && !CDecl_CheckOperatorType(declinfo, 0)) + if (declinfo->operator_token && !CDecl_CheckOperatorType(declinfo, 0)) return NULL; list = CScope_GetLocalObject(nspace2, declinfo->name); @@ -1558,7 +1563,7 @@ void CDecl_TypedefDeclarator(DeclInfo *declinfo) { CError_QualifierCheck(declinfo->qual & ~(Q_ALIGNED_MASK | Q_REFERENCE | Q_PASCAL | Q_VOLATILE | Q_CONST)); if (declinfo->x48 || declinfo->x44) CError_Error(CErrorStr121); - if (declinfo->x3E) + if (declinfo->operator_token) CError_Error(CErrorStr193); objt = NULL; @@ -1603,7 +1608,7 @@ void CDecl_TypedefDeclarator(DeclInfo *declinfo) { objt->qual = declinfo->qual; CScope_AddObject(nspace, declinfo->name, OBJ_BASE(objt)); - if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_100) && + if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL) && CTemplTool_IsTemplateArgumentDependentType(declinfo->thetype)) CTemplClass_RegisterObjectDef(TEMPL_CLASS(nspace->theclass), OBJ_BASE(objt)); @@ -1618,7 +1623,7 @@ void CDecl_TypedefDeclarator(DeclInfo *declinfo) { } if (cparamblkptr->browseoptions.recordTypedefs && declinfo->file->recordbrowseinfo) - CBrowse_NewTypedef(nspace, declinfo->name, declinfo->file, declinfo->file2, declinfo->x60, CPrep_BrowserFileOffset()); + CBrowse_NewTypedef(nspace, declinfo->name, declinfo->file, declinfo->file2, declinfo->sourceoffset, CPrep_BrowserFileOffset()); } static void CDecl_DataDeclarator(DeclInfo *declinfo, AccessType access, Boolean flag) { @@ -1632,10 +1637,10 @@ static void CDecl_DataDeclarator(DeclInfo *declinfo, AccessType access, Boolean if (!nspace) nspace = cscope_current; - CError_QualifierCheck(declinfo->qual & ~(Q_ALIGNED_MASK | Q_OVERLOAD | Q_20000 | Q_PASCAL | Q_VOLATILE | Q_CONST)); + CError_QualifierCheck(declinfo->qual & ~(Q_ALIGNED_MASK | Q_WEAK | Q_20000 | Q_PASCAL | Q_VOLATILE | Q_CONST)); if (declinfo->x48 || declinfo->x44) CError_Error(CErrorStr121); - if (declinfo->x3E) + if (declinfo->operator_token) CError_Error(CErrorStr193); obj = NULL; @@ -1696,7 +1701,7 @@ static void CDecl_DataDeclarator(DeclInfo *declinfo, AccessType access, Boolean if (!tmpflag || (obj->qual & (Q_PASCAL | Q_VOLATILE | Q_CONST)) != (declinfo->qual & (Q_PASCAL | Q_VOLATILE | Q_CONST))) CError_Error(CErrorStr249, CError_GetObjectName(obj), obj->type, obj->qual, declinfo->thetype, declinfo->qual); - if (obj->qual & Q_10000) { + if (obj->qual & Q_INLINE_DATA) { if (tk == ',' || tk == ';') return; CError_Error(CErrorStr333, obj); @@ -1729,7 +1734,7 @@ static void CDecl_DataDeclarator(DeclInfo *declinfo, AccessType access, Boolean obj->access = access; CScope_AddObject(nspace, declinfo->name, OBJ_BASE(obj)); - if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_100) && + if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL) && CTemplTool_IsTemplateArgumentDependentType(declinfo->thetype)) CTemplClass_RegisterObjectDef(TEMPL_CLASS(nspace->theclass), OBJ_BASE(obj)); @@ -1744,23 +1749,23 @@ static void CDecl_DataDeclarator(DeclInfo *declinfo, AccessType access, Boolean CInit_InitializeData(obj); CScope_RestoreScope(&save); - if (declinfo->x3C && obj->nspace->theclass && (TYPE_CLASS(obj->nspace->theclass)->flags & CLASS_FLAGS_800)) + if (declinfo->x3C && obj->nspace->theclass && (TYPE_CLASS(obj->nspace->theclass)->flags & CLASS_IS_TEMPL_INST)) declinfo->x3C = 0; } else { CInit_InitializeData(obj); } if (declinfo->file->recordbrowseinfo && obj->sclass != TK_EXTERN) - CBrowse_NewData(obj, declinfo->file, declinfo->file2, declinfo->x60, CPrep_BrowserFileOffset()); + CBrowse_NewData(obj, declinfo->file, declinfo->file2, declinfo->sourceoffset, CPrep_BrowserFileOffset()); } else if (tk == '=') { tk = lex(); expr = CExpr_IntegralConstOrDepExpr(); if (IS_TYPE_TEMPLATE(obj->type) || !ENODE_IS(expr, EINTCONST)) { - CError_ASSERT(2426, nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_100)); + CError_ASSERT(2426, nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL)); CTemplClass_RegisterObjectInit(TEMPL_CLASS(nspace->theclass), obj, expr); } else if ((obj->qual & Q_CONST) && IS_TYPE_INT_OR_ENUM(obj->type)) { obj->u.data.u.intconst = expr->data.intval; - obj->qual |= Q_10000 | Q_20000; + obj->qual |= Q_INLINE_DATA | Q_20000; } else { CError_Error(CErrorStr354, obj->name->name); } @@ -1794,7 +1799,7 @@ Boolean CDecl_FunctionDeclarator(DeclInfo *declinfo, NameSpace *nspace, Boolean obj, declinfo->file, declinfo->file2, - declinfo->x60, + declinfo->sourceoffset, CPrep_BrowserFileOffset()); if (copts.cplusplus && lookahead() == ';') @@ -1822,14 +1827,14 @@ static void CDecl_ParseSpecialMember(DeclInfo *declinfo, Boolean flag) { } if (IS_TYPE_FUNC(r28->type)) { - if (TYPE_FUNC(r28->type)->flags & (FUNC_FLAGS_1000 | FUNC_FLAGS_2000)) { + if (TYPE_FUNC(r28->type)->flags & (FUNC_IS_CTOR | FUNC_IS_DTOR)) { if (r28->nspace->theclass->sominfo) declinfo->thetype = TYPE(&stvoid); else declinfo->thetype = TYPE(&void_ptr); declinfo->nspace = r28->nspace; declinfo->name = r28->name; - if (TYPE_FUNC(r28->type)->flags & FUNC_FLAGS_1000) + if (TYPE_FUNC(r28->type)->flags & FUNC_IS_CTOR) declinfo->x4B = 1; if ((tk = lex()) == '(') { @@ -1841,8 +1846,8 @@ static void CDecl_ParseSpecialMember(DeclInfo *declinfo, Boolean flag) { cscope_current = r25; if (IS_TYPE_FUNC(declinfo->thetype)) { - if (TYPE_FUNC(r28->type)->flags & FUNC_FLAGS_1000) { - if ((r28->nspace->theclass->flags & CLASS_FLAGS_20) && !r28->nspace->theclass->sominfo) + if (TYPE_FUNC(r28->type)->flags & FUNC_IS_CTOR) { + if ((r28->nspace->theclass->flags & CLASS_HAS_VBASES) && !r28->nspace->theclass->sominfo) CDecl_AddArgument(TYPE_FUNC(declinfo->thetype), TYPE(&stsignedshort)); } else { if (!r28->nspace->theclass->sominfo) @@ -1857,7 +1862,7 @@ static void CDecl_ParseSpecialMember(DeclInfo *declinfo, Boolean flag) { CError_Error(CErrorStr114); } return; - } else if (TYPE_FUNC(r28->type)->flags & FUNC_FLAGS_40) { + } else if (TYPE_FUNC(r28->type)->flags & FUNC_CONVERSION) { CError_FATAL(2603); declinfo->thetype = TYPE_FUNC(r28->type)->functype; @@ -1869,7 +1874,7 @@ static void CDecl_ParseSpecialMember(DeclInfo *declinfo, Boolean flag) { tk = lex(); CDecl_ParseDirectFuncDecl(declinfo); if (IS_TYPE_FUNC(declinfo->thetype)) { - TYPE_FUNC(declinfo->thetype)->flags |= FUNC_FLAGS_40; + TYPE_FUNC(declinfo->thetype)->flags |= FUNC_CONVERSION; if (flag) CDecl_FunctionDeclarator(declinfo, NULL, 1, 1); } else { @@ -1935,12 +1940,12 @@ void CDecl_ScanDeclarator(DeclInfo *declinfo) { if (declinfo->x48 || declinfo->x44) CError_Error(CErrorStr121); - if (declinfo->x3E) + if (declinfo->operator_token) CError_Error(CErrorStr193); if ( - (declinfo->qual & ~(Q_ALIGNED_MASK | Q_OVERLOAD | Q_20000 | Q_PASCAL | Q_VOLATILE | Q_CONST)) || - (declinfo->storageclass == TK_TYPEDEF && (declinfo->qual & ~(Q_ALIGNED_MASK | Q_REFERENCE | Q_PASCAL | Q_VOLATILE | Q_CONST))) + (declinfo->qual & ~(Q_ALIGNED_MASK | Q_WEAK | Q_20000 | Q_PASCAL | Q_VOLATILE | Q_CONST)) || + (declinfo->storageclass == TK_TYPEDEF && (declinfo->qual & ~(Q_ALIGNED_MASK | Q_REFERENCE | Q_PASCAL | Q_VOLATILE | Q_CONST))) ) CError_Error(CErrorStr176); } @@ -1964,7 +1969,7 @@ void scandeclaratorlist(DeclInfo *declinfo) { r30 = declinfo->thetype; r29 = declinfo->qual; declinfo->nspace = NULL; - declinfo->x3E = 0; + declinfo->operator_token = 0; if (IS_TYPE_FUNC(r30)) { declinfo->thetype = galloc(sizeof(TypeFunc)); *TYPE_FUNC(declinfo->thetype) = *TYPE_FUNC(r30); @@ -2127,7 +2132,7 @@ static TypeEnum *CDecl_OldParseEnumList(TypeEnum *tenum, HashNameNode *name) { } } - if (cscope_current->theclass && (cscope_current->theclass->flags & CLASS_FLAGS_100)) { + if (cscope_current->theclass && (cscope_current->theclass->flags & CLASS_IS_TEMPL)) { CTemplClass_RegisterEnumType(TEMPL_CLASS(cscope_current->theclass), tenum); } @@ -2468,7 +2473,7 @@ static TypeEnum *CDecl_ParseEnumList(TypeEnum *tenum, HashNameNode *name) { } } - if (cscope_current->theclass && (cscope_current->theclass->flags & CLASS_FLAGS_100)) { + if (cscope_current->theclass && (cscope_current->theclass->flags & CLASS_IS_TEMPL)) { tmclass = TEMPL_CLASS(cscope_current->theclass); CTemplClass_RegisterEnumType(tmclass, tenum); } else { @@ -2616,7 +2621,7 @@ static TypeEnum *CDecl_ParseEnumList(TypeEnum *tenum, HashNameNode *name) { void scanenum(DeclInfo *declinfo) { HashNameNode *name; Type *type; - CScopeParseResult pr; + NameResult pr; if (tk == '{') { declinfo->thetype = TYPE(CDecl_ParseEnumList(NULL, NULL)); @@ -2648,7 +2653,7 @@ void scanenum(DeclInfo *declinfo) { TYPE_ENUM(declinfo->thetype)->enumname, declinfo->file, declinfo->file2, - declinfo->x60, + declinfo->sourceoffset, CPrep_BrowserFileOffset()); return; } else { @@ -2658,7 +2663,7 @@ void scanenum(DeclInfo *declinfo) { } if (CScope_ParseElaborateName(&pr)) { - if ((type = pr.x8)) { + if ((type = pr.type)) { if (!IS_TYPE_ENUM(type)) CError_Error(CErrorStr121); if ((tk = lex()) == '{') @@ -2692,7 +2697,7 @@ void CDecl_ScanStructDeclarator(BigDeclInfo *bde) { bde->declinfo2 = bde->declinfo; bde->declinfo2.name = NULL; - bde->declinfo2.x3E = 0; + bde->declinfo2.operator_token = 0; bde->xCD = 0; is_bitfield = 0; @@ -2790,7 +2795,7 @@ fuckup: tbitfield->type = TYPEBITFIELD; tbitfield->size = bde->declinfo2.thetype->size; tbitfield->bitfieldtype = bde->declinfo2.thetype; - tbitfield->unkB = val; + tbitfield->bitlength = val; bde->declinfo2.thetype = TYPE(tbitfield); if (tk == TK_UU_ATTRIBUTE_UU) @@ -2852,7 +2857,7 @@ static void CDecl_LayoutStruct(TypeStruct *tstruct) { newmember->next = member->next; newmember->type = innermember->type; newmember->name = innermember->name; - newmember->qual = innermember->qual | Q_OVERLOAD; + newmember->qual = innermember->qual | Q_WEAK; newmember->offset = innerbase + innermember->offset; member->next = newmember; member = newmember; @@ -2946,7 +2951,7 @@ static SInt32 scanstructdeclarationlist(TypeStruct *tstruct, Boolean flag) { bde.xCD = 0; } - if (bde.declinfo2.x3E) { + if (bde.declinfo2.operator_token) { CError_Error(CErrorStr131); bde.xCD = 0; } @@ -3093,12 +3098,12 @@ static void InlineFunctionObject(Object *obj, TypeClass *tclass) { CPrepFileInfo *file; obj->qual |= Q_INLINE; - TYPE_FUNC(obj->type)->flags |= FUNC_FLAGS_2; + TYPE_FUNC(obj->type)->flags |= FUNC_DEFINED; CPrep_StreamGetBlock(&stream, NULL, 1); if (stream.tokens) { - if (IS_TYPEFUNC_METHOD(TYPE_FUNC(obj->type)) && (TYPE_METHOD(obj->type)->theclass->flags & CLASS_FLAGS_100)) { - TYPE_FUNC(obj->type)->flags |= FUNC_FLAGS_800000; + if (IS_TYPEFUNC_METHOD(TYPE_FUNC(obj->type)) && (TYPE_METHOD(obj->type)->theclass->flags & CLASS_IS_TEMPL)) { + TYPE_FUNC(obj->type)->flags |= FUNC_IS_TEMPL_INSTANCE; CTemplClass_DefineMember(TEMPL_CLASS(TYPE_METHOD(obj->type)->theclass), obj, &member_fileoffset, &stream); } else { CInline_AddInlineFunctionAction(obj, tclass, &member_fileoffset, &stream, 0); @@ -3136,12 +3141,12 @@ TypeMemberFunc *CDecl_MakeTypeMemberFunc(TypeFunc *tfunc, TypeClass *tclass, Boo memclrw(method, sizeof(TypeMemberFunc)); *TYPE_FUNC(method) = *tfunc; method->theclass = tclass; - method->x26 = flag; - method->flags |= FUNC_FLAGS_METHOD; + method->is_static = flag; + method->flags |= FUNC_METHOD; if (!flag) CDecl_AddThisPointerArgument(TYPE_FUNC(method), tclass); - if ((flag || (tfunc->flags & (FUNC_FLAGS_1000 | FUNC_FLAGS_2000))) && (tfunc->flags & (FUNC_FLAGS_CONST | FUNC_FLAGS_VOLATILE))) + if ((flag || (tfunc->flags & (FUNC_IS_CTOR | FUNC_IS_DTOR))) && (tfunc->flags & (FUNC_CONST | FUNC_VOLATILE))) CError_Error(CErrorStr384); return method; @@ -3150,12 +3155,12 @@ TypeMemberFunc *CDecl_MakeTypeMemberFunc(TypeFunc *tfunc, TypeClass *tclass, Boo static void CDecl_MakeFunctionVirtual(TypeClass *tclass, Object *func) { if (is_pascal_object(func)) CError_Error(CErrorStr219); - if (tclass->mode == CLASS_MODE_1) + if (tclass->mode == CLASS_MODE_UNION) CError_Error(CErrorStr352, func); func->datatype = DVFUNC; } -static void CDecl_AddFunctionMember(DeclE *decle, TypeClass *tclass, DeclInfo *declinfo, AccessType access, Boolean flag1, Boolean flag2, Boolean flag3, Boolean flag4) { +static void CDecl_AddFunctionMember(ClassLayout *decle, TypeClass *tclass, DeclInfo *declinfo, AccessType access, Boolean flag1, Boolean flag2, Boolean flag3, Boolean flag4) { NameSpaceObjectList *list; // r20 Object *obj; // also r20 TypeMemberFunc *tfunc; // r19 @@ -3203,13 +3208,13 @@ static void CDecl_AddFunctionMember(DeclE *decle, TypeClass *tclass, DeclInfo *d if (!obj) return; if (outflag) - tfunc->x1E = ++decle->x8; + tfunc->vtbl_index = ++decle->lex_order_count; else CError_Error(CErrorStr133, CError_GetObjectName(obj)); } else { - tfunc->x1E = ++decle->x8; + tfunc->vtbl_index = ++decle->lex_order_count; obj = CParser_NewFunctionObject(declinfo); - if ((tclass->flags & CLASS_FLAGS_100) && CTemplTool_IsTemplateArgumentDependentType(declinfo->thetype)) + if ((tclass->flags & CLASS_IS_TEMPL) && CTemplTool_IsTemplateArgumentDependentType(declinfo->thetype)) CTemplClass_RegisterObjectDef(TEMPL_CLASS(tclass), OBJ_BASE(obj)); CScope_AddObject(tclass->nspace, declinfo->name, OBJ_BASE(obj)); } @@ -3218,21 +3223,21 @@ static void CDecl_AddFunctionMember(DeclE *decle, TypeClass *tclass, DeclInfo *d CheckDefaultArgs(TYPE_FUNC(obj->type)->args); if (flag2) { - tfunc->flags |= FUNC_FLAGS_40; - tclass->flags = tclass->flags | CLASS_FLAGS_40; + tfunc->flags |= FUNC_CONVERSION; + tclass->flags = tclass->flags | CLASS_IS_CONVERTIBLE; } if (r31) { CDecl_MakeFunctionVirtual(tclass, obj); - decle->xC = 1; + decle->has_vtable = 1; } if ((flag1 || r31) && flag3 && (tk == '=')) { if ((tk = lex()) == TK_INTCONST) { if (!CInt64_IsZero(&tkintconst)) CError_Error(CErrorStr121); - tfunc->flags |= FUNC_FLAGS_8; - tclass->flags = tclass->flags | CLASS_FLAGS_ABSTRACT; + tfunc->flags |= FUNC_PURE; + tclass->flags = tclass->flags | CLASS_ABSTRACT; tk = lex(); } else { CError_Error(CErrorStr121); @@ -3374,24 +3379,24 @@ static void CDecl_ParseFriendDecl(TypeClass *tclass) { Object *obj; NameSpace *nspace; - is_templ = (tclass->flags & CLASS_FLAGS_100) != 0; + is_templ = (tclass->flags & CLASS_IS_TEMPL) != 0; r27 = (tk == TK_CLASS || tk == TK_STRUCT || tk == TK_UNION); memclrw(&declinfo, sizeof(DeclInfo)); - declinfo.x4C = 1; + declinfo.in_friend_decl = 1; CParser_GetDeclSpecs(&declinfo, 1); if (declinfo.storageclass) { CError_Error(CErrorStr177); declinfo.storageclass = 0; } - declinfo.x4C = 0; + declinfo.in_friend_decl = 0; if (tk == ';') { if (!r27) CError_Error(CErrorStr201); if (IS_TYPE_CLASS(declinfo.thetype)) { - if (!(TYPE_CLASS(declinfo.thetype)->flags & CLASS_FLAGS_100) || CParser_CheckTemplateClassUsage(TEMPL_CLASS(declinfo.thetype), 1)) { + if (!(TYPE_CLASS(declinfo.thetype)->flags & CLASS_IS_TEMPL) || CParser_CheckTemplateClassUsage(TEMPL_CLASS(declinfo.thetype), 1)) { if (!is_templ) CDecl_AddFriend(tclass, NULL, TYPE_CLASS(declinfo.thetype)); else @@ -3460,7 +3465,7 @@ static void CDecl_ParseFriendDecl(TypeClass *tclass) { CError_Error(CErrorStr123); } -static ObjMemberVar *CDecl_InstanceDataDeclarator(DeclE *decle, TypeClass *tclass, Type *type, UInt32 qual, HashNameNode *name, AccessType access) { +static ObjMemberVar *CDecl_InstanceDataDeclarator(ClassLayout *decle, TypeClass *tclass, Type *type, UInt32 qual, HashNameNode *name, AccessType access) { NameSpaceObjectList *list; ObjMemberVar *ivar; ObjMemberVar *scan; @@ -3493,7 +3498,7 @@ static ObjMemberVar *CDecl_InstanceDataDeclarator(DeclE *decle, TypeClass *tclas ivar->type = type; ivar->qual = qual; if (!tclass->sominfo) - decle->x8++; + decle->lex_order_count++; if ((scan = tclass->ivars)) { while (scan->next) @@ -3505,7 +3510,7 @@ static ObjMemberVar *CDecl_InstanceDataDeclarator(DeclE *decle, TypeClass *tclas if (name && name != no_name_node) { CScope_AddObject(tclass->nspace, name, OBJ_BASE(ivar)); - if ((tclass->flags & CLASS_FLAGS_100) && CTemplTool_IsTemplateArgumentDependentType(type)) + if ((tclass->flags & CLASS_IS_TEMPL) && CTemplTool_IsTemplateArgumentDependentType(type)) CTemplClass_RegisterObjectDef(TEMPL_CLASS(tclass), OBJ_BASE(ivar)); if (cparamblkptr->browseoptions.recordClasses) CBrowse_AddClassMemberVar(ivar, CPrep_BrowserTokenOffset(&member_fileoffset) + 1, CPrep_BrowserFileOffset()); @@ -3523,7 +3528,7 @@ void CDecl_CheckCtorIntegrity(FuncArg *args, TypeClass *tclass) { } } -static void CDecl_ParseClassMembers(DeclE *decle, TypeClass *tclass, short mode) { +static void CDecl_ParseClassMembers(ClassLayout *decle, TypeClass *tclass, short mode) { AccessType access; Boolean r17; BigDeclInfo bde; @@ -3539,10 +3544,10 @@ static void CDecl_ParseClassMembers(DeclE *decle, TypeClass *tclass, short mode) Boolean r19; short t; - r17 = (tclass->flags & CLASS_FLAGS_100) && TEMPL_CLASS(tclass)->pspec_owner; + r17 = (tclass->flags & CLASS_IS_TEMPL) && TEMPL_CLASS(tclass)->pspec_owner; memclrw(&bde, sizeof(BigDeclInfo)); - access = (mode == CLASS_MODE_2) ? ACCESSPRIVATE : ACCESSPUBLIC; + access = (mode == CLASS_MODE_CLASS) ? ACCESSPRIVATE : ACCESSPUBLIC; global_access = access; restart: @@ -3557,7 +3562,7 @@ static void CDecl_ParseClassMembers(DeclE *decle, TypeClass *tclass, short mode) NameSpace *nspace = cscope_current; TemplClass *tmclass; - if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_100)) { + if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL)) { tmclass = TEMPL_CLASS(nspace->theclass); } else { for (; nspace; nspace = nspace->parent) { @@ -3663,11 +3668,11 @@ static void CDecl_ParseClassMembers(DeclE *decle, TypeClass *tclass, short mode) bde.declinfo2.qual |= Q_VIRTUAL; } else { CDecl_CheckCtorIntegrity(TYPE_FUNC(bde.declinfo2.thetype)->args, tclass); - if (tclass->flags & CLASS_FLAGS_20) + if (tclass->flags & CLASS_HAS_VBASES) CDecl_AddArgument(TYPE_FUNC(bde.declinfo2.thetype), TYPE(&stsignedshort)); bde.declinfo2.qual &= ~Q_VIRTUAL; } - TYPE_FUNC(bde.declinfo2.thetype)->flags |= FUNC_FLAGS_1000; + TYPE_FUNC(bde.declinfo2.thetype)->flags |= FUNC_IS_CTOR; bde.declinfo2.name = constructor_name_node; bde.declinfo2.qual |= r21; CDecl_AddFunctionMember(decle, tclass, &bde.declinfo2, access, 0, 0, 1, 0); @@ -3701,7 +3706,7 @@ static void CDecl_ParseClassMembers(DeclE *decle, TypeClass *tclass, short mode) goto restart; } CError_QualifierCheck(r22 & ~(Q_VIRTUAL | Q_INLINE | Q_ASM)); - if (tclass->flags & CLASS_FLAGS_900) { + if (tclass->flags & CLASS_IS_TEMPL_ANY) { t = lookahead(); tkidentifier = tclass->classname; if (t == '<') { @@ -3732,7 +3737,7 @@ static void CDecl_ParseClassMembers(DeclE *decle, TypeClass *tclass, short mode) else CDecl_AddArgument(TYPE_FUNC(bde.declinfo2.thetype), TYPE(&stsignedshort)); bde.declinfo2.name = destructor_name_node; - TYPE_FUNC(bde.declinfo2.thetype)->flags |= FUNC_FLAGS_2000; + TYPE_FUNC(bde.declinfo2.thetype)->flags |= FUNC_IS_DTOR; bde.declinfo2.qual |= r21; CDecl_AddFunctionMember(decle, tclass, &bde.declinfo2, access, 1, 0, 1, 0); } else { @@ -3762,7 +3767,7 @@ static void CDecl_ParseClassMembers(DeclE *decle, TypeClass *tclass, short mode) bde.declinfo2.qual |= r21; tmptype = bde.declinfo2.thetype; CDecl_NewConvFuncType(&bde.declinfo2); - if ((tclass->flags & CLASS_FLAGS_100) && CTemplTool_IsTemplateArgumentDependentType(tmptype)) + if ((tclass->flags & CLASS_IS_TEMPL) && CTemplTool_IsTemplateArgumentDependentType(tmptype)) bde.declinfo2.name = CParser_GetUniqueName(); CDecl_AddFunctionMember(decle, tclass, &bde.declinfo2, access, 1, 1, 1, 0); if (tk == ';') @@ -3785,7 +3790,7 @@ static void CDecl_ParseClassMembers(DeclE *decle, TypeClass *tclass, short mode) bde.declinfo.section = r18; CParser_GetDeclSpecs(&bde.declinfo, 0); - if (r19 && tk == '(' && (tclass->flags & CLASS_FLAGS_900) && bde.declinfo.thetype == TYPE(tclass) && !bde.declinfo.nspace) { + if (r19 && tk == '(' && (tclass->flags & CLASS_IS_TEMPL_ANY) && bde.declinfo.thetype == TYPE(tclass) && !bde.declinfo.nspace) { CPrep_UnLex(); tk = TK_IDENTIFIER; tkidentifier = tclass->classname; @@ -3812,11 +3817,11 @@ static void CDecl_ParseClassMembers(DeclE *decle, TypeClass *tclass, short mode) bde.declinfo2.thetype = CTemplTool_ResolveMemberSelfRefs(TEMPL_CLASS(tclass), bde.declinfo2.thetype, &bde.declinfo2.qual); if (bde.declinfo2.nspace) CError_Error(CErrorStr200); - if (bde.declinfo2.x3E) { + if (bde.declinfo2.operator_token) { if (bde.declinfo.storageclass == TK_MUTABLE) CError_QualifierCheck(Q_MUTABLE); r19 = 0; - switch (bde.declinfo2.x3E) { + switch (bde.declinfo2.operator_token) { case TK_NEW: case TK_NEW_ARRAY: CError_QualifierCheck(bde.declinfo2.qual & Q_VIRTUAL); @@ -3978,25 +3983,25 @@ Boolean CDecl_CheckNewBase(TypeClass *tclass, TypeClass *baseclass, Boolean is_v return 0; } - if (!(baseclass->flags & CLASS_FLAGS_2)) { + if (!(baseclass->flags & CLASS_COMPLETED)) { CError_Error(CErrorStr136, baseclass, 0); return 0; } - if (baseclass->flags & CLASS_FLAGS_10) { + if (baseclass->flags & CLASS_SINGLE_OBJECT) { if (is_virtual || tclass->bases) { CError_Error(CErrorStr191); return 0; } - tclass->flags = tclass->flags | CLASS_FLAGS_10; + tclass->flags = tclass->flags | CLASS_SINGLE_OBJECT; } - if (baseclass->flags & CLASS_FLAGS_1) { + if (baseclass->flags & CLASS_HANDLEOBJECT) { if (is_virtual || tclass->bases) { CError_Error(CErrorStr191); return 0; } - tclass->flags = tclass->flags | CLASS_FLAGS_1; + tclass->flags = tclass->flags | CLASS_HANDLEOBJECT; } if (baseclass->sominfo) { @@ -4007,7 +4012,7 @@ Boolean CDecl_CheckNewBase(TypeClass *tclass, TypeClass *baseclass, Boolean is_v CError_Error(CErrorStr267); } - if (tclass->bases && (tclass->flags & CLASS_FLAGS_10) && (tclass->flags & CLASS_FLAGS_10)) { + if (tclass->bases && (tclass->flags & CLASS_SINGLE_OBJECT) && (tclass->flags & CLASS_SINGLE_OBJECT)) { CError_Error(CErrorStr131); return 0; } @@ -4024,15 +4029,15 @@ Boolean CDecl_CheckNewBase(TypeClass *tclass, TypeClass *baseclass, Boolean is_v } } - if (baseclass->flags & CLASS_FLAGS_2000) - tclass->flags = tclass->flags | CLASS_FLAGS_2000; - if (baseclass->flags & CLASS_FLAGS_40) - tclass->flags = tclass->flags | CLASS_FLAGS_40; - if (baseclass->flags & CLASS_FLAGS_20) - tclass->flags = tclass->flags | CLASS_FLAGS_20; + if (baseclass->flags & CLASS_COM_OBJECT) + tclass->flags = tclass->flags | CLASS_COM_OBJECT; + if (baseclass->flags & CLASS_IS_CONVERTIBLE) + tclass->flags = tclass->flags | CLASS_IS_CONVERTIBLE; + if (baseclass->flags & CLASS_HAS_VBASES) + tclass->flags = tclass->flags | CLASS_HAS_VBASES; if (is_virtual) - tclass->flags = tclass->flags | CLASS_FLAGS_20; + tclass->flags = tclass->flags | CLASS_HAS_VBASES; return 1; } @@ -4040,14 +4045,14 @@ Boolean CDecl_CheckNewBase(TypeClass *tclass, TypeClass *baseclass, Boolean is_v static void CDecl_ParseBaseClassList(TypeClass *tclass, short mode, Boolean is_templ) { Boolean is_virtual; AccessType access; - CScopeParseResult pr; + NameResult pr; ObjType *inherited_type; ClassList *base; ClassList *scan; TypeClass *baseclass; do { - if (mode == CLASS_MODE_2) + if (mode == CLASS_MODE_CLASS) access = ACCESSPRIVATE; else access = ACCESSPUBLIC; @@ -4083,7 +4088,7 @@ static void CDecl_ParseBaseClassList(TypeClass *tclass, short mode, Boolean is_t } if (CScope_ParseDeclName(&pr)) { - if (!pr.x8) { + if (!pr.type) { if (!pr.name_4) { CError_Error(CErrorStr121); } else if (tk == TK_IDENTIFIER && pr.name_4 == tkidentifier) { @@ -4093,40 +4098,40 @@ static void CDecl_ParseBaseClassList(TypeClass *tclass, short mode, Boolean is_t continue; } - CDecl_CompleteType(pr.x8); - if (is_templ && CTemplTool_IsTemplateArgumentDependentType(pr.x8)) { - if (!IS_TYPE_CLASS(pr.x8) || !(TYPE_CLASS(pr.x8)->flags & CLASS_FLAGS_100) || - CParser_CheckTemplateClassUsage(TEMPL_CLASS(pr.x8), 1)) { - CTemplClass_RegisterBaseClass(TEMPL_CLASS(tclass), pr.x8, access, is_virtual); + CDecl_CompleteType(pr.type); + if (is_templ && CTemplTool_IsTemplateArgumentDependentType(pr.type)) { + if (!IS_TYPE_CLASS(pr.type) || !(TYPE_CLASS(pr.type)->flags & CLASS_IS_TEMPL) || + CParser_CheckTemplateClassUsage(TEMPL_CLASS(pr.type), 1)) { + CTemplClass_RegisterBaseClass(TEMPL_CLASS(tclass), pr.type, access, is_virtual); if (is_virtual) - tclass->flags = tclass->flags | CLASS_FLAGS_20; + tclass->flags = tclass->flags | CLASS_HAS_VBASES; } continue; } - if (!IS_TYPE_CLASS(pr.x8) || (TYPE_CLASS(pr.x8)->flags & CLASS_FLAGS_100)) { + if (!IS_TYPE_CLASS(pr.type) || (TYPE_CLASS(pr.type)->flags & CLASS_IS_TEMPL)) { CError_Error(CErrorStr131); continue; } - baseclass = TYPE_CLASS(pr.x8); + baseclass = TYPE_CLASS(pr.type); } else { special_parsing: if (!strcmp(tkidentifier->name, "HandleObject")) { if (tclass->bases) CError_Error(CErrorStr191); - tclass->flags |= CLASS_FLAGS_10 | CLASS_FLAGS_1; + tclass->flags |= CLASS_SINGLE_OBJECT | CLASS_HANDLEOBJECT; tk = lex(); break; } if (!strcmp(tkidentifier->name, "SingleObject") || !strcmp(tkidentifier->name, "SingleInheritance")) { if (tclass->bases) CError_Error(CErrorStr191); - tclass->flags = tclass->flags | CLASS_FLAGS_10; + tclass->flags = tclass->flags | CLASS_SINGLE_OBJECT; tk = lex(); break; } if (!strcmp(tkidentifier->name, "__comobject")) { - tclass->flags = tclass->flags | CLASS_FLAGS_2000; + tclass->flags = tclass->flags | CLASS_COM_OBJECT; tk = lex(); break; } @@ -4163,7 +4168,7 @@ static void CDecl_ParseBaseClassList(TypeClass *tclass, short mode, Boolean is_t } } while ((tk = lex()) == ','); - if (tclass->flags & CLASS_FLAGS_20) + if (tclass->flags & CLASS_HAS_VBASES) CDecl_MakeVBaseList(tclass); if (copts.def_inherited && tclass->bases && !tclass->bases->next) { @@ -4191,11 +4196,11 @@ static TypeMemberFunc *CDecl_MakeDefaultCtorType(TypeClass *tclass) { memclrw(tmeth, sizeof(TypeMemberFunc)); tmeth->type = TYPEFUNC; tmeth->functype = TYPE(&void_ptr); - tmeth->flags = FUNC_FLAGS_1000 | FUNC_FLAGS_100 | FUNC_FLAGS_METHOD; + tmeth->flags = FUNC_IS_CTOR | FUNC_AUTO_GENERATED | FUNC_METHOD; tmeth->theclass = tclass; CDecl_SetFuncFlags(TYPE_FUNC(tmeth), 1); - if (tclass->flags & CLASS_FLAGS_20) + if (tclass->flags & CLASS_HAS_VBASES) CDecl_AddArgument(TYPE_FUNC(tmeth), TYPE(&stsignedshort)); CDecl_AddThisPointerArgument(TYPE_FUNC(tmeth), tclass); @@ -4210,14 +4215,14 @@ static void CDecl_AddMemberFunctionObject(TypeClass *tclass, HashNameNode *name, Object *obj = CParser_NewCompilerDefFunctionObject(); obj->name = name; obj->type = TYPE(tmeth); - obj->qual = Q_80000; + obj->qual = Q_MANGLE_NAME; obj->access = access; obj->nspace = tclass->nspace; obj->qual = obj->qual | Q_INLINE; CScope_AddObject(tclass->nspace, obj->name, OBJ_BASE(obj)); } -static void CDecl_AddDefaultConstructor(DeclE *decle, TypeClass *tclass) { +static void CDecl_AddDefaultConstructor(ClassLayout *decle, TypeClass *tclass) { ClassList *base; ObjMemberVar *ivar; Object *obj; @@ -4230,9 +4235,9 @@ static void CDecl_AddDefaultConstructor(DeclE *decle, TypeClass *tclass) { has_ctor = 0; - if (tclass->flags & CLASS_FLAGS_20) + if (tclass->flags & CLASS_HAS_VBASES) has_ctor = 1; - if (decle->xC) + if (decle->has_vtable) has_ctor = 1; for (base = tclass->bases; base; base = base->next) { @@ -4264,7 +4269,7 @@ static TypeMemberFunc *CDecl_MakeCopyCtorType(TypeClass *tclass, Boolean is_cons memclrw(tmeth, sizeof(TypeMemberFunc)); tmeth->type = TYPEFUNC; tmeth->functype = TYPE(&void_ptr); - tmeth->flags = FUNC_FLAGS_1000 | FUNC_FLAGS_100 | FUNC_FLAGS_METHOD; + tmeth->flags = FUNC_IS_CTOR | FUNC_AUTO_GENERATED | FUNC_METHOD; tmeth->theclass = tclass; CDecl_SetFuncFlags(TYPE_FUNC(tmeth), 1); @@ -4274,14 +4279,14 @@ static TypeMemberFunc *CDecl_MakeCopyCtorType(TypeClass *tclass, Boolean is_cons arg->type = CDecl_NewRefPointerType(TYPE(tclass)); tmeth->args = arg; - if (tclass->flags & CLASS_FLAGS_20) + if (tclass->flags & CLASS_HAS_VBASES) CDecl_AddArgument(TYPE_FUNC(tmeth), TYPE(&stsignedshort)); CDecl_AddThisPointerArgument(TYPE_FUNC(tmeth), tclass); return tmeth; } -static void CDecl_AddDefaultCopyConstructor(DeclE *decle, TypeClass *tclass) { +static void CDecl_AddDefaultCopyConstructor(ClassLayout *decle, TypeClass *tclass) { ClassList *base; ObjMemberVar *ivar; Object *obj; @@ -4299,7 +4304,7 @@ static void CDecl_AddDefaultCopyConstructor(DeclE *decle, TypeClass *tclass) { if (CClass_Constructor(tclass)) has_copyctor = 1; - if ((tclass->flags & CLASS_FLAGS_20) || decle->xC) + if ((tclass->flags & CLASS_HAS_VBASES) || decle->has_vtable) has_copyctor = 1; for (base = tclass->bases; base; base = base->next) { @@ -4307,7 +4312,7 @@ static void CDecl_AddDefaultCopyConstructor(DeclE *decle, TypeClass *tclass) { has_copyctor = 1; access = getaccesstype(access, obj->access, ACCESSPRIVATE); arg = TYPE_FUNC(obj->type)->args->next; - if (base->base->flags & CLASS_FLAGS_20) + if (base->base->flags & CLASS_HAS_VBASES) arg = arg->next; if (!(arg->qual & Q_CONST)) is_const = 0; @@ -4322,7 +4327,7 @@ static void CDecl_AddDefaultCopyConstructor(DeclE *decle, TypeClass *tclass) { has_copyctor = 1; access = getaccesstype(access, obj->access, ACCESSPUBLIC); arg = TYPE_FUNC(obj->type)->args->next; - if (TYPE_CLASS(type)->flags & CLASS_FLAGS_20) + if (TYPE_CLASS(type)->flags & CLASS_HAS_VBASES) arg = arg->next; if (!(arg->qual & Q_CONST)) is_const = 0; @@ -4345,7 +4350,7 @@ static TypeMemberFunc *CDecl_MakeAssignmentOperatorType(TypeClass *tclass, Boole memclrw(tmeth, sizeof(TypeMemberFunc)); tmeth->type = TYPEFUNC; tmeth->functype = CDecl_NewRefPointerType(TYPE(tclass)); - tmeth->flags = FUNC_FLAGS_100 | FUNC_FLAGS_METHOD; + tmeth->flags = FUNC_AUTO_GENERATED | FUNC_METHOD; tmeth->theclass = tclass; CDecl_SetFuncFlags(TYPE_FUNC(tmeth), 1); @@ -4359,7 +4364,7 @@ static TypeMemberFunc *CDecl_MakeAssignmentOperatorType(TypeClass *tclass, Boole return tmeth; } -static void CDecl_AddDefaultAssignmentOperator(DeclE *decle, TypeClass *tclass) { +static void CDecl_AddDefaultAssignmentOperator(ClassLayout *decle, TypeClass *tclass) { ClassList *base; ObjMemberVar *ivar; Object *obj; @@ -4376,7 +4381,7 @@ static void CDecl_AddDefaultAssignmentOperator(DeclE *decle, TypeClass *tclass) if (!copts.old_argmatch) has_ass = 1; - if ((tclass->flags & CLASS_FLAGS_20) || decle->xC || CClass_MemberObject(tclass, asop_name_node)) + if ((tclass->flags & CLASS_HAS_VBASES) || decle->has_vtable || CClass_MemberObject(tclass, asop_name_node)) has_ass = 1; for (base = tclass->bases; base; base = base->next) { @@ -4415,7 +4420,7 @@ TypeMemberFunc *CDecl_MakeDefaultDtorType(TypeClass *tclass, Boolean is_virtual) memclrw(tmeth, sizeof(TypeMemberFunc)); tmeth->type = TYPEFUNC; tmeth->functype = (Type *) &void_ptr; - tmeth->flags = FUNC_FLAGS_2000 | FUNC_FLAGS_100 | FUNC_FLAGS_METHOD; + tmeth->flags = FUNC_IS_DTOR | FUNC_AUTO_GENERATED | FUNC_METHOD; tmeth->theclass = tclass; CDecl_SetFuncFlags(TYPE_FUNC(tmeth), 1); if (is_virtual) @@ -4424,7 +4429,7 @@ TypeMemberFunc *CDecl_MakeDefaultDtorType(TypeClass *tclass, Boolean is_virtual) return tmeth; } -static void CDecl_AddDefaultDestructor(DeclE *decle, TypeClass *tclass) { +static void CDecl_AddDefaultDestructor(ClassLayout *decle, TypeClass *tclass) { ClassList *base; ObjMemberVar *ivar; Object *obj; @@ -4471,7 +4476,7 @@ static void CDecl_AddDefaultDestructor(DeclE *decle, TypeClass *tclass) { } } -static void CDecl_SetupClassLayout(DeclE *decle, TypeClass *tclass, ObjBase **objbuf) { +static void CDecl_SetupClassLayout(ClassLayout *decle, TypeClass *tclass, ObjBase **objbuf) { SInt32 index; SInt32 i; Object *obj; @@ -4479,8 +4484,8 @@ static void CDecl_SetupClassLayout(DeclE *decle, TypeClass *tclass, ObjBase **ob ObjMemberVar *ivar; SInt32 bufsize; - if (decle->x8 > 32) { - bufsize = decle->x8 * sizeof(ObjBase *); + if (decle->lex_order_count > 32) { + bufsize = decle->lex_order_count * sizeof(ObjBase *); objbuf = lalloc(bufsize); } else { bufsize = 32 * sizeof(ObjBase *); @@ -4501,16 +4506,16 @@ static void CDecl_SetupClassLayout(DeclE *decle, TypeClass *tclass, ObjBase **ob if (obj->datatype == DALIAS) continue; - i = TYPE_METHOD(obj->type)->x1E; + i = TYPE_METHOD(obj->type)->vtbl_index; if (i > 0) { - CError_ASSERT(6363, (i - 1) < decle->x8 && !objbuf[(int) (i - 1)]); + CError_ASSERT(6363, (i - 1) < decle->lex_order_count && !objbuf[(int) (i - 1)]); objbuf[(int) (i - 1)] = OBJ_BASE(obj); index++; - if (obj->datatype != DVFUNC && !TYPE_METHOD(obj->type)->x26 && CClass_OverridesBaseMember(tclass, obj->name, obj)) + if (obj->datatype != DVFUNC && !TYPE_METHOD(obj->type)->is_static && CClass_OverridesBaseMember(tclass, obj->name, obj)) CDecl_MakeFunctionVirtual(tclass, obj); if (obj->datatype == DVFUNC) { - decle->xC = 1; + decle->has_vtable = 1; if (!tclass->vtable) { CABI_AddVTable(tclass); decle->xA = i - 1; @@ -4518,22 +4523,22 @@ static void CDecl_SetupClassLayout(DeclE *decle, TypeClass *tclass, ObjBase **ob if ((i - 1) < decle->xA) decle->xA = i - 1; } - } else if (TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_8) { + } else if (TYPE_FUNC(obj->type)->flags & FUNC_PURE) { CError_Error(CErrorStr351, obj); - TYPE_FUNC(obj->type)->flags &= ~FUNC_FLAGS_8; + TYPE_FUNC(obj->type)->flags &= ~FUNC_PURE; } } else { CError_ASSERT(6412, i == 0); } if (!tclass->sominfo) - TYPE_METHOD(obj->type)->x1E = 0; + TYPE_METHOD(obj->type)->vtbl_index = 0; } if (!tclass->action) { - for (i = 0; i < decle->x8; i++) { + for (i = 0; i < decle->lex_order_count; i++) { Object *obj2 = OBJECT(objbuf[i]); - if (obj2 && obj2->datatype == DVFUNC && !(obj2->qual & Q_INLINE) && !(TYPE_FUNC(obj2->type)->flags & FUNC_FLAGS_8)) { + if (obj2 && obj2->datatype == DVFUNC && !(obj2->qual & Q_INLINE) && !(TYPE_FUNC(obj2->type)->flags & FUNC_PURE)) { tclass->action = CLASS_ACTION_1; TYPE_FUNC(obj2->type)->flags |= FUNC_FLAGS_4; break; @@ -4542,7 +4547,7 @@ static void CDecl_SetupClassLayout(DeclE *decle, TypeClass *tclass, ObjBase **ob } if (!tclass->sominfo) { - for (i = 0, ivar = tclass->ivars; i < decle->x8; i++) { + for (i = 0, ivar = tclass->ivars; i < decle->lex_order_count; i++) { if (!objbuf[i]) { CError_ASSERT(6449, ivar); objbuf[i] = OBJ_BASE(ivar); @@ -4553,16 +4558,16 @@ static void CDecl_SetupClassLayout(DeclE *decle, TypeClass *tclass, ObjBase **ob CError_ASSERT(6455, ivar == NULL); } - CError_ASSERT(6458, index == decle->x8); + CError_ASSERT(6458, index == decle->lex_order_count); } -void CDecl_CompleteClass(DeclE *decle, TypeClass *tclass) { +void CDecl_CompleteClass(ClassLayout *decle, TypeClass *tclass) { ClassList *base; ObjBase *buf[32]; for (base = tclass->bases; base; base = base->next) { if (base->base->vtable) - decle->xC = 1; + decle->has_vtable = 1; } if (!tclass->sominfo) { @@ -4573,13 +4578,13 @@ void CDecl_CompleteClass(DeclE *decle, TypeClass *tclass) { } CDecl_SetupClassLayout(decle, tclass, buf); - if (decle->xC) + if (decle->has_vtable) CClass_CheckOverrides(tclass); CABI_LayoutClass(decle, tclass); if (tclass->sominfo) CSOM_ClassComplete(tclass); - if ((tclass->flags & CLASS_FLAGS_800) && !TEMPL_CLASS_INST(tclass)->is_specialized) + if ((tclass->flags & CLASS_IS_TEMPL_INST) && !TEMPL_CLASS_INST(tclass)->is_specialized) tclass->action = CLASS_ACTION_0; if (!tclass->action) @@ -4591,7 +4596,7 @@ TypeClass *CDecl_DefineClass(NameSpace *nspace, HashNameNode *name, TypeClass *t NameSpace *mynspace; ObjType *objtype; - if (!tclass && nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_100)) { + if (!tclass && nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL)) { CError_ASSERT(6556, !flag2); return TYPE_CLASS(CTemplClass_DefineNestedClass(TEMPL_CLASS(nspace->theclass), name, mode)); } @@ -4682,13 +4687,13 @@ static TemplClass *CDecl_SpecializeTemplateClass(TemplClass *tmclass) { } void CDecl_ParseClass(DeclInfo *declinfo, short mode, Boolean flag1, UInt8 class_declspec) { - DeclE decle; + ClassLayout decle; TypeClass *tclass; HashNameNode *classname; Type *search; short t; NameSpace *nspace; - CScopeParseResult pr; + NameResult pr; CScopeSave scopesave; GList gl; FileOffsetInfo offsetsave; @@ -4696,7 +4701,7 @@ void CDecl_ParseClass(DeclInfo *declinfo, short mode, Boolean flag1, UInt8 class Boolean is_templ; Boolean add_to_browse; - memclrw(&decle, sizeof(DeclE)); + memclrw(&decle, sizeof(ClassLayout)); if (declinfo->x28) { tclass = TYPE_CLASS(declinfo->x28); } else { @@ -4711,7 +4716,7 @@ void CDecl_ParseClass(DeclInfo *declinfo, short mode, Boolean flag1, UInt8 class break; case TK_IDENTIFIER: classname = tkidentifier; - if (!declinfo->x4C && !declinfo->x4F && ((t = lookahead()) == ':' || t == ';' || t == '{')) { + if (!declinfo->in_friend_decl && !declinfo->x4F && ((t = lookahead()) == ':' || t == ';' || t == '{')) { tk = lex(); search = CScope_GetLocalTagType(cscope_current, classname); if (search) { @@ -4730,7 +4735,11 @@ void CDecl_ParseClass(DeclInfo *declinfo, short mode, Boolean flag1, UInt8 class tclass = TYPE_CLASS(search); } if (tclass->mode != mode) { - if ((mode == CLASS_FLAGS_2 && tclass->mode == CLASS_MODE_0) || (mode == CLASS_MODE_0 && tclass->mode == CLASS_MODE_2)) { + if ( + (mode == CLASS_MODE_CLASS && tclass->mode == CLASS_MODE_STRUCT) || + (mode == CLASS_MODE_STRUCT && tclass->mode == CLASS_MODE_CLASS) + ) + { if (copts.warn_structclass) CError_Warning(CErrorStr343); } else { @@ -4750,12 +4759,12 @@ void CDecl_ParseClass(DeclInfo *declinfo, short mode, Boolean flag1, UInt8 class default: if (!CScope_ParseElaborateName(&pr)) { CError_Error(CErrorStr121); - declinfo->thetype = (Type *) &stsignedint; + declinfo->thetype = TYPE(&stsignedint); return; } tk = lex(); - if ((search = pr.x8)) { + if ((search = pr.type)) { goto tagtype_search; } @@ -4766,13 +4775,18 @@ void CDecl_ParseClass(DeclInfo *declinfo, short mode, Boolean flag1, UInt8 class } } - declinfo->thetype = (Type *) tclass; + declinfo->thetype = TYPE(tclass); if (tk == ':' || tk == '{') { - if (declinfo->x4C) + if (declinfo->in_friend_decl) CError_Error(CErrorStr201); - if (tclass->flags & CLASS_FLAGS_2) { - if ((tclass->flags & CLASS_FLAGS_100) && !TEMPL_CLASS(tclass)->instances && !(TEMPL_CLASS(tclass)->flags & TEMPLCLASS_FLAGS_2)) { + if (tclass->flags & CLASS_COMPLETED) { + if ( + (tclass->flags & CLASS_IS_TEMPL) && + !TEMPL_CLASS(tclass)->instances && + !(TEMPL_CLASS(tclass)->flags & TEMPLCLASS_FLAGS_2) + ) + { tclass = TYPE_CLASS(CDecl_SpecializeTemplateClass(TEMPL_CLASS(tclass))); } else { CError_Error(CErrorStr132, tclass->classname->name); @@ -4788,8 +4802,8 @@ void CDecl_ParseClass(DeclInfo *declinfo, short mode, Boolean flag1, UInt8 class } } - is_templ = (tclass->flags & CLASS_FLAGS_100) != 0; - if (tclass->flags & CLASS_FLAGS_800) { + is_templ = (tclass->flags & CLASS_IS_TEMPL) != 0; + if (tclass->flags & CLASS_IS_TEMPL_INST) { TEMPL_CLASS_INST(tclass)->is_instantiated = 1; if (!declinfo->x28) TEMPL_CLASS_INST(tclass)->is_specialized = 1; diff --git a/compiler_and_linker/unsorted/CError.c b/compiler_and_linker/unsorted/CError.c index 1fe6814..02265c3 100644 --- a/compiler_and_linker/unsorted/CError.c +++ b/compiler_and_linker/unsorted/CError.c @@ -177,7 +177,7 @@ static void CError_BufferAppendNameSpace(CErrorBuffer *eb, NameSpace *nspace) { CError_BufferAppendNameSpace(eb, nspace->parent); if (nspace->theclass) { CError_BufferAppendString(eb, nspace->theclass->classname->name); - if (nspace->theclass->flags & CLASS_FLAGS_800) + if (nspace->theclass->flags & CLASS_IS_TEMPL_INST) CError_BufferAppendTemplArgs( eb, !TEMPL_CLASS_INST(nspace->theclass)->oargs ? TEMPL_CLASS_INST(nspace->theclass)->inst_args : TEMPL_CLASS_INST(nspace->theclass)->oargs @@ -264,11 +264,11 @@ static void CError_BufferAppendFuncArgs(CErrorBuffer *eb, TypeFunc *tfunc, Boole arg = arg->next; if (arg) arg = arg->next; - } else if ((tfunc->flags & FUNC_FLAGS_METHOD) && !TYPE_METHOD(tfunc)->x26) { + } else if ((tfunc->flags & FUNC_METHOD) && !TYPE_METHOD(tfunc)->is_static) { qual = arg->qual; arg = arg->next; if (arg) { - if ((tfunc->flags & FUNC_FLAGS_2000) || ((tfunc->flags & FUNC_FLAGS_1000) && (TYPE_METHOD(tfunc)->theclass->flags & CLASS_FLAGS_20))) + if ((tfunc->flags & FUNC_IS_DTOR) || ((tfunc->flags & FUNC_IS_CTOR) && (TYPE_METHOD(tfunc)->theclass->flags & CLASS_HAS_VBASES))) arg = arg->next; } } @@ -401,7 +401,7 @@ static void CError_BufferAppendType(CErrorBuffer *eb, Type *ty, UInt32 qual) { CError_BufferAppendNameSpace(eb, TYPE_CLASS(ty)->nspace->parent); if (TYPE_CLASS(ty)->classname) { CError_BufferAppendString(eb, TYPE_CLASS(ty)->classname->name); - if (TYPE_CLASS(ty)->flags & CLASS_FLAGS_800) + if (TYPE_CLASS(ty)->flags & CLASS_IS_TEMPL_INST) CError_BufferAppendTemplArgs( eb, TEMPL_CLASS_INST(ty)->oargs ? TEMPL_CLASS_INST(ty)->oargs : TEMPL_CLASS_INST(ty)->inst_args @@ -426,7 +426,7 @@ static void CError_BufferAppendType(CErrorBuffer *eb, Type *ty, UInt32 qual) { CError_BufferAppendQualifier(eb, qual); switch (scan->type) { case TYPEFUNC: - if (TYPE_FUNC(scan)->flags & FUNC_FLAGS_PASCAL) + if (TYPE_FUNC(scan)->flags & FUNC_PASCAL) CError_BufferAppendString(eb, "pascal "); CError_BufferAppendType(eb, TYPE_FUNC(scan)->functype, 0); CError_BufferAppendString(eb, " ("); @@ -452,7 +452,7 @@ static void CError_BufferAppendType(CErrorBuffer *eb, Type *ty, UInt32 qual) { } break; case TYPEFUNC: - if (TYPE_FUNC(ty)->flags & FUNC_FLAGS_PASCAL) + if (TYPE_FUNC(ty)->flags & FUNC_PASCAL) CError_BufferAppendString(eb, "pascal "); CError_BufferAppendQualifier(eb, qual); CError_BufferAppendType(eb, TYPE_FUNC(ty)->functype, 0); @@ -484,7 +484,7 @@ static void CError_BufferAppendType(CErrorBuffer *eb, Type *ty, UInt32 qual) { CError_BufferAppendString(eb, "T"); return; case TYPEBITFIELD: - sprintf(buf, "bitfield:%" PRId32, TYPE_BITFIELD(ty)->unkB); + sprintf(buf, "bitfield:%" PRId32, TYPE_BITFIELD(ty)->bitlength); CError_BufferAppendString(eb, buf); return; default: @@ -527,7 +527,7 @@ static void CError_AppendUnqualFunctionName(CErrorBuffer *eb, NameSpace *nspace, if (!flag) { opname = CMangler_GetOperator(name); if (!opname) { - if (tfunc && (tfunc->flags & FUNC_FLAGS_40)) { + if (tfunc && (tfunc->flags & FUNC_CONVERSION)) { CError_BufferAppendString(eb, "operator "); CError_BufferAppendType(eb, tfunc->functype, tfunc->qual); } else { @@ -547,7 +547,7 @@ static void CError_AppendFunctionName(CErrorBuffer *eb, NameSpace *nspace, HashN CError_AppendUnqualFunctionName(eb, nspace, name, tfunc); CError_BufferAppendTemplArgs(eb, templargs); if (tfunc) { - if (!templargs && (tfunc->flags & FUNC_FLAGS_100000)) + if (!templargs && (tfunc->flags & FUNC_IS_TEMPL)) CError_BufferAppendString(eb, "<...>"); CError_BufferAppendFuncArgs(eb, tfunc, 0); } else { @@ -874,9 +874,9 @@ void CError_ErrorFuncCall(short code, NameSpaceObjectList *args, ENodeList *argN OBJECT(args->object)->nspace, OBJECT(args->object)->name, TYPE_FUNC(OBJECT(args->object)->type)); - if (TYPE_FUNC(OBJECT(args->object)->type)->flags & FUNC_FLAGS_METHOD) - if (TYPE_FUNC(OBJECT(args->object)->type)->flags & FUNC_FLAGS_1000) - if (TYPE_METHOD(OBJECT(args->object)->type)->theclass->flags & CLASS_FLAGS_20) + if (TYPE_FUNC(OBJECT(args->object)->type)->flags & FUNC_METHOD) + if (TYPE_FUNC(OBJECT(args->object)->type)->flags & FUNC_IS_CTOR) + if (TYPE_METHOD(OBJECT(args->object)->type)->theclass->flags & CLASS_HAS_VBASES) if (argNodes) argNodes = argNodes->next; } else { diff --git a/compiler_and_linker/unsorted/CException.c b/compiler_and_linker/unsorted/CException.c index 9bc9d83..d68ce13 100644 --- a/compiler_and_linker/unsorted/CException.c +++ b/compiler_and_linker/unsorted/CException.c @@ -54,7 +54,7 @@ Boolean CExcept_CanThrowException(Object *object, Boolean flag) { if (flag) return 1; - if (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_NOTHROW) + if (TYPE_FUNC(object->type)->flags & FUNC_NOTHROW) return 0; if ( @@ -67,7 +67,7 @@ Boolean CExcept_CanThrowException(Object *object, Boolean flag) { if ( copts.optEH2 && - !(object->qual & Q_80000) && + !(object->qual & Q_MANGLE_NAME) && object != rt_ptmf_call && object != rt_ptmf_scall && object != Rdync_func && @@ -450,7 +450,7 @@ void CExcept_Magic(void) { } static Object *CExcept_FindLocalObject(char *name) { - CScopeParseResult result; + NameResult result; NameSpaceObjectList *list; list = CScope_FindObjectList(&result, GetHashNameNodeExport(name)); @@ -879,7 +879,7 @@ static ENode *CExcept_CallCopyCtor(Object *object, Type *type, ENode *expr1, ENo expr = funccallexpr(object, expr1, NULL, NULL, NULL); list = expr->data.funccall.args; - if (TYPE_CLASS(type)->flags & CLASS_FLAGS_20) { + if (TYPE_CLASS(type)->flags & CLASS_HAS_VBASES) { CError_ASSERT(1179, arg = arg->next); list->next = lalloc(sizeof(ENodeList)); list = list->next; @@ -1205,7 +1205,7 @@ void CExcept_ScanTryBlock(DeclThing *dt, Boolean flag) { di.thetype = CDecl_NewPointerType(TPTR_TARGET(di.thetype)); IsCompleteType(di.thetype); - if (IS_TYPE_CLASS(di.thetype) && (TYPE_CLASS(di.thetype)->flags & CLASS_FLAGS_ABSTRACT)) + if (IS_TYPE_CLASS(di.thetype) && (TYPE_CLASS(di.thetype)->flags & CLASS_ABSTRACT)) CError_AbstractClassError(TYPE_CLASS(di.thetype)); catchBlock->type = di.thetype; @@ -2164,7 +2164,7 @@ static Boolean CExcept_CanThrowCheck(Object *func, Statement *stmt) { } if (!cexcept_canthrow) { - TYPE_FUNC(cscope_currentfunc->type)->flags |= FUNC_FLAGS_NOTHROW; + TYPE_FUNC(cscope_currentfunc->type)->flags |= FUNC_NOTHROW; return 0; } else { return 1; diff --git a/compiler_and_linker/unsorted/CExpr.c b/compiler_and_linker/unsorted/CExpr.c index 500ae57..23fe22f 100644 --- a/compiler_and_linker/unsorted/CExpr.c +++ b/compiler_and_linker/unsorted/CExpr.c @@ -44,7 +44,7 @@ restart: goto restart; } - if ((obj->qual & Q_10000) && expr->rtype == obj->type) { + if ((obj->qual & Q_INLINE_DATA) && expr->rtype == obj->type) { switch (expr->rtype->type) { case TYPEINT: case TYPEENUM: @@ -783,7 +783,7 @@ ENode *CExpr_DoExplicitConversion(Type *type, UInt32 qual, ENodeList *list) { } CDecl_CompleteType(type); - if (!(TYPE_CLASS(type)->flags & CLASS_FLAGS_2)) + if (!(TYPE_CLASS(type)->flags & CLASS_COMPLETED)) CError_Error(CErrorStr136, type, 0); CanCreateObject(type); @@ -866,7 +866,7 @@ static Boolean CExpr_IsTemplateFunc(Object *obj) { return IS_TEMPL_FUNC(obj->type); } -static ENode *CExpr_ExplicitTemplateArgCheck(CScopeParseResult *pr) { +static ENode *CExpr_ExplicitTemplateArgCheck(NameResult *pr) { NameSpaceObjectList *list; NameSpaceObjectList *newhead; NameSpaceObjectList *newlist; @@ -912,7 +912,7 @@ static ENode *CExpr_ExplicitTemplateArgCheck(CScopeParseResult *pr) { return expr; } -ENode *CExpr_MakeNameLookupResultExpr(CScopeParseResult *pr) { +ENode *CExpr_MakeNameLookupResultExpr(NameResult *pr) { ENode *expr; if (pr->obj_10) { @@ -979,7 +979,7 @@ static Type *CExpr_NewPTMType(EMemberInfo *member, Object *obj) { tmethod->args = tmethod->args->next; CDecl_MakePTMFuncType(TYPE_FUNC(tmethod)); - tmethod->flags &= ~FUNC_FLAGS_2; + tmethod->flags &= ~FUNC_DEFINED; ptm->size = 12; ptm->ty2 = TYPE(tmethod->theclass); @@ -989,7 +989,7 @@ static Type *CExpr_NewPTMType(EMemberInfo *member, Object *obj) { return TYPE(ptm); } -static ENode *CExpr_ParseNameResultExpr(CScopeParseResult *pr, ENode *expr, Boolean flag1, Boolean flag2) { +static ENode *CExpr_ParseNameResultExpr(NameResult *pr, ENode *expr, Boolean flag1, Boolean flag2) { ENode *result; ENode *ta_expr; ObjEnumConst *oec; @@ -1000,25 +1000,25 @@ static ENode *CExpr_ParseNameResultExpr(CScopeParseResult *pr, ENode *expr, Bool TypeFunc *tfunc; SInt32 val; - if (pr->x8) { + if (pr->type) { if (copts.cplusplus) { - if (IS_TYPE_TEMPLATE(pr->x8)) { - if (TYPE_TEMPLATE(pr->x8)->dtype == TEMPLDEP_ARGUMENT && TYPE_TEMPLATE(pr->x8)->u.pid.type == TPT_NONTYPE) { + if (IS_TYPE_TEMPLATE(pr->type)) { + if (TYPE_TEMPLATE(pr->type)->dtype == TEMPLDEP_ARGUMENT && TYPE_TEMPLATE(pr->type)->u.pid.type == TPT_NONTYPE) { result = CExpr_NewTemplDepENode(TDE_PARAM); - result->data.templdep.u.pid = TYPE_TEMPLATE(pr->x8)->u.pid; + result->data.templdep.u.pid = TYPE_TEMPLATE(pr->type)->u.pid; tk = lex(); return result; } - if (TYPE_TEMPLATE(pr->x8)->dtype == TEMPLDEP_QUALNAME && !pr->x20) { + if (TYPE_TEMPLATE(pr->type)->dtype == TEMPLDEP_QUALNAME && !pr->x20) { result = CExpr_NewTemplDepENode(TDE_QUALNAME); - result->data.templdep.u.qual.type = TYPE_TEMPLATE(pr->x8)->u.qual.type; - result->data.templdep.u.qual.name = TYPE_TEMPLATE(pr->x8)->u.qual.name; + result->data.templdep.u.qual.type = TYPE_TEMPLATE(pr->type)->u.qual.type; + result->data.templdep.u.qual.name = TYPE_TEMPLATE(pr->type)->u.qual.name; tk = lex(); return result; } } tk = lex(); - return CExpr_ParseExplicitConversion(pr->x8, pr->xC); + return CExpr_ParseExplicitConversion(pr->type, pr->qual); } CError_ErrorSkip(CErrorStr141); tk = lex(); @@ -1028,7 +1028,7 @@ static ENode *CExpr_ParseNameResultExpr(CScopeParseResult *pr, ENode *expr, Bool if (pr->obj_10) { switch (pr->obj_10->otype) { case OT_OBJECT: - if (OBJECT(pr->obj_10)->nspace && OBJECT(pr->obj_10)->nspace->theclass && (OBJECT(pr->obj_10)->nspace->theclass->flags & CLASS_FLAGS_100)) { + if (OBJECT(pr->obj_10)->nspace && OBJECT(pr->obj_10)->nspace->theclass && (OBJECT(pr->obj_10)->nspace->theclass->flags & CLASS_IS_TEMPL)) { result = CExpr_NewTemplDepENode(TDE_OBJ); result->data.templdep.u.obj = OBJECT(pr->obj_10); tk = lex(); @@ -1103,7 +1103,7 @@ static ENode *CExpr_ParseNameResultExpr(CScopeParseResult *pr, ENode *expr, Bool case OT_ENUMCONST: CClass_CheckEnumAccess(pr->bcl_18, OBJ_ENUM_CONST(pr->obj_10)); oec = OBJ_ENUM_CONST(pr->obj_10); - if (CInt64_IsZero(&oec->val) && IS_TYPE_ENUM(oec->type) && TYPE_ENUM(oec->type)->nspace && TYPE_ENUM(oec->type)->nspace->theclass && (TYPE_ENUM(oec->type)->nspace->theclass->flags & CLASS_FLAGS_100)) { + if (CInt64_IsZero(&oec->val) && IS_TYPE_ENUM(oec->type) && TYPE_ENUM(oec->type)->nspace && TYPE_ENUM(oec->type)->nspace->theclass && (TYPE_ENUM(oec->type)->nspace->theclass->flags & CLASS_IS_TEMPL)) { val = 0; expr = NULL; for (act = TEMPL_CLASS(TYPE_ENUM(oec->type)->nspace->theclass)->actions; act; act = act->next) { @@ -1304,7 +1304,7 @@ static ENode *CExpr_ParseRotate(Boolean is_right) { static ENode *CExpr_ParseNextArg(void) { NameSpaceObjectList *list; - CScopeParseResult pr; + NameResult pr; ENode *expr; SInt32 rounded_size; @@ -1560,7 +1560,7 @@ static ENode *CExpr_ParseBuiltin_isintconst(void) { } static ENode *primary_expression(Boolean flag) { - CScopeParseResult pr; + NameResult pr; ENode *expr; switch (tk) { @@ -1753,7 +1753,7 @@ static ENode *call_ptmf(ENode *expr) { static ENode *CExpr_DummyDestr(ENode *expr) { SInt32 state; - CScopeParseResult pr; + NameResult pr; DeclInfo di; NameSpace *nspace; @@ -1779,17 +1779,17 @@ loop: nspace = pr.nspace_0; goto loop; } - } else if (IS_TYPE_CLASS(pr.x8) && tk == TK_COLON_COLON) { + } else if (IS_TYPE_CLASS(pr.type) && tk == TK_COLON_COLON) { tk = lex(); - nspace = TYPE_CLASS(pr.x8)->nspace; + nspace = TYPE_CLASS(pr.type)->nspace; goto loop; } else { - if (!is_typesame(pr.x8, expr->rtype)) + if (!is_typesame(pr.type, expr->rtype)) CError_Error(CErrorStr146); if (tk == TK_COLON_COLON && ((tk = lex()) == '~') && ((tk = lex()) == TK_IDENTIFIER)) { parse_dtor: if (CScope_FindTypeName(nspace, tkidentifier, &pr) && !pr.nspace_0) { - if (!is_typesame(pr.x8, expr->rtype)) + if (!is_typesame(pr.type, expr->rtype)) CError_Error(CErrorStr146); tk = lex(); goto parsed; @@ -1833,7 +1833,7 @@ parsed: } static ENode *postfix_expression(Boolean flag) { - CScopeParseResult pr; + NameResult pr; Conversion conv; ENode *expr; ENode *subexpr; @@ -1988,7 +1988,7 @@ loop: if (TYPE_CLASS(expr->rtype)->objcinfo && copts.cplusplus && (subexpr = CObjC_CheckModernSendMessage(TYPE_CLASS(expr->rtype), expr))) return subexpr; - if (!(TYPE_CLASS(expr->rtype)->flags & CLASS_FLAGS_2)) + if (!(TYPE_CLASS(expr->rtype)->flags & CLASS_COMPLETED)) CError_Error(CErrorStr136, expr->rtype, 0); if ((tk = lex()) == TK_TEMPLATE && (tk = lex()) != TK_IDENTIFIER) @@ -2341,7 +2341,7 @@ ENode *getpointertomemberfunc(ENode *expr, Type *type, Boolean flag) { CError_ASSERT(3503, obj->otype == OT_OBJECT && IS_TYPE_NONSTATIC_METHOD(obj->type)); - if (TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_100000) + if (TYPE_FUNC(obj->type)->flags & FUNC_IS_TEMPL) CError_Error(CErrorStr190); ptmtype = CExpr_NewPTMType(expr->data.emember, obj); @@ -2356,7 +2356,7 @@ ENode *getpointertomemberfunc(ENode *expr, Type *type, Boolean flag) { data[0] = 0; if (obj->datatype == DVFUNC) { olist = NULL; - data[1] = tmethod->x1E; + data[1] = tmethod->vtbl_index; data[2] = tmethod->theclass->vtable->offset; } else { data[1] = -1; diff --git a/compiler_and_linker/unsorted/CExpr2.c b/compiler_and_linker/unsorted/CExpr2.c index 6a5150c..e5c662a 100644 --- a/compiler_and_linker/unsorted/CExpr2.c +++ b/compiler_and_linker/unsorted/CExpr2.c @@ -810,7 +810,7 @@ Boolean CExpr_IsLValue(ENode *expr) { case ETEMP: return 0; case EFUNCCALL: - if (expr->data.funccall.functype->functype->type != TYPEPOINTER || (expr->data.funccall.functype->flags & FUNC_FLAGS_1000)) + if (expr->data.funccall.functype->functype->type != TYPEPOINTER || (expr->data.funccall.functype->flags & FUNC_IS_CTOR)) return 0; default: return 1; @@ -925,7 +925,7 @@ ENode *CExpr_MakeObjRefNode(Object *obj, Boolean flag) { if (!IS_TYPE_FUNC(obj->type)) expr->flags = obj->qual & ENODE_FLAG_QUALS; if (flag) - obj->flags |= OBJECT_FLAGS_1; + obj->flags |= OBJECT_USED; return expr; } @@ -1390,7 +1390,7 @@ static short std_assign_check_overload(NameSpaceObjectList *list, TemplArg *temp if (obj->otype != OT_OBJECT) continue; - if (IS_TYPE_FUNC(obj->type) && (TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_100000)) { + if (IS_TYPE_FUNC(obj->type) && (TYPE_FUNC(obj->type)->flags & FUNC_IS_TEMPL)) { if (!found_non_template_func && CTempl_CanDeduceFunc(obj, TYPE_FUNC(type), templargs)) { instance = CTempl_DeduceFunc(obj, TYPE_FUNC(type), templargs, NULL, 0); CError_ASSERT(1861, instance); @@ -1429,7 +1429,7 @@ static short std_assign_check_overload(NameSpaceObjectList *list, TemplArg *temp assign_node = expr; expr->rtype = CDecl_NewPointerType(used_obj->type); expr->flags = obj->qual & ENODE_FLAG_QUALS; - used_obj->flags |= OBJECT_FLAGS_1; + used_obj->flags |= OBJECT_USED; if (used_obj->datatype == DINLINEFUNC) CError_Error(CErrorStr175); } @@ -1594,7 +1594,7 @@ static short std_assign_check(ENode *expr, Type *type, Boolean flag1, Boolean fl return std_assign_check_overload(expr->data.objlist.list, expr->data.objlist.templargs, type, flag1); } if (IS_TYPE_POINTER_ONLY(expr->rtype)) { - if (ENODE_IS(expr, EOBJREF) && IS_TYPE_FUNC(expr->data.objref->type) && (TYPE_FUNC(expr->data.objref->type)->flags & FUNC_FLAGS_100000)) { + if (ENODE_IS(expr, EOBJREF) && IS_TYPE_FUNC(expr->data.objref->type) && (TYPE_FUNC(expr->data.objref->type)->flags & FUNC_IS_TEMPL)) { NameSpaceObjectList list; list.next = NULL; list.object = OBJ_BASE(expr->data.objref); @@ -1706,7 +1706,7 @@ static void CExpr_ConIteratorInit(ConIterator *iter) { ConIteratorList *list; for (base = iter->tclass->bases; base; base = base->next) { - if (base->base->flags & CLASS_FLAGS_40) { + if (base->base->flags & CLASS_IS_CONVERTIBLE) { subiter = galloc(sizeof(ConIterator)); memclrw(subiter, sizeof(ConIterator)); subiter->parent = iter; @@ -1724,7 +1724,7 @@ static void CExpr_ConIteratorInit(ConIterator *iter) { void CExpr_ConversionIteratorInit(ConversionIterator *iter, TypeClass *tclass) { memclrw(iter, sizeof(ConversionIterator)); - if (tclass->flags & CLASS_FLAGS_40) { + if (tclass->flags & CLASS_IS_CONVERTIBLE) { iter->coniter = &iter->myconiter; iter->myconiter.tclass = tclass; CExpr_ConIteratorInit(&iter->myconiter); @@ -1745,9 +1745,9 @@ static Boolean CExpr_ConversionIteratorIsHidden(ConIterator *iter, TypeFunc *tfu objtfunc = TYPE_FUNC(OBJECT(obj)->type); if ( - IS_TYPE_FUNC(objtfunc) && - (objtfunc->flags & FUNC_FLAGS_40) && - is_compatible_conversion(tfunc->functype, objtfunc->functype) && + IS_TYPE_FUNC(objtfunc) && + (objtfunc->flags & FUNC_CONVERSION) && + is_compatible_conversion(tfunc->functype, objtfunc->functype) && (tfunc->args->qual & Q_CONST) == (objtfunc->args->qual & Q_CONST) && (tfunc->qual & Q_CONST) == (objtfunc->qual & Q_CONST) ) @@ -1770,9 +1770,9 @@ Object *CExpr_ConversionIteratorNext(ConversionIterator *iter) { restart: if ((obj = OBJECT(CScope_NextObjectIteratorObject(&iter->objiter)))) { if ( - IS_TYPE_FUNC(obj->type) && - (TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_40) && - !CExpr_ConversionIteratorIsHidden(ci->parent, TYPE_FUNC(obj->type)) + IS_TYPE_FUNC(obj->type) && + (TYPE_FUNC(obj->type)->flags & FUNC_CONVERSION) && + !CExpr_ConversionIteratorIsHidden(ci->parent, TYPE_FUNC(obj->type)) ) { return obj; } @@ -1903,7 +1903,7 @@ short user_assign_check(ENode *expr, Type *type, UInt32 qual, Boolean flag1, Boo continue; if (!(arg = r14c->args->next)) continue; - if ((TYPE_CLASS(type)->flags & CLASS_FLAGS_20) && !(arg = arg->next)) + if ((TYPE_CLASS(type)->flags & CLASS_HAS_VBASES) && !(arg = arg->next)) continue; if (arg == &elipsis) continue; @@ -1955,9 +1955,9 @@ short user_assign_check(ENode *expr, Type *type, UInt32 qual, Boolean flag1, Boo if (flag1) { if (r24) { r13 = TYPE_METHOD(r26->type); - CError_ASSERT(2537, r13->flags & FUNC_FLAGS_METHOD); + CError_ASSERT(2537, r13->flags & FUNC_METHOD); r15b = create_objectrefnode(r26); - r26->flags |= OBJECT_FLAGS_1; + r26->flags |= OBJECT_USED; r14d = lalloc(sizeof(ENodeList)); r14d->next = NULL; expr = getnodeaddress(expr, 0); @@ -1980,7 +1980,7 @@ short user_assign_check(ENode *expr, Type *type, UInt32 qual, Boolean flag1, Boo r13b = lalloc(sizeof(ENodeList)); r13b->next = NULL; r13b->node = r25; - if (TYPE_CLASS(type)->flags & CLASS_FLAGS_20) { + if (TYPE_CLASS(type)->flags & CLASS_HAS_VBASES) { r13b->next = lalloc(sizeof(ENodeList)); r13b->next->node = r25; r13b->next->next = NULL; @@ -2275,7 +2275,7 @@ Boolean CExpr_MatchCompare(Object *obj, Match13 *a, Match13 *b) { static void MatchOverloadFunc(Object *obj, FuncArg *args, ENodeList *argexprs, Match13 *match) { Match13 match2; - if (IS_TYPE_FUNC(obj->type) && !(TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_100000)) { + if (IS_TYPE_FUNC(obj->type) && !(TYPE_FUNC(obj->type)->flags & FUNC_IS_TEMPL)) { memclrw(&match2, sizeof(Match13)); while (1) { if (!args || args->type == &stvoid) { @@ -2309,19 +2309,19 @@ static void MatchOverloadFunc(Object *obj, FuncArg *args, ENodeList *argexprs, M Boolean CExpr_GetFuncMatchArgs(Object *obj, ENodeList *argexprs, ENode *expr, FuncMatchArgs *result) { ENode *intexpr; - if (!(TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_METHOD)) { + if (!(TYPE_FUNC(obj->type)->flags & FUNC_METHOD)) { result->exprs = argexprs; result->args = TYPE_FUNC(obj->type)->args; return 1; } - if (TYPE_METHOD(obj->type)->x26) { + if (TYPE_METHOD(obj->type)->is_static) { result->exprs = argexprs; result->args = TYPE_FUNC(obj->type)->args; return 1; } - if (TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_1000) { + if (TYPE_FUNC(obj->type)->flags & FUNC_IS_CTOR) { result->exprs = argexprs; result->args = TYPE_FUNC(obj->type)->args->next; return 1; @@ -2397,7 +2397,7 @@ static void CExpr_MatchArgList(NameSpaceObjectList *list, TemplArg *templargs, E if (obj->otype != OT_OBJECT) continue; if (IS_TYPE_FUNC(obj->type) && (!flag || !(obj->qual & Q_EXPLICIT))) { - if (!(TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_100000)) { + if (!(TYPE_FUNC(obj->type)->flags & FUNC_IS_TEMPL)) { if (CExpr_GetFuncMatchArgs(obj, argexprs, expr, &fma)) MatchOverloadFunc(obj, fma.args, fma.exprs, match); } else { @@ -2457,7 +2457,7 @@ static ENode *CExpr_GenericCall(ENode *funcexpr, ENodeList *argexprs, TypeFunc * callexpr->data.funccall.funcref->rtype = CDecl_NewPointerType(TYPE(tfunc)); callexpr->data.funccall.args = argexprs; callexpr->data.funccall.functype = tfunc; - funcexpr->data.objref->flags |= OBJECT_FLAGS_1; + funcexpr->data.objref->flags |= OBJECT_USED; return CExpr_AdjustFunctionCall(callexpr); } @@ -2562,7 +2562,7 @@ ENode *CExpr_GenericFuncCall(BClassList *path, ENode *funcexpr, Boolean flag1, O return nullnode(); } - if (IS_TYPEFUNC_METHOD(tfunc) && !TYPE_METHOD(tfunc)->x26) { + if (IS_TYPEFUNC_METHOD(tfunc) && !TYPE_METHOD(tfunc)->is_static) { had_alias = 0; buildpath = NULL; access = obj->access; @@ -2592,9 +2592,9 @@ ENode *CExpr_GenericFuncCall(BClassList *path, ENode *funcexpr, Boolean flag1, O } if ( - (tfunc->flags & FUNC_FLAGS_8) && - cscope_currentfunc && - (TYPE_FUNC(cscope_currentfunc->type)->flags & (FUNC_FLAGS_1000 | FUNC_FLAGS_2000)) && + (tfunc->flags & FUNC_PURE) && + cscope_currentfunc && + (TYPE_FUNC(cscope_currentfunc->type)->flags & (FUNC_IS_CTOR | FUNC_IS_DTOR)) && cscope_currentclass == TYPE_METHOD(tfunc)->theclass && ENODE_IS(funcexpr, EINDIRECT) && ENODE_IS(funcexpr->data.monadic, EINDIRECT) && @@ -2611,7 +2611,7 @@ ENode *CExpr_GenericFuncCall(BClassList *path, ENode *funcexpr, Boolean flag1, O scan_expr->node->data.objref->flags |= OBJECT_FLAGS_2; if (((funcexpr->flags & Q_CONST) && !(tfunc->args->qual & Q_CONST)) || ((funcexpr->flags & Q_VOLATILE) && !(tfunc->args->qual & Q_VOLATILE))) { - if (!(tfunc->flags & (FUNC_FLAGS_1000 | FUNC_FLAGS_2000))) + if (!(tfunc->flags & (FUNC_IS_CTOR | FUNC_IS_DTOR))) CError_Error(CErrorStr236); } @@ -2624,7 +2624,7 @@ ENode *CExpr_GenericFuncCall(BClassList *path, ENode *funcexpr, Boolean flag1, O scan_arg = tfunc->args; scan_expr = nodes; - if (tfunc->flags & FUNC_FLAGS_METHOD) { + if (tfunc->flags & FUNC_METHOD) { CError_ASSERT(3599, TYPE_METHOD(tfunc)->theclass->sominfo == NULL); } } @@ -2735,7 +2735,7 @@ ENode *CExpr_MakeFunctionCall(ENode *funcexpr, ENodeList *arg_exprs) { if ( funcexpr->data.objlist.list->object->otype == OT_OBJECT && - (TYPE_FUNC(OBJECT(funcexpr->data.objlist.list->object)->type)->flags & FUNC_FLAGS_200) && + (TYPE_FUNC(OBJECT(funcexpr->data.objlist.list->object)->type)->flags & FUNC_INTRINSIC) && (expr = CodeGen_HandleIntrinsicCall(OBJECT(funcexpr->data.objlist.list->object), arg_exprs))) return expr; @@ -2763,7 +2763,7 @@ ENode *CExpr_MakeFunctionCall(ENode *funcexpr, ENodeList *arg_exprs) { save_isambig = 0; } - if (ENODE_IS(funcexpr, EOBJREF) && IS_TYPE_FUNC(funcexpr->data.objref->type) && (TYPE_FUNC(funcexpr->data.objref->type)->flags & FUNC_FLAGS_200)) { + if (ENODE_IS(funcexpr, EOBJREF) && IS_TYPE_FUNC(funcexpr->data.objref->type) && (TYPE_FUNC(funcexpr->data.objref->type)->flags & FUNC_INTRINSIC)) { if (!(expr = CodeGen_HandleIntrinsicCall(funcexpr->data.objref, arg_exprs))) { expr = CExpr_GenericFuncCall( save_path, save_expr, save_1D, funcexpr->data.objref, @@ -3204,8 +3204,8 @@ Boolean CExpr_CheckOperatorConversion(short token, ENode *left, ENode *right, EN Boolean CExpr_CheckOperator(short token, ENode *left, ENode *right, Conversion *conv) { Match13 match; - CScopeParseResult pr; - CScopeParseResult pr2; + NameResult pr; + NameResult pr2; ENode *expr; Object *obj; ENodeList *nodes; @@ -3389,7 +3389,7 @@ ENode *CExpr_ConstructObject(TypeClass *tclass, ENode *addr_expr, ENodeList *arg } if ((ctorlist = CClass_Constructor(tclass))) { - if (tclass->flags & CLASS_FLAGS_20) { + if (tclass->flags & CLASS_HAS_VBASES) { ENodeList *list = lalloc(sizeof(ENodeList)); list->next = args; args = list; @@ -3430,7 +3430,7 @@ static ENode *CExpr_DeleteFuncCall(Object *obj, ENode *arg, Type *type, Boolean expr->rtype = &stvoid; expr->data.funccall.funcref = create_objectrefnode(obj); expr->data.funccall.functype = TYPE_FUNC(obj->type); - obj->flags |= OBJECT_FLAGS_1; + obj->flags |= OBJECT_USED; list = lalloc(sizeof(ENodeList)); list->node = arg; @@ -3504,7 +3504,7 @@ static ENode *CExpr_PlacementDeleteCall(Type *type, ENode *expr, Object *obj, Bo result->rtype = &stvoid; result->data.funccall.funcref = create_objectrefnode(funcobj); result->data.funccall.functype = TYPE_FUNC(funcobj->type); - funcobj->flags |= OBJECT_FLAGS_1; + funcobj->flags |= OBJECT_USED; list = lalloc(sizeof(ENodeList)); list->node = create_objectnode(obj); @@ -3567,7 +3567,7 @@ static UInt32 cv_qualifier_list(void) { } static void scan_new_declarator(DeclInfo *di, Boolean flag) { - CScopeParseResult pr; + NameResult pr; SInt32 size; ENode *expr; @@ -3641,7 +3641,7 @@ static ENode *CExpr_NewAlloc(Type *type, ENodeList *args, Boolean flag1, Boolean Object *obj; Boolean found; HashNameNode *name; - CScopeParseResult pr; + NameResult pr; found = 0; if (!flag1 && IS_TYPE_CLASS(type)) { @@ -3653,7 +3653,7 @@ static ENode *CExpr_NewAlloc(Type *type, ENodeList *args, Boolean flag1, Boolean obj = OBJECT(pr.obj_10); CError_ASSERT(4935, list || obj); found = 1; - } else if (TYPE_CLASS(type)->flags & CLASS_FLAGS_1) { + } else if (TYPE_CLASS(type)->flags & CLASS_HANDLEOBJECT) { CError_ASSERT(4942, !flag2); obj = newh_func; found = 1; @@ -3784,7 +3784,7 @@ static ENode *CExpr_NewArray(Type *type, UInt32 qual, ENodeList *nodelist, Boole if (CClass_Constructor(TYPE_CLASS(innertype))) { ctor = CClass_DefaultConstructor(TYPE_CLASS(innertype)); if (ctor) { - ctor->flags |= OBJECT_FLAGS_1; + ctor->flags |= OBJECT_USED; } else { ctor = CClass_DummyDefaultConstructor(TYPE_CLASS(innertype)); if (!ctor) @@ -4151,7 +4151,7 @@ ENode *scandelete(Boolean flag) { if (TYPE_CLASS(innertype)->objcinfo) return CObjC_Delete(TYPE_CLASS(innertype), expr); - if (!(TYPE_CLASS(innertype)->flags & CLASS_FLAGS_2) && copts.pedantic) + if (!(TYPE_CLASS(innertype)->flags & CLASS_COMPLETED) && copts.pedantic) CError_Warning(CErrorStr136, innertype, 0); obj = CParser_FindDeallocationObject(innertype, NULL, 0, flag, &outflag); @@ -4187,7 +4187,7 @@ ENode *scandelete(Boolean flag) { result_expr = CABI_DestroyObject(dtor, expr, 2, 0, 0); result_expr->rtype = TYPE(&void_ptr); result_expr = funccallexpr(obj, result_expr, NULL, NULL, NULL); - obj->flags |= OBJECT_FLAGS_1; + obj->flags |= OBJECT_USED; } if (is_virtual) { diff --git a/compiler_and_linker/unsorted/CExprConvMatch.c b/compiler_and_linker/unsorted/CExprConvMatch.c index c01f54b..5cc145f 100644 --- a/compiler_and_linker/unsorted/CExprConvMatch.c +++ b/compiler_and_linker/unsorted/CExprConvMatch.c @@ -81,8 +81,8 @@ static Type *CExpr_GetImplictObjectParamType(Object *object, UInt32 *qual) { Type *type; CError_ASSERT(98, IS_TYPE_FUNC(object->type)); - CError_ASSERT(99, TYPE_FUNC(object->type)->flags & FUNC_FLAGS_METHOD); - CError_ASSERT(100, !TYPE_METHOD(object->type)->x26); + CError_ASSERT(99, TYPE_FUNC(object->type)->flags & FUNC_METHOD); + CError_ASSERT(100, !TYPE_METHOD(object->type)->is_static); CError_ASSERT(101, TYPE_METHOD(object->type)->args); type = CDecl_NewRefPointerType(TYPE(TYPE_METHOD(object->type)->theclass)); @@ -567,7 +567,7 @@ static Boolean CExpr_OverloadFuncMatch(NameSpaceObjectList *list, TemplArg *temp *outExpr = expr; expr->rtype = CDecl_NewPointerType(object26->type); expr->flags = object->qual & ENODE_FLAG_QUALS; - object26->flags |= OBJECT_FLAGS_1; + object26->flags |= OBJECT_USED; if (object26->datatype == DINLINEFUNC) CError_Error(CErrorStr175); } @@ -613,7 +613,7 @@ static Boolean CExpr_StandardConversionMatch(ENode *expr, Type *type2, UInt32 qu if ( IS_TYPE_INT(expr->rtype) && ENODE_IS_INDIRECT_TO(expr, EOBJREF) && - (expr->data.monadic->data.objref->qual & Q_10000) && + (expr->data.monadic->data.objref->qual & Q_INLINE_DATA) && CInt64_IsZero(&expr->data.monadic->data.objref->u.data.u.intconst) ) return CExpr_SetupStandardConversionResult(expr, type2, qual2, SSCR_2, x14, refFlag, result); @@ -912,7 +912,7 @@ static ENode *CExpr_UserConversion(ENode *expr, Type *type2, UInt32 qual2, Impli flag22 = 1; while ((object26 = CExpr_ConversionIteratorNext(&convIter))) { tfunc23 = TYPE_FUNC(object26->type); - if (tfunc23->flags & FUNC_FLAGS_100000) { + if (tfunc23->flags & FUNC_IS_TEMPL) { object26 = CTempl_DeduceFromConversion(object26, type2, qual2); if (!object26) continue; @@ -996,7 +996,7 @@ static ENode *CExpr_UserConversion(ENode *expr, Type *type2, UInt32 qual2, Impli (isExplicit || !(object26->qual & Q_EXPLICIT)) ) { - if (tfunc23->flags & FUNC_FLAGS_100000) { + if (tfunc23->flags & FUNC_IS_TEMPL) { myarglist.next = NULL; myarglist.node = expr; object26 = CTempl_DeduceFromFunctionCall(object26, NULL, &myarglist); @@ -1009,7 +1009,7 @@ static ENode *CExpr_UserConversion(ENode *expr, Type *type2, UInt32 qual2, Impli continue; if (!(arg21 = arg21->next)) continue; - if ((TYPE_CLASS(type2)->flags & CLASS_FLAGS_20) && !(arg21 = arg21->next)) + if ((TYPE_CLASS(type2)->flags & CLASS_HAS_VBASES) && !(arg21 = arg21->next)) continue; if (arg21 == &elipsis) continue; @@ -1086,7 +1086,7 @@ static ENode *CExpr_UserConversion(ENode *expr, Type *type2, UInt32 qual2, Impli CError_ASSERT(1416, IS_TYPEFUNC_METHOD(tfunc23)); funcref = create_objectrefnode(object28); - object28->flags |= OBJECT_FLAGS_1; + object28->flags |= OBJECT_USED; arglist = lalloc(sizeof(ENodeList)); arglist->next = NULL; @@ -1135,7 +1135,7 @@ static ENode *CExpr_UserConversion(ENode *expr, Type *type2, UInt32 qual2, Impli arglist->next = NULL; arglist->node = expr; - if (TYPE_CLASS(type2)->flags & CLASS_FLAGS_20) { + if (TYPE_CLASS(type2)->flags & CLASS_HAS_VBASES) { arglist->next = lalloc(sizeof(ENodeList)); arglist->next->node = expr; arglist->next->next = NULL; @@ -1616,11 +1616,11 @@ static Boolean CExpr_MatchArgs(Object *func, ENodeList *argexprs, ENode *expr, I args = TYPE_FUNC(func->type)->args; - if (!(TYPE_FUNC(func->type)->flags & FUNC_FLAGS_METHOD)) { + if (!(TYPE_FUNC(func->type)->flags & FUNC_METHOD)) { convs->type = ICT_0; - } else if (TYPE_METHOD(func->type)->x26) { + } else if (TYPE_METHOD(func->type)->is_static) { convs->type = ICT_0; - } else if (TYPE_FUNC(func->type)->flags & FUNC_FLAGS_1000) { + } else if (TYPE_FUNC(func->type)->flags & FUNC_IS_CTOR) { convs->type = ICT_0; args = args->next; } else { @@ -1770,7 +1770,7 @@ void CExpr_FuncArgMatch(NameSpaceObjectList *list, TemplArg *templargs, ENodeLis (!flag || !(object->qual & Q_EXPLICIT)) ) { - if (object->datatype == DALIAS && (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_METHOD)) { + if (object->datatype == DALIAS && (TYPE_FUNC(object->type)->flags & FUNC_METHOD)) { for (j = list; j; j = j->next) { if (j == i) continue; @@ -1785,10 +1785,10 @@ void CExpr_FuncArgMatch(NameSpaceObjectList *list, TemplArg *templargs, ENodeLis FuncArg *argsA; FuncArg *argsB; argsA = TYPE_FUNC(object->type)->args; - if (argsA && !TYPE_METHOD(object->type)->x26) + if (argsA && !TYPE_METHOD(object->type)->is_static) argsA = argsA->next; argsB = TYPE_FUNC(object2->type)->args; - if (argsB && !TYPE_METHOD(object2->type)->x26) + if (argsB && !TYPE_METHOD(object2->type)->is_static) argsB = argsB->next; if (is_arglistsame(argsA, argsB)) break; @@ -1799,7 +1799,7 @@ void CExpr_FuncArgMatch(NameSpaceObjectList *list, TemplArg *templargs, ENodeLis continue; } - if (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100000) { + if (TYPE_FUNC(object->type)->flags & FUNC_IS_TEMPL) { specialfunc = object; object = CTempl_DeduceFromFunctionCall(object, templargs, argexprs); if (!object) @@ -2235,7 +2235,7 @@ Boolean CExpr_OperatorMatch(short token, ENode *left, ENode *right, Conversion * UInt32 leftQual; Type *rightType; UInt32 rightQual; - CScopeParseResult pr; + NameResult pr; NameSpaceObjectList myList; Match myMatch; @@ -2278,7 +2278,7 @@ Boolean CExpr_OperatorMatch(short token, ENode *left, ENode *right, Conversion * for (list = pr.nsol_14; list; list = list->next) { object = OBJECT(list->object); if (object->otype == OT_OBJECT && IS_TYPE_FUNC(object->type)) { - if (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100000) { + if (TYPE_FUNC(object->type)->flags & FUNC_IS_TEMPL) { specialfunc = object; object = CTempl_DeduceFromFunctionCall(object, NULL, argExprs->next); if (!object) @@ -2326,7 +2326,7 @@ Boolean CExpr_OperatorMatch(short token, ENode *left, ENode *right, Conversion * for (list = pr.nsol_14; list; list = list->next) { object = OBJECT(list->object); if (object->otype == OT_OBJECT && IS_TYPE_NONMETHOD(object->type)) { - if (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100000) { + if (TYPE_FUNC(object->type)->flags & FUNC_IS_TEMPL) { specialfunc = object; object = CTempl_DeduceFromFunctionCall(object, NULL, argExprs); if (!object) @@ -2422,7 +2422,7 @@ static ENode *CExpr_ClassCopyInit(TypeClass *tclass, ENode *expr1, ENode *expr2) CError_ASSERT(3199, arg); arg = arg->next; - if (tclass->flags & CLASS_FLAGS_20) { + if (tclass->flags & CLASS_HAS_VBASES) { CError_ASSERT(3203, arg); arg = arg->next; } @@ -2497,7 +2497,7 @@ static ENode *CExpr_ClassCopyInit(TypeClass *tclass, ENode *expr1, ENode *expr2) argExprs = lalloc(sizeof(ENodeList)); argExprs->node = expr2; - if (tclass->flags & CLASS_FLAGS_20) { + if (tclass->flags & CLASS_HAS_VBASES) { argExprs->next = lalloc(sizeof(ENodeList)); argExprs->next->next = NULL; argExprs->next->node = intconstnode(TYPE(&stsignedshort), 1); diff --git a/compiler_and_linker/unsorted/CFunc.c b/compiler_and_linker/unsorted/CFunc.c index 2ea883b..38cfab3 100644 --- a/compiler_and_linker/unsorted/CFunc.c +++ b/compiler_and_linker/unsorted/CFunc.c @@ -601,9 +601,9 @@ void CFunc_WarnUnused(void) { ObjectList *list; for (list = locals; list; list = list->next) { if ( - !(list->object->flags & OBJECT_FLAGS_1) && + !(list->object->flags & OBJECT_USED) && !IsTempName(list->object->name) && - !(list->object->qual & Q_10000) + !(list->object->qual & Q_INLINE_DATA) ) { CError_SetErrorToken(&list->object->u.var.info->deftoken); @@ -616,7 +616,7 @@ void CFunc_WarnUnused(void) { ObjectList *list; for (list = arguments; list; list = list->next) { if ( - !(list->object->flags & OBJECT_FLAGS_1) && + !(list->object->flags & OBJECT_USED) && !IsTempName(list->object->name) && list->object->name != this_name_node && list->object->name != self_name_node @@ -1064,7 +1064,7 @@ static void CFunc_LocalDataDeclarator(DeclInfo *di, TStreamElement *deftoken, Bo if (object) { if ( !is_typesame(di->thetype, object->type) || - (di->qual & (Q_CONST | Q_VOLATILE | Q_PASCAL | Q_20000 | Q_OVERLOAD | Q_ALIGNED_MASK)) != (object->qual & (Q_CONST | Q_VOLATILE | Q_PASCAL | Q_20000 | Q_OVERLOAD | Q_ALIGNED_MASK)) + (di->qual & (Q_CONST | Q_VOLATILE | Q_PASCAL | Q_20000 | Q_WEAK | Q_ALIGNED_MASK)) != (object->qual & (Q_CONST | Q_VOLATILE | Q_PASCAL | Q_20000 | Q_WEAK | Q_ALIGNED_MASK)) ) { CError_Error(CErrorStr249, di->name->name, object->type, object->qual, di->thetype, di->qual); @@ -1098,7 +1098,7 @@ static void CFunc_LocalDataDeclarator(DeclInfo *di, TStreamElement *deftoken, Bo CError_Error(CErrorStr174); if (CanCreateObject(di->thetype)) { - CError_QualifierCheck(di->qual & ~(Q_CONST | Q_VOLATILE | Q_PASCAL | Q_20000 | Q_OVERLOAD | Q_ALIGNED_MASK)); + CError_QualifierCheck(di->qual & ~(Q_CONST | Q_VOLATILE | Q_PASCAL | Q_20000 | Q_WEAK | Q_ALIGNED_MASK)); CParser_NewAliasObject(object, 0); object->nspace = cscope_root; object->datatype = DDATA; @@ -1184,7 +1184,7 @@ static ENode *CFunc_ParseLocalDeclarationList(Boolean flag1, Boolean flag2, Bool CPrep_GetFileOffsetInfo2(&cparser_fileoffset, &sourceoffset, &sourcefilepath); memclrw(&di, sizeof(di)); - di.x4E = cfunc_is_extern_c; + di.is_extern_c = cfunc_is_extern_c; CParser_GetDeclSpecs(&di, 0); if (IS_TYPE_TEMPLATE(di.thetype)) { @@ -2319,7 +2319,7 @@ void CFunc_SetupNewFuncArgs(Object *func, FuncArg *args) { TPTR_QUAL(obj->type) = Q_REFERENCE | Q_RESTRICT; } - if (obj->name == no_name_node && copts.ANSIstrict && !copts.cplusplus && !(func->qual & Q_80000)) + if (obj->name == no_name_node && copts.ANSIstrict && !copts.cplusplus && !(func->qual & Q_MANGLE_NAME)) CError_Error(CErrorStr127); if (newlist) { @@ -2659,7 +2659,7 @@ static void CFunc_CheckCtorInitializer(TypeClass *tclass, CtorChain *chain) { ObjMemberVar *ivar; CtorChain *scan; - if (tclass->mode != CLASS_MODE_1) { + if (tclass->mode != CLASS_MODE_UNION) { for (ivar = tclass->ivars; ivar; ivar = ivar->next) { if (IS_TYPE_REFERENCE(ivar->type)) { for (scan = chain; scan; scan = scan->next) { @@ -2862,13 +2862,13 @@ static void CFunc_ParseCtorInitializer(void) { } static void CFunc_FunctionRedefinedCheck(Object *func) { - if (TYPE_FUNC(func->type)->flags & FUNC_FLAGS_100) + if (TYPE_FUNC(func->type)->flags & FUNC_AUTO_GENERATED) CError_Error(CErrorStr333, func); - if ((TYPE_FUNC(func->type)->flags & FUNC_FLAGS_2) && func->datatype != DINLINEFUNC) + if ((TYPE_FUNC(func->type)->flags & FUNC_DEFINED) && func->datatype != DINLINEFUNC) CError_Error(CErrorStr333, func); - TYPE_FUNC(func->type)->flags |= FUNC_FLAGS_2; + TYPE_FUNC(func->type)->flags |= FUNC_DEFINED; } static Object *CFunc_DeclareFuncName(char *str, HashNameNode *name) { @@ -2927,7 +2927,7 @@ void CFunc_ParseFuncDef(Object *func, DeclInfo *di, TypeClass *tclass, Boolean i if (cscope_currentclass) CClass_MemberDef(func, cscope_currentclass); - cfunc_is_extern_c = di->x4E; + cfunc_is_extern_c = di->is_extern_c; CError_ASSERT(3392, IS_TYPE_FUNC(func->type)); if (di->x45 && (func->qual & Q_ASM)) @@ -3035,11 +3035,11 @@ void CFunc_ParseFuncDef(Object *func, DeclInfo *di, TypeClass *tclass, Boolean i CheckCLabels(); - if (nameobj_func && (nameobj_func->flags & OBJECT_FLAGS_1)) + if (nameobj_func && (nameobj_func->flags & OBJECT_USED)) CInit_DeclareData(nameobj_func->u.alias.object, func->name->name, NULL, strlen(func->name->name) + 1); - if (nameobj_FUNCTION && (nameobj_FUNCTION->flags & OBJECT_FLAGS_1)) + if (nameobj_FUNCTION && (nameobj_FUNCTION->flags & OBJECT_USED)) CInit_DeclareData(nameobj_FUNCTION->u.alias.object, func->name->name, NULL, strlen(func->name->name) + 1); - if (nameobj_pretty && (nameobj_pretty->flags & OBJECT_FLAGS_1)) + if (nameobj_pretty && (nameobj_pretty->flags & OBJECT_USED)) CInit_DeclareData(nameobj_pretty->u.alias.object, prettyname, NULL, strlen(prettyname) + 1); if (!fatalerrors) { @@ -3079,7 +3079,7 @@ void InitExpr_Register(ENode *expr, Object *object) { if ( cparamblkptr->precompile == 1 && object->sclass != TK_STATIC && - !(object->qual & (Q_20000 | Q_OVERLOAD)) + !(object->qual & (Q_20000 | Q_WEAK)) ) { CError_Error(CErrorStr180); @@ -3184,7 +3184,7 @@ void CFunc_GenerateDummyCtorFunc(Object *func, Object *real_ctor) { expr->data.funccall.functype = TYPE_FUNC(func->type); CError_ASSERT(3716, IS_TYPE_FUNC(real_ctor->type)); - CError_ASSERT(3717, TYPE_FUNC(real_ctor->type)->flags & FUNC_FLAGS_METHOD); + CError_ASSERT(3717, TYPE_FUNC(real_ctor->type)->flags & FUNC_METHOD); CError_ASSERT(3718, arg0 = TYPE_FUNC(real_ctor->type)->args); CError_ASSERT(3720, arg1 = arg0->next); CError_ASSERT(3721, arguments); @@ -3193,7 +3193,7 @@ void CFunc_GenerateDummyCtorFunc(Object *func, Object *real_ctor) { expr->data.funccall.args = list; list->node = create_objectnode(arguments->object); - if (TYPE_METHOD(real_ctor->type)->theclass->flags & CLASS_FLAGS_20) { + if (TYPE_METHOD(real_ctor->type)->theclass->flags & CLASS_HAS_VBASES) { CError_ASSERT(3727, arg1 = arg1->next); CError_ASSERT(3728, arguments->next); list->next = lalloc(sizeof(ENodeList)); diff --git a/compiler_and_linker/unsorted/CIRTransform.c b/compiler_and_linker/unsorted/CIRTransform.c index 852d3f4..b91f6af 100644 --- a/compiler_and_linker/unsorted/CIRTransform.c +++ b/compiler_and_linker/unsorted/CIRTransform.c @@ -71,7 +71,7 @@ static Object *CIRTrans_GetRuntimeFunction(StrangeRuntimeFunction *rtfunc, Type object->nspace = cscope_root; object->name = GetHashNameNodeExport(rtfunc->name); - object->flags = OBJECT_FLAGS_10; + object->flags = OBJECT_INTERNAL; if (type) { switch (type->size) { diff --git a/compiler_and_linker/unsorted/CInit.c b/compiler_and_linker/unsorted/CInit.c index 5493e15..c2d2299 100644 --- a/compiler_and_linker/unsorted/CInit.c +++ b/compiler_and_linker/unsorted/CInit.c @@ -427,7 +427,7 @@ static Object *CInit_CreateStaticDataObject(Type *type, UInt32 qual, HashNameNod di.name = name ? name : CParser_GetUniqueName(); di.qual = qual; di.storageclass = TK_STATIC; - di.x4E = 1; + di.is_extern_c = 1; obj = CParser_NewGlobalDataObject(&di); obj->nspace = cscope_root; @@ -637,13 +637,13 @@ static void CInit_SetBitfield(TypeBitfield *tbitfield, UInt8 *buffer, CInt64 val int step; if (copts.littleendian) { - pos = tbitfield->unkA; + pos = tbitfield->offset; step = 1; } else { - pos = tbitfield->unkB + tbitfield->unkA - 1; + pos = tbitfield->bitlength + tbitfield->offset - 1; step = -1; } - for (i = 0; i < tbitfield->unkB; i++, pos += step) { + for (i = 0; i < tbitfield->bitlength; i++, pos += step) { if (CInt64_GetULong(&val) & 1) { if (copts.littleendian) { buffer[pos >> 3] |= 1 << (pos & 7); @@ -868,7 +868,7 @@ static void CInit_InitTypeStruct(CInit_Stuff *s, CInit_Stuff2 *s2, const TypeStr do { member = member->next; - } while (member && (member->qual & Q_OVERLOAD)); + } while (member && (member->qual & Q_WEAK)); if (!member || tstruct->stype == STRUCT_TYPE_UNION) { if (flag) { @@ -967,7 +967,7 @@ static ObjMemberVar *CInit_FindNextMember(ObjMemberVar *ivar) { return scan; if (scan->offset > ivar->offset) return scan; - if (IS_TYPE_BITFIELD(scan->type) && IS_TYPE_BITFIELD(ivar->type) && TYPE_BITFIELD(scan->type)->unkA != TYPE_BITFIELD(ivar->type)->unkA) + if (IS_TYPE_BITFIELD(scan->type) && IS_TYPE_BITFIELD(ivar->type) && TYPE_BITFIELD(scan->type)->offset != TYPE_BITFIELD(ivar->type)->offset) return scan; } } @@ -1042,7 +1042,7 @@ static void CInit_InitTypeClass(CInit_Stuff *s, CInit_Stuff2 *s2, TypeClass *tcl } last_offset = ivar->offset; - if (!(ivar = CInit_FindNextMember(ivar)) || (tclass->mode == CLASS_MODE_1 && ivar->offset == last_offset)) { + if (!(ivar = CInit_FindNextMember(ivar)) || (tclass->mode == CLASS_MODE_UNION && ivar->offset == last_offset)) { if (flag) { switch (CInit_ParseNextInit(s2)) { case Stage3: @@ -1739,7 +1739,7 @@ static void CInit_Struct(TypeStruct *tstruct, Boolean flag) { do { member = member->next; - } while (member && (member->qual & Q_OVERLOAD)); + } while (member && (member->qual & Q_WEAK)); if (!member) { if (!in_block) @@ -2066,7 +2066,7 @@ static ENode *CInit_GenericData(Object *obj, Type *type, UInt32 qual, ExprCB exp break; r31->u.data.u.intconst = tmpexpr->data.intval; common_8068C: - r31->qual |= Q_10000; + r31->qual |= Q_INLINE_DATA; if (!obj) { r31->sclass = TK_STATIC; r31->datatype = DDATA; @@ -2117,7 +2117,7 @@ static ENode *CInit_GenericData(Object *obj, Type *type, UInt32 qual, ExprCB exp void CInit_ExportConst(Object *obj) { char buffer[64]; - if (obj->flags & OBJECT_FLAGS_4) + if (obj->flags & OBJECT_DEFINED) return; switch (obj->type->type) { @@ -2766,9 +2766,9 @@ void CInit_InitializeData(Object *obj) { } } } else { - if (obj->flags & OBJECT_FLAGS_4) + if (obj->flags & OBJECT_DEFINED) CError_Error(CErrorStr329, obj); - obj->flags = obj->flags | OBJECT_FLAGS_4; + obj->flags = obj->flags | OBJECT_DEFINED; needs_construction = 0; if (IS_TYPE_ARRAY(obj->type)) { @@ -2809,7 +2809,7 @@ void CInit_InitializeData(Object *obj) { return; } - if (obj->flags & OBJECT_FLAGS_4) + if (obj->flags & OBJECT_DEFINED) CError_Error(CErrorStr329, obj); if (CInit_IsSimpleStructArrayInit(obj->type)) { @@ -3047,7 +3047,7 @@ static void declaredata(Object *obj, void *data, OLinkList *list, SInt32 size, B if (cparamblkptr->precompile == 1) { PreComp_StaticData(obj, data, list, size); } else { - obj->flags = obj->flags | OBJECT_FLAGS_4; + obj->flags = obj->flags | OBJECT_DEFINED; if (!fatalerrors) { for (scan = list; scan; scan = scan->next) CInline_ObjectAddrRef(scan->obj); @@ -3074,7 +3074,7 @@ void CInit_DefineTentativeData(void) { ObjectList *list; for (list = cinit_tentative; list; list = list->next) { - if (!(list->object->flags & OBJECT_FLAGS_4)) + if (!(list->object->flags & OBJECT_DEFINED)) CInit_DeclareData(list->object, NULL, NULL, list->object->type->size); } diff --git a/compiler_and_linker/unsorted/CInline.c b/compiler_and_linker/unsorted/CInline.c index 1afbde8..de51ab7 100644 --- a/compiler_and_linker/unsorted/CInline.c +++ b/compiler_and_linker/unsorted/CInline.c @@ -3468,7 +3468,7 @@ void CInline_AddInlineFunctionAction(Object *object, TypeClass *tclass, FileOffs CError_ASSERT(4132, IS_TYPE_FUNC(object->type)); - TYPE_FUNC(object->type)->flags |= FUNC_FLAGS_800000; + TYPE_FUNC(object->type)->flags |= FUNC_IS_TEMPL_INSTANCE; action = galloc(sizeof(CI_Action)); memclrw(action, sizeof(CI_Action)); @@ -3539,7 +3539,7 @@ static void CInline_AddFRefList_Object(Object *object) { if ( !(object->datatype == DFUNC || object->datatype == DVFUNC) || - (object->flags & OBJECT_FLAGS_4) || + (object->flags & OBJECT_DEFINED) || IS_TEMPL_FUNC(object->type) ) return; @@ -3764,8 +3764,8 @@ void CInline_ObjectAddrRef(Object *object) { if ( (object->qual & Q_INLINE) && (funcdata = object->u.func.u.ifuncdata) && - !(object->flags & OBJECT_FLAGS_4) && - !(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100000) + !(object->flags & OBJECT_DEFINED) && + !(TYPE_FUNC(object->type)->flags & FUNC_IS_TEMPL) ) { CI_Export *export = galloc(sizeof(CI_Export)); @@ -3777,12 +3777,12 @@ void CInline_ObjectAddrRef(Object *object) { export->next = cinline_exportlist; cinline_exportlist = export; - object->flags |= OBJECT_FLAGS_4; + object->flags |= OBJECT_DEFINED; return; } else if ( - (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100) && - !(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_2) + (TYPE_FUNC(object->type)->flags & FUNC_AUTO_GENERATED) && + !(TYPE_FUNC(object->type)->flags & FUNC_DEFINED) ) { CInline_AddDefaultFunctionAction(object); @@ -3800,11 +3800,11 @@ void CInline_ObjectAddrRef(Object *object) { return; case DDATA: - if (object->qual & Q_10000) + if (object->qual & Q_INLINE_DATA) CInit_ExportConst(object); - if (object->flags & OBJECT_FLAGS_8) { - object->flags &= ~OBJECT_FLAGS_8; + if (object->flags & OBJECT_LAZY) { + object->flags &= ~OBJECT_LAZY; CParser_CallBackAction(object); } return; @@ -3821,15 +3821,15 @@ static Boolean CInline_CheckDependencies(ObjectList *list) { object = list->object; if ( - (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100) && - !(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_2) + (TYPE_FUNC(object->type)->flags & FUNC_AUTO_GENERATED) && + !(TYPE_FUNC(object->type)->flags & FUNC_DEFINED) ) { CInline_AddDefaultFunctionAction(object); result = 1; } else if ( - (object->qual & Q_400000) && + (object->qual & Q_IS_TEMPLATED) && CTempl_InlineFunctionCheck(object) ) { @@ -3934,7 +3934,7 @@ void CInline_GenFunc(Statement *stmt, Object *object, UInt8 unk) { } } - object->flags |= OBJECT_FLAGS_4; + object->flags |= OBJECT_DEFINED; cinline_freflist = NULL; CInline_AddFRefList_Statement(stmt); @@ -3972,8 +3972,8 @@ void CInline_GenFunc(Statement *stmt, Object *object, UInt8 unk) { static void CInline_GenerateDefaultFunc(Object *object) { TypeClass *tclass; - CError_ASSERT(4770, TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100); - CError_ASSERT(4771, TYPE_FUNC(object->type)->flags & FUNC_FLAGS_METHOD); + CError_ASSERT(4770, TYPE_FUNC(object->type)->flags & FUNC_AUTO_GENERATED); + CError_ASSERT(4771, TYPE_FUNC(object->type)->flags & FUNC_METHOD); tclass = TYPE_METHOD(object->type)->theclass; @@ -3997,7 +3997,7 @@ static TemplClassInst *CInline_FindNestedTemplInst(TypeClass *tclass) { NameSpace *nspace; while (tclass) { - if ((tclass->flags & CLASS_FLAGS_800)) + if ((tclass->flags & CLASS_IS_TEMPL_INST)) return TEMPL_CLASS_INST(tclass); if (!copts.template_patch) @@ -4040,7 +4040,7 @@ static void CInline_GenerateInlineFunc(CI_Action *action) { symdecltoken = *CPrep_CurStreamElement(); - TYPE_FUNC(object->type)->flags &= ~FUNC_FLAGS_2; + TYPE_FUNC(object->type)->flags &= ~FUNC_DEFINED; if (IS_TYPE_METHOD(object->type) && (inst = CInline_FindNestedTemplInst(TYPE_METHOD(object->type)->theclass))) { CTempl_ParseInstanceScopeFunction(object, inst, NULL); } else { @@ -4086,17 +4086,17 @@ Boolean CInline_GenerateDeferredFuncs(void) { CInline_GenerateDefaultFunc(action->obj); break; case CI_ActionInlineFunc: - if (!(action->obj->flags & OBJECT_FLAGS_4)) + if (!(action->obj->flags & OBJECT_DEFINED)) CInline_GenerateInlineFunc(action); break; case CI_ActionMemberFunc: - if (!(TYPE_FUNC(action->obj->type)->flags & FUNC_FLAGS_2)) + if (!(TYPE_FUNC(action->obj->type)->flags & FUNC_DEFINED)) CTempl_InstantiateMember( action->u.memberfunc.templ, action->u.memberfunc.inst, action->u.memberfunc.tmemb, action->obj, 0); break; case CI_ActionTemplateFunc: - if (!(TYPE_FUNC(action->obj->type)->flags & FUNC_FLAGS_2) && !action->u.templatefunc.inst->is_specialized) + if (!(TYPE_FUNC(action->obj->type)->flags & FUNC_DEFINED) && !action->u.templatefunc.inst->is_specialized) CTempl_GenFuncInstance(action->u.templatefunc.func, action->u.templatefunc.inst, 0); break; default: @@ -4128,7 +4128,7 @@ static InitExpr *CInline_InitTemplateData(InitExpr *init) { data = CParser_NewCompilerDefDataObject(); data->type = TYPE(&stsignedchar); data->name = CParser_NameConcat("__init__", CMangler_GetLinkName(object)->name); - data->qual = Q_OVERLOAD; + data->qual = Q_WEAK; CInit_DeclareData(data, NULL, NULL, data->type->size); stmt = CFunc_AppendStatement(ST_IFGOTO); @@ -4180,7 +4180,7 @@ void CInline_Finish(void) { init = init_expressions; while (init) { - if (init->object->nspace->theclass && (init->object->nspace->theclass->flags & CLASS_FLAGS_800)) { + if (init->object->nspace->theclass && (init->object->nspace->theclass->flags & CLASS_IS_TEMPL_INST)) { init = CInline_InitTemplateData(init); } else { stmt = CFunc_AppendStatement(ST_EXPRESSION); diff --git a/compiler_and_linker/unsorted/CMachine.c b/compiler_and_linker/unsorted/CMachine.c index eff2243..bfa7023 100644 --- a/compiler_and_linker/unsorted/CMachine.c +++ b/compiler_and_linker/unsorted/CMachine.c @@ -1268,26 +1268,26 @@ SInt32 CMach_StructLayoutBitfield(TypeBitfield *tbitfield, UInt32 qual) { if (!cmach_curbfsize) { cmach_structoffset += padding_at_start; - if (!tbitfield->unkB) + if (!tbitfield->bitlength) return cmach_structoffset; - cmach_curbfsize = tbitfield->unkB; + cmach_curbfsize = tbitfield->bitlength; cmach_curbfbasesize = basesize; cmach_curbfoffset = cmach_structoffset; cmach_structoffset += basesize; - tbitfield->unkA = 0; + tbitfield->offset = 0; return cmach_curbfoffset; } else { - if (!tbitfield->unkB || (cmach_curbfsize + tbitfield->unkB) > basesize_bits || cmach_curbfbasesize != basesize) { + if (!tbitfield->bitlength || (cmach_curbfsize + tbitfield->bitlength) > basesize_bits || cmach_curbfbasesize != basesize) { cmach_structoffset += padding_at_start; cmach_curbfsize = 0; cmach_curbfbasesize = basesize; - if (!tbitfield->unkB) + if (!tbitfield->bitlength) return cmach_structoffset; cmach_curbfoffset = cmach_structoffset; cmach_structoffset += basesize; } - tbitfield->unkA = cmach_curbfsize; - cmach_curbfsize += tbitfield->unkB; + tbitfield->offset = cmach_curbfsize; + cmach_curbfsize += tbitfield->bitlength; return cmach_curbfoffset; } } diff --git a/compiler_and_linker/unsorted/CMangler.c b/compiler_and_linker/unsorted/CMangler.c index 496f600..615abf5 100644 --- a/compiler_and_linker/unsorted/CMangler.c +++ b/compiler_and_linker/unsorted/CMangler.c @@ -539,7 +539,7 @@ static void CMangler_MangleFunction(Object *obj, NameSpace *nspace) { AppendGListName(&name_mangle_list, obj->name->name); if (obj->u.func.inst) { - if (tfunc->flags & FUNC_FLAGS_40) + if (tfunc->flags & FUNC_CONVERSION) CMangler_MangleTypeAppend(tfunc->functype, tfunc->qual); CMangler_AppendTemplateArgumentList(obj->u.func.inst->args); } @@ -557,10 +557,10 @@ static void CMangler_MangleFunction(Object *obj, NameSpace *nspace) { if (arg) { if (obj->name == constructor_name_node) { arg = arg->next; - if (arg && (nspace->theclass->flags & CLASS_FLAGS_20)) + if (arg && (nspace->theclass->flags & CLASS_HAS_VBASES)) arg = arg->next; } else { - if ((tfunc->flags & FUNC_FLAGS_METHOD) && !TYPE_METHOD(tfunc)->x26) { + if ((tfunc->flags & FUNC_METHOD) && !TYPE_METHOD(tfunc)->is_static) { CMangler_MangleQualifier(arg->qual); arg = arg->next; } @@ -625,7 +625,7 @@ static HashNameNode *CMangler_FunctionLinkName(Object *obj) { if (is_pascal_object(obj) && (!nspace || !nspace->theclass)) { AppendGListData(&name_mangle_list, "_", 1); AppendGListID(&name_mangle_list, obj->name->name); - } else if ((obj->qual & Q_80000) && (strcmp("main", obj->name->name) || (obj->nspace != cscope_root))) { + } else if ((obj->qual & Q_MANGLE_NAME) && (strcmp("main", obj->name->name) || (obj->nspace != cscope_root))) { AppendGListData(&name_mangle_list, "_", 1); CMangler_MangleFunction(obj, nspace); AppendGListByte(&name_mangle_list, 0); @@ -670,7 +670,7 @@ static HashNameNode *CMangler_DataLinkName(Object *obj) { while (nspace && nspace->name == NULL) nspace = nspace->parent; - if (nspace && (obj->qual & Q_80000)) { + if (nspace && (obj->qual & Q_MANGLE_NAME)) { AppendGListName(&name_mangle_list, "__"); CMangler_MangleNameSpaceName(nspace->parent, nspace->name->name); } diff --git a/compiler_and_linker/unsorted/CObjC.c b/compiler_and_linker/unsorted/CObjC.c index 4af8b09..b7d885f 100644 --- a/compiler_and_linker/unsorted/CObjC.c +++ b/compiler_and_linker/unsorted/CObjC.c @@ -673,8 +673,8 @@ static TypeClass *CObjC_NewObjCClass(HashNameNode *name) { info = galloc(sizeof(ObjCInfo)); memclrw(info, sizeof(ObjCInfo)); - tclass = CDecl_DefineClass(cscope_root, name, NULL, CLASS_MODE_2, 1, 1); - tclass->flags |= CLASS_FLAGS_10; + tclass = CDecl_DefineClass(cscope_root, name, NULL, CLASS_MODE_CLASS, 1, 1); + tclass->flags |= CLASS_SINGLE_OBJECT; tclass->objcinfo = info; info->classobject = CObjC_MakeObject("L_OBJC_CLASS_", name->name, 40); @@ -1017,7 +1017,7 @@ static TypeFunc *CObjC_GetMethodFuncType(ObjCMethod *meth) { functype->type = TYPEFUNC; functype->functype = meth->return_type; functype->qual = meth->return_qual; - functype->flags = FUNC_FLAGS_4000; + functype->flags = FUNC_OBJC_METHOD; CDecl_SetFuncFlags(functype, 1); CObjC_AppendArgument(functype, CObjC_GetSelfName(), CObjC_GetObjCType_id(1), 0); @@ -1179,7 +1179,7 @@ void CObjC_ParseDefs(TypeStruct *tstruct) { if ((tk = lex()) == '(') { if ((tk = lex()) == TK_IDENTIFIER) { if ((tclass = CObjC_FindObjCClass(tkidentifier, 1))) { - if (tclass->flags & CLASS_FLAGS_2) { + if (tclass->flags & CLASS_COMPLETED) { tstruct->size = tclass->size; tstruct->align = tclass->align; CObjC_AddClassMembers(tstruct, tclass); @@ -1208,7 +1208,7 @@ Type *CObjC_ParseID(void) { type->pointer = *TYPE_POINTER(CObjC_GetObjCType_id(1)); type->protocols = CObjC_ParserProtocolList(); - type->pointer.qual |= Q_100000; + type->pointer.qual |= Q_IS_OBJC_ID; return TYPE(type); } else { @@ -1367,7 +1367,7 @@ static void CObjC_EncodeTypeClass(TypeClass *tclass, Boolean flag) { ObjMemberVar *ivar; if (CClass_IsPODClass(tclass)) { - AppendGListByte(&name_mangle_list, (tclass->mode == CLASS_MODE_1) ? '(' : '{'); + AppendGListByte(&name_mangle_list, (tclass->mode == CLASS_MODE_UNION) ? '(' : '{'); if (cobjc_encodemethod) AppendGListByte(&name_mangle_list, '?'); @@ -1380,7 +1380,7 @@ static void CObjC_EncodeTypeClass(TypeClass *tclass, Boolean flag) { CObjC_EncodeType(ivar->type, ivar->qual, 1); } - AppendGListByte(&name_mangle_list, (tclass->mode == CLASS_MODE_1) ? ')' : '}'); + AppendGListByte(&name_mangle_list, (tclass->mode == CLASS_MODE_UNION) ? ')' : '}'); } else { AppendGListByte(&name_mangle_list, '?'); } @@ -1540,7 +1540,7 @@ static void CObjC_EncodeType(Type *type, UInt32 qual, Boolean flag) { case TYPEBITFIELD: AppendGListByte(&name_mangle_list, 'b'); - sprintf(buf, "%" PRId32, TYPE_BITFIELD(type)->unkB); + sprintf(buf, "%" PRId32, TYPE_BITFIELD(type)->bitlength); AppendGListName(&name_mangle_list, buf); return; @@ -2310,7 +2310,7 @@ static void CObjC_ParseInstanceVariables(TypeClass *tclass, Boolean checkOnly) { CError_Error(CErrorStr131); bdi.xCD = 0; } - if (bdi.declinfo2.x3E) { + if (bdi.declinfo2.operator_token) { CError_Error(CErrorStr131); bdi.xCD = 0; } @@ -2397,7 +2397,7 @@ static void CObjC_ParseInterfaceImplementation(void) { return; } - flag2 = (tclass->flags & CLASS_FLAGS_2) ? 1 : 0; + flag2 = (tclass->flags & CLASS_COMPLETED) ? 1 : 0; if (flag2 && isInterface) { CError_Error(CErrorStr132, tclass->classname->name); return; @@ -2410,7 +2410,7 @@ static void CObjC_ParseInterfaceImplementation(void) { } if ((tclassbase = CObjC_FindObjCClass(tkidentifier, 1))) { - if (tclassbase->flags & CLASS_FLAGS_2) { + if (tclassbase->flags & CLASS_COMPLETED) { if (!flag2) { base = galloc(sizeof(ClassList)); memclrw(base, sizeof(ClassList)); @@ -2445,9 +2445,9 @@ static void CObjC_ParseInterfaceImplementation(void) { CObjC_ParseInstanceVariables(tclass, flag2); if (!flag2) { - DeclE decle; - memclrw(&decle, sizeof(decle)); - CABI_LayoutClass(&decle, tclass); + ClassLayout layout; + memclrw(&layout, sizeof(layout)); + CABI_LayoutClass(&layout, tclass); } cobjc_currentclass = tclass; @@ -2696,7 +2696,7 @@ ENode *CObjC_MakeSendMsgExpr(ENode *objexpr, TypeClass *tclass, ObjCNamedArg *na } if (!meth) { - if (IS_TYPE_POINTER_ONLY(objexpr->rtype) && (TPTR_QUAL(objexpr->rtype) & Q_100000)) { + if (IS_TYPE_POINTER_ONLY(objexpr->rtype) && (TPTR_QUAL(objexpr->rtype) & Q_IS_OBJC_ID)) { for (protlist = TYPE_OBJC_ID(objexpr->rtype)->protocols; protlist; protlist = protlist->next) { for (meth = protlist->protocol->methods; meth; meth = meth->next) { if (CObjC_SelectorCompare(meth, namedArgs, unnamedArgs != NULL)) { diff --git a/compiler_and_linker/unsorted/CParser.c b/compiler_and_linker/unsorted/CParser.c index 92d75c1..e53b0bf 100644 --- a/compiler_and_linker/unsorted/CParser.c +++ b/compiler_and_linker/unsorted/CParser.c @@ -155,7 +155,7 @@ Object *CParser_NewRTFunc(Type *rettype, HashNameNode *name, Boolean flag, int a obj->name = name; obj->type = TYPE(tfunc); if (flag == 1) - obj->qual = Q_80000; + obj->qual = Q_MANGLE_NAME; return obj; } @@ -657,18 +657,18 @@ static void CParser_SetCFMFlags(Object *object, DeclInfo *declinfo) { if (object->datatype == DDATA) { if (copts.cfm_export) - object->flags = object->flags | OBJECT_FLAGS_40; + object->flags = object->flags | OBJECT_EXPORT; if (copts.cfm_internal) - object->flags = object->flags | OBJECT_FLAGS_10; + object->flags = object->flags | OBJECT_INTERNAL; } else if (copts.cfm_internal) { - object->flags = object->flags | OBJECT_FLAGS_10; + object->flags = object->flags | OBJECT_INTERNAL; } else { if (copts.cfm_import) - object->flags = object->flags | OBJECT_FLAGS_20; + object->flags = object->flags | OBJECT_IMPORT; if (copts.cfm_export) - object->flags = object->flags | OBJECT_FLAGS_40; + object->flags = object->flags | OBJECT_EXPORT; if (copts.cfm_lib_export) - object->flags = object->flags | OBJECT_FLAGS_20 | OBJECT_FLAGS_40; + object->flags = object->flags | OBJECT_IMPORT | OBJECT_EXPORT; } } @@ -728,8 +728,8 @@ Object *CParser_NewGlobalDataObject(DeclInfo *declinfo) { object->name = declinfo->name; object->qual = declinfo->qual; object->sclass = declinfo->storageclass; - if (copts.cplusplus && !declinfo->x4E) - object->qual |= Q_80000; + if (copts.cplusplus && !declinfo->is_extern_c) + object->qual |= Q_MANGLE_NAME; } CParser_UpdateObject(object, declinfo); @@ -762,8 +762,8 @@ Object *CParser_NewFunctionObject(DeclInfo *declinfo) { object->name = declinfo->name; object->qual = declinfo->qual; object->sclass = declinfo->storageclass; - if (copts.cplusplus && !declinfo->x4E) - object->qual |= Q_80000; + if (copts.cplusplus && !declinfo->is_extern_c) + object->qual |= Q_MANGLE_NAME; } CParser_UpdateObject(object, declinfo); @@ -825,7 +825,7 @@ Object *CParser_FindDeallocationObject(Type *type, FuncArg *args, Boolean flag1, NameSpaceObjectList *list; NameSpaceObjectList *scan; NameSpaceObjectList mylist; - CScopeParseResult pr; + NameResult pr; Boolean first_time; Boolean retry_flag; Object *obj; @@ -845,7 +845,7 @@ Object *CParser_FindDeallocationObject(Type *type, FuncArg *args, Boolean flag1, CError_ASSERT(1202, pr.nsol_14); list = pr.nsol_14; } - } else if (TYPE_CLASS(type)->flags & CLASS_FLAGS_1) { + } else if (TYPE_CLASS(type)->flags & CLASS_HANDLEOBJECT) { CError_ASSERT(1210, !args && !flag1); return delh_func; } @@ -983,7 +983,7 @@ short is_memberpointerequal(Type *a, Type *b) { if (!is_typesame(TYPE_FUNC(a)->functype, TYPE_FUNC(b)->functype)) return 0; - if ((TYPE_FUNC(a)->flags & (FUNC_FLAGS_F0000000 | FUNC_FLAGS_PASCAL)) != (TYPE_FUNC(b)->flags & (FUNC_FLAGS_F0000000 | FUNC_FLAGS_PASCAL))) + if ((TYPE_FUNC(a)->flags & FUNC_CALL_CONV_MASK) != (TYPE_FUNC(b)->flags & FUNC_CALL_CONV_MASK)) return 0; CError_ASSERT(1345, arg_a = TYPE_FUNC(a)->args); @@ -1042,7 +1042,7 @@ restart: if (!is_typesame(TYPE_FUNC(a)->functype, TYPE_FUNC(b)->functype)) return 0; } - if ((TYPE_FUNC(a)->flags & (FUNC_FLAGS_F0000000 | FUNC_FLAGS_PASCAL)) != (TYPE_FUNC(b)->flags & (FUNC_FLAGS_F0000000 | FUNC_FLAGS_PASCAL))) + if ((TYPE_FUNC(a)->flags & FUNC_CALL_CONV_MASK) != (TYPE_FUNC(b)->flags & FUNC_CALL_CONV_MASK)) return 0; } return is_arglistequal(TYPE_FUNC(a)->args, TYPE_FUNC(b)->args); @@ -1095,7 +1095,7 @@ short iscpp_typeequal(Type *a, Type *b) { case TYPEFUNC: if (!is_typesame(TYPE_FUNC(a)->functype, TYPE_FUNC(b)->functype)) return 0; - if ((TYPE_FUNC(a)->flags & (FUNC_FLAGS_F0000000 | FUNC_FLAGS_PASCAL)) != (TYPE_FUNC(b)->flags & (FUNC_FLAGS_F0000000 | FUNC_FLAGS_PASCAL))) + if ((TYPE_FUNC(a)->flags & FUNC_CALL_CONV_MASK) != (TYPE_FUNC(b)->flags & FUNC_CALL_CONV_MASK)) return 0; return is_arglistequal(TYPE_FUNC(a)->args, TYPE_FUNC(b)->args); case TYPETEMPLATE: @@ -1232,9 +1232,9 @@ Boolean is_arglistsame(FuncArg *a, FuncArg *b) { short is_typesame(Type *a, Type *b) { restart: if (a->type != b->type) { - if (IS_TYPE_TEMPLATE(a) && IS_TYPE_CLASS(b) && (TYPE_CLASS(b)->flags & CLASS_FLAGS_100)) + if (IS_TYPE_TEMPLATE(a) && IS_TYPE_CLASS(b) && (TYPE_CLASS(b)->flags & CLASS_IS_TEMPL)) return CTemplTool_IsSameTemplateType(b, a); - if (IS_TYPE_TEMPLATE(b) && IS_TYPE_CLASS(a) && (TYPE_CLASS(a)->flags & CLASS_FLAGS_100)) + if (IS_TYPE_TEMPLATE(b) && IS_TYPE_CLASS(a) && (TYPE_CLASS(a)->flags & CLASS_IS_TEMPL)) return CTemplTool_IsSameTemplateType(a, b); return 0; } @@ -1274,7 +1274,7 @@ restart: return 0; if (TYPE_FUNC(a)->qual != TYPE_FUNC(b)->qual) return 0; - if ((TYPE_FUNC(a)->flags & (FUNC_FLAGS_F0000000 | FUNC_FLAGS_PASCAL)) != (TYPE_FUNC(b)->flags & (FUNC_FLAGS_F0000000 | FUNC_FLAGS_PASCAL))) + if ((TYPE_FUNC(a)->flags & FUNC_CALL_CONV_MASK) != (TYPE_FUNC(b)->flags & FUNC_CALL_CONV_MASK)) return 0; return is_arglistsame(TYPE_FUNC(a)->args, TYPE_FUNC(b)->args); default: @@ -1534,7 +1534,7 @@ Type *CParser_ParseTypeID(UInt32 *qual, Boolean *flag) { } CParser_GetDeclSpecs(&di, 0); - if (di.x57 && IS_TYPE_CLASS(di.thetype) && (TYPE_CLASS(di.thetype)->flags & CLASS_FLAGS_100)) { + if (di.x57 && IS_TYPE_CLASS(di.thetype) && (TYPE_CLASS(di.thetype)->flags & CLASS_IS_TEMPL)) { CParser_RemoveTryBlock(&tryblock); *qual = di.qual; *flag = 1; @@ -1730,7 +1730,7 @@ Boolean CParser_HasInternalLinkage(const Object *obj) { if (obj->datatype == DLOCAL) return 1; - if (obj->qual & (Q_20000 | Q_OVERLOAD)) + if (obj->qual & (Q_20000 | Q_WEAK)) return 0; if (obj->sclass == TK_STATIC) return 1; @@ -1744,7 +1744,7 @@ Boolean CParser_HasInternalLinkage(const Object *obj) { Boolean CParser_HasInternalLinkage2(const Object *obj) { if (obj->datatype == DLOCAL) return 1; - if (obj->qual & (Q_20000 | Q_OVERLOAD)) + if (obj->qual & (Q_20000 | Q_WEAK)) return 0; if (obj->sclass == TK_STATIC) return 1; @@ -1758,7 +1758,7 @@ Boolean CParser_HasInternalLinkage2(const Object *obj) { Boolean CParser_IsVirtualFunction(Object *obj, TypeClass **tclass, SInt32 *index) { if (obj->datatype == DVFUNC) { *tclass = TYPE_METHOD(obj->type)->theclass; - *index = TYPE_METHOD(obj->type)->x1E; + *index = TYPE_METHOD(obj->type)->vtbl_index; return 1; } @@ -1766,7 +1766,7 @@ Boolean CParser_IsVirtualFunction(Object *obj, TypeClass **tclass, SInt32 *index } Boolean is_pascal_object(Object *obj) { - return IS_TYPE_FUNC(obj->type) && (TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_PASCAL); + return IS_TYPE_FUNC(obj->type) && (TYPE_FUNC(obj->type)->flags & FUNC_PASCAL); } Boolean is_cfm_type(Type *type) { @@ -2014,7 +2014,7 @@ void CParser_ParseAttribute(Type *type, DeclInfo *declinfo) { } } else if (!strcmp(tkidentifier->name, "nothrow") || !strcmp(tkidentifier->name, "__nothrow__")) { if (declinfo && declinfo->thetype && IS_TYPE_FUNC(declinfo->thetype)) - TYPE_FUNC(declinfo->thetype)->flags |= FUNC_FLAGS_NOTHROW; + TYPE_FUNC(declinfo->thetype)->flags |= FUNC_NOTHROW; else CError_Error(CErrorStr359); } else if (!strcmp("function_summary", tkidentifier->name)) { @@ -2114,7 +2114,7 @@ void CParser_ParseDeclSpec(DeclInfo *declinfo, Boolean flag) { } else if (!strcmp("lib_export", tkidentifier->name)) { declinfo->exportflags = declinfo->exportflags | EXPORT_FLAGS_IMPORT | EXPORT_FLAGS_EXPORT; } else if (!strcmp("weak", tkidentifier->name)) { - declinfo->qual |= Q_OVERLOAD; + declinfo->qual |= Q_WEAK; } else { CodeGen_ParseDeclSpec(tkidentifier, declinfo); } @@ -2600,12 +2600,10 @@ void CParser_GetDeclSpecs(DeclInfo *di, Boolean flag) { Boolean r24; Boolean r23; SInt32 state; - CScopeParseResult pr; + NameResult pr; di->file = CPrep_BrowserCurrentFile(); - CPrep_BrowserFilePosition( - (CPrepFileInfo **) &di->file2, - &di->x60); + CPrep_BrowserFilePosition(&di->file2, &di->sourceoffset); r24 = 1; r23 = copts.cplusplus; @@ -2798,7 +2796,7 @@ restart: if (typetoken || signedness || typesize) CError_Error(CErrorStr121); tk = lex(); - CDecl_ParseClass(di, CLASS_MODE_2, 1, 0); + CDecl_ParseClass(di, CLASS_MODE_CLASS, 1, 0); if (tk == TK_UU_ATTRIBUTE_UU) CParser_ParseAttribute(di->thetype, NULL); if (!(tk != TK_CONST && tk != TK_VOLATILE && tk != TK_UU_FAR && tk != TK_UU_DECLSPEC)) { @@ -2888,20 +2886,20 @@ restart: some_shared_label: CPrep_TokenStreamGetState(&state); if (CScope_ParseDeclName(&pr)) { - if (pr.x8) { - if (IS_TYPE_TEMPLATE(pr.x8)) { - switch (TYPE_TEMPLATE(pr.x8)->dtype) { + if (pr.type) { + if (IS_TYPE_TEMPLATE(pr.type)) { + switch (TYPE_TEMPLATE(pr.type)->dtype) { case TEMPLDEP_ARGUMENT: - switch (TYPE_TEMPLATE(pr.x8)->u.pid.type) { + switch (TYPE_TEMPLATE(pr.type)->u.pid.type) { case TPT_TYPE: break; case TPT_NONTYPE: CError_Error(CErrorStr348); - pr.x8 = TYPE(&stsignedint); + pr.type = TYPE(&stsignedint); break; case TPT_TEMPLATE: CError_Error(CErrorStr230); - pr.x8 = TYPE(&stsignedint); + pr.type = TYPE(&stsignedint); break; default: CError_FATAL(4109); @@ -2921,23 +2919,23 @@ restart: } } - if (IS_TYPE_CLASS(pr.x8) && (TYPE_CLASS(pr.x8)->flags & CLASS_FLAGS_100)) { - if (!CParser_CheckTemplateClassUsage(TEMPL_CLASS(pr.x8), 0)) { + if (IS_TYPE_CLASS(pr.type) && (TYPE_CLASS(pr.type)->flags & CLASS_IS_TEMPL)) { + if (!CParser_CheckTemplateClassUsage(TEMPL_CLASS(pr.type), 0)) { if (di->x56) { if (di->qual) CError_Error(CErrorStr121); - di->thetype = pr.x8; + di->thetype = pr.type; di->x57 = 1; tk = lex(); return; } else { CError_Error(CErrorStr230); - pr.x8 = TYPE(&stsignedint); + pr.type = TYPE(&stsignedint); } } } - TypedefDeclInfo(di, pr.x8, pr.xC); + TypedefDeclInfo(di, pr.type, pr.qual); di->x49 = pr.x20; typetoken = -1; tk = lex(); @@ -2946,9 +2944,9 @@ restart: goto bailOut; } else if (pr.nsol_14) { if (pr.x1D) { - if (flag && (OBJECT(pr.nsol_14->object)->nspace == pr.nspace_0 || di->x4C)) { + if (flag && (OBJECT(pr.nsol_14->object)->nspace == pr.nspace_0 || di->in_friend_decl)) { di->x14 = pr.nsol_14; - if (IS_TYPE_FUNC(OBJECT(di->x14->object)->type) && ((TYPE_FUNC(OBJECT(di->x14->object)->type)->flags & FUNC_FLAGS_1000) | FUNC_FLAGS_2000)) + if (IS_TYPE_FUNC(OBJECT(di->x14->object)->type) && ((TYPE_FUNC(OBJECT(di->x14->object)->type)->flags & FUNC_IS_CTOR) | FUNC_IS_DTOR)) r23 = 0; } else { CError_Error(CErrorStr121); @@ -2958,9 +2956,9 @@ restart: switch (pr.obj_10->otype) { case OT_OBJECT: if (pr.x1D) { - if (flag && (OBJECT(pr.obj_10)->nspace == pr.nspace_0 || di->x4C)) { + if (flag && (OBJECT(pr.obj_10)->nspace == pr.nspace_0 || di->in_friend_decl)) { di->x10 = OBJECT(pr.obj_10); - if (IS_TYPE_FUNC(di->x10->type) && ((TYPE_FUNC(di->x10->type)->flags & FUNC_FLAGS_1000) | FUNC_FLAGS_2000)) + if (IS_TYPE_FUNC(di->x10->type) && ((TYPE_FUNC(di->x10->type)->flags & FUNC_IS_CTOR) | FUNC_IS_DTOR)) r23 = 0; } else { CError_Error(CErrorStr121); @@ -3097,8 +3095,8 @@ static void CParser_GlobalCleanup(Boolean flag) { Boolean CParser_IsAnonymousUnion(DeclInfo *di, Boolean flag) { return IS_TYPE_CLASS(di->thetype) && - ((TYPE_CLASS(di->thetype)->mode == CLASS_MODE_1 || (flag && copts.cpp_extensions))) && - IsTempName(TYPE_CLASS(di->thetype)->classname); + ((TYPE_CLASS(di->thetype)->mode == CLASS_MODE_UNION || (flag && copts.cpp_extensions))) && + IsTempName(TYPE_CLASS(di->thetype)->classname); } void CParser_CheckAnonymousUnion(DeclInfo *di, Boolean flag) { @@ -3156,7 +3154,7 @@ void CParser_NewCallBackAction(Object *obj, TypeClass *tclass) { act->obj = obj; act->tclass = tclass; callbackactions = act; - obj->flags = obj->flags | OBJECT_FLAGS_8; + obj->flags = obj->flags | OBJECT_LAZY; } void CParser_NewClassAction(TypeClass *tclass) { @@ -3192,7 +3190,7 @@ static Object *CParser_FindOverloadFunc(NameSpaceObjectList *list, TypeFunc *tfu Object *CParser_ParseObject(void) { DeclInfo di; - CScopeParseResult pr; + NameResult pr; NameSpaceObjectList *list; Object *obj; @@ -3243,21 +3241,21 @@ void CParser_ParseGlobalDeclaration(void) { } static void CParser_ParseLinkageSpecification(DeclInfo *di) { - UInt32 r29; + UInt32 qual; UInt8 r28; if (!strcmp(tkstring, "C") || !strcmp(tkstring, "Objective C")) { - r29 = 0; + qual = 0; r28 = 1; } else if (!strcmp(tkstring, "C++")) { - r29 = 0; + qual = 0; r28 = 0; } else if (!strcmp(tkstring, "Pascal")) { - r29 = 8; + qual = Q_PASCAL; r28 = 1; } else { CError_Error(CErrorStr121); - r29 = 0; + qual = 0; r28 = 1; } @@ -3276,8 +3274,8 @@ static void CParser_ParseLinkageSpecification(DeclInfo *di) { symdecltoken = *CPrep_CurStreamElement(); memclrw(di, sizeof(DeclInfo)); - di->x4E = r28; - di->qual = r29; + di->is_extern_c = r28; + di->qual = qual; CParser_ParseDeclaration(di); } } else if (tk == TK_EXTERN && copts.cpp_extensions && lookahead() == TK_STRING) { @@ -3285,8 +3283,8 @@ static void CParser_ParseLinkageSpecification(DeclInfo *di) { CParser_ParseLinkageSpecification(di); } else { memclrw(di, sizeof(DeclInfo)); - di->x4E = r28; - di->qual = r29; + di->is_extern_c = r28; + di->qual = qual; CParser_GetDeclSpecs(di, 1); if (di->storageclass != TK_TYPEDEF) { diff --git a/compiler_and_linker/unsorted/CPrec.c b/compiler_and_linker/unsorted/CPrec.c index 9872211..e61b96e 100644 --- a/compiler_and_linker/unsorted/CPrec.c +++ b/compiler_and_linker/unsorted/CPrec.c @@ -205,7 +205,7 @@ static OLinkList *CPrec_OLinkListCopy(OLinkList *list) { void PreComp_StaticData(Object *obj, const void *data, OLinkList *links, SInt32 size) { StaticData *entry; - if (obj->sclass != TK_STATIC && !(obj->qual & (Q_20000 | Q_OVERLOAD))) + if (obj->sclass != TK_STATIC && !(obj->qual & (Q_20000 | Q_WEAK))) CError_Error(CErrorStr180); entry = galloc(sizeof(StaticData)); @@ -702,7 +702,7 @@ static TypePointer *CPrec_GetTypePointerPatch(TypePointer *tptr) { TypePointer *scan1; TypePointer *scan2; - if (tptr->qual & Q_100000) { + if (tptr->qual & Q_IS_OBJC_ID) { p = CPrec_AppendAlign(); CPrec_NewAddrPatch(tptr, p); CPrec_AppendData(tptr, sizeof(TypeObjCID)); @@ -872,14 +872,14 @@ static TypeFunc *CPrec_GetTypeFuncPatch(TypeFunc *type) { TypeFunc *p = CPrec_AppendAlign(); CPrec_NewAddrPatch(type, p); - CPrec_AppendData(type, (type->flags & FUNC_FLAGS_METHOD) ? sizeof(TypeMemberFunc) : sizeof(TypeFunc)); + CPrec_AppendData(type, (type->flags & FUNC_METHOD) ? sizeof(TypeMemberFunc) : sizeof(TypeFunc)); CPrec_NewPointerPatch(&p->functype, CPrec_GetTypePatch(type->functype)); if (type->args) - CPrec_NewPointerPatch(&p->args, CPrec_GetArgListPatch(type->args, (type->flags & FUNC_FLAGS_900000) != 0)); + CPrec_NewPointerPatch(&p->args, CPrec_GetArgListPatch(type->args, (type->flags & FUNC_IS_TEMPL_ANY) != 0)); if (type->exspecs) CPrec_NewPointerPatch(&p->exspecs, CPrec_GetExceptSpecPatch(type->exspecs)); - if (type->flags & FUNC_FLAGS_METHOD) + if (type->flags & FUNC_METHOD) CPrec_NewPointerPatch(&TYPE_METHOD(p)->theclass, CPrec_GetTypePatch((Type *) TYPE_METHOD(type)->theclass)); return p; @@ -1683,7 +1683,7 @@ static TypeClass *CPrec_GetTypeClassPatch(TypeClass *tclass) { hasNextTempl = hasNextTemplInst = 0; CPrec_NewAddrPatch(tclass, current); - if (tclass->flags & CLASS_FLAGS_100) { + if (tclass->flags & CLASS_IS_TEMPL) { // template class CPrec_AppendData(tclass, sizeof(TemplClass)); if (TEMPL_CLASS(tclass)->next) @@ -1704,7 +1704,7 @@ static TypeClass *CPrec_GetTypeClassPatch(TypeClass *tclass) { CPrec_NewPointerPatch(&TEMPL_CLASS(current)->pspecs, CPrec_GetTemplPartialSpecPatch(TEMPL_CLASS(tclass)->pspecs)); if (TEMPL_CLASS(tclass)->actions) CPrec_NewPointerPatch(&TEMPL_CLASS(current)->actions, CPrec_GetTemplateActionPatch(TEMPL_CLASS(tclass)->actions)); - } else if (tclass->flags & CLASS_FLAGS_800) { + } else if (tclass->flags & CLASS_IS_TEMPL_INST) { // template class instance CPrec_AppendData(tclass, sizeof(TemplClassInst)); if (TEMPL_CLASS_INST(tclass)->next) @@ -2308,7 +2308,7 @@ static Object *CPrec_GetObjectPatch(Object *obj) { obj->toc = NULL; - if ((obj->qual & Q_400000) && obj->datatype != DALIAS) { + if ((obj->qual & Q_IS_TEMPLATED) && obj->datatype != DALIAS) { CPrec_AppendData(obj, sizeof(ObjectTemplated)); CPrec_NewPointerPatch(&OBJECT_TEMPL(p)->parent, CPrec_GetObjectPatch(OBJECT_TEMPL(obj)->parent)); } else { @@ -2346,7 +2346,7 @@ static Object *CPrec_GetObjectPatch(Object *obj) { case DDATA: CError_ASSERT(3622, !obj->u.data.info); - if (obj->qual & Q_10000) { + if (obj->qual & Q_INLINE_DATA) { switch (obj->type->type) { case TYPEINT: case TYPEENUM: diff --git a/compiler_and_linker/unsorted/CRTTI.c b/compiler_and_linker/unsorted/CRTTI.c index 7b4ef5d..3881153 100644 --- a/compiler_and_linker/unsorted/CRTTI.c +++ b/compiler_and_linker/unsorted/CRTTI.c @@ -267,7 +267,7 @@ static Object *CRTTI_ConstructTypeInfoObject(Type *type, UInt32 qual) { if (IS_TYPE_CLASS(type) && type->size == 0) { CDecl_CompleteType(type); - if (!(TYPE_CLASS(type)->flags & CLASS_FLAGS_2)) + if (!(TYPE_CLASS(type)->flags & CLASS_COMPLETED)) CError_Error(CErrorStr136, type, 0); } @@ -544,7 +544,7 @@ static void CRTTI_IncompleteCheck(Type *type) { if (IS_TYPE_CLASS(type) && type->size == 0) { CDecl_CompleteType(type); - if (!(TYPE_CLASS(type)->flags & CLASS_FLAGS_2)) + if (!(TYPE_CLASS(type)->flags & CLASS_COMPLETED)) CError_Error(CErrorStr136, type, 0); } } @@ -701,7 +701,7 @@ ENode *CRTTI_Parse_dynamic_cast(void) { if (IS_TYPE_CLASS(TPTR_TARGET(di.thetype))) { destclass = TYPE_CLASS(TPTR_TARGET(di.thetype)); CDecl_CompleteType(TYPE(destclass)); - if (!(destclass->flags & CLASS_FLAGS_2)) { + if (!(destclass->flags & CLASS_COMPLETED)) { CError_Error(CErrorStr136, destclass, 0); return expr; } @@ -738,7 +738,7 @@ ENode *CRTTI_Parse_dynamic_cast(void) { } } - if (!(srcclass->flags & CLASS_FLAGS_2)) { + if (!(srcclass->flags & CLASS_COMPLETED)) { CError_Error(CErrorStr136, srcclass, 0); return expr; } diff --git a/compiler_and_linker/unsorted/CSOM.c b/compiler_and_linker/unsorted/CSOM.c index 394ea2b..afd68a3 100644 --- a/compiler_and_linker/unsorted/CSOM.c +++ b/compiler_and_linker/unsorted/CSOM.c @@ -206,7 +206,7 @@ static Type *CSOM_FindClassType(HashNameNode *name) { CW_INLINE UInt16 CSOM_GetTokenTableIndex(const Object *object) { CError_ASSERT(173, IS_TYPE_METHOD(object->type)); - return TYPE_METHOD(object->type)->x1E; + return TYPE_METHOD(object->type)->vtbl_index; } static SInt32 CSOM_GetTokenOffset(Object *object) { @@ -313,7 +313,7 @@ static void CSOM_GetFuncSig(TypeFunc *tfunc, Boolean flag) { if (flag) { if ((arg = tfunc->args)) { - if (TYPE_METHOD(tfunc)->x26 == 0) + if (TYPE_METHOD(tfunc)->is_static == 0) arg = arg->next; if (arg && CMach_GetFunctionResultClass(tfunc) != 0) arg = arg->next; @@ -370,7 +370,7 @@ void CSOM_MakeSOMClass(TypeClass *tclass) { tclass->sominfo = info; info->classdataobject = CSOM_MakeObject(tclass->classname->name, "ClassData", 28); - info->classdataobject->flags = info->classdataobject->flags | OBJECT_FLAGS_40; + info->classdataobject->flags = info->classdataobject->flags | OBJECT_EXPORT; } } @@ -379,7 +379,7 @@ static Boolean CSOM_IsTokenListFunc(Object *object) { if ( IS_TYPE_FUNC(type) && !(TYPE_FUNC(type)->flags & FUNC_FLAGS_20) && - !TYPE_METHOD(type)->x26 && + !TYPE_METHOD(type)->is_static && (!(object->qual & Q_INLINE) || object->datatype == DVFUNC) ) return 1; @@ -401,10 +401,10 @@ static Object **CSOM_GetLexicalOrderMethodArray(TypeClass *tclass, int *resultCo if (IS_TYPE_METHOD(object->type)) { if (CSOM_IsTokenListFunc(object)) { - if (TYPE_METHOD(object->type)->x1E > count) - count = TYPE_METHOD(object->type)->x1E; + if (TYPE_METHOD(object->type)->vtbl_index > count) + count = TYPE_METHOD(object->type)->vtbl_index; } else { - TYPE_METHOD(object->type)->x1E = 0; + TYPE_METHOD(object->type)->vtbl_index = 0; } } } @@ -420,7 +420,7 @@ static Object **CSOM_GetLexicalOrderMethodArray(TypeClass *tclass, int *resultCo break; if (CSOM_IsTokenListFunc(object)) - array[TYPE_METHOD(object->type)->x1E] = object; + array[TYPE_METHOD(object->type)->vtbl_index] = object; } return array; @@ -445,7 +445,7 @@ void CSOM_ClassComplete(TypeClass *tclass) { for (order = tclass->sominfo->order, counter = 0; order; order = order->next, counter++) { if (order->name == name) { order->state = SOMMS_Method; - TYPE_METHOD(object->type)->x1E = counter; + TYPE_METHOD(object->type)->vtbl_index = counter; break; } } @@ -480,7 +480,7 @@ void CSOM_ClassComplete(TypeClass *tclass) { if (object) { if (counter == 0 && copts.pedantic) CError_Warning(CErrorStr291); - TYPE_METHOD(object->type)->x1E = counter++; + TYPE_METHOD(object->type)->vtbl_index = counter++; } } } @@ -512,7 +512,7 @@ void CSOM_ClassComplete(TypeClass *tclass) { CError_ASSERT(529, IS_TYPE_FUNC(object->type)); TYPE_FUNC(object->type)->flags |= FUNC_FLAGS_4; - tclass->action = 1; + tclass->action = CLASS_ACTION_1; while (1) { if (!(object = OBJECT(CScope_NextObjectIteratorObject(&iter)))) break; @@ -535,7 +535,7 @@ void CSOM_ClassComplete(TypeClass *tclass) { if ( IS_TYPE_FUNC(object->type) && - TYPE_METHOD(object->type)->x26 == 0 && + TYPE_METHOD(object->type)->is_static == 0 && !(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_20) && !( TYPE_FUNC(object->type)->args && @@ -550,7 +550,7 @@ void CSOM_ClassComplete(TypeClass *tclass) { } } - if (tclass->action == 0) + if (tclass->action == CLASS_ACTION_0) CError_Error(CErrorStr280); } @@ -747,7 +747,7 @@ static void CSOM_GenerateOverrideIntroLists(SOMGenerator *gen, TypeClass *tclass CSOM_NameTranslate(object->name) == order->name ) { - CError_ASSERT(733, TYPE_METHOD(object->type)->x1E == index); + CError_ASSERT(733, TYPE_METHOD(object->type)->vtbl_index == index); method->u.object = object; break; } @@ -1934,7 +1934,7 @@ static ENode *CSOM_SOMGlueCall(TypeClass *tclass, SInt32 offset, Object *object) stubObj->u.func.linkname = stubObj->name; stubObj->type = object->type; stubObj->qual = object->qual | Q_20000; - stubObj->flags = OBJECT_FLAGS_10; + stubObj->flags = OBJECT_INTERNAL; CScope_AddObject(stubObj->nspace, stubObj->name, OBJ_BASE(stubObj)); stub = galloc(sizeof(CSOMStub)); diff --git a/compiler_and_linker/unsorted/CTemplateClass.c b/compiler_and_linker/unsorted/CTemplateClass.c index 45d07b8..8b3b889 100644 --- a/compiler_and_linker/unsorted/CTemplateClass.c +++ b/compiler_and_linker/unsorted/CTemplateClass.c @@ -23,7 +23,7 @@ TemplClass *CTemplClass_GetMasterTemplate(TemplClass *tmclass) { if (tmclass->inst_parent) { tmclass = TEMPL_CLASS(tmclass->theclass.nspace->theclass); - CError_ASSERT(42, tmclass->theclass.flags & CLASS_FLAGS_100); + CError_ASSERT(42, tmclass->theclass.flags & CLASS_IS_TEMPL); } return tmclass; @@ -89,7 +89,7 @@ void CTemplClass_RegisterFriend(TemplClass *tmclass, DeclInfo *di) { if (tk == '{' && IS_TYPE_FUNC(di->thetype)) { di->qual |= Q_INLINE; - TYPE_FUNC(di->thetype)->flags |= FUNC_FLAGS_2 | FUNC_FLAGS_800000; + TYPE_FUNC(di->thetype)->flags |= FUNC_DEFINED | FUNC_IS_TEMPL_INSTANCE; tfriend->fileoffset = cparser_fileoffset; CPrep_StreamGetBlock(&tfriend->stream, NULL, 1); @@ -182,11 +182,11 @@ void CTemplClass_RegisterObjectDef(TemplClass *tmclass, ObjBase *refobj) { CTemplClass_AppendTemplateAction(tmclass, action); } -void CTemplClass_CompleteClass(TemplClass *templ, DeclE *de) { - templ->lex_order_count = de->x8; - if (de->xC) - templ->flags |= TEMPLCLASS_FLAGS_1; - templ->theclass.flags |= CLASS_FLAGS_2; +void CTemplClass_CompleteClass(TemplClass *templ, ClassLayout *de) { + templ->lex_order_count = de->lex_order_count; + if (de->has_vtable) + templ->flags |= TEMPLCLASS_HAS_VTABLE; + templ->theclass.flags |= CLASS_COMPLETED; } static TemplClassInst *CTemplClass_NewInstance(TemplClass *templ, TemplArg *inst_args, TemplArg *oargs) { @@ -224,7 +224,7 @@ static TemplClassInst *CTemplClass_NewInstance(TemplClass *templ, TemplArg *inst } inst->theclass.type = TYPECLASS; - inst->theclass.flags = CLASS_FLAGS_800; + inst->theclass.flags = CLASS_IS_TEMPL_INST; inst->theclass.nspace = nspace; inst->theclass.classname = templ->theclass.classname; inst->theclass.mode = templ->theclass.mode; @@ -285,8 +285,8 @@ static void CTemplClass_ParseBody(TemplClass *templ, short mode, SInt32 *offset) memclrw(&di, sizeof(di)); di.file = CPrep_BrowserCurrentFile(); - CPrep_BrowserFilePosition(&di.file2, &di.x60); - di.x60 = *offset; + CPrep_BrowserFilePosition(&di.file2, &di.sourceoffset); + di.sourceoffset = *offset; di.x28 = templ; CDecl_ParseClass(&di, mode, 1, 0); @@ -296,7 +296,7 @@ static void CTemplClass_ParseBody(TemplClass *templ, short mode, SInt32 *offset) if (tk != ';') CError_Error(CErrorStr123); - CBrowse_NewTemplateClass(templ, di.file2, di.x60, CPrep_BrowserFileOffset() + 1); + CBrowse_NewTemplateClass(templ, di.file2, di.sourceoffset, CPrep_BrowserFileOffset() + 1); } void CTemplClass_ParsePartialSpecialization(DeclFucker *what_is_this, TemplParam *params, short mode, SInt32 *offset) { @@ -394,7 +394,7 @@ void CTemplClass_ParsePartialSpecialization(DeclFucker *what_is_this, TemplParam templ->templ__params = params; CDecl_DefineClass(nspace, TEMPL_CLASS(type)->theclass.classname, TYPE_CLASS(templ), mode, 0, 0); - templ->theclass.flags = CLASS_FLAGS_100; + templ->theclass.flags = CLASS_IS_TEMPL; templ->pspec_owner = TEMPL_CLASS(type); pspec = galloc(sizeof(TemplPartialSpec)); @@ -405,7 +405,7 @@ void CTemplClass_ParsePartialSpecialization(DeclFucker *what_is_this, TemplParam pspec->next = TEMPL_CLASS(type)->pspecs; TEMPL_CLASS(type)->pspecs = pspec; } else { - if ((pspec->templ->theclass.flags & CLASS_FLAGS_2) && tk != ';') { + if ((pspec->templ->theclass.flags & CLASS_COMPLETED) && tk != ';') { CError_Error(CErrorStr132, TEMPL_CLASS(type)->theclass.classname->name); return; } @@ -451,11 +451,11 @@ void CTemplClass_ParseClass(DeclFucker *what_is_this, TemplParam *params, short templ->templ__params = params; CDecl_DefineClass(nspace, tkidentifier, TYPE_CLASS(templ), mode, 0, 1); - templ->theclass.flags = CLASS_FLAGS_100; + templ->theclass.flags = CLASS_IS_TEMPL; templ->theclass.eflags = classDeclSpec; tk = lex(); - if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_100)) { + if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL)) { TemplateAction *action; templ->templ_parent = TEMPL_CLASS(nspace->theclass); @@ -484,7 +484,7 @@ void CTemplClass_ParseClass(DeclFucker *what_is_this, TemplParam *params, short tk = lex(); - if ((templ->theclass.flags & CLASS_FLAGS_2) && tk != ';') { + if ((templ->theclass.flags & CLASS_COMPLETED) && tk != ';') { CError_Error(CErrorStr132, templ->theclass.classname->name); return; } @@ -793,7 +793,7 @@ TemplClass *CTemplClass_DefineNestedClass(TemplClass *parent, HashNameNode *name templ->templ__params = NULL; CDecl_DefineClass(parent->theclass.nspace, name, TYPE_CLASS(templ), mode, 0, 1); - templ->theclass.flags = CLASS_FLAGS_100; + templ->theclass.flags = CLASS_IS_TEMPL; templ->align = copts.structalignment; action = galloc(sizeof(TemplateAction)); @@ -925,7 +925,7 @@ static void CTemplClass_CopyBaseClasses(TypeDeduce *deduce, TemplClassInst *inst } } - if (inst->theclass.flags & CLASS_FLAGS_20) + if (inst->theclass.flags & CLASS_HAS_VBASES) CDecl_MakeVBaseList(TYPE_CLASS(inst)); } @@ -1159,10 +1159,10 @@ static void CTemplClass_CopyMemberTemplate(TypeDeduce *deduce, Object *src) { CError_ASSERT(1553, IS_TYPE_FUNC(dest->type)); - TYPE_FUNC(dest->type)->flags |= FUNC_FLAGS_100000; + TYPE_FUNC(dest->type)->flags |= FUNC_IS_TEMPL; if ( - (TYPE_FUNC(dest->type)->flags & FUNC_FLAGS_1000) && + (TYPE_FUNC(dest->type)->flags & FUNC_IS_CTOR) && deduce->x17 && !action ) @@ -1211,11 +1211,11 @@ static void CTemplClass_CopyObject(TypeDeduce *deduce, Object *src) { if (flag) dest->object.nspace = deduce->inst->theclass.nspace; - dest->object.qual |= Q_400000; + dest->object.qual |= Q_IS_TEMPLATED; dest->parent = src; if (IS_TYPE_FUNC(dest->object.type)) - TYPE_FUNC(dest->object.type)->flags &= ~FUNC_FLAGS_2; + TYPE_FUNC(dest->object.type)->flags &= ~FUNC_DEFINED; switch (dest->object.datatype) { case DDATA: @@ -1238,7 +1238,7 @@ static void CTemplClass_CopyObject(TypeDeduce *deduce, Object *src) { CError_ASSERT(1651, !dest->object.u.func.u.templ && !dest->object.u.func.defargdata); if ( - (TYPE_FUNC(dest->object.type)->flags & FUNC_FLAGS_1000) && + (TYPE_FUNC(dest->object.type)->flags & FUNC_IS_CTOR) && deduce->x17 && !action ) @@ -1251,7 +1251,7 @@ static void CTemplClass_CopyObject(TypeDeduce *deduce, Object *src) { TYPE_FUNC(dest->object.type)->args->next = arg; } - if (TYPE_FUNC(dest->object.type)->flags & FUNC_FLAGS_40) { + if (TYPE_FUNC(dest->object.type)->flags & FUNC_CONVERSION) { CError_ASSERT(1665, IS_TYPE_FUNC(src->type)); if (CTemplTool_IsTemplateArgumentDependentType(TYPE_FUNC(src->type)->functype)) { CError_ASSERT(1668, action); @@ -1319,19 +1319,19 @@ static void CTemplClass_CompleteObject(TypeDeduce *deduce, TemplateAction *actio deduce->x15 = 0; CError_ASSERT(1753, IS_TYPE_FUNC(dest->type)); - TYPE_FUNC(dest->type)->flags |= FUNC_FLAGS_100000; + TYPE_FUNC(dest->type)->flags |= FUNC_IS_TEMPL; } else { dest->type = CTemplTool_DeduceTypeCopy(deduce, dest->type, &dest->qual); - dest->qual |= Q_400000; + dest->qual |= Q_IS_TEMPLATED; if (IS_TYPE_FUNC(dest->type)) - TYPE_FUNC(dest->type)->flags &= ~FUNC_FLAGS_2; + TYPE_FUNC(dest->type)->flags &= ~FUNC_DEFINED; switch (dest->datatype) { case DFUNC: case DVFUNC: CError_ASSERT(1769, IS_TYPE_FUNC(dest->type)); - if (TYPE_FUNC(dest->type)->flags & FUNC_FLAGS_40) { + if (TYPE_FUNC(dest->type)->flags & FUNC_CONVERSION) { CError_ASSERT(1772, IS_TYPE_FUNC(dest->type)); if (CTemplTool_IsTemplateArgumentDependentType(TYPE_FUNC(src->type)->functype)) { dest->name = CMangler_ConversionFuncName( @@ -1340,7 +1340,7 @@ static void CTemplClass_CompleteObject(TypeDeduce *deduce, TemplateAction *actio } } - if ((TYPE_FUNC(dest->type)->flags & FUNC_FLAGS_1000) && deduce->x17) { + if ((TYPE_FUNC(dest->type)->flags & FUNC_IS_CTOR) && deduce->x17) { FuncArg *arg; CError_ASSERT(1786, TYPE_FUNC(dest->type)->args); arg = CParser_NewFuncArg(); @@ -1360,7 +1360,7 @@ static void CTemplClass_CompleteObjectInit(TypeDeduce *deduce, TemplateAction *a if (ENODE_IS(expr, EINTCONST) && (object->qual & Q_CONST) && IS_TYPE_INT_OR_ENUM(object->type)) { object->u.data.u.intconst = expr->data.intval; - object->qual |= Q_10000 | Q_20000; + object->qual |= Q_INLINE_DATA | Q_20000; } else { CError_Error(CErrorStr354, object->name->name); } @@ -1473,14 +1473,14 @@ Boolean CTempl_InstantiateTemplateClass(TypeClass *tclass) { TypeDeduce deduce; TemplStack stack; CScopeSave saveScope; - DeclE declE; + ClassLayout layout; TemplClass *templ; TStreamElement *saveErrorRef; TemplArg *inst_args; - CError_ASSERT(1989, tclass->flags & CLASS_FLAGS_800); + CError_ASSERT(1989, tclass->flags & CLASS_IS_TEMPL_INST); - if (tclass->flags & CLASS_FLAGS_2) + if (tclass->flags & CLASS_COMPLETED) return 1; inst = TEMPL_CLASS_INST(tclass); @@ -1498,7 +1498,7 @@ Boolean CTempl_InstantiateTemplateClass(TypeClass *tclass) { inst->inst_args = inst_args; } - if (!(templ->theclass.flags & CLASS_FLAGS_2)) + if (!(templ->theclass.flags & CLASS_COMPLETED)) return 0; if (inst->is_instantiated) @@ -1522,11 +1522,11 @@ Boolean CTempl_InstantiateTemplateClass(TypeClass *tclass) { CError_ASSERT(2049, !templ->theclass.vtable); inst->theclass.flags |= templ->theclass.flags & - (CLASS_FLAGS_ABSTRACT | CLASS_FLAGS_10 | CLASS_FLAGS_20 | CLASS_FLAGS_40 | CLASS_FLAGS_2000); + (CLASS_ABSTRACT | CLASS_SINGLE_OBJECT | CLASS_HAS_VBASES | CLASS_IS_CONVERTIBLE | CLASS_COM_OBJECT); CTemplClass_CopyBaseClasses(&deduce, inst, templ); - deduce.x17 = (inst->theclass.flags & CLASS_FLAGS_20) && !(templ->theclass.flags & CLASS_FLAGS_20); + deduce.x17 = (inst->theclass.flags & CLASS_HAS_VBASES) && !(templ->theclass.flags & CLASS_HAS_VBASES); for (action = templ->actions; action; action = action->next) { switch (action->type) { @@ -1610,13 +1610,13 @@ Boolean CTempl_InstantiateTemplateClass(TypeClass *tclass) { } } - memclrw(&declE, sizeof(declE)); - declE.x8 = templ->lex_order_count; - declE.xC = templ->flags & TEMPLCLASS_FLAGS_1; + memclrw(&layout, sizeof(layout)); + layout.lex_order_count = templ->lex_order_count; + layout.has_vtable = templ->flags & TEMPLCLASS_HAS_VTABLE; saveAlignMode = copts.structalignment; copts.structalignment = templ->align; - CDecl_CompleteClass(&declE, TYPE_CLASS(inst)); + CDecl_CompleteClass(&layout, TYPE_CLASS(inst)); copts.structalignment = saveAlignMode; if (templ->theclass.align > inst->theclass.align) { diff --git a/compiler_and_linker/unsorted/CTemplateFunc.c b/compiler_and_linker/unsorted/CTemplateFunc.c index 847b103..3c5de98 100644 --- a/compiler_and_linker/unsorted/CTemplateFunc.c +++ b/compiler_and_linker/unsorted/CTemplateFunc.c @@ -24,7 +24,7 @@ static Boolean CTempl_DeduceType1(Type *type1, UInt32 qual1, Type *type2, UInt32 static void CTemplFunc_SetupTypeDeduce(TypeDeduce *deduce, TemplateFunction *templ, TemplArg *args) { memclrw(deduce, sizeof(TypeDeduce)); - if (templ->tfunc->nspace->theclass && (templ->tfunc->nspace->theclass->flags & CLASS_FLAGS_100)) + if (templ->tfunc->nspace->theclass && (templ->tfunc->nspace->theclass->flags & CLASS_IS_TEMPL)) deduce->tmclass = TEMPL_CLASS(templ->tfunc->nspace->theclass); deduce->params = templ->params; deduce->args = args; @@ -110,12 +110,12 @@ static TemplFuncInstance *CTempl_GetCreateFuncInstance(Object *funcobj, TemplArg instobj->access = funcobj->access; instobj->nspace = funcobj->nspace; instobj->sclass = funcobj->sclass; - instobj->qual = funcobj->qual | Q_80000; + instobj->qual = funcobj->qual | Q_MANGLE_NAME; instobj->name = templ->name; instobj->u.func.inst = inst; CTemplFunc_SetupTypeDeduce(&deduce, templ, inst->args); - if (funcobj->nspace->theclass && (funcobj->nspace->theclass->flags & CLASS_FLAGS_800)) { + if (funcobj->nspace->theclass && (funcobj->nspace->theclass->flags & CLASS_IS_TEMPL_INST)) { deduce.tmclass = TEMPL_CLASS_INST(funcobj->nspace->theclass)->templ; deduce.inst = TEMPL_CLASS_INST(funcobj->nspace->theclass); } @@ -124,13 +124,13 @@ static TemplFuncInstance *CTempl_GetCreateFuncInstance(Object *funcobj, TemplArg inst->object = instobj; if (IS_TYPE_FUNC(instobj->type)) { - TYPE_FUNC(instobj->type)->flags &= ~FUNC_FLAGS_2; - if (TYPE_FUNC(instobj->type)->flags & FUNC_FLAGS_1000) { + TYPE_FUNC(instobj->type)->flags &= ~FUNC_DEFINED; + if (TYPE_FUNC(instobj->type)->flags & FUNC_IS_CTOR) { FuncArg *funcarg; - CError_ASSERT(152, TYPE_FUNC(instobj->type)->flags & FUNC_FLAGS_METHOD); + CError_ASSERT(152, TYPE_FUNC(instobj->type)->flags & FUNC_METHOD); CError_ASSERT(153, funcarg = TYPE_FUNC(instobj->type)->args); - if (TYPE_METHOD(instobj->type)->theclass->flags & CLASS_FLAGS_20) + if (TYPE_METHOD(instobj->type)->theclass->flags & CLASS_HAS_VBASES) CError_ASSERT(156, funcarg = funcarg->next); if (funcarg->next) @@ -1268,7 +1268,7 @@ static int CTemplFunc_TemplateNestLevel(NameSpace *nspace) { int level = 0; while (nspace) { - if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_900)) + if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL_ANY)) level++; nspace = nspace->parent; } @@ -1288,17 +1288,17 @@ static Boolean CTemplFunc_SameFuncType(TypeFunc *a, TypeFunc *b) { if (a->qual != b->qual) return 0; - if ((a->flags & (FUNC_FLAGS_PASCAL | FUNC_FLAGS_F0000000)) != (b->flags & (FUNC_FLAGS_PASCAL | FUNC_FLAGS_F0000000))) + if ((a->flags & FUNC_CALL_CONV_MASK) != (b->flags & FUNC_CALL_CONV_MASK)) return 0; arg1 = a->args; - if ((a->flags & FUNC_FLAGS_METHOD) && !TYPE_METHOD(a)->x26) { + if ((a->flags & FUNC_METHOD) && !TYPE_METHOD(a)->is_static) { CError_ASSERT(1808, arg1); arg1 = arg1->next; } arg2 = b->args; - if ((b->flags & FUNC_FLAGS_METHOD) && !TYPE_METHOD(b)->x26) { + if ((b->flags & FUNC_METHOD) && !TYPE_METHOD(b)->is_static) { CError_ASSERT(1814, arg2); arg2 = arg2->next; } diff --git a/compiler_and_linker/unsorted/CTemplateNew.c b/compiler_and_linker/unsorted/CTemplateNew.c index 9c94349..c33534a 100644 --- a/compiler_and_linker/unsorted/CTemplateNew.c +++ b/compiler_and_linker/unsorted/CTemplateNew.c @@ -278,12 +278,12 @@ static ENode *CTempl_ParseTemplArgExpr(Type *type, UInt32 qual) { } static Type *CTempl_ParseTemplArgTempl(TemplParam *params) { - CScopeParseResult pr; + NameResult pr; if ( (tk != TK_IDENTIFIER && tk != TK_COLON_COLON) || !CScope_ParseDeclName(&pr) || - !pr.x8 + !pr.type ) { CError_Error(CErrorStr121); @@ -291,26 +291,26 @@ static Type *CTempl_ParseTemplArgTempl(TemplParam *params) { return NULL; } - if (IS_TEMPL_CLASS(pr.x8)) { - if (params && !CTemplTool_EqualParams(params->data.templparam.plist, TEMPL_CLASS(pr.x8)->templ__params, 0)) { + if (IS_TEMPL_CLASS(pr.type)) { + if (params && !CTemplTool_EqualParams(params->data.templparam.plist, TEMPL_CLASS(pr.type)->templ__params, 0)) { CError_Error(CErrorStr235); tk = lex(); return NULL; } } else { - if (!CTemplTool_IsTemplateArgumentDependentType(pr.x8)) + if (!CTemplTool_IsTemplateArgumentDependentType(pr.type)) CError_Error(CErrorStr146); } tk = lex(); - return pr.x8; + return pr.type; } static UInt8 CTempl_GetTemplateNestIndex(NameSpace *nspace) { UInt8 count = 0; while (nspace) { - if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_900)) + if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL_ANY)) count++; nspace = nspace->parent; } @@ -778,7 +778,7 @@ Boolean CTempl_IsQualifiedMember(DeclInfo *di, Type *type, NameSpace **resultnsp static void *CTempl_ParseMemberFunction(int unk1, int unk2, int unk3, Object *func) { // no idea what should've been here, it's not called - CError_ASSERT(974, TYPE_FUNC(func->type)->flags & FUNC_FLAGS_METHOD); + CError_ASSERT(974, TYPE_FUNC(func->type)->flags & FUNC_METHOD); return NULL; } @@ -792,7 +792,7 @@ static void CTempl_ParseMember(TemplParam *params, TemplClass *templ, DeclInfo * Boolean saveForceLoc; TemplateMember *member; - if (templ->theclass.flags & CLASS_FLAGS_100) + if (templ->theclass.flags & CLASS_IS_TEMPL) di->thetype = CTemplTool_ResolveMemberSelfRefs(templ, di->thetype, &di->qual); if (IS_TYPE_FUNC(di->thetype)) { @@ -811,12 +811,12 @@ static void CTempl_ParseMember(TemplParam *params, TemplClass *templ, DeclInfo * } if ( - (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_2) && - (!(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100000) || object->u.func.u.templ->instances) + (TYPE_FUNC(object->type)->flags & FUNC_DEFINED) && + (!(TYPE_FUNC(object->type)->flags & FUNC_IS_TEMPL) || object->u.func.u.templ->instances) ) CError_Error(CErrorStr333, object); - TYPE_FUNC(object->type)->flags |= FUNC_FLAGS_800000 | FUNC_FLAGS_2; + TYPE_FUNC(object->type)->flags |= FUNC_IS_TEMPL_INSTANCE | FUNC_DEFINED; CPrep_StreamGetBlock(&stream, NULL, 1); saveForceLoc = gForceSourceLoc; @@ -859,7 +859,7 @@ static void CTempl_ParseMember(TemplParam *params, TemplClass *templ, DeclInfo * object->u.func.u.templ->stream = stream; } else { - if (!(templ->theclass.flags & CLASS_FLAGS_100)) { + if (!(templ->theclass.flags & CLASS_IS_TEMPL)) { CError_Error(CErrorStr190); return; } @@ -903,9 +903,9 @@ static TemplateFunction *CTempl_DeclareTemplateFunction(DeclInfo *di, TemplParam object->name = di->name; object->u.func.linkname = CParser_GetUniqueName(); object->type = di->thetype; - object->qual = di->qual | Q_80000; + object->qual = di->qual | Q_MANGLE_NAME; object->sclass = di->storageclass; - TYPE_FUNC(object->type)->flags |= FUNC_FLAGS_100000; + TYPE_FUNC(object->type)->flags |= FUNC_IS_TEMPL; object->u.func.u.templ = templ; if (di->qual & Q_INLINE) @@ -931,10 +931,10 @@ static void CTempl_ParseTemplateFunction(TemplateFunction *templ, TypeClass *tcl object->sclass = TK_STATIC; } - if (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_2) + if (TYPE_FUNC(object->type)->flags & FUNC_DEFINED) CError_Error(CErrorStr333, object); - TYPE_FUNC(object->type)->flags |= FUNC_FLAGS_2 | FUNC_FLAGS_800000; + TYPE_FUNC(object->type)->flags |= FUNC_DEFINED | FUNC_IS_TEMPL_INSTANCE; CPrep_StreamGetBlock(&templ->stream, NULL, 0); @@ -972,7 +972,7 @@ static HashNameNode *CTempl_FindConversionFuncName(TypeClass *tclass, Type *type return NULL; } while ( !IS_TYPE_FUNC(object->type) || - !(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_40) || + !(TYPE_FUNC(object->type)->flags & FUNC_CONVERSION) || (TYPE_FUNC(object->type)->qual & (Q_CONST | Q_VOLATILE)) != (qual & (Q_CONST | Q_VOLATILE)) || !is_typesame(TYPE_FUNC(object->type)->functype, type) ); @@ -987,7 +987,7 @@ static void CTempl_ParseConversionFunctionTemplate(DeclInfo *di, DeclFucker *wha return; } - tclass->flags = tclass->flags | CLASS_FLAGS_40; + tclass->flags = tclass->flags | CLASS_IS_CONVERTIBLE; CError_QualifierCheck(di->qual & ~Q_INLINE); conversion_type_name(di); @@ -1063,12 +1063,12 @@ static void CTempl_ParseFunctionOrMemberTemplate(DeclFucker *what_is_this, Templ CError_ASSERT(1344, IS_TYPE_FUNC(di.x10->type)); tfunc = TYPE_FUNC(di.x10->type); - if (tfunc->flags & FUNC_FLAGS_40) { + if (tfunc->flags & FUNC_CONVERSION) { di.thetype = tfunc->functype; di.qual |= tfunc->qual; di.nspace = di.x10->nspace; di.name = di.x10->name; - } else if (tfunc->flags & FUNC_FLAGS_1000) { + } else if (tfunc->flags & FUNC_IS_CTOR) { di.thetype = TYPE(&void_ptr); di.nspace = di.x10->nspace; di.name = di.x10->name; @@ -1102,7 +1102,7 @@ static void CTempl_ParseFunctionOrMemberTemplate(DeclFucker *what_is_this, Templ } } - CError_QualifierCheck(di.qual & ~(Q_CONST | Q_VOLATILE | Q_ASM | Q_PASCAL | Q_INLINE | Q_EXPLICIT | Q_20000 | Q_OVERLOAD | Q_ALIGNED_MASK)); + CError_QualifierCheck(di.qual & ~(Q_CONST | Q_VOLATILE | Q_ASM | Q_PASCAL | Q_INLINE | Q_EXPLICIT | Q_20000 | Q_WEAK | Q_ALIGNED_MASK)); if (tk == TK_OPERATOR && di.x4A) { CTempl_ParseConversionFunctionTemplate(&di, what_is_this, params, tclass, startOffset, access); @@ -1126,10 +1126,10 @@ static void CTempl_ParseFunctionOrMemberTemplate(DeclFucker *what_is_this, Templ TYPE_FUNC(di.thetype)->args = NULL; } - if (tclass->flags & CLASS_FLAGS_20) + if (tclass->flags & CLASS_HAS_VBASES) CDecl_AddArgument(TYPE_FUNC(di.thetype), TYPE(&stsignedshort)); - TYPE_FUNC(di.thetype)->flags |= FUNC_FLAGS_1000; + TYPE_FUNC(di.thetype)->flags |= FUNC_IS_CTOR; di.name = constructor_name_node; what_is_this->nspace->tparams = NULL; @@ -1165,10 +1165,10 @@ static void CTempl_ParseFunctionOrMemberTemplate(DeclFucker *what_is_this, Templ if (IS_TYPE_FUNC(di.thetype)) { di.name = constructor_name_node; - if (tclass2->flags & CLASS_FLAGS_20) + if (tclass2->flags & CLASS_HAS_VBASES) CDecl_AddArgument(TYPE_FUNC(di.thetype), TYPE(&stsignedshort)); - TYPE_FUNC(di.thetype)->flags |= FUNC_FLAGS_1000; + TYPE_FUNC(di.thetype)->flags |= FUNC_IS_CTOR; CTempl_ParseMember(params, TEMPL_CLASS(tclass2), &di, startOffset); } else { CError_Error(CErrorStr241); @@ -1228,7 +1228,7 @@ static void CTempl_ParseFunctionOrMemberTemplate(DeclFucker *what_is_this, Templ CDecl_AddArgument(TYPE_FUNC(di.thetype), TYPE(&stsignedshort)); di.name = destructor_name_node; - TYPE_FUNC(di.thetype)->flags |= FUNC_FLAGS_2000; + TYPE_FUNC(di.thetype)->flags |= FUNC_IS_DTOR; CTempl_ParseMember(params, TEMPL_CLASS(tclass2), &di, startOffset); } else { CError_Error(CErrorStr241); @@ -1360,7 +1360,7 @@ static void CTempl_ExplicitInstantiation(void) { if (tk == ';') { if (IS_TEMPL_CLASS_INST(di.thetype)) { CTempl_InstantiateTemplateClass(TYPE_CLASS(di.thetype)); - if ((TYPE_CLASS(di.thetype)->flags & CLASS_FLAGS_2) && !(TYPE_CLASS(di.thetype)->eflags & CLASS_EFLAGS_IMPORT)) { + if ((TYPE_CLASS(di.thetype)->flags & CLASS_COMPLETED) && !(TYPE_CLASS(di.thetype)->eflags & CLASS_EFLAGS_IMPORT)) { if (flag) CTempl_GenClassInstance(TEMPL_CLASS_INST(di.thetype), 1); else @@ -1525,13 +1525,13 @@ void CTempl_Parse(TemplClass *templ, AccessType access) { switch (tk) { case TK_CLASS: - mode = CLASS_MODE_2; + mode = CLASS_MODE_CLASS; break; case TK_UNION: - mode = CLASS_MODE_1; + mode = CLASS_MODE_UNION; break; case TK_STRUCT: - mode = CLASS_MODE_0; + mode = CLASS_MODE_STRUCT; break; default: mode = -1; @@ -1587,7 +1587,7 @@ void CTempl_ParseInstanceScopeFunction(Object *funcobj, TemplClassInst *inst, Ty TemplStack stack; params = inst->templ->templ__params; - if (funcobj->qual & Q_400000) { + if (funcobj->qual & Q_IS_TEMPLATED) { for (member = CTemplClass_GetMasterTemplate(inst->templ)->members, parent = OBJECT_TEMPL(funcobj)->parent; member; member = member->next) { if (member->object == parent) { if (member->params) @@ -1656,12 +1656,12 @@ Boolean CTempl_GenFuncInstance(TemplateFunction *templ, TemplFuncInstance *inst, } if (inst->object->sclass != TK_STATIC) - inst->object->qual |= Q_OVERLOAD; + inst->object->qual |= Q_WEAK; memclrw(&di, sizeof(di)); di.file2 = templ->srcfile; di.file = CPrep_BrowserCurrentFile(); - di.x60 = templ->startoffset; + di.sourceoffset = templ->startoffset; CTemplTool_PushInstance(&stack, NULL, inst->object); CTemplTool_MergeArgNames(TYPE_FUNC(templ->tfunc->type), TYPE_FUNC(inst->object->type)); @@ -1682,7 +1682,7 @@ Boolean CTempl_GenFuncInstance(TemplateFunction *templ, TemplFuncInstance *inst, copts.filesyminfo = saveDebugInfo; if (di.file->recordbrowseinfo) - CBrowse_NewFunction(inst->object, di.file, di.file2, di.x60, templ->endoffset); + CBrowse_NewFunction(inst->object, di.file, di.file2, di.sourceoffset, templ->endoffset); return 1; } @@ -1719,12 +1719,12 @@ void CTempl_InstantiateMember(TemplClass *templ, TemplClassInst *inst, TemplateM } if (object->sclass != TK_STATIC) - object->qual |= Q_OVERLOAD; + object->qual |= Q_WEAK; memclrw(&di, sizeof(di)); di.file2 = tmemb->srcfile; di.file = CPrep_BrowserCurrentFile(); - di.x60 = tmemb->startoffset; + di.sourceoffset = tmemb->startoffset; switch (object->datatype) { case DFUNC: @@ -1782,24 +1782,24 @@ static Boolean CTempl_GenClassInstance(TemplClassInst *inst, Boolean flag) { if (IS_TYPE_FUNC(object->type) && object->datatype != DALIAS) { if ( (flag || (object->flags & OBJECT_FLAGS_2)) && - !(TYPE_FUNC(object->type)->flags & (FUNC_FLAGS_2 | FUNC_FLAGS_100)) && + !(TYPE_FUNC(object->type)->flags & (FUNC_DEFINED | FUNC_AUTO_GENERATED)) && CTempl_GenMemberInstance(inst, OBJECT_TEMPL(object), flag) && - (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_2) + (TYPE_FUNC(object->type)->flags & FUNC_DEFINED) ) result = 1; } else { if ( - !inst->x49 && + !inst->static_instantiated && object->datatype == DDATA && - !(object->qual & Q_10000) && - !(object->flags & OBJECT_FLAGS_4) && + !(object->qual & Q_INLINE_DATA) && + !(object->flags & OBJECT_DEFINED) && CTempl_GenMemberInstance(inst, OBJECT_TEMPL(object), flag) ) result = 1; } } - inst->x49 = 1; + inst->static_instantiated = 1; return result; } @@ -1814,7 +1814,7 @@ Boolean CTempl_Instantiate(void) { for (templ = ctempl_templates; templ; templ = templ->next) { for (inst = templ->instances; inst; inst = inst->next) { if ( - (inst->theclass.flags & CLASS_FLAGS_800) && + (inst->theclass.flags & CLASS_IS_TEMPL_INST) && !inst->is_specialized && CTempl_GenClassInstance(inst, 0) ) @@ -1824,7 +1824,7 @@ Boolean CTempl_Instantiate(void) { for (pspec = templ->pspecs; pspec; pspec = pspec->next) { for (inst = pspec->templ->instances; inst; inst = inst->next) { if ( - (inst->theclass.flags & CLASS_FLAGS_800) && + (inst->theclass.flags & CLASS_IS_TEMPL_INST) && !inst->is_specialized && CTempl_GenClassInstance(inst, 0) ) @@ -1839,7 +1839,7 @@ Boolean CTempl_Instantiate(void) { !instf->is_instantiated && !instf->is_specialized && (instf->object->flags & OBJECT_FLAGS_2) && - !(TYPE_FUNC(instf->object->type)->flags & FUNC_FLAGS_2) + !(TYPE_FUNC(instf->object->type)->flags & FUNC_DEFINED) ) { instf->is_instantiated = 1; @@ -1857,9 +1857,9 @@ Boolean CTempl_InlineFunctionCheck(Object *funcobj) { TemplateMember *member; Object *parent; - CError_ASSERT(2422, IS_TYPE_FUNC(funcobj->type) && (funcobj->qual & Q_400000)); + CError_ASSERT(2422, IS_TYPE_FUNC(funcobj->type) && (funcobj->qual & Q_IS_TEMPLATED)); - if (!(TYPE_FUNC(funcobj->type)->flags & FUNC_FLAGS_2)) { + if (!(TYPE_FUNC(funcobj->type)->flags & FUNC_DEFINED)) { inst = TEMPL_CLASS_INST(TYPE_METHOD(funcobj->type)->theclass); if (!inst->is_specialized) { parent = OBJECT_TEMPL(funcobj)->parent; diff --git a/compiler_and_linker/unsorted/CTemplateTools.c b/compiler_and_linker/unsorted/CTemplateTools.c index 03a51cb..0e77e74 100644 --- a/compiler_and_linker/unsorted/CTemplateTools.c +++ b/compiler_and_linker/unsorted/CTemplateTools.c @@ -376,7 +376,7 @@ static FuncArg *CTemplTool_GetFirstRealArg(TypeFunc *tfunc) { if (IS_TYPEFUNC_NONSTATIC_METHOD(tfunc)) { CError_ASSERT(502, arg); arg = arg->next; - if ((tfunc->flags & FUNC_FLAGS_1000) && (TYPE_METHOD(tfunc)->theclass->flags & CLASS_FLAGS_20)) { + if ((tfunc->flags & FUNC_IS_CTOR) && (TYPE_METHOD(tfunc)->theclass->flags & CLASS_HAS_VBASES)) { CError_ASSERT(507, arg); arg = arg->next; } @@ -543,7 +543,7 @@ void CTemplTool_SetupOuterTemplateArgumentNameSpace(NameSpace *nspace) { NameSpace *newns; while (nspace) { - if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_800)) { + if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL_INST)) { newns = CTemplTool_SetupTemplateArgumentNameSpace( TEMPL_CLASS_INST(nspace->theclass)->templ->templ__params, TEMPL_CLASS_INST(nspace->theclass)->inst_args, @@ -570,7 +570,7 @@ NameSpace *CTemplTool_InsertTemplateArgumentNameSpace(TemplParam *params, TemplC void CTemplTool_RemoveOuterTemplateArgumentNameSpace(NameSpace *nspace) { while (nspace->parent) { - if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_800) && nspace->parent->is_templ) + if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL_INST) && nspace->parent->is_templ) nspace->parent = nspace->parent->parent; nspace = nspace->parent; } @@ -595,7 +595,7 @@ Boolean CTemplTool_IsTemplateArgumentDependentType(Type *type) { case TYPESTRUCT: return 0; case TYPECLASS: - return (TYPE_CLASS(type)->flags & CLASS_FLAGS_100) ? 1 : 0; + return (TYPE_CLASS(type)->flags & CLASS_IS_TEMPL) ? 1 : 0; case TYPEMEMBERPOINTER: if (CTemplTool_IsTemplateArgumentDependentType(TYPE_MEMBER_POINTER(type)->ty1)) return 1; @@ -1004,7 +1004,7 @@ static TemplClassInst *CTemplTool_FindNestedClassInstance(TemplClass *a, TemplCl if (i < 0) break; - if ((inst->theclass.flags & (CLASS_FLAGS_2 | CLASS_FLAGS_800)) == CLASS_FLAGS_800) + if ((inst->theclass.flags & (CLASS_COMPLETED | CLASS_IS_TEMPL_INST)) == CLASS_IS_TEMPL_INST) CTempl_InstantiateTemplateClass(TYPE_CLASS(inst)); } @@ -1067,7 +1067,7 @@ static Type *CTemplTool_FindTemplateInstance(TypeDeduce *deduce, TemplClass *tem if (dtempl->flags & TEMPLCLASS_FLAGS_2) { scantempl = TEMPL_CLASS(dtempl->theclass.nspace->theclass); - CError_ASSERT(1422, scantempl->theclass.flags & CLASS_FLAGS_100); + CError_ASSERT(1422, scantempl->theclass.flags & CLASS_IS_TEMPL); scaninst = dinst; while (1) { @@ -1127,7 +1127,7 @@ ENode *CTemplTool_DeduceExpr(TypeDeduce *deduce, ENode *expr) { ENode *newExpr; NameSpaceObjectList *nsObjectList; TStreamElement *saved; - CScopeParseResult pr; + NameResult pr; Type *type; UInt32 qual; @@ -1310,7 +1310,7 @@ ENode *CTemplTool_DeduceDefaultArg(Object *func, ENode *expr) { if (func->u.func.inst) deduce.args = func->u.func.inst->args; - if ((TYPE_FUNC(func->type)->flags & FUNC_FLAGS_METHOD) && (TYPE_METHOD(func->type)->theclass->flags & CLASS_FLAGS_800)) { + if ((TYPE_FUNC(func->type)->flags & FUNC_METHOD) && (TYPE_METHOD(func->type)->theclass->flags & CLASS_IS_TEMPL_INST)) { deduce.inst = TEMPL_CLASS_INST(TYPE_METHOD(func->type)->theclass); deduce.tmclass = TEMPL_CLASS_INST(TYPE_METHOD(func->type)->theclass)->templ; } @@ -1572,7 +1572,7 @@ static Type *CTemplTool_DeduceBitfieldCopy(TypeDeduce *deduce, Type *type, ENode tbitfield->type = TYPEBITFIELD; tbitfield->size = type->size; tbitfield->bitfieldtype = type; - tbitfield->unkB = sizeval; + tbitfield->bitlength = sizeval; return TYPE(tbitfield); } @@ -1817,7 +1817,7 @@ Type *CTemplTool_DeduceTypeCopy(TypeDeduce *deduce, Type *type, UInt32 *resultQu case TYPEENUM: if ( TYPE_ENUM(type)->nspace->theclass && - (TYPE_ENUM(type)->nspace->theclass->flags & CLASS_FLAGS_100) && + (TYPE_ENUM(type)->nspace->theclass->flags & CLASS_IS_TEMPL) && !deduce->x14 ) { @@ -1834,10 +1834,10 @@ Type *CTemplTool_DeduceTypeCopy(TypeDeduce *deduce, Type *type, UInt32 *resultQu case TYPECLASS: if (!deduce->x14) { - if (TYPE_CLASS(type)->flags & CLASS_FLAGS_100) + if (TYPE_CLASS(type)->flags & CLASS_IS_TEMPL) return CTemplTool_FindTemplateInstance(deduce, TEMPL_CLASS(type)); - if (TYPE_CLASS(type)->nspace->theclass && (TYPE_CLASS(type)->nspace->theclass->flags & CLASS_FLAGS_100)) { + if (TYPE_CLASS(type)->nspace->theclass && (TYPE_CLASS(type)->nspace->theclass->flags & CLASS_IS_TEMPL)) { CError_ASSERT(2492, deduce->inst); CError_ASSERT(2493, TYPE_CLASS(type)->classname); @@ -1904,11 +1904,11 @@ Type *CTemplTool_DeduceTypeCopy(TypeDeduce *deduce, Type *type, UInt32 *resultQu return deduced; case TYPEFUNC: - if (TYPE_FUNC(type)->flags & FUNC_FLAGS_METHOD) { + if (TYPE_FUNC(type)->flags & FUNC_METHOD) { qual2 = 0; deduced = galloc(sizeof(TypeMemberFunc)); *TYPE_METHOD(deduced) = *TYPE_METHOD(type); - TYPE_METHOD(deduced)->x22 = 0; + TYPE_METHOD(deduced)->funcid = 0; TYPE_METHOD(deduced)->theclass = TYPE_CLASS(CTemplTool_DeduceTypeQualCopy(deduce, TYPE(TYPE_METHOD(type)->theclass), &qual2)); CError_ASSERT(2556, IS_TYPE_CLASS(TYPE_METHOD(deduced)->theclass)); } else { @@ -1916,7 +1916,7 @@ Type *CTemplTool_DeduceTypeCopy(TypeDeduce *deduce, Type *type, UInt32 *resultQu *TYPE_FUNC(deduced) = *TYPE_FUNC(type); } - TYPE_FUNC(deduced)->flags &= ~FUNC_FLAGS_100000; + TYPE_FUNC(deduced)->flags &= ~FUNC_IS_TEMPL; qual2 = TYPE_FUNC(type)->qual; TYPE_FUNC(deduced)->functype = CTemplTool_DeduceTypeQualCopy(deduce, TYPE_FUNC(type)->functype, &qual2); diff --git a/compiler_and_linker/unsorted/FuncLevelAsmPPC.c b/compiler_and_linker/unsorted/FuncLevelAsmPPC.c index dead030..8b45459 100644 --- a/compiler_and_linker/unsorted/FuncLevelAsmPPC.c +++ b/compiler_and_linker/unsorted/FuncLevelAsmPPC.c @@ -85,7 +85,7 @@ void assign_local_addresses(void) { for (list = locals; list; list = list->next) { vi = CodeGen_GetNewVarInfo(); list->object->u.var.info = vi; - list->object->flags |= OBJECT_FLAGS_1; + list->object->flags |= OBJECT_USED; vi->used = 1; } @@ -241,7 +241,7 @@ void Assembler(Object *func) { cprep_eoltokens = 0; name = CMangler_GetLinkName(func)->name; - func->flags |= OBJECT_FLAGS_4; + func->flags |= OBJECT_DEFINED; if (fralloc_parameter_area_size) update_out_param_size(fralloc_parameter_area_size); diff --git a/compiler_and_linker/unsorted/FunctionCalls.c b/compiler_and_linker/unsorted/FunctionCalls.c index 898d567..67d7443 100644 --- a/compiler_and_linker/unsorted/FunctionCalls.c +++ b/compiler_and_linker/unsorted/FunctionCalls.c @@ -480,7 +480,7 @@ static Boolean needs_TOC_reload(Object *func) { } static void load_virtual_function(TypeClass *tclass, SInt32 offset, int reg, Operand *opnd) { - if (tclass->flags & CLASS_FLAGS_1) { + if (tclass->flags & CLASS_HANDLEOBJECT) { load_store_register(PC_LWZ, 12, reg, NULL, 0); load_store_register(PC_LWZ, 12, 12, NULL, tclass->vtable->offset); } else { diff --git a/compiler_and_linker/unsorted/GenStabs.c b/compiler_and_linker/unsorted/GenStabs.c index f024ede..f0c2777 100644 --- a/compiler_and_linker/unsorted/GenStabs.c +++ b/compiler_and_linker/unsorted/GenStabs.c @@ -417,8 +417,8 @@ static void local_struct_add(StabType *list) { StabAppendType(TYPE_BITFIELD(type)->bitfieldtype); sprintf(buf, ",%d,%d;", - TYPE_BITFIELD(type)->unkA + member->offset * 8, - TYPE_BITFIELD(type)->unkB); + TYPE_BITFIELD(type)->offset + member->offset * 8, + TYPE_BITFIELD(type)->bitlength); AppendGListName(&stab_string, buf); } else { StabAppendType(type); @@ -508,7 +508,7 @@ static void local_class_add(StabClass *list) { list->id2 = list->id; - if (TYPE_CLASS(type)->flags & CLASS_FLAGS_1) { + if (TYPE_CLASS(type)->flags & CLASS_HANDLEOBJECT) { AppendGListName(&stab_string, "*"); StabAppendNextTypeDefinition(); } @@ -574,8 +574,8 @@ static void local_class_add(StabClass *list) { if (IS_TYPE_BITFIELD(ivarType)) { StabAppendType(TYPE_BITFIELD(ivarType)->bitfieldtype); sprintf(buf, ",%d,%d;", - TYPE_BITFIELD(ivarType)->unkA + ivar->offset * 8, - TYPE_BITFIELD(ivarType)->unkB); + TYPE_BITFIELD(ivarType)->offset + ivar->offset * 8, + TYPE_BITFIELD(ivarType)->bitlength); AppendGListName(&stab_string, buf); } else { StabAppendType(ivarType); @@ -1106,7 +1106,7 @@ void GenStab_Var(Object *object) { StabAppendType(object->type); output_stab_string(Output_LSYM_Stab, 0, local_offset_32(object)); } - } else if (CParser_HasInternalLinkage(object) || (object->qual & (Q_20000 | Q_OVERLOAD))) { + } else if (CParser_HasInternalLinkage(object) || (object->qual & (Q_20000 | Q_WEAK))) { AppendGListName(&stab_string, ":S"); StabAppendType(object->type); output_stab_string(Output_STSYM_Stab, 0, CMangler_GetLinkName(object)->id); diff --git a/compiler_and_linker/unsorted/InlineAsm.c b/compiler_and_linker/unsorted/InlineAsm.c index 3594cb0..46a95d2 100644 --- a/compiler_and_linker/unsorted/InlineAsm.c +++ b/compiler_and_linker/unsorted/InlineAsm.c @@ -103,7 +103,7 @@ Boolean InlineAsm_LookupSymbolOrTag(HashNameNode *name, IALookupResult *result, result->has_value = 1; result->value = OBJECT(obj)->u.address; } else { - if (OBJECT(obj)->datatype == DDATA && (OBJECT(obj)->qual & Q_10000)) + if (OBJECT(obj)->datatype == DDATA && (OBJECT(obj)->qual & Q_INLINE_DATA)) CInit_ExportConst(OBJECT(obj)); result->object = OBJECT(obj); } diff --git a/compiler_and_linker/unsorted/InlineAsmPPC.c b/compiler_and_linker/unsorted/InlineAsmPPC.c index 9da367a..39a4056 100644 --- a/compiler_and_linker/unsorted/InlineAsmPPC.c +++ b/compiler_and_linker/unsorted/InlineAsmPPC.c @@ -630,7 +630,7 @@ static void memoryoperand(IAOperand *op, InlineAsm *ia, Boolean flag, short effe CError_Error(CErrorStr155); } - expr.object->flags |= OBJECT_FLAGS_1; + expr.object->flags |= OBJECT_USED; return; } @@ -679,7 +679,7 @@ static void memoryoperand(IAOperand *op, InlineAsm *ia, Boolean flag, short effe op[0].u.obj.obj = expr.xC; op[0].u.obj.offset = expr.value; - expr.xC->flags |= OBJECT_FLAGS_1; + expr.xC->flags |= OBJECT_USED; return; } @@ -732,7 +732,7 @@ static void registeroperand(IAOperand *op, char rclass, short effect) { op->u.reg.num = num; op->u.reg.effect = effect; if (obj) { - reg->object->flags |= OBJECT_FLAGS_1; + reg->object->flags |= OBJECT_USED; Registers_GetVarInfo(obj)->flags |= VarInfoFlag40; } } else if (rclass == RegClass_CRFIELD) { @@ -889,7 +889,7 @@ static void imm_or_labeldiff_operand(InlineAsm *ia, IAOperand *op, SInt32 minimu InlineAsm_ExpressionPPC(&expr, 0); - if ((obj = expr.xC) && !expr.x10 && expr.type == IAExpr_5 && obj->datatype == DDATA && IS_TYPE_INT_OR_ENUM(obj->type) && (obj->qual & Q_10000)) { + if ((obj = expr.xC) && !expr.x10 && expr.type == IAExpr_5 && obj->datatype == DDATA && IS_TYPE_INT_OR_ENUM(obj->type) && (obj->qual & Q_INLINE_DATA)) { switch (ia->opcode) { case PC_ADDI: case PC_ADDIC: @@ -1574,10 +1574,10 @@ static IAEntryPoint *InlineAsm_CreateEntryPoint(HashNameNode *name, Boolean flag IALookupResult result; if (InlineAsm_LookupSymbol(name, &result) && (obj = result.object)) { - if (!(obj->datatype == DFUNC && !(obj->flags & OBJECT_FLAGS_4))) + if (!(obj->datatype == DFUNC && !(obj->flags & OBJECT_DEFINED))) CError_Error(CErrorStr122, name->name); - obj->flags |= OBJECT_FLAGS_4; + obj->flags |= OBJECT_DEFINED; obj->sclass = flag ? TK_STATIC : TK_EXTERN; ep = lalloc(sizeof(IAEntryPoint)); diff --git a/compiler_and_linker/unsorted/Intrinsics.c b/compiler_and_linker/unsorted/Intrinsics.c index 7384b5d..59d3a24 100644 --- a/compiler_and_linker/unsorted/Intrinsics.c +++ b/compiler_and_linker/unsorted/Intrinsics.c @@ -2246,7 +2246,7 @@ int is_intrinsic_function_call(ENode *funccall) { return ENODE_IS(funcref, EOBJREF) && funcref->data.objref->datatype == DFUNC && - (TYPE_FUNC(funcref->data.objref->type)->flags & FUNC_FLAGS_200); + (TYPE_FUNC(funcref->data.objref->type)->flags & FUNC_INTRINSIC); } static void abs_intrinsic(ENode *expr, short outputReg, Operand *output) { @@ -4552,7 +4552,7 @@ void Intrinsics_SetupRuntimeObjects(void) { for (i = 0; i < MaxIntrinsics; i++) { CError_ASSERT(6600, intrinsics[i]); intrinsics[i]->u.func.u.intrinsicid = i; - TYPE_FUNC(intrinsics[i]->type)->flags |= FUNC_FLAGS_200; + TYPE_FUNC(intrinsics[i]->type)->flags |= FUNC_INTRINSIC; CScope_AddGlobalObject(intrinsics[i]); } diff --git a/compiler_and_linker/unsorted/IroDump.c b/compiler_and_linker/unsorted/IroDump.c index 38412ea..e7ca940 100644 --- a/compiler_and_linker/unsorted/IroDump.c +++ b/compiler_and_linker/unsorted/IroDump.c @@ -629,7 +629,7 @@ void IRO_SpellType(Type *type, char *buf) { break; case TYPEBITFIELD: IRO_SpellType(TYPE_BITFIELD(type)->bitfieldtype, mybuf); - sprintf(buf, "bitfield(%s){%d:%d}", mybuf, TYPE_BITFIELD(type)->unkA, TYPE_BITFIELD(type)->unkB); + sprintf(buf, "bitfield(%s){%d:%d}", mybuf, TYPE_BITFIELD(type)->offset, TYPE_BITFIELD(type)->bitlength); break; case TYPELABEL: strcpy(buf, "label"); diff --git a/compiler_and_linker/unsorted/IroEval.c b/compiler_and_linker/unsorted/IroEval.c index a34cf89..adf74b8 100644 --- a/compiler_and_linker/unsorted/IroEval.c +++ b/compiler_and_linker/unsorted/IroEval.c @@ -133,7 +133,7 @@ void IRO_TruncateBitfieldValueToType(CInt64 *val, Type *type, Type *type2) { CInt64 work; work = cint64_zero; - limit = TYPE_BITFIELD(type2)->unkB; + limit = TYPE_BITFIELD(type2)->bitlength; for (i = 0; i < limit; i++) work = CInt64_Or(work, CInt64_Shl(cint64_one, IRO_MakeULong(i))); *val = CInt64_And(*val, work); diff --git a/compiler_and_linker/unsorted/IroTransform.c b/compiler_and_linker/unsorted/IroTransform.c index e63421b..54f3302 100644 --- a/compiler_and_linker/unsorted/IroTransform.c +++ b/compiler_and_linker/unsorted/IroTransform.c @@ -655,7 +655,7 @@ static void DoTransformations11(IROLinear *nd) { left->u.monadic->u.monadic->nodetype == EBITFIELD && IS_TYPE_BITFIELD(left->u.monadic->u.monadic->rtype) ) - tmp2 = TYPE_BITFIELD(left->u.monadic->u.monadic->rtype)->unkB; + tmp2 = TYPE_BITFIELD(left->u.monadic->u.monadic->rtype)->bitlength; else tmp2 = type->size * 8; } else { diff --git a/compiler_and_linker/unsorted/IroUtil.c b/compiler_and_linker/unsorted/IroUtil.c index 3ed6350..4ade9b1 100644 --- a/compiler_and_linker/unsorted/IroUtil.c +++ b/compiler_and_linker/unsorted/IroUtil.c @@ -123,9 +123,9 @@ Boolean IRO_TypesEqual(Type *a, Type *b) { if (IS_TYPE_BITFIELD(a)) { if (IS_TYPE_BITFIELD(b)) { if ( - (TYPE_BITFIELD(a)->bitfieldtype == TYPE_BITFIELD(b)->bitfieldtype) && - (TYPE_BITFIELD(a)->unkA == TYPE_BITFIELD(b)->unkA) && - (TYPE_BITFIELD(a)->unkB == TYPE_BITFIELD(b)->unkB)) + (TYPE_BITFIELD(a)->bitfieldtype == TYPE_BITFIELD(b)->bitfieldtype) && + (TYPE_BITFIELD(a)->offset == TYPE_BITFIELD(b)->offset) && + (TYPE_BITFIELD(a)->bitlength == TYPE_BITFIELD(b)->bitlength)) return 1; } return 0; diff --git a/compiler_and_linker/unsorted/IroVars.c b/compiler_and_linker/unsorted/IroVars.c index 15e7e65..6bb3d02 100644 --- a/compiler_and_linker/unsorted/IroVars.c +++ b/compiler_and_linker/unsorted/IroVars.c @@ -1296,8 +1296,8 @@ static Boolean CheckAddressConsistency(IROLinear *nd, VarRecord *var, SInt32 add flag = 0; inner = nd->u.monadic; if (inner->type == IROLinearOp1Arg && inner->nodetype == EBITFIELD) { - start_bit = TYPE_BITFIELD(inner->rtype)->unkA + 8 * addend; - end_bit = start_bit + TYPE_BITFIELD(inner->rtype)->unkB - 1; + start_bit = TYPE_BITFIELD(inner->rtype)->offset + 8 * addend; + end_bit = start_bit + TYPE_BITFIELD(inner->rtype)->bitlength - 1; } else { start_bit = 8 * addend; end_bit = start_bit + 8 * type->size - 1; diff --git a/compiler_and_linker/unsorted/ObjGenMachO.c b/compiler_and_linker/unsorted/ObjGenMachO.c index 684316e..072824a 100644 --- a/compiler_and_linker/unsorted/ObjGenMachO.c +++ b/compiler_and_linker/unsorted/ObjGenMachO.c @@ -126,7 +126,7 @@ static Section ObjGen_CheckCoalesceSection(Object *object) { if ( !CParser_HasInternalLinkage(object) && - (object->qual & (Q_20000 | Q_OVERLOAD)) && + (object->qual & (Q_20000 | Q_WEAK)) && (s = def_section_info[object->section].x1) != SECT_DEFAULT ) return s; @@ -191,22 +191,22 @@ static char ObjGen_ComputePrivFlag(UInt8 objectFlags) { case 0: case 1: if ( - (objectFlags & OBJECT_FLAGS_1) && + (objectFlags & OBJECT_USED) && (objectFlags & OBJECT_FLAGS_2) && - !(objectFlags & OBJECT_FLAGS_4) + !(objectFlags & OBJECT_DEFINED) ) return 0; return 1; case 3: case 4: - if ((objectFlags & OBJECT_FLAGS_10) == OBJECT_FLAGS_10) + if ((objectFlags & OBJECT_INTERNAL) == OBJECT_INTERNAL) return 1; - if ((objectFlags & OBJECT_FLAGS_40) == OBJECT_FLAGS_40) + if ((objectFlags & OBJECT_EXPORT) == OBJECT_EXPORT) return 0; if ( - (objectFlags & OBJECT_FLAGS_1) && + (objectFlags & OBJECT_USED) && (objectFlags & OBJECT_FLAGS_2) && - !(objectFlags & OBJECT_FLAGS_4) + !(objectFlags & OBJECT_DEFINED) ) return 0; return 1; @@ -272,7 +272,7 @@ SInt32 ObjGen_GetHashNodeRelocID(Object *object, MachOSection *section, SInt32 v r.x2 = 1; r.privFlag = ObjGen_ComputePrivFlag(object->flags); if (!CParser_HasInternalLinkage(object)) - r.x3 = (object->qual & (Q_20000 | Q_OVERLOAD)) > 0; + r.x3 = (object->qual & (Q_20000 | Q_WEAK)) > 0; r.name = name->name; r.x4 = value; @@ -282,7 +282,7 @@ SInt32 ObjGen_GetHashNodeRelocID(Object *object, MachOSection *section, SInt32 v } else if (section) { other_rd = &RELOC_DATA(name->id); other_rd->privFlag = ObjGen_ComputePrivFlag(object->flags); - if (!CParser_HasInternalLinkage(object) && (object->qual & (Q_20000 | Q_OVERLOAD))) { + if (!CParser_HasInternalLinkage(object) && (object->qual & (Q_20000 | Q_WEAK))) { other_rd->x3 = 1; switch (other_rd->type) { case RT_0: @@ -399,7 +399,7 @@ static Boolean ObjGen_DeclareSymbol(Object *object, MachOSection *section, SInt3 } } - if (!CParser_HasInternalLinkage(object) && (object->qual & (Q_20000 | Q_OVERLOAD))) + if (!CParser_HasInternalLinkage(object) && (object->qual & (Q_20000 | Q_WEAK))) r.x3 = 1; r.x4 = value; @@ -1023,7 +1023,7 @@ static void patchuplazyptr(Object *object) { RelocDataT *rd; Object *toc; - if (CParser_HasInternalLinkage(object) || !(object->qual & (Q_20000 | Q_OVERLOAD))) { + if (CParser_HasInternalLinkage(object) || !(object->qual & (Q_20000 | Q_WEAK))) { toc = object->toc; if (toc->section == SECT_NONLAZY_PTRS) { toc->section = SECT_CONST_PTR; diff --git a/compiler_and_linker/unsorted/Operands.c b/compiler_and_linker/unsorted/Operands.c index 08eee12..c5da285 100644 --- a/compiler_and_linker/unsorted/Operands.c +++ b/compiler_and_linker/unsorted/Operands.c @@ -1000,9 +1000,9 @@ void extract_bitfield(Operand *input_op, TypeBitfield *tbitfield, short output_r int tmp_reg; int output; - offset = tbitfield->unkB; + offset = tbitfield->bitlength; output = output_reg ? output_reg : used_virtual_registers[RegClass_GPR]++; - r27 = tbitfield->unkA + (32 - (tbitfield->bitfieldtype->size * 8)); + r27 = tbitfield->offset + (32 - (tbitfield->bitfieldtype->size * 8)); if (is_unsigned(tbitfield->bitfieldtype)) { emitpcode(PC_RLWINM, output, input_op->reg, (r27 + offset) & 31, 32 - offset, 31); } else if (r27 == 0) { @@ -1018,8 +1018,8 @@ void extract_bitfield(Operand *input_op, TypeBitfield *tbitfield, short output_r } void insert_bitfield(short reg, Operand *op, TypeBitfield *tbitfield) { - int offset = tbitfield->unkB; - int r7 = tbitfield->unkA + (32 - (tbitfield->bitfieldtype->size * 8)); + int offset = tbitfield->bitlength; + int r7 = tbitfield->offset + (32 - (tbitfield->bitfieldtype->size * 8)); emitpcode(PC_RLWIMI, op->reg, reg, 32 - (r7 + offset), r7, r7 + offset - 1); } diff --git a/compiler_and_linker/unsorted/Switch.c b/compiler_and_linker/unsorted/Switch.c index 23cc02b..4bbd82e 100644 --- a/compiler_and_linker/unsorted/Switch.c +++ b/compiler_and_linker/unsorted/Switch.c @@ -352,7 +352,7 @@ static Object *create_switch_table(void) { obj->toc = NULL; obj->sclass = TK_STATIC; obj->qual = Q_CONST; - obj->flags |= OBJECT_FLAGS_2 | OBJECT_FLAGS_4; + obj->flags |= OBJECT_FLAGS_2 | OBJECT_DEFINED; obj->u.data.linkname = obj->name; obj->type = NULL; createIndirect(obj, 0, 0); diff --git a/compiler_and_linker/unsorted/TOC.c b/compiler_and_linker/unsorted/TOC.c index daa6464..a40eadd 100644 --- a/compiler_and_linker/unsorted/TOC.c +++ b/compiler_and_linker/unsorted/TOC.c @@ -197,7 +197,7 @@ Object *createfloatconstant(Type *type, Float *data) { obj->u.data.info = NULL; obj->u.data.linkname = obj->name; obj->sclass = TK_STATIC; - obj->qual = Q_CONST | Q_10000; + obj->qual = Q_CONST | Q_INLINE_DATA; obj->datatype = DDATA; if (type->size == 8) obj->section = SECT_8BYTE_LITERALS; @@ -242,7 +242,7 @@ Object *createvectorconstant(Type *type, MWVector128 *data) { obj->u.data.info = NULL; obj->u.data.linkname = obj->name; obj->sclass = TK_STATIC; - obj->qual = Q_CONST | Q_10000; + obj->qual = Q_CONST | Q_INLINE_DATA; obj->datatype = DDATA; if (type->size == 16) obj->section = SECT_16BYTE_LITERALS; @@ -337,7 +337,7 @@ static Object *CreatePooledFloatConst(Type *type, Float *data, SInt32 *pOffset) di.name = GetHashNameNodeExport("@doubleBase0"); di.qual = Q_CONST; di.storageclass = TK_STATIC; - di.x4E = 1; + di.is_extern_c = 1; di.section = SECT_CONST; object = CParser_NewGlobalDataObject(&di); object->nspace = cscope_root; @@ -385,7 +385,7 @@ static Object *CreatePooledFloatConst(Type *type, Float *data, SInt32 *pOffset) di.name = GetHashNameNodeExport("@floatBase0"); di.qual = Q_CONST; di.storageclass = TK_STATIC; - di.x4E = 1; + di.is_extern_c = 1; di.section = SECT_CONST; object = CParser_NewGlobalDataObject(&di); object->nspace = cscope_root; @@ -461,7 +461,7 @@ static void RewriteVectorConst(ENode *expr) { di.name = GetHashNameNodeExport("@vectorBase0"); di.qual = Q_CONST; di.storageclass = TK_STATIC; - di.x4E = 1; + di.is_extern_c = 1; di.section = SECT_CONST; object = CParser_NewGlobalDataObject(&di); object->nspace = cscope_root; @@ -511,7 +511,7 @@ static Object *createcodelabel(CLabel *label) { obj->sclass = TK_STATIC; obj->qual = Q_CONST; obj->datatype = DDATA; - obj->flags |= OBJECT_FLAGS_2 | OBJECT_FLAGS_4; + obj->flags |= OBJECT_FLAGS_2 | OBJECT_DEFINED; list = galloc(sizeof(CodeLabelList)); memclrw(list, sizeof(CodeLabelList)); @@ -2244,7 +2244,7 @@ Object *createstaticinitobject(void) { tfunc->type = TYPEFUNC; tfunc->functype = &stvoid; tfunc->args = NULL; - tfunc->flags = FUNC_FLAGS_2; + tfunc->flags = FUNC_DEFINED; obj = galloc(sizeof(Object)); memclrw(obj, sizeof(Object)); diff --git a/compiler_and_linker/unsorted/uDump.c b/compiler_and_linker/unsorted/uDump.c index e7ed2d2..89574a5 100644 --- a/compiler_and_linker/unsorted/uDump.c +++ b/compiler_and_linker/unsorted/uDump.c @@ -577,8 +577,8 @@ static void spell(Type *type, char *buf) { sprintf(buf, "bitfield(%s){%d:%d}", mybuf, - TYPE_BITFIELD(type)->unkA, - TYPE_BITFIELD(type)->unkB); + TYPE_BITFIELD(type)->offset, + TYPE_BITFIELD(type)->bitlength); break; case TYPELABEL: strcpy(buf, "label"); diff --git a/includes/compiler/CABI.h b/includes/compiler/CABI.h index 6e190d5..fb56d79 100644 --- a/includes/compiler/CABI.h +++ b/includes/compiler/CABI.h @@ -22,7 +22,7 @@ extern SInt16 CABI_StructSizeAlignValue(Type *type, SInt32 size); extern void CABI_ReverseBitField(TypeBitfield *tbitfield); extern void CABI_AddVTable(TypeClass *tclass); extern SInt32 CABI_GetVTableOffset(TypeClass *tclass); -extern void CABI_LayoutClass(DeclE *decle, TypeClass *tclass); +extern void CABI_LayoutClass(ClassLayout *layout, TypeClass *tclass); extern void CABI_MakeDefaultArgConstructor(TypeClass *tclass, Object *func); extern ENode *CABI_MakeThisExpr(TypeClass *tclass, SInt32 offset); extern SInt32 CABI_GetCtorOffsetOffset(TypeClass *tclass, TypeClass *base); diff --git a/includes/compiler/CClass.h b/includes/compiler/CClass.h index bb952de..aa3cc89 100644 --- a/includes/compiler/CClass.h +++ b/includes/compiler/CClass.h @@ -7,13 +7,6 @@ #pragma options align=mac68k #endif -/*typedef struct VTableObjectLink { - struct VTableObjectLink *next; - Object *methodobj; - SInt32 offset; - SInt32 xC; -} VTableObjectLink;*/ - extern void CClass_Init(void); extern void CClass_GenThunks(void); extern UInt8 CClass_GetOverrideKind(TypeFunc *a, TypeFunc *b, Boolean errorflag); diff --git a/includes/compiler/CDecl.h b/includes/compiler/CDecl.h index e4537f8..97501fa 100644 --- a/includes/compiler/CDecl.h +++ b/includes/compiler/CDecl.h @@ -10,12 +10,12 @@ #endif // named because it's 0xE bytes big (hurr) -struct DeclE { +struct ClassLayout { ObjBase **objlist; ObjMemberVar *vtable_ivar; - unsigned short x8; // lex_order_count? - unsigned short xA; - Boolean xC; + UInt16 lex_order_count; + UInt16 xA; + Boolean has_vtable; }; // what the fuck am I? @@ -41,8 +41,7 @@ struct DeclInfo { DeclFucker *fucker34; TemplateFunction *x38; UInt8 x3C; // related to template nindex - Boolean x3D; - short x3E; + short operator_token; // when an operator name like "operator +" is scanned, this is the token short storageclass; UInt8 section; UInt8 exportflags; @@ -54,9 +53,9 @@ struct DeclInfo { Boolean x49; Boolean x4A; // objc related Boolean x4B; - Boolean x4C; + Boolean in_friend_decl; // set to 1 when parsing a 'friend' declaration Boolean x4D; - Boolean x4E; // is_extern_c? + Boolean is_extern_c; Boolean x4F; Boolean x50; Boolean x51; @@ -66,10 +65,9 @@ struct DeclInfo { Boolean x55; Boolean x56; Boolean x57; - //FileOffsetInfo fileoffsetinfo; CPrepFileInfo *file; CPrepFileInfo *file2; - SInt32 x60; // file offset? + SInt32 sourceoffset; Boolean x64; }; @@ -125,7 +123,7 @@ extern void CDecl_CheckCtorIntegrity(FuncArg *args, TypeClass *tclass); extern void CDecl_MakeVBaseList(TypeClass *tclass); extern Boolean CDecl_CheckNewBase(TypeClass *tclass, TypeClass *baseclass, Boolean is_virtual); extern TypeMemberFunc *CDecl_MakeDefaultDtorType(TypeClass *tclass, Boolean is_virtual); -extern void CDecl_CompleteClass(DeclE *decle, TypeClass *tclass); +extern void CDecl_CompleteClass(ClassLayout *layout, TypeClass *tclass); extern TypeClass *CDecl_DefineClass(NameSpace *nspace, HashNameNode *name, TypeClass *tclass, short mode, Boolean flag2, Boolean flag3); extern void CDecl_ParseClassDeclSpec(UInt8 *declspec); extern void CDecl_ParseClass(DeclInfo *declinfo, short mode, Boolean flag1, UInt8 class_declspec); diff --git a/includes/compiler/CExpr.h b/includes/compiler/CExpr.h index bdc0789..9cc6b71 100644 --- a/includes/compiler/CExpr.h +++ b/includes/compiler/CExpr.h @@ -85,7 +85,7 @@ extern ENode *argumentpromotion(ENode *expr, Type *type, short qual, Boolean fla extern ENode *classargument(ENode *expr); extern ENodeList *CExpr_ScanExpressionList(Boolean is_parens); extern ENode *CExpr_DoExplicitConversion(Type *type, UInt32 qual, ENodeList *list); -extern ENode *CExpr_MakeNameLookupResultExpr(CScopeParseResult *pr); +extern ENode *CExpr_MakeNameLookupResultExpr(NameResult *pr); extern SInt32 scansizeof(void); extern SInt32 scanalignof(void); extern ENode *getnodeaddress(ENode *expr, Boolean flag); diff --git a/includes/compiler/CScope.h b/includes/compiler/CScope.h index 7a4c3de..d19a655 100644 --- a/includes/compiler/CScope.h +++ b/includes/compiler/CScope.h @@ -20,12 +20,11 @@ struct CScopeSave { Boolean is_member_func; }; // assumed name -// this might be called NameResult -typedef struct CScopeParseResult { +typedef struct NameResult { NameSpace *nspace_0; HashNameNode *name_4; - Type *x8; - UInt32 xC; // qual + Type *type; + UInt32 qual; ObjBase *obj_10; NameSpaceObjectList *nsol_14; BClassList *bcl_18; @@ -35,12 +34,12 @@ typedef struct CScopeParseResult { Boolean x1F; Boolean x20; Boolean x21; -} CScopeParseResult; +} NameResult; typedef struct CScopeNSIterator { NameSpace *nspace; NameSpaceLookupList *lookup; - CScopeParseResult *result; + NameResult *result; } CScopeNSIterator; typedef struct CScopeObjectIterator { @@ -75,27 +74,27 @@ extern void CScope_MergeNameSpace(NameSpace *dst, NameSpace *src); extern void CScope_AddObject(NameSpace *nspace, HashNameNode *name, ObjBase *obj); extern void CScope_AddGlobalObject(Object *obj); extern NameSpaceLookupList *CScope_BuildNameSpaceLookupList(NameSpace *nspace); -extern Boolean CScope_FindQualifiedClassMember(CScopeParseResult *result, TypeClass *tclass, HashNameNode *name); +extern Boolean CScope_FindQualifiedClassMember(NameResult *result, TypeClass *tclass, HashNameNode *name); extern Type *CScope_GetType(NameSpace *nspace, HashNameNode *name, UInt32 *qual); extern Type *CScope_GetTagType(NameSpace *nspace, HashNameNode *name); -extern Boolean CScope_ParseExprName(CScopeParseResult *result); -extern Boolean CScope_ParseDeclName(CScopeParseResult *result); -extern Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1, Boolean flag2); -extern Boolean CScope_ParseElaborateName(CScopeParseResult *result); -extern Boolean CScope_FindObject(NameSpace *nspace, CScopeParseResult *result, HashNameNode *name); -extern Boolean CScope_FindNonClassObject(NameSpace *nspace, CScopeParseResult *result, HashNameNode *name); -extern NameSpaceObjectList *CScope_FindObjectList(CScopeParseResult *result, HashNameNode *name); +extern Boolean CScope_ParseExprName(NameResult *result); +extern Boolean CScope_ParseDeclName(NameResult *result); +extern Boolean CScope_ParseQualifiedNameSpace(NameResult *result, Boolean flag1, Boolean flag2); +extern Boolean CScope_ParseElaborateName(NameResult *result); +extern Boolean CScope_FindObject(NameSpace *nspace, NameResult *result, HashNameNode *name); +extern Boolean CScope_FindNonClassObject(NameSpace *nspace, NameResult *result, HashNameNode *name); +extern NameSpaceObjectList *CScope_FindObjectList(NameResult *result, HashNameNode *name); extern Boolean CScope_PossibleTypeName(HashNameNode *name); -extern Boolean CScope_FindClassMemberObject(TypeClass *tclass, CScopeParseResult *result, HashNameNode *name); +extern Boolean CScope_FindClassMemberObject(TypeClass *tclass, NameResult *result, HashNameNode *name); extern void CScope_InitObjectIterator(CScopeObjectIterator *iterator, NameSpace *nspace); extern ObjBase *CScope_NextObjectIteratorObject(CScopeObjectIterator *iterator); extern NameSpaceObjectList *CScope_NextObjectIteratorObjectList(CScopeObjectIterator *iterator); extern void CScope_DefineTypeTag(NameSpace *nspace, HashNameNode *name, Type *type); extern Type *CScope_GetLocalTagType(NameSpace *nspace, HashNameNode *name); -extern Boolean CScope_FindTypeName(NameSpace *nspace, HashNameNode *name, CScopeParseResult *result); +extern Boolean CScope_FindTypeName(NameSpace *nspace, HashNameNode *name, NameResult *result); extern NameSpaceObjectList *CScope_GetLocalObject(NameSpace *nspace, HashNameNode *name); extern BClassList *CScope_GetClassAccessPath(BClassList *list, TypeClass *tclass); -extern Boolean CScope_ParseMemberName(TypeClass *tclass, CScopeParseResult *result, Boolean flag); +extern Boolean CScope_ParseMemberName(TypeClass *tclass, NameResult *result, Boolean flag); extern void CScope_AddClassUsingDeclaration(TypeClass *tclass, TypeClass *tclass2, HashNameNode *name, AccessType access); extern void CScope_ParseUsingDeclaration(NameSpace *nspace, AccessType access, Boolean flag); extern void CScope_ParseNameSpaceAlias(HashNameNode *name); diff --git a/includes/compiler/CTemplateClass.h b/includes/compiler/CTemplateClass.h index 12cd088..b683bda 100644 --- a/includes/compiler/CTemplateClass.h +++ b/includes/compiler/CTemplateClass.h @@ -11,7 +11,7 @@ extern void CTemplClass_RegisterEnumType(TemplClass *tmclass, TypeEnum *enumtype extern void CTemplClass_RegisterEnumerator(TemplClass *tmclass, ObjEnumConst *objenumconst, ENode *initexpr); extern void CTemplClass_RegisterObjectInit(TemplClass *tmclass, Object *object, ENode *initexpr); extern void CTemplClass_RegisterObjectDef(TemplClass *tmclass, ObjBase *refobj); -extern void CTemplClass_CompleteClass(TemplClass *templ, DeclE *de); +extern void CTemplClass_CompleteClass(TemplClass *templ, ClassLayout *de); extern TemplClassInst *CTemplClass_GetInstance(TemplClass *tmclass, TemplArg *args1, TemplArg *args2); extern TemplateMember *CTemplClass_DefineMember(TemplClass *tmclass, Object *object, FileOffsetInfo *foi, TokenStream *stream); extern void CTemplClass_ParsePartialSpecialization(DeclFucker *what_is_this, TemplParam *params, short mode, SInt32 *offset); diff --git a/includes/compiler/common.h b/includes/compiler/common.h index ed5b25a..c5e2324 100644 --- a/includes/compiler/common.h +++ b/includes/compiler/common.h @@ -113,11 +113,11 @@ typedef struct Alias Alias; typedef struct BClassList BClassList; typedef struct CI_FuncData CI_FuncData; typedef struct CLabel CLabel; +typedef struct ClassLayout ClassLayout; typedef struct ClassList ClassList; typedef struct CompilerLinkerParamBlk CompilerLinkerParamBlk; typedef struct CPrepFileInfo CPrepFileInfo; typedef struct CScopeSave CScopeSave; -typedef struct DeclE DeclE; typedef struct DeclFucker DeclFucker; typedef struct DeclInfo DeclInfo; typedef struct DeclThing DeclThing; // rename me please @@ -176,7 +176,6 @@ typedef struct Statement Statement; typedef struct StructMember StructMember; typedef struct SwitchCase SwitchCase; typedef struct SwitchInfo SwitchInfo; -typedef struct Template Template; typedef struct TemplateAction TemplateAction; typedef struct TemplateFriend TemplateFriend; typedef struct TemplateMember TemplateMember; @@ -185,7 +184,6 @@ typedef struct TemplClass TemplClass; typedef struct TemplClassInst TemplClassInst; typedef struct TemplateFunction TemplateFunction; typedef struct TemplFuncInstance TemplFuncInstance; -typedef struct TemplInstance TemplInstance; typedef struct TemplParam TemplParam; typedef struct TemplPartialSpec TemplPartialSpec; typedef struct TemplStack TemplStack; @@ -252,13 +250,13 @@ enum { Q_BYCOPY = 0x2000, Q_BYREF = 0x4000, Q_ONEWAY = 0x8000, - Q_10000 = 0x10000, + Q_INLINE_DATA = 0x10000, // this object contains constant data in its union Q_20000 = 0x20000, - Q_OVERLOAD = 0x40000, // weak - Q_80000 = 0x80000, - Q_100000 = 0x100000, // Objective-C ID + Q_WEAK = 0x40000, // weak + Q_MANGLE_NAME = 0x80000, // adds C++ mangling info to a name + Q_IS_OBJC_ID = 0x100000, // Objective-C ID Q_RESTRICT = 0x200000, - Q_400000 = 0x400000, // is templated from another object? + Q_IS_TEMPLATED = 0x400000, // is templated from another object? Q_1000000 = 0x1000000, Q_ALIGNED_1 = 0x2000000, Q_ALIGNED_2 = 0x4000000, diff --git a/includes/compiler/objects.h b/includes/compiler/objects.h index 5f56877..0f5d52f 100644 --- a/includes/compiler/objects.h +++ b/includes/compiler/objects.h @@ -188,14 +188,14 @@ struct ObjectTemplated { }; enum { - OBJECT_FLAGS_1 = 1, - OBJECT_FLAGS_2 = 2, - OBJECT_FLAGS_4 = 4, - OBJECT_FLAGS_8 = 8, - OBJECT_FLAGS_10 = 0x10, // internal - OBJECT_FLAGS_20 = 0x20, // import - OBJECT_FLAGS_40 = 0x40, // export - OBJECT_FLAGS_60 = 0x60 // lib export + OBJECT_USED = 1, + OBJECT_FLAGS_2 = 2, // this object has been used in certain contexts (figure me out?) + OBJECT_DEFINED = 4, + OBJECT_LAZY = 8, // this object will be created by a CParser callback action only if referenced + OBJECT_INTERNAL = 0x10, + OBJECT_IMPORT = 0x20, + OBJECT_EXPORT = 0x40, + OBJECT_LIB_EXPORT = 0x60 }; #define OBJ_BASE(obj) ((ObjBase *) (obj)) @@ -209,7 +209,7 @@ enum { #define OBJECT_TEMPL(obj) ((ObjectTemplated *) (obj)) -struct VarInfo { // OK! +struct VarInfo { Object *func; SInt32 usage; TStreamElement deftoken; diff --git a/includes/compiler/templates.h b/includes/compiler/templates.h index 14f60b6..9a54c4b 100644 --- a/includes/compiler/templates.h +++ b/includes/compiler/templates.h @@ -9,7 +9,7 @@ #pragma options align=mac68k #endif -struct PackedDeclInfo { // ok +struct PackedDeclInfo { Type *thetype; UInt32 qual; NameSpace *nspace; @@ -21,20 +21,13 @@ struct PackedDeclInfo { // ok Boolean has_expltargs; }; -struct Template { - Template *parent; - TemplInstance *parentinst; - TemplParam *params; - Boolean is_class; -}; - -struct TemplateFriend { // verified via CPrec +struct TemplateFriend { PackedDeclInfo decl; FileOffsetInfo fileoffset; TokenStream stream; }; -struct TemplateMember { // verified via CPrec +struct TemplateMember { struct TemplateMember *next; TemplParam *params; Object *object; @@ -45,17 +38,7 @@ struct TemplateMember { // verified via CPrec SInt32 endoffset; }; -struct TemplInstance { - // Template *templ; - TemplInstance *parent; - TemplArg *args; - Boolean is_instantiated; - Boolean is_specialized; - Boolean is_extern; - Boolean static_instantiated; -}; - -struct TemplParam { // verified via CPrec +struct TemplParam { TemplParam *next; HashNameNode *name; TemplParamID pid; @@ -76,7 +59,7 @@ struct TemplParam { // verified via CPrec } data; }; -struct TemplArg { // verified by CPrec +struct TemplArg { TemplArg *next; TemplParamID pid; union { @@ -123,7 +106,7 @@ struct TypeDeduce { Boolean x19; }; -struct TemplPartialSpec { // confirmed via CPrec (but templ might be a different type?) +struct TemplPartialSpec { TemplPartialSpec *next; TemplClass *templ; TemplArg *args; @@ -146,47 +129,48 @@ struct TemplStack { struct TemplClass { TypeClass theclass; TemplClass *next; - TemplClass *templ_parent; // confirmed by v8 - TemplClassInst *inst_parent; // confirmed by v8 + TemplClass *templ_parent; + TemplClassInst *inst_parent; TemplParam *templ__params; TemplateMember *members; TemplClassInst *instances; TemplClass *pspec_owner; TemplPartialSpec *pspecs; TemplateAction *actions; - UInt16 lex_order_count; // confirmed by v8 + UInt16 lex_order_count; SInt8 align; UInt8 flags; }; +// TemplClass::flags enum { - TEMPLCLASS_FLAGS_1 = 1, + TEMPLCLASS_HAS_VTABLE = 1, TEMPLCLASS_FLAGS_2 = 2 }; struct TemplClassInst { TypeClass theclass; - TemplClassInst *next; // confirmed by v8 - TemplClassInst *parent; // confirmed by v8 + TemplClassInst *next; + TemplClassInst *parent; TemplClass *templ; TemplArg *inst_args; TemplArg *oargs; Boolean is_instantiated; Boolean is_specialized; Boolean is_extern; - Boolean x49; + Boolean static_instantiated; }; #define TEMPL_CLASS(ty) ( (TemplClass *) (ty) ) #define TEMPL_CLASS_INST(ty) ( (TemplClassInst *) (ty) ) -#define IS_TEMPL_CLASS(ty) ( IS_TYPE_CLASS(ty) && (TYPE_CLASS(ty)->flags & CLASS_FLAGS_100) ) -#define IS_TEMPL_CLASS_INST(ty) ( IS_TYPE_CLASS(ty) && (TYPE_CLASS(ty)->flags & CLASS_FLAGS_800) ) +#define IS_TEMPL_CLASS(ty) ( IS_TYPE_CLASS(ty) && (TYPE_CLASS(ty)->flags & CLASS_IS_TEMPL) ) +#define IS_TEMPL_CLASS_INST(ty) ( IS_TYPE_CLASS(ty) && (TYPE_CLASS(ty)->flags & CLASS_IS_TEMPL_INST) ) /*************/ /* Functions */ /*************/ -struct TemplateFunction { // verified via CPrec +struct TemplateFunction { TemplateFunction *next; TemplateFunction *unk4; // parent? HashNameNode *name; @@ -200,19 +184,18 @@ struct TemplateFunction { // verified via CPrec SInt32 endoffset; }; -struct TemplFuncInstance { // verified via CPrec +struct TemplFuncInstance { TemplFuncInstance *next; Object *object; TemplArg *args; Boolean is_instantiated; Boolean is_specialized; Boolean is_extern; - Boolean static_instantiated; }; #define TEMPL_FUNC(ty) ( (TemplateFunction *) (ty) ) #define TEMPL_FUNC_INST(ty) ( (TemplFuncInstance *) (ty) ) -#define IS_TEMPL_FUNC(ty) ( IS_TYPE_FUNC(ty) && (TYPE_FUNC(ty)->flags & FUNC_FLAGS_100000) ) +#define IS_TEMPL_FUNC(ty) ( IS_TYPE_FUNC(ty) && (TYPE_FUNC(ty)->flags & FUNC_IS_TEMPL) ) /***********/ /* Actions */ @@ -230,7 +213,7 @@ typedef enum TemplateActionType { TAT_ILLEGAL } TemplateActionType; -struct TemplateAction { // verified via CPrec +struct TemplateAction { TemplateAction *next; TStreamElement source_ref; union { diff --git a/includes/compiler/types.h b/includes/compiler/types.h index 5767eb9..caca63c 100644 --- a/includes/compiler/types.h +++ b/includes/compiler/types.h @@ -70,7 +70,7 @@ struct TypeIntegral { }; -struct TypeEnum { // checked via CPrec +struct TypeEnum { TypeType type; SInt32 size; NameSpace *nspace; @@ -115,7 +115,7 @@ enum { }; -struct ClassList { // checked via CPrec +struct ClassList { ClassList *next; TypeClass *base; SInt32 offset; @@ -124,16 +124,15 @@ struct ClassList { // checked via CPrec Boolean is_virtual; }; -struct VClassList { // checked via CPrec +struct VClassList { VClassList *next; TypeClass *base; SInt32 offset; // offset within the class instance SInt32 voffset; // offset within the vtable Boolean has_override; - char alignsave; }; -typedef struct ClassFriend { // checked via CPrec +typedef struct ClassFriend { struct ClassFriend *next; union { TypeClass *theclass; @@ -142,12 +141,12 @@ typedef struct ClassFriend { // checked via CPrec Boolean isclass; } ClassFriend; -struct BClassList { // checked via CPrec +struct BClassList { struct BClassList *next; Type *type; }; -typedef struct VTable { // checked via CPrec +typedef struct VTable { Object *object; TypeClass *owner; SInt32 offset; @@ -174,25 +173,23 @@ struct TypeClass { }; typedef enum { - CLASS_MODE_0 = 0, // struct - CLASS_MODE_1 = 1, // union - CLASS_MODE_2 = 2 // class + CLASS_MODE_STRUCT = 0, + CLASS_MODE_UNION = 1, + CLASS_MODE_CLASS = 2 } ClassMode; enum { - CLASS_FLAGS_1 = 1, - CLASS_FLAGS_2 = 2, // completed class? - CLASS_FLAGS_ABSTRACT = 8, - CLASS_FLAGS_10 = 0x10, - CLASS_FLAGS_20 = 0x20, - CLASS_FLAGS_40 = 0x40, - CLASS_FLAGS_80 = 0x80, - CLASS_FLAGS_100 = 0x100, // is TemplClass - CLASS_FLAGS_800 = 0x800, // is TemplClassInst - CLASS_FLAGS_900 = 0x900, - CLASS_FLAGS_1000 = 0x1000, // is empty class - CLASS_FLAGS_2000 = 0x2000, - CLASS_FLAGS_4000 = 0x4000, + CLASS_HANDLEOBJECT = 1, // class is a HandleObject + CLASS_COMPLETED = 2, // completed class? + CLASS_ABSTRACT = 8, + CLASS_SINGLE_OBJECT = 0x10, // inherits from SingleObject/SingleInheritance + CLASS_HAS_VBASES = 0x20, + CLASS_IS_CONVERTIBLE = 0x40, // defines at least one conversion function + CLASS_IS_TEMPL = 0x100, // is TemplClass + CLASS_IS_TEMPL_INST = 0x800, // is TemplClassInst + CLASS_IS_TEMPL_ANY = CLASS_IS_TEMPL | CLASS_IS_TEMPL_INST, + CLASS_EMPTY = 0x1000, // is 0 bytes (forced to 1 byte for ABI reasons) + CLASS_COM_OBJECT = 0x2000, // inherits from __comobject CLASS_FLAGS_8000 = 0x8000 }; @@ -225,7 +222,6 @@ struct FuncArg { // ok UInt32 qual; SInt16 sclass; Boolean is_array; - Boolean has_defdefarg; }; struct TypeFunc { @@ -237,37 +233,37 @@ struct TypeFunc { UInt32 qual; UInt32 flags; }; + +// TypeFunc::flags enum { - FUNC_FLAGS_PASCAL = 1, // on TypeFunc::flags - FUNC_FLAGS_2 = 2, // member function that has an inline definition? + FUNC_PASCAL = 1, + FUNC_DEFINED = 2, // does the function have a body? FUNC_FLAGS_4 = 4, - FUNC_FLAGS_8 = 8, // abstract - FUNC_FLAGS_METHOD = 0x10, + FUNC_PURE = 8, // abstract + FUNC_METHOD = 0x10, FUNC_FLAGS_20 = 0x20, - FUNC_FLAGS_40 = 0x40, // func that's like "operator SomeOtherType()" + FUNC_CONVERSION = 0x40, // func that's like "operator SomeOtherType()" FUNC_FLAGS_80 = 0x80, - FUNC_FLAGS_100 = 0x100, - FUNC_FLAGS_200 = 0x200, // intrinsic? - FUNC_FLAGS_NOTHROW = 0x400, + FUNC_AUTO_GENERATED = 0x100, // an auto-generated ctor, dtor or assignment operator + FUNC_INTRINSIC = 0x200, + FUNC_NOTHROW = 0x400, FUNC_FLAGS_800 = 0x800, // autoinlined? - FUNC_FLAGS_1000 = 0x1000, // is ctor - FUNC_FLAGS_2000 = 0x2000, // is dtor - FUNC_FLAGS_4000 = 0x4000, // objc method? - FUNC_FLAGS_CONST = 0x8000, - FUNC_FLAGS_VOLATILE = 0x10000, - FUNC_FLAGS_CV = FUNC_FLAGS_CONST | FUNC_FLAGS_VOLATILE, - FUNC_FLAGS_100000 = 0x100000, // is template? + FUNC_IS_CTOR = 0x1000, // is ctor + FUNC_IS_DTOR = 0x2000, // is dtor + FUNC_OBJC_METHOD = 0x4000, + FUNC_CONST = 0x8000, + FUNC_VOLATILE = 0x10000, + FUNC_FLAGS_CV = FUNC_CONST | FUNC_VOLATILE, + FUNC_IS_TEMPL = 0x100000, // the definition of a template FUNC_FLAGS_200000 = 0x200000, FUNC_FLAGS_400000 = 0x400000, // covariant? - FUNC_FLAGS_800000 = 0x800000, - FUNC_FLAGS_900000 = 0x900000, + FUNC_IS_TEMPL_INSTANCE = 0x800000, // a concrete instance of a template + FUNC_IS_TEMPL_ANY = FUNC_IS_TEMPL | FUNC_IS_TEMPL_INSTANCE, FUNC_FLAGS_4000000 = 0x4000000, FUNC_FLAGS_10000000 = 0x10000000, - FUNC_FLAGS_F0000000 = 0xF0000000 + FUNC_CALL_CONV_MASK = 0xF0000000 | FUNC_PASCAL }; -// This is actually called TypeMemberFunc... -// There seems to be a version of this which adds a class pointer at the end struct TypeMemberFunc { TypeType type; SInt32 size; @@ -277,9 +273,9 @@ struct TypeMemberFunc { UInt32 qual; UInt32 flags; TypeClass *theclass; - SInt32 x1E; // vtable offset? - SInt32 x22; // browser index? - Boolean x26; // is static + SInt32 vtbl_index; // index of this method within the vtable + SInt32 funcid; // ID used for tracking this method within browse data + Boolean is_static; // is static }; @@ -287,24 +283,18 @@ struct TypeBitfield { TypeType type; SInt32 size; Type *bitfieldtype; - char unkA; // offset in bits - char unkB; // size in bits + char offset; // offset in bits + char bitlength; // size in bits }; -// Label - - typedef enum TypeTemplDepType { TEMPLDEP_ARGUMENT, TEMPLDEP_QUALNAME, TEMPLDEP_TEMPLATE, TEMPLDEP_ARRAY, TEMPLDEP_QUALTEMPL, - TEMPLDEP_BITFIELD, - TEMPLDEP_VALUEDEP, // not in v7? - TEMPLDEP_ENUMVAL, // not in v7? - TEMPLDEP_TYPEOF // not in v7? + TEMPLDEP_BITFIELD } TypeTemplDepType; struct TypeTemplDep { @@ -333,13 +323,6 @@ struct TypeTemplDep { Type *type; ENode *size; } bitfield; - // the following ones may not be in v7 - Type *vdep; - ENode *tof; - struct { - TypeEnum *etype; - ENode *expr; - } enumval; } u; }; @@ -362,7 +345,7 @@ struct TypePointer { }; -/// Always has Q_100000 set +/// Always has Q_IS_OBJC_ID set struct TypeObjCID { TypePointer pointer; ObjCProtocolList *protocols; @@ -403,13 +386,13 @@ struct TypeList { #define IS_TYPE_SOM_CLASS(ty) ( (ty)->type == TYPECLASS && TYPE_CLASS((ty))->sominfo ) #define IS_TYPE_OBJC_CLASS(ty) ( (ty)->type == TYPECLASS && TYPE_CLASS((ty))->objcinfo ) #define IS_TYPE_FUNC(ty) ( (ty)->type == TYPEFUNC ) -#define IS_TYPEFUNC_METHOD(ty) ( (ty)->flags & FUNC_FLAGS_METHOD ) +#define IS_TYPEFUNC_METHOD(ty) ( (ty)->flags & FUNC_METHOD ) #define IS_TYPE_METHOD(ty) ( IS_TYPE_FUNC(ty) && IS_TYPEFUNC_METHOD(TYPE_FUNC(ty)) ) #define IS_TYPE_NONMETHOD(ty) ( IS_TYPE_FUNC(ty) && !IS_TYPEFUNC_METHOD(TYPE_FUNC(ty)) ) -#define IS_TYPE_NONSTATIC_METHOD(ty) ( IS_TYPE_FUNC(ty) && IS_TYPEFUNC_METHOD(TYPE_FUNC(ty)) && !TYPE_METHOD(ty)->x26 ) -#define IS_TYPE_STATIC_METHOD(ty) ( IS_TYPE_FUNC(ty) && IS_TYPEFUNC_METHOD(TYPE_FUNC(ty)) && TYPE_METHOD(ty)->x26 ) -#define IS_TYPEFUNC_NONSTATIC_METHOD(ty) ( IS_TYPEFUNC_METHOD(ty) && !TYPE_METHOD(ty)->x26 ) -#define IS_TYPEFUNC_STATIC_METHOD(ty) ( IS_TYPEFUNC_METHOD(ty) && TYPE_METHOD(ty)->x26 ) +#define IS_TYPE_NONSTATIC_METHOD(ty) ( IS_TYPE_FUNC(ty) && IS_TYPEFUNC_METHOD(TYPE_FUNC(ty)) && !TYPE_METHOD(ty)->is_static ) +#define IS_TYPE_STATIC_METHOD(ty) ( IS_TYPE_FUNC(ty) && IS_TYPEFUNC_METHOD(TYPE_FUNC(ty)) && TYPE_METHOD(ty)->is_static ) +#define IS_TYPEFUNC_NONSTATIC_METHOD(ty) ( IS_TYPEFUNC_METHOD(ty) && !TYPE_METHOD(ty)->is_static ) +#define IS_TYPEFUNC_STATIC_METHOD(ty) ( IS_TYPEFUNC_METHOD(ty) && TYPE_METHOD(ty)->is_static ) #define IS_TYPE_TEMPLATE(ty) ( (ty)->type == TYPETEMPLATE ) #define IS_TYPE_POINTER(ty) ( (ty)->type == TYPEPOINTER || (ty)->type == TYPEARRAY ) #define IS_TYPE_POINTER_ONLY(ty) ( (ty)->type == TYPEPOINTER ) |