diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-01-20 11:56:38 +0000 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-01-20 11:56:38 +0000 |
commit | 0905072b3ccfcb394b1dca2405a55cff4e2b9271 (patch) | |
tree | c7c6f87ecf257c4e7b6a92355e75030165731371 /compiler_and_linker/unsorted/CDecl.c | |
parent | 7d986adf37220e1981a707745b784b078de4e3bc (diff) | |
download | MWCC-0905072b3ccfcb394b1dca2405a55cff4e2b9271.tar.gz MWCC-0905072b3ccfcb394b1dca2405a55cff4e2b9271.zip |
tons more renaming of stuff
Diffstat (limited to 'compiler_and_linker/unsorted/CDecl.c')
-rw-r--r-- | compiler_and_linker/unsorted/CDecl.c | 424 |
1 files changed, 219 insertions, 205 deletions
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; |