tons more renaming of stuff

This commit is contained in:
Ash Wolf 2023-01-20 11:56:38 +00:00
parent 7d986adf37
commit 0905072b3c
52 changed files with 1009 additions and 1039 deletions

View File

@ -2836,13 +2836,13 @@ static void pragma_on_off_reset(UInt32 bits) {
macrocheck = 1; macrocheck = 1;
if ((bits & OPT_OFFSET_MASK) == OPT_OFFSET(cfm_internal)) 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)) 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)) 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)) else if ((bits & OPT_OFFSET_MASK) == OPT_OFFSET(cfm_lib_export))
imex_flags = OBJECT_FLAGS_60; imex_flags = OBJECT_LIB_EXPORT;
else else
CError_FATAL(3610); CError_FATAL(3610);
CPrep_PragmaImExport(imex_flags); CPrep_PragmaImExport(imex_flags);
@ -2952,7 +2952,7 @@ static void CPrep_PragmaUnused(void) {
list = CScope_GetLocalObject(nspace, tkidentifier); list = CScope_GetLocalObject(nspace, tkidentifier);
if (list && list->object->otype == OT_OBJECT && OBJECT(list->object)->datatype == DLOCAL) { 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()) { if (notendofline()) {
t = plex(); t = plex();
if (t == ')') if (t == ')')
@ -3157,7 +3157,7 @@ static void pragma_overload(void) {
if ((obj = CParser_ParseObject())) { if ((obj = CParser_ParseObject())) {
if (obj->sclass && obj->sclass != 0x103) if (obj->sclass && obj->sclass != 0x103)
CPrep_Error(CErrorStr177); CPrep_Error(CErrorStr177);
obj->qual |= Q_OVERLOAD; obj->qual |= Q_WEAK;
} else { } else {
CPrep_Error(CErrorStr186); CPrep_Error(CErrorStr186);
} }

View File

@ -96,10 +96,10 @@ void CScope_SetFunctionScope(Object *function, CScopeSave *save) {
cscope_currentclass = NULL; cscope_currentclass = NULL;
cscope_is_member_func = 0; 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_currentclass = TYPE_METHOD(function->type)->theclass;
cscope_current = cscope_currentclass->nspace; 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 { } else {
cscope_current = function->nspace; cscope_current = function->nspace;
} }
@ -377,7 +377,7 @@ NameSpaceObjectList *CScope_ArgumentDependentNameLookup(NameSpaceObjectList *lis
continue; continue;
if (!IS_TYPE_FUNC(OBJECT(iscan->object)->type)) if (!IS_TYPE_FUNC(OBJECT(iscan->object)->type))
continue; 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; continue;
for (iiscan = list; iiscan; iiscan = iiscan->next) { for (iiscan = list; iiscan; iiscan = iiscan->next) {
@ -480,14 +480,14 @@ void CScope_AddObject(NameSpace *nspace, HashNameNode *name, ObjBase *obj) {
newlist = lalloc(sizeof(NameSpaceObjectList)); newlist = lalloc(sizeof(NameSpaceObjectList));
if (obj->otype == OT_NAMESPACE || objlist->object->otype == OT_NAMESPACE) { if (obj->otype == OT_NAMESPACE || objlist->object->otype == OT_NAMESPACE) {
CError_Error(CErrorStr322/*, objlist->object*/); CError_Error(CErrorStr322);
return; return;
} }
if (obj->otype == OT_TYPETAG) { if (obj->otype == OT_TYPETAG) {
do { do {
if (objlist->object->otype == OT_TYPETAG) { if (objlist->object->otype == OT_TYPETAG) {
CError_Error(CErrorStr322/*, objlist->object*/); CError_Error(CErrorStr322);
return; return;
} }
@ -549,7 +549,7 @@ void CScope_AddObject(NameSpace *nspace, HashNameNode *name, ObjBase *obj) {
objlist = objlist->next; objlist = objlist->next;
} while (1); } 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; CScope_AppendName(nspace, name)->object = obj;
} else { } else {
CScope_InsertName(nspace, name)->object = obj; 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; Boolean fail;
NameSpace *nspace; NameSpace *nspace;
NameSpaceObjectList *list; NameSpaceObjectList *list;
@ -798,8 +798,8 @@ static BClassList *CScope_RecFindClassMember(CScopeParseResult *result, TypeClas
&& result->nsol_14->object->otype == OT_TYPETAG && result->nsol_14->object->otype == OT_TYPETAG
&& IS_TYPE_CLASS(OBJ_TYPE_TAG(list->object)->type) && IS_TYPE_CLASS(OBJ_TYPE_TAG(list->object)->type)
&& IS_TYPE_CLASS(OBJ_TYPE_TAG(result->nsol_14->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(list->object)->type)->flags & CLASS_IS_TEMPL_INST)
&& (TYPE_CLASS(OBJ_TYPE_TAG(result->nsol_14->object)->type)->flags & CLASS_FLAGS_800) && (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 && 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; 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_foundclass = tclass;
cscope_foundclassoffset = offset; cscope_foundclassoffset = offset;
result->x8 = OBJ_TYPE_TAG(list->object)->type; result->type = OBJ_TYPE_TAG(list->object)->type;
newlist = lalloc(sizeof(BClassList)); newlist = lalloc(sizeof(BClassList));
newlist->next = NULL; newlist->next = NULL;
newlist->type = TYPE(tclass); newlist->type = TYPE(tclass);
@ -869,7 +869,7 @@ static BClassList *CScope_RecFindClassMember(CScopeParseResult *result, TypeClas
return bestBase; 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 *bcl;
BClassList *scan; BClassList *scan;
@ -1195,22 +1195,22 @@ static NameSpace *CScope_NSIteratorFindNameSpace(CScopeNSIterator *iterator, Has
return NULL; 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) { if (!list->next || list->next->object->otype == OT_TYPETAG) {
switch (list->object->otype) { switch (list->object->otype) {
case OT_NAMESPACE: case OT_NAMESPACE:
CError_Error(CErrorStr321); CError_Error(CErrorStr321);
return 0; return 0;
case OT_TYPE: case OT_TYPE:
result->x8 = OBJ_TYPE(list->object)->type; result->type = OBJ_TYPE(list->object)->type;
result->xC = OBJ_TYPE(list->object)->qual; result->qual = OBJ_TYPE(list->object)->qual;
result->obj_10 = list->object; result->obj_10 = list->object;
result->name_4 = name; result->name_4 = name;
result->x20 = 1; result->x20 = 1;
break; break;
case OT_TYPETAG: case OT_TYPETAG:
result->x8 = OBJ_TYPE_TAG(list->object)->type; result->type = OBJ_TYPE_TAG(list->object)->type;
result->xC = 0; result->qual = 0;
result->obj_10 = list->object; result->obj_10 = list->object;
result->name_4 = name; result->name_4 = name;
result->x20 = 1; result->x20 = 1;
@ -1225,10 +1225,10 @@ static Boolean CScope_SetupParseNameResult(CScopeParseResult *result, NameSpaceO
return 1; return 1;
} }
Boolean CScope_FindQualifiedClassMember(CScopeParseResult *result, TypeClass *tclass, HashNameNode *name) { Boolean CScope_FindQualifiedClassMember(NameResult *result, TypeClass *tclass, HashNameNode *name) {
NameSpaceObjectList *list; NameSpaceObjectList *list;
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
CDecl_CompleteType(TYPE(tclass)); CDecl_CompleteType(TYPE(tclass));
if (CScope_FindClassMember(result, tclass->nspace, name, Lookup_0)) { if (CScope_FindClassMember(result, tclass->nspace, name, Lookup_0)) {
@ -1236,7 +1236,7 @@ Boolean CScope_FindQualifiedClassMember(CScopeParseResult *result, TypeClass *tc
CError_ASSERT(1780, list); CError_ASSERT(1780, list);
result->nsol_14 = NULL; result->nsol_14 = NULL;
if (CScope_SetupParseNameResult(result, list, name) && !result->x8) if (CScope_SetupParseNameResult(result, list, name) && !result->type)
return 1; return 1;
else else
CError_Error(CErrorStr340, name->name); CError_Error(CErrorStr340, name->name);
@ -1245,7 +1245,7 @@ Boolean CScope_FindQualifiedClassMember(CScopeParseResult *result, TypeClass *tc
return 0; return 0;
} }
static NameSpace *CScope_FindQualifiedNameSpace(CScopeParseResult *result, NameSpace *nspace, HashNameNode *name) { static NameSpace *CScope_FindQualifiedNameSpace(NameResult *result, NameSpace *nspace, HashNameNode *name) {
NameSpaceObjectList *list; NameSpaceObjectList *list;
NameSpace *cand; NameSpace *cand;
NameSpace *found; NameSpace *found;
@ -1288,7 +1288,7 @@ static NameSpace *CScope_FindQualifiedNameSpace(CScopeParseResult *result, NameS
return NULL; 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; NameSpaceObjectList *list;
NameSpaceLookupList *lookup; NameSpaceLookupList *lookup;
@ -1318,7 +1318,7 @@ static NameSpaceObjectList *CScope_FindQualifiedName(CScopeParseResult *result,
return NULL; return NULL;
} }
static Boolean CScope_FindQualifiedTag(CScopeParseResult *result, NameSpace *nspace, HashNameNode *name) { static Boolean CScope_FindQualifiedTag(NameResult *result, NameSpace *nspace, HashNameNode *name) {
NameSpaceObjectList *list; NameSpaceObjectList *list;
NameSpaceLookupList *lookup; NameSpaceLookupList *lookup;
Type *best; Type *best;
@ -1333,7 +1333,7 @@ static Boolean CScope_FindQualifiedTag(CScopeParseResult *result, NameSpace *nsp
if ((list = CScope_FindQualName(nspace, name))) { if ((list = CScope_FindQualName(nspace, name))) {
for (; list; list = list->next) { for (; list; list = list->next) {
if (list->object->otype == OT_TYPETAG) { if (list->object->otype == OT_TYPETAG) {
result->x8 = OBJ_TYPE_TAG(list->object)->type; result->type = OBJ_TYPE_TAG(list->object)->type;
return 1; return 1;
} }
} }
@ -1355,7 +1355,7 @@ static Boolean CScope_FindQualifiedTag(CScopeParseResult *result, NameSpace *nsp
} }
if (best) { if (best) {
result->x8 = best; result->type = best;
return 1; return 1;
} }
} }
@ -1364,7 +1364,7 @@ static Boolean CScope_FindQualifiedTag(CScopeParseResult *result, NameSpace *nsp
return 0; 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 // assumed name
if (nspace->usings) { if (nspace->usings) {
iterator->nspace = NULL; iterator->nspace = NULL;
@ -1395,7 +1395,7 @@ CW_INLINE Boolean CScope_NSIteratorNext(CScopeNSIterator *iterator) {
} }
Type *CScope_GetType(NameSpace *nspace, HashNameNode *name, UInt32 *qual) { Type *CScope_GetType(NameSpace *nspace, HashNameNode *name, UInt32 *qual) {
CScopeParseResult result; NameResult result;
CScopeNSIterator iterator; CScopeNSIterator iterator;
NameSpaceObjectList *list; NameSpaceObjectList *list;
Boolean ok; Boolean ok;
@ -1422,7 +1422,7 @@ Type *CScope_GetType(NameSpace *nspace, HashNameNode *name, UInt32 *qual) {
} }
Type *CScope_GetTagType(NameSpace *nspace, HashNameNode *name) { Type *CScope_GetTagType(NameSpace *nspace, HashNameNode *name) {
CScopeParseResult result; NameResult result;
CScopeNSIterator iterator; CScopeNSIterator iterator;
NameSpaceObjectList *list; NameSpaceObjectList *list;
Boolean ok; Boolean ok;
@ -1440,7 +1440,7 @@ Type *CScope_GetTagType(NameSpace *nspace, HashNameNode *name) {
return NULL; 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; SInt32 streamstate;
int token; int token;
TypeTemplDep *newtype; TypeTemplDep *newtype;
@ -1461,7 +1461,7 @@ static Boolean CScope_DependentTemplateMember(CScopeParseResult *result, TypeTem
CPrep_TokenStreamSetState(&streamstate); CPrep_TokenStreamSetState(&streamstate);
lex(); lex();
tk = lex(); tk = lex();
result->x8 = TYPE(newtype); result->type = TYPE(newtype);
return 1; return 1;
} }
@ -1489,7 +1489,7 @@ static Boolean CScope_DependentTemplateMember(CScopeParseResult *result, TypeTem
continue; continue;
} else { } else {
CPrep_TokenStreamSetState(&streamstate); CPrep_TokenStreamSetState(&streamstate);
result->x8 = TYPE(newtype2); result->type = TYPE(newtype2);
return 1; return 1;
} }
} }
@ -1523,12 +1523,12 @@ static Boolean CScope_DependentTemplateMember(CScopeParseResult *result, TypeTem
} }
CPrep_TokenStreamSetState(&streamstate); CPrep_TokenStreamSetState(&streamstate);
result->x8 = TYPE(newtype); result->type = TYPE(newtype);
return 1; return 1;
} }
CPrep_TokenStreamSetState(&streamstate); CPrep_TokenStreamSetState(&streamstate);
result->x8 = TYPE(ttempldep); result->type = TYPE(ttempldep);
return 1; return 1;
} }
} }
@ -1547,7 +1547,7 @@ static Boolean CScope_CheckDtorName(TypeClass *tclass, Boolean *flag) {
{ {
if (!CClass_Destructor(tclass)) if (!CClass_Destructor(tclass))
*flag = 1; *flag = 1;
if ((tclass->flags & CLASS_FLAGS_800) && (lookahead() == '<')) { if ((tclass->flags & CLASS_IS_TEMPL_INST) && (lookahead() == '<')) {
tk = lex(); tk = lex();
if (!CTemplTool_EqualArgs(TEMPL_CLASS_INST(tclass)->inst_args, CTempl_ParseUncheckTemplArgs(NULL, 0))) if (!CTemplTool_EqualArgs(TEMPL_CLASS_INST(tclass)->inst_args, CTempl_ParseUncheckTemplArgs(NULL, 0)))
CError_Error(CErrorStr374); CError_Error(CErrorStr374);
@ -1560,7 +1560,7 @@ static Boolean CScope_CheckDtorName(TypeClass *tclass, Boolean *flag) {
return 0; return 0;
} }
static Boolean CScope_ParseQualifiedName(CScopeParseResult *result, NameSpace *nspace) { static Boolean CScope_ParseQualifiedName(NameResult *result, NameSpace *nspace) {
NameSpaceObjectList *list; NameSpaceObjectList *list;
HashNameNode *saveidentifier; HashNameNode *saveidentifier;
TypeClass *tclass; TypeClass *tclass;
@ -1602,33 +1602,37 @@ static Boolean CScope_ParseQualifiedName(CScopeParseResult *result, NameSpace *n
return 0; 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) { if (flag) {
result->x1C = 1; result->x1C = 1;
return 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); CError_Error(CErrorStr136, nspace->theclass, 0);
else else
CError_Error(CErrorStr140, saveidentifier->name); CError_Error(CErrorStr140, saveidentifier->name);
return 0; return 0;
} }
if (result->x8 && IS_TYPE_CLASS(result->x8) && (lookahead() == '<')) { if (result->type && IS_TYPE_CLASS(result->type) && (lookahead() == '<')) {
tclass = TYPE_CLASS(result->x8); tclass = TYPE_CLASS(result->type);
if (tclass->flags & CLASS_FLAGS_800) if (tclass->flags & CLASS_IS_TEMPL_INST)
tclass = TYPE_CLASS(TEMPL_CLASS_INST(tclass)->templ); tclass = TYPE_CLASS(TEMPL_CLASS_INST(tclass)->templ);
else if (!(tclass->flags & CLASS_FLAGS_100)) else if (!(tclass->flags & CLASS_IS_TEMPL))
return 1; return 1;
tk = lex(); tk = lex();
result->x8 = CTempl_ClassGetType(TEMPL_CLASS(tclass)); result->type = CTempl_ClassGetType(TEMPL_CLASS(tclass));
if (IS_TYPE_CLASS(result->x8) && (lookahead() == TK_COLON_COLON)) { if (IS_TYPE_CLASS(result->type) && (lookahead() == TK_COLON_COLON)) {
lex(); lex();
tk = lex(); tk = lex();
result->x1D = 1; result->x1D = 1;
nspace = TYPE_CLASS(result->x8)->nspace; nspace = TYPE_CLASS(result->type)->nspace;
result->x8 = NULL; result->type = NULL;
result->obj_10 = NULL; result->obj_10 = NULL;
continue; continue;
} }
@ -1638,14 +1642,14 @@ static Boolean CScope_ParseQualifiedName(CScopeParseResult *result, NameSpace *n
} while (1); } while (1);
} }
Boolean CScope_ParseExprName(CScopeParseResult *result) { Boolean CScope_ParseExprName(NameResult *result) {
CScopeNSIterator iterator; CScopeNSIterator iterator;
HashNameNode *name; HashNameNode *name;
NameSpaceObjectList *list; NameSpaceObjectList *list;
Boolean flag; Boolean flag;
if (!copts.cplusplus) { if (!copts.cplusplus) {
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
if (tk != TK_IDENTIFIER) { if (tk != TK_IDENTIFIER) {
CError_Error(CErrorStr107); CError_Error(CErrorStr107);
return 0; return 0;
@ -1665,11 +1669,11 @@ Boolean CScope_ParseExprName(CScopeParseResult *result) {
return 1; return 1;
} else { } else {
if ((tk == TK_COLON_COLON || tk == TK_IDENTIFIER) && CScope_ParseQualifiedNameSpace(result, 1, 1)) { if ((tk == TK_COLON_COLON || tk == TK_IDENTIFIER) && CScope_ParseQualifiedNameSpace(result, 1, 1)) {
if (result->x8) if (result->type)
return 1; return 1;
CError_ASSERT(2313, result->nspace_0); CError_ASSERT(2313, result->nspace_0);
} else { } else {
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
result->nspace_0 = cscope_current; 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; CScopeNSIterator iterator;
HashNameNode *name; HashNameNode *name;
NameSpaceObjectList *list; NameSpaceObjectList *list;
@ -1748,7 +1752,7 @@ Boolean CScope_ParseDeclName(CScopeParseResult *result) {
CError_Error(CErrorStr107); CError_Error(CErrorStr107);
return 0; return 0;
} }
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
name = tkidentifier; name = tkidentifier;
CScope_NSIteratorInit(&iterator, cscope_current, result); CScope_NSIteratorInit(&iterator, cscope_current, result);
@ -1771,7 +1775,7 @@ Boolean CScope_ParseDeclName(CScopeParseResult *result) {
if (!CScope_ParseQualifiedNameSpace(result, 0, 0)) if (!CScope_ParseQualifiedNameSpace(result, 0, 0))
goto non_cpp_mode; goto non_cpp_mode;
if (result->x8) if (result->type)
return 1; return 1;
nspace = result->nspace_0; 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 // mostly matches, some registers are awkwardly swapped
HashNameNode *name; // r25 HashNameNode *name; // r25
NameSpace *nspace; // r24 NameSpace *nspace; // r24
@ -1845,7 +1849,7 @@ Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1,
NameSpaceObjectList *list; // r21 NameSpaceObjectList *list; // r21
CScopeNSIterator iterator; CScopeNSIterator iterator;
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
nspace = NULL; nspace = NULL;
if (tk == TK_COLON_COLON) { if (tk == TK_COLON_COLON) {
result->nspace_0 = nspace = cscope_root; result->nspace_0 = nspace = cscope_root;
@ -1894,7 +1898,7 @@ Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1,
type = OBJ_TYPE_TAG(list->object)->type; type = OBJ_TYPE_TAG(list->object)->type;
if (type->type != TYPECLASS) { if (type->type != TYPECLASS) {
if (t == '<') { if (t == '<') {
result->x8 = type; result->type = type;
return 1; return 1;
} else { } else {
CError_Error(CErrorStr121); CError_Error(CErrorStr121);
@ -1903,19 +1907,19 @@ Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1,
} }
parse_thing: parse_thing:
if (t == '<') { 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); type = TYPE(TEMPL_CLASS_INST(type)->templ);
} else if (!(TYPE_CLASS(type)->flags & CLASS_FLAGS_100)) { } else if (!(TYPE_CLASS(type)->flags & CLASS_IS_TEMPL)) {
result->x8 = type; result->type = type;
return 1; return 1;
} }
} }
if ((tk = lex()) == '<') { 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)); type2 = CTempl_ClassGetType(TEMPL_CLASS(type));
if (IS_TYPE_TEMPLATE(type2)) { if (IS_TYPE_TEMPLATE(type2)) {
if (lookahead() != TK_COLON_COLON) { if (lookahead() != TK_COLON_COLON) {
result->x8 = type2; result->type = type2;
return 1; return 1;
} }
return CScope_DependentTemplateMember(result, TYPE_TEMPLATE(type2), flag1, flag2); 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; result->nspace_0 = nspace = TYPE_CLASS(type2)->nspace;
if (lookahead() != TK_COLON_COLON) { if (lookahead() != TK_COLON_COLON) {
result->x8 = type2; result->type = type2;
return 1; return 1;
} }
tk = lex(); tk = lex();
CDecl_CompleteType(type2); CDecl_CompleteType(type2);
} else { } else {
CError_ASSERT(2632, tk == TK_COLON_COLON); 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; result->nspace_0 = nspace = TYPE_CLASS(type)->nspace;
CDecl_CompleteType(type); 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) { if (TYPE_TEMPLATE(type2)->dtype == TEMPLDEP_ARGUMENT && TYPE_TEMPLATE(type2)->u.pid.type == TPT_TEMPLATE) {
type2 = CTempl_ParseTemplTemplParam(TYPE_TEMPLATE(type2)); type2 = CTempl_ParseTemplTemplParam(TYPE_TEMPLATE(type2));
if ((type2->type != TYPETEMPLATE) || ((t = lookahead()) != TK_COLON_COLON)) { if ((type2->type != TYPETEMPLATE) || ((t = lookahead()) != TK_COLON_COLON)) {
result->x8 = type2; result->type = type2;
return 1; return 1;
} }
} }
@ -1956,19 +1960,19 @@ Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1,
return CScope_DependentTemplateMember(result, TYPE_TEMPLATE(type2), flag1, flag2); return CScope_DependentTemplateMember(result, TYPE_TEMPLATE(type2), flag1, flag2);
} }
if (t == '<') { if (t == '<') {
result->x8 = type2; result->type = type2;
return 1; return 1;
} else { } else {
CError_Error(CErrorStr121); CError_Error(CErrorStr121);
return 0; return 0;
} }
} else { } else {
if ((t == '<') && (TYPE_CLASS(type2)->flags & CLASS_FLAGS_100)) { if ((t == '<') && (TYPE_CLASS(type2)->flags & CLASS_IS_TEMPL)) {
type = type2; type = type2;
goto parse_thing; goto parse_thing;
} }
if ((tk = lex()) == '<') { if ((tk = lex()) == '<') {
result->x8 = type2; result->type = type2;
return 1; return 1;
} }
CError_ASSERT(2686, tk == TK_COLON_COLON); CError_ASSERT(2686, tk == TK_COLON_COLON);
@ -1989,14 +1993,14 @@ Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1,
return 0; return 0;
} }
Boolean CScope_ParseElaborateName(CScopeParseResult *result) { Boolean CScope_ParseElaborateName(NameResult *result) {
CScopeNSIterator iterator; CScopeNSIterator iterator;
HashNameNode *name; HashNameNode *name;
NameSpaceObjectList *list; NameSpaceObjectList *list;
Boolean flag; Boolean flag;
if (!copts.cplusplus) { if (!copts.cplusplus) {
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
if (tk != TK_IDENTIFIER) { if (tk != TK_IDENTIFIER) {
CError_Error(CErrorStr107); CError_Error(CErrorStr107);
return 0; return 0;
@ -2029,7 +2033,7 @@ Boolean CScope_ParseElaborateName(CScopeParseResult *result) {
} }
name = tkidentifier; name = tkidentifier;
} else { } else {
if (result->x8) if (result->type)
return 1; return 1;
CError_ASSERT(2760, result->nspace_0); 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; CScopeNSIterator iterator;
NameSpaceObjectList *list; NameSpaceObjectList *list;
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
CScope_NSIteratorInit(&iterator, nspace, result); CScope_NSIteratorInit(&iterator, nspace, result);
do { do {
for (list = CScope_NSIteratorFind(&iterator, name); list; list = list->next) { for (list = CScope_NSIteratorFind(&iterator, name); list; list = list->next) {
@ -2080,11 +2084,11 @@ Boolean CScope_FindObject(NameSpace *nspace, CScopeParseResult *result, HashName
return 0; return 0;
} }
Boolean CScope_FindNonClassObject(NameSpace *nspace, CScopeParseResult *result, HashNameNode *name) { Boolean CScope_FindNonClassObject(NameSpace *nspace, NameResult *result, HashNameNode *name) {
CScopeNSIterator iterator; CScopeNSIterator iterator;
NameSpaceObjectList *list; NameSpaceObjectList *list;
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
CScope_NSIteratorInit(&iterator, nspace, result); CScope_NSIteratorInit(&iterator, nspace, result);
do { do {
for (list = CScope_NSIteratorNonClassFind(&iterator, name); list; list = list->next) { for (list = CScope_NSIteratorNonClassFind(&iterator, name); list; list = list->next) {
@ -2098,11 +2102,11 @@ Boolean CScope_FindNonClassObject(NameSpace *nspace, CScopeParseResult *result,
return 0; return 0;
} }
NameSpaceObjectList *CScope_FindObjectList(CScopeParseResult *result, HashNameNode *name) { NameSpaceObjectList *CScope_FindObjectList(NameResult *result, HashNameNode *name) {
CScopeNSIterator iterator; CScopeNSIterator iterator;
NameSpaceObjectList *list; NameSpaceObjectList *list;
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
CScope_NSIteratorInit(&iterator, cscope_current, result); CScope_NSIteratorInit(&iterator, cscope_current, result);
do { do {
for (list = CScope_NSIteratorFind(&iterator, name); list; list = list->next) { 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) { Boolean CScope_PossibleTypeName(HashNameNode *name) {
CScopeParseResult result; NameResult result;
CScopeNSIterator iterator; CScopeNSIterator iterator;
NameSpaceObjectList *list; NameSpaceObjectList *list;
memclrw(&result, sizeof(CScopeParseResult)); memclrw(&result, sizeof(NameResult));
CScope_NSIteratorInit(&iterator, cscope_current, &result); CScope_NSIteratorInit(&iterator, cscope_current, &result);
do { do {
if ((list = CScope_NSIteratorFind(&iterator, name))) { if ((list = CScope_NSIteratorFind(&iterator, name))) {
@ -2142,10 +2146,10 @@ Boolean CScope_PossibleTypeName(HashNameNode *name) {
return 0; return 0;
} }
Boolean CScope_FindClassMemberObject(TypeClass *tclass, CScopeParseResult *result, HashNameNode *name) { Boolean CScope_FindClassMemberObject(TypeClass *tclass, NameResult *result, HashNameNode *name) {
NameSpaceObjectList *list; NameSpaceObjectList *list;
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
if (CScope_FindClassMember(result, tclass->nspace, name, Lookup_0)) { if (CScope_FindClassMember(result, tclass->nspace, name, Lookup_0)) {
list = result->nsol_14; list = result->nsol_14;
@ -2228,12 +2232,12 @@ Type *CScope_GetLocalTagType(NameSpace *nspace, HashNameNode *name) {
return NULL; return NULL;
} }
Boolean CScope_FindTypeName(NameSpace *nspace, HashNameNode *name, CScopeParseResult *result) { Boolean CScope_FindTypeName(NameSpace *nspace, HashNameNode *name, NameResult *result) {
CScopeNSIterator iterator; CScopeNSIterator iterator;
NameSpaceObjectList *list; NameSpaceObjectList *list;
NameSpaceObjectList *scan; NameSpaceObjectList *scan;
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
CScope_NSIteratorInit(&iterator, nspace, result); CScope_NSIteratorInit(&iterator, nspace, result);
do { do {
@ -2342,7 +2346,7 @@ BClassList *CScope_GetClassAccessPath(BClassList *list, TypeClass *tclass) {
return NULL; 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->bcl_18 = CScope_GetClassAccessPath(result->bcl_18, tclass))) {
if (result->name_4) if (result->name_4)
CError_Error(CErrorStr150, result->name_4->name); 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; HashNameNode *name;
NameSpaceObjectList *list; NameSpaceObjectList *list;
short t; short t;
@ -2365,11 +2369,11 @@ Boolean CScope_ParseMemberName(TypeClass *tclass, CScopeParseResult *result, Boo
if (!CScope_ParseExprName(result)) if (!CScope_ParseExprName(result))
return 0; 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) if (flag)
return 1; return 1;
CError_Error(CErrorStr340, TYPE_TEMPLATE(result->x8)->u.qual.name->name); CError_Error(CErrorStr340, TYPE_TEMPLATE(result->type)->u.qual.name->name);
result->x8 = NULL; result->type = NULL;
return 0; return 0;
} }
@ -2385,7 +2389,7 @@ Boolean CScope_ParseMemberName(TypeClass *tclass, CScopeParseResult *result, Boo
tkidentifier = name; tkidentifier = name;
switch (t) { switch (t) {
case TK_COLON_COLON: case TK_COLON_COLON:
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
if (!CScope_FindClassMember(result, tclass->nspace, name, Lookup_2)) if (!CScope_FindClassMember(result, tclass->nspace, name, Lookup_2))
goto restart; goto restart;
break; break;
@ -2395,7 +2399,7 @@ Boolean CScope_ParseMemberName(TypeClass *tclass, CScopeParseResult *result, Boo
break; break;
} }
} else if (tk == '~') { } else if (tk == '~') {
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
if (CScope_CheckDtorName(tclass, &dtorflag)) { if (CScope_CheckDtorName(tclass, &dtorflag)) {
if (dtorflag) { if (dtorflag) {
result->x1C = 1; result->x1C = 1;
@ -2412,7 +2416,7 @@ Boolean CScope_ParseMemberName(TypeClass *tclass, CScopeParseResult *result, Boo
return 0; return 0;
} }
memclrw(result, sizeof(CScopeParseResult)); memclrw(result, sizeof(NameResult));
return CScope_ParseQualifiedName(result, tclass->nspace); 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) { void CScope_AddClassUsingDeclaration(TypeClass *tclass, TypeClass *tclass2, HashNameNode *name, AccessType access) {
CScopeParseResult result; NameResult result;
NameSpaceObjectList *scan; NameSpaceObjectList *scan;
memclrw(&result, sizeof(CScopeParseResult)); memclrw(&result, sizeof(NameResult));
if (!CScope_FindClassMember(&result, tclass2->nspace, name, Lookup_0) || !CScope_FixMemberResult(tclass, &result)) { if (!CScope_FindClassMember(&result, tclass2->nspace, name, Lookup_0) || !CScope_FixMemberResult(tclass, &result)) {
CError_Error(CErrorStr340, name->name); CError_Error(CErrorStr340, name->name);
return; return;
@ -2540,10 +2544,10 @@ void CScope_ParseUsingDeclaration(NameSpace *nspace, AccessType access, Boolean
Boolean isTemplate; Boolean isTemplate;
Boolean isTypename; Boolean isTypename;
NameSpaceObjectList *scan; NameSpaceObjectList *scan;
CScopeParseResult result; NameResult result;
if (nspace->theclass) { 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; isTypename = 0;
if (tk == TK_TYPENAME) { if (tk == TK_TYPENAME) {
if (!isTemplate) if (!isTemplate)
@ -2557,7 +2561,7 @@ void CScope_ParseUsingDeclaration(NameSpace *nspace, AccessType access, Boolean
return; 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); CError_ASSERT(3578, isTemplate);
if (isTypename) { if (isTypename) {
@ -2565,12 +2569,12 @@ void CScope_ParseUsingDeclaration(NameSpace *nspace, AccessType access, Boolean
memclrw(objtype, sizeof(ObjType)); memclrw(objtype, sizeof(ObjType));
objtype->otype = OT_TYPE; objtype->otype = OT_TYPE;
objtype->access = access; objtype->access = access;
objtype->type = result.x8; objtype->type = result.type;
CScope_AddObject(nspace, TYPE_TEMPLATE(result.x8)->u.qual.name, OBJ_BASE(objtype)); CScope_AddObject(nspace, TYPE_TEMPLATE(result.type)->u.qual.name, OBJ_BASE(objtype));
} else { } else {
CTemplClass_RegisterUsingDecl( CTemplClass_RegisterUsingDecl(
TEMPL_CLASS(nspace->theclass), TEMPL_CLASS(nspace->theclass),
TYPE_TEMPLATE(result.x8), TYPE_TEMPLATE(result.type),
access); access);
} }
@ -2612,11 +2616,11 @@ void CScope_ParseUsingDeclaration(NameSpace *nspace, AccessType access, Boolean
} }
static NameSpace *CScope_ParseQualifiedNamespaceSpecifier(NameSpace *nspace) { static NameSpace *CScope_ParseQualifiedNamespaceSpecifier(NameSpace *nspace) {
CScopeParseResult result; NameResult result;
CScopeNSIterator iterator; CScopeNSIterator iterator;
NameSpaceObjectList *list; NameSpaceObjectList *list;
memclrw(&result, sizeof(CScopeParseResult)); memclrw(&result, sizeof(NameResult));
if (tk == TK_COLON_COLON) { if (tk == TK_COLON_COLON) {
nspace = cscope_root; nspace = cscope_root;
result.x1D = 1; result.x1D = 1;

View File

@ -70,9 +70,9 @@ void CABI_ReverseBitField(TypeBitfield *tbitfield) {
CError_FATAL(172); CError_FATAL(172);
} }
b = tbitfield->unkB; b = tbitfield->bitlength;
a = tbitfield->unkA; a = tbitfield->offset;
tbitfield->unkA = (bits - a) - b; tbitfield->offset = (bits - a) - b;
} }
static void CABI_AllocateZeroVTablePointer(void *unk, TypeClass *tclass) { static void CABI_AllocateZeroVTablePointer(void *unk, TypeClass *tclass) {
@ -95,7 +95,7 @@ static SInt32 CABI_GetBaseSize(TypeClass *tclass) {
return size; return size;
} }
static void CABI_AllocateBases(DeclE *decle, TypeClass *tclass) { static void CABI_AllocateBases(ClassLayout *layout, TypeClass *tclass) {
Boolean flag; Boolean flag;
TypeClass *baseclass; TypeClass *baseclass;
ClassList *base; ClassList *base;
@ -108,7 +108,7 @@ static void CABI_AllocateBases(DeclE *decle, TypeClass *tclass) {
for (base = tclass->bases; base; base = base->next) { for (base = tclass->bases; base; base = base->next) {
if (!base->is_virtual) { if (!base->is_virtual) {
baseclass = base->base; baseclass = base->base;
if (!(baseclass->flags & CLASS_FLAGS_1000)) { if (!(baseclass->flags & CLASS_EMPTY)) {
base->offset = size + CMach_MemberAlignValue(TYPE(baseclass), size); base->offset = size + CMach_MemberAlignValue(TYPE(baseclass), size);
if (copts.vbase_abi_v2) { if (copts.vbase_abi_v2) {
size = base->offset + CABI_GetBaseSize(baseclass); size = base->offset + CABI_GetBaseSize(baseclass);
@ -131,7 +131,7 @@ static void CABI_AllocateBases(DeclE *decle, TypeClass *tclass) {
tclass->size = size; tclass->size = size;
} }
static void CABI_AllocateVirtualBasePointers(DeclE *decle, TypeClass *tclass) { static void CABI_AllocateVirtualBasePointers(ClassLayout *layout, TypeClass *tclass) {
ClassList *base; ClassList *base;
SInt32 size; 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; ObjMemberVar *ivar;
SInt32 initialSize; SInt32 initialSize;
SInt32 maxSize; SInt32 maxSize;
@ -180,7 +180,7 @@ static void CABI_AllocateMembers(DeclE *decle, TypeClass *tclass) {
for (ivar = tclass->ivars; ivar; ivar = ivar->next) { for (ivar = tclass->ivars; ivar; ivar = ivar->next) {
if (!ivar->anonunion) { if (!ivar->anonunion) {
if (!(ivar->offset & 0x80000000)) { if (!(ivar->offset & 0x80000000)) {
if (tclass->mode == CLASS_MODE_1) if (tclass->mode == CLASS_MODE_UNION)
CMach_StructLayoutInitOffset(initialSize); CMach_StructLayoutInitOffset(initialSize);
if (IS_TYPE_BITFIELD(ivar->type)) if (IS_TYPE_BITFIELD(ivar->type))
@ -188,7 +188,7 @@ static void CABI_AllocateMembers(DeclE *decle, TypeClass *tclass) {
else else
ivar->offset = CMach_StructLayoutGetOffset(ivar->type, ivar->qual); ivar->offset = CMach_StructLayoutGetOffset(ivar->type, ivar->qual);
if (tclass->mode == CLASS_MODE_1) { if (tclass->mode == CLASS_MODE_UNION) {
SInt32 tmp = CMach_StructLayoutGetCurSize(); SInt32 tmp = CMach_StructLayoutGetCurSize();
if (tmp > maxSize) if (tmp > maxSize)
maxSize = tmp; maxSize = tmp;
@ -208,14 +208,14 @@ static void CABI_AllocateMembers(DeclE *decle, TypeClass *tclass) {
} else { } else {
CError_ASSERT(422, IS_TYPE_CLASS(ivar->type)); CError_ASSERT(422, IS_TYPE_CLASS(ivar->type));
if (tclass->mode == CLASS_MODE_1) if (tclass->mode == CLASS_MODE_UNION)
CMach_StructLayoutInitOffset(initialSize); CMach_StructLayoutInitOffset(initialSize);
unionStart = CMach_StructLayoutGetOffset(ivar->type, ivar->qual); unionStart = CMach_StructLayoutGetOffset(ivar->type, ivar->qual);
unionClass = TYPE_CLASS(ivar->type); unionClass = TYPE_CLASS(ivar->type);
inAnonUnion = 1; inAnonUnion = 1;
if (tclass->mode == CLASS_MODE_1) { if (tclass->mode == CLASS_MODE_UNION) {
SInt32 tmp = CMach_StructLayoutGetCurSize(); SInt32 tmp = CMach_StructLayoutGetCurSize();
if (tmp > maxSize) if (tmp > maxSize)
maxSize = tmp; maxSize = tmp;
@ -224,7 +224,7 @@ static void CABI_AllocateMembers(DeclE *decle, TypeClass *tclass) {
removeNoNameIvars = 1; removeNoNameIvars = 1;
} }
if (decle->vtable_ivar == ivar) if (layout->vtable_ivar == ivar)
tclass->vtable->offset = ivar->offset; 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; tclass->size = maxSize;
else else
tclass->size = CMach_StructLayoutGetCurSize(); 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; VClassList *vbase;
SInt32 size; SInt32 size;
@ -331,14 +331,14 @@ static SInt32 CABI_GetBaseVTableSize(TypeClass *tclass) {
static void CABI_ApplyClassFlags(Object *obj, UInt8 flags, Boolean unused) { static void CABI_ApplyClassFlags(Object *obj, UInt8 flags, Boolean unused) {
if (flags & CLASS_EFLAGS_INTERNAL) if (flags & CLASS_EFLAGS_INTERNAL)
obj->flags = obj->flags | OBJECT_FLAGS_10; obj->flags = obj->flags | OBJECT_INTERNAL;
if (flags & CLASS_EFLAGS_IMPORT) if (flags & CLASS_EFLAGS_IMPORT)
obj->flags = obj->flags | OBJECT_FLAGS_20; obj->flags = obj->flags | OBJECT_IMPORT;
if (flags & CLASS_EFLAGS_EXPORT) 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; SInt32 size;
ObjBase *objbase; ObjBase *objbase;
Object *obj; Object *obj;
@ -351,7 +351,7 @@ static void CABI_AllocateVTable(DeclE *decle, TypeClass *tclass) {
if (!tclass->vtable) { if (!tclass->vtable) {
CABI_AddVTable(tclass); CABI_AddVTable(tclass);
decle->xA = decle->x8 - 1; layout->xA = layout->lex_order_count - 1;
} }
if (!CABI_FindZeroDeltaVPtr(tclass)) { if (!CABI_FindZeroDeltaVPtr(tclass)) {
@ -362,30 +362,30 @@ static void CABI_AllocateVTable(DeclE *decle, TypeClass *tclass) {
ivar->access = ACCESSPUBLIC; ivar->access = ACCESSPUBLIC;
ivar->name = vptr_name_node; ivar->name = vptr_name_node;
ivar->type = TYPE(&void_ptr); 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) { if (i < 0) {
ivar->next = tclass->ivars; ivar->next = tclass->ivars;
tclass->ivars = ivar; tclass->ivars = ivar;
break; break;
} }
CError_ASSERT(666, decle->objlist[i]); CError_ASSERT(666, layout->objlist[i]);
if (decle->objlist[i]->otype == OT_MEMBERVAR) { if (layout->objlist[i]->otype == OT_MEMBERVAR) {
ivar->next = OBJ_MEMBER_VAR(decle->objlist[i])->next; ivar->next = OBJ_MEMBER_VAR(layout->objlist[i])->next;
OBJ_MEMBER_VAR(decle->objlist[i])->next = ivar; OBJ_MEMBER_VAR(layout->objlist[i])->next = ivar;
break; break;
} }
} }
if (tclass->flags & (CLASS_FLAGS_10 | CLASS_FLAGS_2000)) if (tclass->flags & (CLASS_SINGLE_OBJECT | CLASS_COM_OBJECT))
size = void_ptr.size; size = void_ptr.size;
else else
size = 8; size = 8;
} else { } else {
decle->vtable_ivar = NULL; layout->vtable_ivar = NULL;
} }
for (base = tclass->bases; base; base = base->next) { 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++) { for (i = 0; i < layout->lex_order_count; i++) {
CError_ASSERT(714, objbase = decle->objlist[i]); CError_ASSERT(714, objbase = layout->objlist[i]);
if (objbase->otype == OT_OBJECT && OBJECT(objbase)->datatype == DVFUNC) { if (objbase->otype == OT_OBJECT && OBJECT(objbase)->datatype == DVFUNC) {
TypeMemberFunc *tmethod = TYPE_METHOD(OBJECT(objbase)->type); TypeMemberFunc *tmethod = TYPE_METHOD(OBJECT(objbase)->type);
Object *baseobj = CABI_FindZeroVirtualBaseMember(tclass, OBJECT(objbase)); Object *baseobj = CABI_FindZeroVirtualBaseMember(tclass, OBJECT(objbase));
if (baseobj) { if (baseobj) {
tmethod->x1E = TYPE_METHOD(baseobj->type)->x1E; tmethod->vtbl_index = TYPE_METHOD(baseobj->type)->vtbl_index;
} else { } else {
tmethod->x1E = size; tmethod->vtbl_index = size;
size += 4; size += 4;
} }
} }
@ -450,34 +450,34 @@ static void CABI_AllocateVTable(DeclE *decle, TypeClass *tclass) {
tclass->vtable->size = size; tclass->vtable->size = size;
} }
void CABI_LayoutClass(DeclE *decle, TypeClass *tclass) { void CABI_LayoutClass(ClassLayout *layout, TypeClass *tclass) {
char saveAlignMode = copts.structalignment; char saveAlignMode = copts.structalignment;
tclass->size = 0; tclass->size = 0;
if (!tclass->sominfo) { if (!tclass->sominfo) {
if (tclass->bases) if (tclass->bases)
CABI_AllocateBases(decle, tclass); CABI_AllocateBases(layout, tclass);
if (tclass->flags & CLASS_FLAGS_20) if (tclass->flags & CLASS_HAS_VBASES)
CABI_AllocateVirtualBasePointers(decle, tclass); CABI_AllocateVirtualBasePointers(layout, tclass);
if (decle->xC) if (layout->has_vtable)
CABI_AllocateVTable(decle, tclass); CABI_AllocateVTable(layout, tclass);
CABI_AllocateMembers(decle, tclass); CABI_AllocateMembers(layout, tclass);
if (tclass->flags & CLASS_FLAGS_20) if (tclass->flags & CLASS_HAS_VBASES)
CABI_AllocateVirtualBases(decle, tclass); CABI_AllocateVirtualBases(layout, tclass);
} else { } else {
copts.structalignment = AlignMode2_PPC; copts.structalignment = AlignMode2_PPC;
CABI_AllocateMembers(decle, tclass); CABI_AllocateMembers(layout, tclass);
} }
tclass->align = CMach_GetClassAlign(tclass); tclass->align = CMach_GetClassAlign(tclass);
if (tclass->size == 0) { if (tclass->size == 0) {
tclass->size = 1; tclass->size = 1;
tclass->flags = tclass->flags | CLASS_FLAGS_1000; tclass->flags = tclass->flags | CLASS_EMPTY;
} else { } else {
tclass->size += CABI_StructSizeAlignValue(TYPE(tclass), tclass->size); tclass->size += CABI_StructSizeAlignValue(TYPE(tclass), tclass->size);
} }
tclass->flags = tclass->flags | CLASS_FLAGS_2; tclass->flags = tclass->flags | CLASS_COMPLETED;
copts.structalignment = saveAlignMode; copts.structalignment = saveAlignMode;
} }
@ -510,7 +510,7 @@ void CABI_MakeDefaultArgConstructor(TypeClass *tclass, Object *func) {
CFunc_SetupNewFuncArgs(func, TYPE_FUNC(func->type)->args); 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; arguments->next->object->name = no_name_node;
firstStmt.next = &returnStmt; firstStmt.next = &returnStmt;
@ -531,7 +531,7 @@ void CABI_MakeDefaultArgConstructor(TypeClass *tclass, Object *func) {
argexprs->node = create_objectnode(arguments->object); argexprs->node = create_objectnode(arguments->object);
if (tclass->flags & CLASS_FLAGS_20) { if (tclass->flags & CLASS_HAS_VBASES) {
args = args->next; args = args->next;
argexprs->next = lalloc(sizeof(ENodeList)); argexprs->next = lalloc(sizeof(ENodeList));
argexprs = argexprs->next; argexprs = argexprs->next;
@ -571,7 +571,7 @@ ENode *CABI_MakeThisExpr(TypeClass *tclass, SInt32 offset) {
if (tclass) { if (tclass) {
if (!tclass->sominfo) { if (!tclass->sominfo) {
expr = create_objectnode(CABI_ThisArg()); expr = create_objectnode(CABI_ThisArg());
if (tclass->flags & CLASS_FLAGS_1) if (tclass->flags & CLASS_HANDLEOBJECT)
expr = makemonadicnode(expr, EINDIRECT); expr = makemonadicnode(expr, EINDIRECT);
} else { } else {
expr = CSOM_SOMSelfObjectExpr(tclass); expr = CSOM_SOMSelfObjectExpr(tclass);
@ -601,7 +601,7 @@ static ENode *CABI_MakeCopyConArgExpr(TypeClass *tclass, Boolean flag) {
CError_ASSERT(1000, args = arguments); CError_ASSERT(1000, args = arguments);
CError_ASSERT(1001, args = args->next); 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(1002, args = args->next);
CError_ASSERT(1003, IS_TYPE_POINTER_ONLY(args->object->type)); 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) { Object *CABI_ConstructorCallsNew(TypeClass *tclass) {
NameSpaceObjectList *nsol; 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 (CScope_FindClassMemberObject(tclass, &pr, CMangler_OperatorName(TK_NEW))) {
if (pr.obj_10) { if (pr.obj_10) {
if (CABI_IsOperatorNew(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->sominfo) {
if (tclass->flags & CLASS_FLAGS_20) { if (tclass->flags & CLASS_HAS_VBASES) {
label = newlabel(); label = newlabel();
stmt = CFunc_InsertStatement(ST_IFGOTO, stmt); 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); CFunc_SetupNewFuncArgs(func, TYPE_FUNC(func->type)->args);
ctor_chain = NULL; ctor_chain = NULL;
if (tclass->flags & CLASS_FLAGS_20) if (tclass->flags & CLASS_HAS_VBASES)
arguments->next->object->name = CParser_GetUniqueName(); arguments->next->object->name = CParser_GetUniqueName();
firstStmt.next = &returnStmt; firstStmt.next = &returnStmt;
@ -1333,7 +1333,7 @@ static Statement *CABI_CopyConAssignCB(Statement *stmt, TypeClass *tclass, TypeC
Object *tmpfunc; Object *tmpfunc;
if (baseclass) { if (baseclass) {
if (baseclass->flags & CLASS_FLAGS_1000) { if (baseclass->flags & CLASS_EMPTY) {
if ( if (
(flag && !CClass_CopyConstructor(baseclass)) || (flag && !CClass_CopyConstructor(baseclass)) ||
(!flag && !CClass_AssignmentOperator(baseclass)) (!flag && !CClass_AssignmentOperator(baseclass))
@ -1556,7 +1556,7 @@ void CABI_MakeDefaultCopyConstructor(TypeClass *tclass, Object *func) {
CFunc_SetupNewFuncArgs(func, TYPE_FUNC(func->type)->args); CFunc_SetupNewFuncArgs(func, TYPE_FUNC(func->type)->args);
ctor_chain = NULL; ctor_chain = NULL;
if (tclass->flags & CLASS_FLAGS_20) if (tclass->flags & CLASS_HAS_VBASES)
arguments->next->object->name = CParser_GetUniqueName(); arguments->next->object->name = CParser_GetUniqueName();
firstStmt.next = &returnStmt; firstStmt.next = &returnStmt;
@ -1599,7 +1599,7 @@ void CABI_MakeDefaultAssignmentOperator(TypeClass *tclass, Object *func) {
stmt = curstmt; stmt = curstmt;
if (tclass->mode == CLASS_MODE_1) { if (tclass->mode == CLASS_MODE_UNION) {
expr1 = makemonadicnode(CABI_MakeThisExpr(tclass, 0), EINDIRECT); expr1 = makemonadicnode(CABI_MakeThisExpr(tclass, 0), EINDIRECT);
expr1->rtype = TYPE(tclass); expr1->rtype = TYPE(tclass);
@ -1803,13 +1803,13 @@ void CABI_TransDestructor(Object *obj1, Object *obj2, Statement *stmt, TypeClass
scan->dobjstack = NULL; scan->dobjstack = NULL;
label->stmt = scan; label->stmt = scan;
if (flag23 && !(tclass->flags & CLASS_FLAGS_1)) if (flag23 && !(tclass->flags & CLASS_HANDLEOBJECT))
scan = CABI_DestroyMembers(scan, tclass->ivars, tclass); scan = CABI_DestroyMembers(scan, tclass->ivars, tclass);
if (flag25 && tclass->bases) if (flag25 && tclass->bases)
scan = CABI_DestroyBases(scan, tclass->bases); scan = CABI_DestroyBases(scan, tclass->bases);
if (flag24 && (tclass->flags & CLASS_FLAGS_20)) { if (flag24 && (tclass->flags & CLASS_HAS_VBASES)) {
label3 = newlabel(); label3 = newlabel();
scan = CFunc_InsertStatement(ST_IFNGOTO, scan); scan = CFunc_InsertStatement(ST_IFNGOTO, scan);
scan->expr = CABI_MakeVArgExpr(); scan->expr = CABI_MakeVArgExpr();
@ -1957,12 +1957,12 @@ static void CABI_AddLayeredDestructor(TypeClass *tclass, Object *dtor, HashNameN
func->nspace = dtor->nspace; func->nspace = dtor->nspace;
func->name = name; func->name = name;
func->type = TYPE(CDecl_MakeDefaultDtorType(tclass, is_virtual)); 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; func->qual |= Q_INLINE;
CABI_ApplyClassFlags(func, tclass->eflags, 1); CABI_ApplyClassFlags(func, tclass->eflags, 1);
CError_ASSERT(2678, IS_TYPE_FUNC(func->type)); 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) { if (dtor->datatype == DVFUNC) {
func->datatype = DVFUNC; func->datatype = DVFUNC;
@ -2018,7 +2018,7 @@ ENode *CABI_DestroyObject(Object *dtor, ENode *objexpr, CABIDestroyMode mode, Bo
if (flag1) if (flag1)
expr->data.funccall.funcref->flags = expr->data.funccall.funcref->flags | ENODE_FLAG_80; expr->data.funccall.funcref->flags = expr->data.funccall.funcref->flags | ENODE_FLAG_80;
expr->data.funccall.functype = TYPE_FUNC(dtor->type); 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 = lalloc(sizeof(ENodeList));
list->node = objexpr; list->node = objexpr;

View File

@ -202,7 +202,7 @@ void CBrowse_BeginClass(DeclInfo *di, GList *gl) {
!di->file->recordbrowseinfo || !di->file->recordbrowseinfo ||
!di->file2 || !di->file2 ||
!di->file2->fileID || !di->file2->fileID ||
di->x60 <= 0 di->sourceoffset <= 0
) )
{ {
memclrw(&gClassData, sizeof(gClassData)); memclrw(&gClassData, sizeof(gClassData));
@ -218,9 +218,9 @@ void CBrowse_BeginClass(DeclInfo *di, GList *gl) {
AppendGListByte(&gClassData, browseClass); AppendGListByte(&gClassData, browseClass);
AppendGListWord(&gClassData, di->file->fileID); AppendGListWord(&gClassData, di->file->fileID);
AppendGListWord(&gClassData, di->file2->fileID); AppendGListWord(&gClassData, di->file2->fileID);
AppendGListLong(&gClassData, di->x60 - 1); AppendGListLong(&gClassData, di->sourceoffset - 1);
CError_ASSERT(270, gClassData.size == 9); CError_ASSERT(270, gClassData.size == 9);
AppendGListLong(&gClassData, di->x60 - 1); AppendGListLong(&gClassData, di->sourceoffset - 1);
AppendGListLong(&gClassData, 0); AppendGListLong(&gClassData, 0);
RecordName(&gClassData, TYPE_CLASS(di->thetype)->classname->name, TYPE_CLASS(di->thetype)->classname->id); 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); AppendGListByte(&gClassData, base->is_virtual);
tclass = base->base; 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); tclass = TYPE_CLASS(TEMPL_CLASS_INST(tclass)->templ);
CMangler_MangleType(TYPE(tclass), 0); 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)); CError_ASSERT(391, object->type && IS_TYPE_FUNC(object->type));
tfunc = TYPE_METHOD(object->type); tfunc = TYPE_METHOD(object->type);
if (tfunc->flags & FUNC_FLAGS_100) if (tfunc->flags & FUNC_AUTO_GENERATED)
return; return;
if (object->datatype == DVFUNC) if (object->datatype == DVFUNC)
flags |= kVirtual; flags |= kVirtual;
if (tfunc->flags & FUNC_FLAGS_8) if (tfunc->flags & FUNC_PURE)
flags |= kAbstract; flags |= kAbstract;
if (tfunc->x26) if (tfunc->is_static)
flags |= kStatic; flags |= kStatic;
if (tfunc->flags & FUNC_FLAGS_1000) if (tfunc->flags & FUNC_IS_CTOR)
flags |= kCtor; flags |= kCtor;
if (tfunc->flags & FUNC_FLAGS_2000) if (tfunc->flags & FUNC_IS_DTOR)
flags |= kDtor; flags |= kDtor;
AppendGListByte(&gClassData, memberFunction); AppendGListByte(&gClassData, memberFunction);
AppendGListByte(&gClassData, gFromAccessType[object->access]); AppendGListByte(&gClassData, gFromAccessType[object->access]);
AppendGListLong(&gClassData, flags); AppendGListLong(&gClassData, flags);
id = tfunc->x22; id = tfunc->funcid;
if (id <= 0) { if (id <= 0) {
// TODO: this is not 64-bit safe // 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); AppendGListLong(&gMemberFuncList, (SInt32) object);
tfunc->x22 = id = gNextMemberFuncID++; tfunc->funcid = id = gNextMemberFuncID++;
} }
AppendGListLong(&gClassData, id); AppendGListLong(&gClassData, id);
@ -398,7 +398,7 @@ void CBrowse_BeginStruct(DeclInfo *di, TypeStruct *tstruct, GList *gl) {
!di->file->recordbrowseinfo || !di->file->recordbrowseinfo ||
!di->file2 || !di->file2 ||
!di->file2->fileID || !di->file2->fileID ||
di->x60 <= 0 di->sourceoffset <= 0
) )
{ {
memclrw(&gClassData, sizeof(gClassData)); memclrw(&gClassData, sizeof(gClassData));
@ -415,9 +415,9 @@ void CBrowse_BeginStruct(DeclInfo *di, TypeStruct *tstruct, GList *gl) {
AppendGListByte(&gClassData, browseClass); AppendGListByte(&gClassData, browseClass);
AppendGListWord(&gClassData, di->file->fileID); AppendGListWord(&gClassData, di->file->fileID);
AppendGListWord(&gClassData, di->file2->fileID); AppendGListWord(&gClassData, di->file2->fileID);
AppendGListLong(&gClassData, di->x60 - 1); AppendGListLong(&gClassData, di->sourceoffset - 1);
CError_ASSERT(521, gClassData.size == 9); CError_ASSERT(521, gClassData.size == 9);
AppendGListLong(&gClassData, di->x60 - 1); AppendGListLong(&gClassData, di->sourceoffset - 1);
AppendGListLong(&gClassData, 0); AppendGListLong(&gClassData, 0);
RecordName(&gClassData, name->name, name->id); RecordName(&gClassData, name->name, name->id);
AppendGListWord(&gClassData, 0); AppendGListWord(&gClassData, 0);
@ -540,7 +540,7 @@ static void RecordFunction(Object *object, int fileID1, int fileID2, SInt32 star
return; return;
tfunc = TYPE_FUNC(object->type); 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; return;
linkname = object->name; linkname = object->name;
@ -566,7 +566,7 @@ static void RecordFunction(Object *object, int fileID1, int fileID2, SInt32 star
} }
} else { } else {
flag = 1; 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; tmp = TYPE_METHOD(tfunc)->theclass->classname->name;
while (*tmp >= '0' && *tmp <= '9') while (*tmp >= '0' && *tmp <= '9')
tmp++; tmp++;
@ -576,7 +576,7 @@ static void RecordFunction(Object *object, int fileID1, int fileID2, SInt32 star
if ((tmp = strrchr(str29, ':'))) if ((tmp = strrchr(str29, ':')))
str29 = tmp + 1; str29 = tmp + 1;
if (tfunc->flags & FUNC_FLAGS_2000) { if (tfunc->flags & FUNC_IS_DTOR) {
buf2[0] = '~'; buf2[0] = '~';
strncpy(&buf2[1], str29, sizeof(buf2) - 1); strncpy(&buf2[1], str29, sizeof(buf2) - 1);
namestr = buf2; namestr = buf2;
@ -623,15 +623,15 @@ static void RecordFunction(Object *object, int fileID1, int fileID2, SInt32 star
flags |= kAsm; flags |= kAsm;
if (object->sclass == TK_STATIC) if (object->sclass == TK_STATIC)
flags |= kStatic; flags |= kStatic;
if (tfunc->flags & FUNC_FLAGS_METHOD) if (tfunc->flags & FUNC_METHOD)
flags |= kMember; flags |= kMember;
AppendGListLong(&gBrowseData, flags); AppendGListLong(&gBrowseData, flags);
funcid = 0; funcid = 0;
if (tfunc->flags & FUNC_FLAGS_METHOD) { if (tfunc->flags & FUNC_METHOD) {
funcid = TYPE_METHOD(tfunc)->x22; funcid = TYPE_METHOD(tfunc)->funcid;
if (funcid <= 0) { if (funcid <= 0) {
TYPE_METHOD(tfunc)->x22 = funcid = gNextMemberFuncID++; TYPE_METHOD(tfunc)->funcid = funcid = gNextMemberFuncID++;
} }
} }
AppendGListLong(&gBrowseData, funcid); AppendGListLong(&gBrowseData, funcid);
@ -729,7 +729,7 @@ static void RecordUndefinedMemberFunctions(void) {
count = gMemberFuncList.size / sizeof(Object *); count = gMemberFuncList.size / sizeof(Object *);
array = (Object **) *gMemberFuncList.data; array = (Object **) *gMemberFuncList.data;
for (i = 0; i < count; i++, array++) { 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); RecordFunction(*array, 0, 0, -1, -1);
} }

View File

@ -83,7 +83,7 @@ void CClass_GenThunks(void) {
ThunkList *list; ThunkList *list;
for (list = cclass_thunklist; list; list = list->next) { 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); 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; return 0;
if ( 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) || !is_arglistsame(a->args->next, b->args->next) ||
a->args->qual != b->args->qual 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) { for (nsol = CScope_FindName(tclass->nspace, constructor_name_node); nsol; nsol = nsol->next) {
object = OBJECT(nsol->object); object = OBJECT(nsol->object);
if (object->otype == OT_OBJECT && IS_TYPE_FUNC(object->type)) { 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) if (TYPE_FUNC(object->type)->args->next && !TYPE_FUNC(object->type)->args->next->next)
return object; return object;
} else { } else {
@ -238,7 +238,7 @@ Object *CClass_DummyDefaultConstructor(TypeClass *tclass) {
if (object->otype == OT_OBJECT && IS_TYPE_FUNC(object->type)) { if (object->otype == OT_OBJECT && IS_TYPE_FUNC(object->type)) {
CError_ASSERT(305, args = TYPE_FUNC(object->type)->args); CError_ASSERT(305, args = TYPE_FUNC(object->type)->args);
args = args->next; args = args->next;
if ((tclass->flags & CLASS_FLAGS_20) && !tclass->sominfo) { if ((tclass->flags & CLASS_HAS_VBASES) && !tclass->sominfo) {
CError_ASSERT(309, args); CError_ASSERT(309, args);
args = args->next; args = args->next;
} }
@ -272,18 +272,18 @@ Object *CClass_DummyDefaultConstructor(TypeClass *tclass) {
tmethod->type = TYPEFUNC; tmethod->type = TYPEFUNC;
tmethod->functype = TYPE(&void_ptr); tmethod->functype = TYPE(&void_ptr);
tmethod->flags = FUNC_FLAGS_METHOD; tmethod->flags = FUNC_METHOD;
tmethod->theclass = tclass; tmethod->theclass = tclass;
CDecl_SetFuncFlags(TYPE_FUNC(tmethod), 0); 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_AddArgument(TYPE_FUNC(tmethod), TYPE(&stsignedshort));
CDecl_AddThisPointerArgument(TYPE_FUNC(tmethod), tclass); CDecl_AddThisPointerArgument(TYPE_FUNC(tmethod), tclass);
object = CParser_NewCompilerDefFunctionObject(); object = CParser_NewCompilerDefFunctionObject();
object->type = TYPE(tmethod); object->type = TYPE(tmethod);
object->qual = Q_INLINE | Q_80000; object->qual = Q_INLINE | Q_MANGLE_NAME;
object->nspace = tclass->nspace; object->nspace = tclass->nspace;
object->name = name; object->name = name;
@ -319,7 +319,7 @@ ENode *CClass_DefaultConstructorCall(TypeClass *tclass, TypeClass *b, ENode *obj
args = args->next; args = args->next;
if ((tclass->flags & CLASS_FLAGS_20) && !tclass->sominfo) { if ((tclass->flags & CLASS_HAS_VBASES) && !tclass->sominfo) {
CError_ASSERT(401, args); CError_ASSERT(401, args);
args = args->next; args = args->next;
} }
@ -362,7 +362,7 @@ ENode *CClass_DefaultConstructorCall(TypeClass *tclass, TypeClass *b, ENode *obj
} }
skipCheck: skipCheck:
if ((tclass->flags & CLASS_FLAGS_20) && !tclass->sominfo) { if ((tclass->flags & CLASS_HAS_VBASES) && !tclass->sominfo) {
argexprs = lalloc(sizeof(ENodeList)); argexprs = lalloc(sizeof(ENodeList));
argexprs->next = NULL; argexprs->next = NULL;
argexprs->node = intconstnode(TYPE(&stsignedshort), varg); argexprs->node = intconstnode(TYPE(&stsignedshort), varg);
@ -443,7 +443,7 @@ Object *CClass_CopyConstructor(TypeClass *tclass) {
args = args->next; args = args->next;
if (tclass->flags & CLASS_FLAGS_20) { if (tclass->flags & CLASS_HAS_VBASES) {
CError_ASSERT(536, args); CError_ASSERT(536, args);
args = args->next; args = args->next;
} }
@ -499,11 +499,11 @@ Object *CClass_Destructor(TypeClass *tclass) {
} }
Boolean CClass_IsConstructor(Object *obj) { 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) { 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) { Boolean CClass_IsPODClass(TypeClass *tclass) {
@ -519,13 +519,13 @@ Boolean CClass_IsPODClass(TypeClass *tclass) {
if ( if (
nsol->object->otype == OT_OBJECT && nsol->object->otype == OT_OBJECT &&
IS_TYPE_FUNC(OBJECT(nsol->object)->type) && 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; return 0;
} }
object = CClass_AssignmentOperator(tclass); 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; return 0;
for (ivar = tclass->ivars; ivar; ivar = ivar->next) { for (ivar = tclass->ivars; ivar; ivar = ivar->next) {
@ -563,7 +563,7 @@ Boolean CClass_IsTrivialCopyClass(TypeClass *tclass) {
return 0; return 0;
object = CClass_CopyConstructor(tclass); 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; return 0;
for (base = tclass->bases; base; base = base->next) { for (base = tclass->bases; base; base = base->next) {
@ -592,7 +592,7 @@ Boolean CClass_IsTrivialCopyAssignClass(TypeClass *tclass) {
return 0; return 0;
object = CClass_AssignmentOperator(tclass); 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; return 0;
for (ivar = tclass->ivars; ivar; ivar = ivar->next) { for (ivar = tclass->ivars; ivar; ivar = ivar->next) {
@ -612,7 +612,7 @@ Boolean CClass_IsTrivialCopyAssignClass(TypeClass *tclass) {
} }
Boolean CClass_ReferenceArgument(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)); CDecl_CompleteType(TYPE(tclass));
if (copts.simple_class_byval) if (copts.simple_class_byval)
@ -778,9 +778,9 @@ BClassList *CClass_GetBasePath(TypeClass *a, TypeClass *b, short *founddepth, Bo
BClassList *path; BClassList *path;
BClassList *result; 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)); 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)); CDecl_CompleteType(TYPE(b));
cclass_founddepth = 0; cclass_founddepth = 0;
@ -903,7 +903,7 @@ ENode *CClass_ClassPointerCast(ENode *expr, TypeClass *a, TypeClass *b, Boolean
CError_Error(CErrorStr188); CError_Error(CErrorStr188);
if (pathcheckflag) if (pathcheckflag)
CClass_CheckPathAccess(path, NULL, ACCESSPUBLIC); 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); expr = CClass_AccessPathCast(path, expr, reverse);
} }
} }
@ -1362,7 +1362,7 @@ static void CClass_AllocVTableRec(OVClass *ovclass) {
return; return;
for (ovfunc = ovclass->vfuncs; ovfunc; ovfunc = ovfunc->next) { 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); CError_ASSERT(1867, offset27 < vtable_data_size);
if (!(vtable_object_data[offset27])) { if (!(vtable_object_data[offset27])) {
@ -1382,7 +1382,7 @@ static void CClass_AllocVTableRec(OVClass *ovclass) {
} }
if ((offset26 = ovfunc->ovc8->offset - ovclass->offset)) { 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; cclass_ovbase = NULL;
CError_ASSERT(1899, CClass_IsBaseOf(ovclass, ovfunc->ovc8)); CError_ASSERT(1899, CClass_IsBaseOf(ovclass, ovfunc->ovc8));
@ -1400,7 +1400,7 @@ static void CClass_AllocVTableRec(OVClass *ovclass) {
object = ovfunc->obj; 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 = lalloc(sizeof(OLinkList));
link->next = vtable_object_links; link->next = vtable_object_links;
link->obj = object; link->obj = object;
@ -1432,7 +1432,7 @@ static Object *CClass_CheckClass(OVClass *ovclass, Boolean errorflag) {
if (!object) { if (!object) {
check = ovfunc->ovfC ? ovfunc->ovfC->obj : ovfunc->obj; 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; object = check;
} }
} }
@ -1567,7 +1567,7 @@ void CClass_CheckOverrides(TypeClass *tclass) {
CClass_OverrideOVClassTree(tree); CClass_OverrideOVClassTree(tree);
if (CClass_CheckClass(tree, 0)) if (CClass_CheckClass(tree, 0))
tclass->flags |= CLASS_FLAGS_ABSTRACT; tclass->flags |= CLASS_ABSTRACT;
if (copts.warn_hidevirtual) if (copts.warn_hidevirtual)
CClass_CheckHideVirtual(tree, tree); CClass_CheckHideVirtual(tree, tree);
@ -1677,7 +1677,7 @@ static void CClass_ConstructVTable(TypeClass *tclass, SInt32 voffset, SInt32 off
break; break;
if (object->datatype == DVFUNC) { 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); CError_ASSERT(2288, newoffset < vtable_data_size);
if (!vtable_object_data[newoffset]) { if (!vtable_object_data[newoffset]) {
@ -1697,7 +1697,7 @@ static void CClass_ConstructVTable(TypeClass *tclass, SInt32 voffset, SInt32 off
vtable_object_data[newoffset] = 1; 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) { if (!check_pures) {
thunkobject = cclass_dominator_oobject; thunkobject = cclass_dominator_oobject;
if ((thunkoffset = cclass_dominator_ooffset - offset)) { if ((thunkoffset = cclass_dominator_ooffset - offset)) {
@ -1765,7 +1765,7 @@ void CClass_ClassAction(TypeClass *tclass) {
CClass_AllocVTable(tclass); CClass_AllocVTable(tclass);
memclrw(vtable_object_data, vtable_data_size); 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); vtable_object_links = CRTTI_ConstructVTableHeaders(tclass, vtable_object_data, vtable_object_links);
CError_ASSERT(2492, tclass->vtable->object->type->size == tclass->vtable->size); 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; short i;
innertype = TYPE_BITFIELD(*ptype)->bitfieldtype; innertype = TYPE_BITFIELD(*ptype)->bitfieldtype;
if (TYPE_BITFIELD(*ptype)->unkB == 8) { if (TYPE_BITFIELD(*ptype)->bitlength == 8) {
switch (TYPE_BITFIELD(*ptype)->unkA) { switch (TYPE_BITFIELD(*ptype)->offset) {
case 0: case 0:
i = 0; i = 0;
break; break;
@ -2188,8 +2188,8 @@ static void CClass_OptimizeBitFieldAccess(Type **ptype, SInt32 *poffset) {
} }
} }
if (TYPE_BITFIELD(*ptype)->unkB == 16) { if (TYPE_BITFIELD(*ptype)->bitlength == 16) {
switch (TYPE_BITFIELD(*ptype)->unkA) { switch (TYPE_BITFIELD(*ptype)->offset) {
case 0: case 0:
i = 0; i = 0;
break; 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 (innertype->size != stsignedlong.size) {
if (is_unsigned(innertype)) if (is_unsigned(innertype))
*ptype = TYPE(&stunsignedlong); *ptype = TYPE(&stunsignedlong);
@ -2228,22 +2228,22 @@ static void CClass_OptimizeBitFieldAccess(Type **ptype, SInt32 *poffset) {
} }
if ((*ptype)->size != stsignedchar.size) { 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 = galloc(sizeof(TypeBitfield));
*newtype = *TYPE_BITFIELD(*ptype); *newtype = *TYPE_BITFIELD(*ptype);
*ptype = TYPE(newtype); *ptype = TYPE(newtype);
i = 0; i = 0;
if (newtype->unkA >= 8) if (newtype->offset >= 8)
i = 1; i = 1;
if (newtype->unkA >= 16) if (newtype->offset >= 16)
i = 2; i = 2;
if (newtype->unkA >= 24) if (newtype->offset >= 24)
i = 3; i = 3;
*poffset += i; *poffset += i;
newtype->unkA -= 8 * i; newtype->offset -= 8 * i;
newtype->bitfieldtype = is_unsigned(innertype) ? TYPE(&stunsignedchar) : TYPE(&stsignedchar); newtype->bitfieldtype = is_unsigned(innertype) ? TYPE(&stunsignedchar) : TYPE(&stsignedchar);
newtype->size = newtype->bitfieldtype->size; newtype->size = newtype->bitfieldtype->size;
@ -2251,16 +2251,16 @@ static void CClass_OptimizeBitFieldAccess(Type **ptype, SInt32 *poffset) {
} }
if ((*ptype)->size != stsignedshort.size) { 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 = galloc(sizeof(TypeBitfield));
*newtype = *TYPE_BITFIELD(*ptype); *newtype = *TYPE_BITFIELD(*ptype);
*ptype = TYPE(newtype); *ptype = TYPE(newtype);
i = 0; i = 0;
if (newtype->unkA >= 16) if (newtype->offset >= 16)
i = stsignedshort.size; i = stsignedshort.size;
*poffset += i; *poffset += i;
newtype->unkA -= 8 * i; newtype->offset -= 8 * i;
newtype->bitfieldtype = is_unsigned(innertype) ? TYPE(&stunsignedshort) : TYPE(&stsignedshort); newtype->bitfieldtype = is_unsigned(innertype) ? TYPE(&stunsignedshort) : TYPE(&stsignedshort);
newtype->size = newtype->bitfieldtype->size; newtype->size = newtype->bitfieldtype->size;
@ -2276,7 +2276,7 @@ ENode *CClass_AccessMember(ENode *classexpr, Type *type, UInt32 qual, SInt32 off
innertype = NULL; 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 = makemonadicnode(classexpr, EINDIRECT);
classexpr->data.monadic->rtype = CDecl_NewPointerType(classexpr->rtype); classexpr->data.monadic->rtype = CDecl_NewPointerType(classexpr->rtype);
} }

File diff suppressed because it is too large Load Diff

View File

@ -177,7 +177,7 @@ static void CError_BufferAppendNameSpace(CErrorBuffer *eb, NameSpace *nspace) {
CError_BufferAppendNameSpace(eb, nspace->parent); CError_BufferAppendNameSpace(eb, nspace->parent);
if (nspace->theclass) { if (nspace->theclass) {
CError_BufferAppendString(eb, nspace->theclass->classname->name); CError_BufferAppendString(eb, nspace->theclass->classname->name);
if (nspace->theclass->flags & CLASS_FLAGS_800) if (nspace->theclass->flags & CLASS_IS_TEMPL_INST)
CError_BufferAppendTemplArgs( CError_BufferAppendTemplArgs(
eb, eb,
!TEMPL_CLASS_INST(nspace->theclass)->oargs ? TEMPL_CLASS_INST(nspace->theclass)->inst_args : TEMPL_CLASS_INST(nspace->theclass)->oargs !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; arg = arg->next;
if (arg) if (arg)
arg = arg->next; 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; qual = arg->qual;
arg = arg->next; arg = arg->next;
if (arg) { 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; 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); CError_BufferAppendNameSpace(eb, TYPE_CLASS(ty)->nspace->parent);
if (TYPE_CLASS(ty)->classname) { if (TYPE_CLASS(ty)->classname) {
CError_BufferAppendString(eb, TYPE_CLASS(ty)->classname->name); 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( CError_BufferAppendTemplArgs(
eb, eb,
TEMPL_CLASS_INST(ty)->oargs ? TEMPL_CLASS_INST(ty)->oargs : TEMPL_CLASS_INST(ty)->inst_args 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); CError_BufferAppendQualifier(eb, qual);
switch (scan->type) { switch (scan->type) {
case TYPEFUNC: case TYPEFUNC:
if (TYPE_FUNC(scan)->flags & FUNC_FLAGS_PASCAL) if (TYPE_FUNC(scan)->flags & FUNC_PASCAL)
CError_BufferAppendString(eb, "pascal "); CError_BufferAppendString(eb, "pascal ");
CError_BufferAppendType(eb, TYPE_FUNC(scan)->functype, 0); CError_BufferAppendType(eb, TYPE_FUNC(scan)->functype, 0);
CError_BufferAppendString(eb, " ("); CError_BufferAppendString(eb, " (");
@ -452,7 +452,7 @@ static void CError_BufferAppendType(CErrorBuffer *eb, Type *ty, UInt32 qual) {
} }
break; break;
case TYPEFUNC: case TYPEFUNC:
if (TYPE_FUNC(ty)->flags & FUNC_FLAGS_PASCAL) if (TYPE_FUNC(ty)->flags & FUNC_PASCAL)
CError_BufferAppendString(eb, "pascal "); CError_BufferAppendString(eb, "pascal ");
CError_BufferAppendQualifier(eb, qual); CError_BufferAppendQualifier(eb, qual);
CError_BufferAppendType(eb, TYPE_FUNC(ty)->functype, 0); 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"); CError_BufferAppendString(eb, "T");
return; return;
case TYPEBITFIELD: case TYPEBITFIELD:
sprintf(buf, "bitfield:%" PRId32, TYPE_BITFIELD(ty)->unkB); sprintf(buf, "bitfield:%" PRId32, TYPE_BITFIELD(ty)->bitlength);
CError_BufferAppendString(eb, buf); CError_BufferAppendString(eb, buf);
return; return;
default: default:
@ -527,7 +527,7 @@ static void CError_AppendUnqualFunctionName(CErrorBuffer *eb, NameSpace *nspace,
if (!flag) { if (!flag) {
opname = CMangler_GetOperator(name); opname = CMangler_GetOperator(name);
if (!opname) { if (!opname) {
if (tfunc && (tfunc->flags & FUNC_FLAGS_40)) { if (tfunc && (tfunc->flags & FUNC_CONVERSION)) {
CError_BufferAppendString(eb, "operator "); CError_BufferAppendString(eb, "operator ");
CError_BufferAppendType(eb, tfunc->functype, tfunc->qual); CError_BufferAppendType(eb, tfunc->functype, tfunc->qual);
} else { } else {
@ -547,7 +547,7 @@ static void CError_AppendFunctionName(CErrorBuffer *eb, NameSpace *nspace, HashN
CError_AppendUnqualFunctionName(eb, nspace, name, tfunc); CError_AppendUnqualFunctionName(eb, nspace, name, tfunc);
CError_BufferAppendTemplArgs(eb, templargs); CError_BufferAppendTemplArgs(eb, templargs);
if (tfunc) { if (tfunc) {
if (!templargs && (tfunc->flags & FUNC_FLAGS_100000)) if (!templargs && (tfunc->flags & FUNC_IS_TEMPL))
CError_BufferAppendString(eb, "<...>"); CError_BufferAppendString(eb, "<...>");
CError_BufferAppendFuncArgs(eb, tfunc, 0); CError_BufferAppendFuncArgs(eb, tfunc, 0);
} else { } else {
@ -874,9 +874,9 @@ void CError_ErrorFuncCall(short code, NameSpaceObjectList *args, ENodeList *argN
OBJECT(args->object)->nspace, OBJECT(args->object)->nspace,
OBJECT(args->object)->name, OBJECT(args->object)->name,
TYPE_FUNC(OBJECT(args->object)->type)); 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_METHOD)
if (TYPE_FUNC(OBJECT(args->object)->type)->flags & FUNC_FLAGS_1000) if (TYPE_FUNC(OBJECT(args->object)->type)->flags & FUNC_IS_CTOR)
if (TYPE_METHOD(OBJECT(args->object)->type)->theclass->flags & CLASS_FLAGS_20) if (TYPE_METHOD(OBJECT(args->object)->type)->theclass->flags & CLASS_HAS_VBASES)
if (argNodes) if (argNodes)
argNodes = argNodes->next; argNodes = argNodes->next;
} else { } else {

View File

@ -54,7 +54,7 @@ Boolean CExcept_CanThrowException(Object *object, Boolean flag) {
if (flag) if (flag)
return 1; return 1;
if (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_NOTHROW) if (TYPE_FUNC(object->type)->flags & FUNC_NOTHROW)
return 0; return 0;
if ( if (
@ -67,7 +67,7 @@ Boolean CExcept_CanThrowException(Object *object, Boolean flag) {
if ( if (
copts.optEH2 && copts.optEH2 &&
!(object->qual & Q_80000) && !(object->qual & Q_MANGLE_NAME) &&
object != rt_ptmf_call && object != rt_ptmf_call &&
object != rt_ptmf_scall && object != rt_ptmf_scall &&
object != Rdync_func && object != Rdync_func &&
@ -450,7 +450,7 @@ void CExcept_Magic(void) {
} }
static Object *CExcept_FindLocalObject(char *name) { static Object *CExcept_FindLocalObject(char *name) {
CScopeParseResult result; NameResult result;
NameSpaceObjectList *list; NameSpaceObjectList *list;
list = CScope_FindObjectList(&result, GetHashNameNodeExport(name)); 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); expr = funccallexpr(object, expr1, NULL, NULL, NULL);
list = expr->data.funccall.args; 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); CError_ASSERT(1179, arg = arg->next);
list->next = lalloc(sizeof(ENodeList)); list->next = lalloc(sizeof(ENodeList));
list = list->next; list = list->next;
@ -1205,7 +1205,7 @@ void CExcept_ScanTryBlock(DeclThing *dt, Boolean flag) {
di.thetype = CDecl_NewPointerType(TPTR_TARGET(di.thetype)); di.thetype = CDecl_NewPointerType(TPTR_TARGET(di.thetype));
IsCompleteType(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)); CError_AbstractClassError(TYPE_CLASS(di.thetype));
catchBlock->type = di.thetype; catchBlock->type = di.thetype;
@ -2164,7 +2164,7 @@ static Boolean CExcept_CanThrowCheck(Object *func, Statement *stmt) {
} }
if (!cexcept_canthrow) { if (!cexcept_canthrow) {
TYPE_FUNC(cscope_currentfunc->type)->flags |= FUNC_FLAGS_NOTHROW; TYPE_FUNC(cscope_currentfunc->type)->flags |= FUNC_NOTHROW;
return 0; return 0;
} else { } else {
return 1; return 1;

View File

@ -44,7 +44,7 @@ restart:
goto 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) { switch (expr->rtype->type) {
case TYPEINT: case TYPEINT:
case TYPEENUM: case TYPEENUM:
@ -783,7 +783,7 @@ ENode *CExpr_DoExplicitConversion(Type *type, UInt32 qual, ENodeList *list) {
} }
CDecl_CompleteType(type); CDecl_CompleteType(type);
if (!(TYPE_CLASS(type)->flags & CLASS_FLAGS_2)) if (!(TYPE_CLASS(type)->flags & CLASS_COMPLETED))
CError_Error(CErrorStr136, type, 0); CError_Error(CErrorStr136, type, 0);
CanCreateObject(type); CanCreateObject(type);
@ -866,7 +866,7 @@ static Boolean CExpr_IsTemplateFunc(Object *obj) {
return IS_TEMPL_FUNC(obj->type); return IS_TEMPL_FUNC(obj->type);
} }
static ENode *CExpr_ExplicitTemplateArgCheck(CScopeParseResult *pr) { static ENode *CExpr_ExplicitTemplateArgCheck(NameResult *pr) {
NameSpaceObjectList *list; NameSpaceObjectList *list;
NameSpaceObjectList *newhead; NameSpaceObjectList *newhead;
NameSpaceObjectList *newlist; NameSpaceObjectList *newlist;
@ -912,7 +912,7 @@ static ENode *CExpr_ExplicitTemplateArgCheck(CScopeParseResult *pr) {
return expr; return expr;
} }
ENode *CExpr_MakeNameLookupResultExpr(CScopeParseResult *pr) { ENode *CExpr_MakeNameLookupResultExpr(NameResult *pr) {
ENode *expr; ENode *expr;
if (pr->obj_10) { if (pr->obj_10) {
@ -979,7 +979,7 @@ static Type *CExpr_NewPTMType(EMemberInfo *member, Object *obj) {
tmethod->args = tmethod->args->next; tmethod->args = tmethod->args->next;
CDecl_MakePTMFuncType(TYPE_FUNC(tmethod)); CDecl_MakePTMFuncType(TYPE_FUNC(tmethod));
tmethod->flags &= ~FUNC_FLAGS_2; tmethod->flags &= ~FUNC_DEFINED;
ptm->size = 12; ptm->size = 12;
ptm->ty2 = TYPE(tmethod->theclass); ptm->ty2 = TYPE(tmethod->theclass);
@ -989,7 +989,7 @@ static Type *CExpr_NewPTMType(EMemberInfo *member, Object *obj) {
return TYPE(ptm); 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 *result;
ENode *ta_expr; ENode *ta_expr;
ObjEnumConst *oec; ObjEnumConst *oec;
@ -1000,25 +1000,25 @@ static ENode *CExpr_ParseNameResultExpr(CScopeParseResult *pr, ENode *expr, Bool
TypeFunc *tfunc; TypeFunc *tfunc;
SInt32 val; SInt32 val;
if (pr->x8) { if (pr->type) {
if (copts.cplusplus) { if (copts.cplusplus) {
if (IS_TYPE_TEMPLATE(pr->x8)) { if (IS_TYPE_TEMPLATE(pr->type)) {
if (TYPE_TEMPLATE(pr->x8)->dtype == TEMPLDEP_ARGUMENT && TYPE_TEMPLATE(pr->x8)->u.pid.type == TPT_NONTYPE) { if (TYPE_TEMPLATE(pr->type)->dtype == TEMPLDEP_ARGUMENT && TYPE_TEMPLATE(pr->type)->u.pid.type == TPT_NONTYPE) {
result = CExpr_NewTemplDepENode(TDE_PARAM); 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(); tk = lex();
return result; 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 = CExpr_NewTemplDepENode(TDE_QUALNAME);
result->data.templdep.u.qual.type = TYPE_TEMPLATE(pr->x8)->u.qual.type; result->data.templdep.u.qual.type = TYPE_TEMPLATE(pr->type)->u.qual.type;
result->data.templdep.u.qual.name = TYPE_TEMPLATE(pr->x8)->u.qual.name; result->data.templdep.u.qual.name = TYPE_TEMPLATE(pr->type)->u.qual.name;
tk = lex(); tk = lex();
return result; return result;
} }
} }
tk = lex(); tk = lex();
return CExpr_ParseExplicitConversion(pr->x8, pr->xC); return CExpr_ParseExplicitConversion(pr->type, pr->qual);
} }
CError_ErrorSkip(CErrorStr141); CError_ErrorSkip(CErrorStr141);
tk = lex(); tk = lex();
@ -1028,7 +1028,7 @@ static ENode *CExpr_ParseNameResultExpr(CScopeParseResult *pr, ENode *expr, Bool
if (pr->obj_10) { if (pr->obj_10) {
switch (pr->obj_10->otype) { switch (pr->obj_10->otype) {
case OT_OBJECT: 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 = CExpr_NewTemplDepENode(TDE_OBJ);
result->data.templdep.u.obj = OBJECT(pr->obj_10); result->data.templdep.u.obj = OBJECT(pr->obj_10);
tk = lex(); tk = lex();
@ -1103,7 +1103,7 @@ static ENode *CExpr_ParseNameResultExpr(CScopeParseResult *pr, ENode *expr, Bool
case OT_ENUMCONST: case OT_ENUMCONST:
CClass_CheckEnumAccess(pr->bcl_18, OBJ_ENUM_CONST(pr->obj_10)); CClass_CheckEnumAccess(pr->bcl_18, OBJ_ENUM_CONST(pr->obj_10));
oec = 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; val = 0;
expr = NULL; expr = NULL;
for (act = TEMPL_CLASS(TYPE_ENUM(oec->type)->nspace->theclass)->actions; act; act = act->next) { 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) { static ENode *CExpr_ParseNextArg(void) {
NameSpaceObjectList *list; NameSpaceObjectList *list;
CScopeParseResult pr; NameResult pr;
ENode *expr; ENode *expr;
SInt32 rounded_size; SInt32 rounded_size;
@ -1560,7 +1560,7 @@ static ENode *CExpr_ParseBuiltin_isintconst(void) {
} }
static ENode *primary_expression(Boolean flag) { static ENode *primary_expression(Boolean flag) {
CScopeParseResult pr; NameResult pr;
ENode *expr; ENode *expr;
switch (tk) { switch (tk) {
@ -1753,7 +1753,7 @@ static ENode *call_ptmf(ENode *expr) {
static ENode *CExpr_DummyDestr(ENode *expr) { static ENode *CExpr_DummyDestr(ENode *expr) {
SInt32 state; SInt32 state;
CScopeParseResult pr; NameResult pr;
DeclInfo di; DeclInfo di;
NameSpace *nspace; NameSpace *nspace;
@ -1779,17 +1779,17 @@ loop:
nspace = pr.nspace_0; nspace = pr.nspace_0;
goto loop; 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(); tk = lex();
nspace = TYPE_CLASS(pr.x8)->nspace; nspace = TYPE_CLASS(pr.type)->nspace;
goto loop; goto loop;
} else { } else {
if (!is_typesame(pr.x8, expr->rtype)) if (!is_typesame(pr.type, expr->rtype))
CError_Error(CErrorStr146); CError_Error(CErrorStr146);
if (tk == TK_COLON_COLON && ((tk = lex()) == '~') && ((tk = lex()) == TK_IDENTIFIER)) { if (tk == TK_COLON_COLON && ((tk = lex()) == '~') && ((tk = lex()) == TK_IDENTIFIER)) {
parse_dtor: parse_dtor:
if (CScope_FindTypeName(nspace, tkidentifier, &pr) && !pr.nspace_0) { 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); CError_Error(CErrorStr146);
tk = lex(); tk = lex();
goto parsed; goto parsed;
@ -1833,7 +1833,7 @@ parsed:
} }
static ENode *postfix_expression(Boolean flag) { static ENode *postfix_expression(Boolean flag) {
CScopeParseResult pr; NameResult pr;
Conversion conv; Conversion conv;
ENode *expr; ENode *expr;
ENode *subexpr; ENode *subexpr;
@ -1988,7 +1988,7 @@ loop:
if (TYPE_CLASS(expr->rtype)->objcinfo && copts.cplusplus && (subexpr = CObjC_CheckModernSendMessage(TYPE_CLASS(expr->rtype), expr))) if (TYPE_CLASS(expr->rtype)->objcinfo && copts.cplusplus && (subexpr = CObjC_CheckModernSendMessage(TYPE_CLASS(expr->rtype), expr)))
return subexpr; 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); CError_Error(CErrorStr136, expr->rtype, 0);
if ((tk = lex()) == TK_TEMPLATE && (tk = lex()) != TK_IDENTIFIER) 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)); 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); CError_Error(CErrorStr190);
ptmtype = CExpr_NewPTMType(expr->data.emember, obj); ptmtype = CExpr_NewPTMType(expr->data.emember, obj);
@ -2356,7 +2356,7 @@ ENode *getpointertomemberfunc(ENode *expr, Type *type, Boolean flag) {
data[0] = 0; data[0] = 0;
if (obj->datatype == DVFUNC) { if (obj->datatype == DVFUNC) {
olist = NULL; olist = NULL;
data[1] = tmethod->x1E; data[1] = tmethod->vtbl_index;
data[2] = tmethod->theclass->vtable->offset; data[2] = tmethod->theclass->vtable->offset;
} else { } else {
data[1] = -1; data[1] = -1;

View File

@ -810,7 +810,7 @@ Boolean CExpr_IsLValue(ENode *expr) {
case ETEMP: case ETEMP:
return 0; return 0;
case EFUNCCALL: 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; return 0;
default: default:
return 1; return 1;
@ -925,7 +925,7 @@ ENode *CExpr_MakeObjRefNode(Object *obj, Boolean flag) {
if (!IS_TYPE_FUNC(obj->type)) if (!IS_TYPE_FUNC(obj->type))
expr->flags = obj->qual & ENODE_FLAG_QUALS; expr->flags = obj->qual & ENODE_FLAG_QUALS;
if (flag) if (flag)
obj->flags |= OBJECT_FLAGS_1; obj->flags |= OBJECT_USED;
return expr; return expr;
} }
@ -1390,7 +1390,7 @@ static short std_assign_check_overload(NameSpaceObjectList *list, TemplArg *temp
if (obj->otype != OT_OBJECT) if (obj->otype != OT_OBJECT)
continue; 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)) { if (!found_non_template_func && CTempl_CanDeduceFunc(obj, TYPE_FUNC(type), templargs)) {
instance = CTempl_DeduceFunc(obj, TYPE_FUNC(type), templargs, NULL, 0); instance = CTempl_DeduceFunc(obj, TYPE_FUNC(type), templargs, NULL, 0);
CError_ASSERT(1861, instance); CError_ASSERT(1861, instance);
@ -1429,7 +1429,7 @@ static short std_assign_check_overload(NameSpaceObjectList *list, TemplArg *temp
assign_node = expr; assign_node = expr;
expr->rtype = CDecl_NewPointerType(used_obj->type); expr->rtype = CDecl_NewPointerType(used_obj->type);
expr->flags = obj->qual & ENODE_FLAG_QUALS; expr->flags = obj->qual & ENODE_FLAG_QUALS;
used_obj->flags |= OBJECT_FLAGS_1; used_obj->flags |= OBJECT_USED;
if (used_obj->datatype == DINLINEFUNC) if (used_obj->datatype == DINLINEFUNC)
CError_Error(CErrorStr175); 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); return std_assign_check_overload(expr->data.objlist.list, expr->data.objlist.templargs, type, flag1);
} }
if (IS_TYPE_POINTER_ONLY(expr->rtype)) { 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; NameSpaceObjectList list;
list.next = NULL; list.next = NULL;
list.object = OBJ_BASE(expr->data.objref); list.object = OBJ_BASE(expr->data.objref);
@ -1706,7 +1706,7 @@ static void CExpr_ConIteratorInit(ConIterator *iter) {
ConIteratorList *list; ConIteratorList *list;
for (base = iter->tclass->bases; base; base = base->next) { 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)); subiter = galloc(sizeof(ConIterator));
memclrw(subiter, sizeof(ConIterator)); memclrw(subiter, sizeof(ConIterator));
subiter->parent = iter; subiter->parent = iter;
@ -1724,7 +1724,7 @@ static void CExpr_ConIteratorInit(ConIterator *iter) {
void CExpr_ConversionIteratorInit(ConversionIterator *iter, TypeClass *tclass) { void CExpr_ConversionIteratorInit(ConversionIterator *iter, TypeClass *tclass) {
memclrw(iter, sizeof(ConversionIterator)); memclrw(iter, sizeof(ConversionIterator));
if (tclass->flags & CLASS_FLAGS_40) { if (tclass->flags & CLASS_IS_CONVERTIBLE) {
iter->coniter = &iter->myconiter; iter->coniter = &iter->myconiter;
iter->myconiter.tclass = tclass; iter->myconiter.tclass = tclass;
CExpr_ConIteratorInit(&iter->myconiter); CExpr_ConIteratorInit(&iter->myconiter);
@ -1745,9 +1745,9 @@ static Boolean CExpr_ConversionIteratorIsHidden(ConIterator *iter, TypeFunc *tfu
objtfunc = TYPE_FUNC(OBJECT(obj)->type); objtfunc = TYPE_FUNC(OBJECT(obj)->type);
if ( if (
IS_TYPE_FUNC(objtfunc) && IS_TYPE_FUNC(objtfunc) &&
(objtfunc->flags & FUNC_FLAGS_40) && (objtfunc->flags & FUNC_CONVERSION) &&
is_compatible_conversion(tfunc->functype, objtfunc->functype) && is_compatible_conversion(tfunc->functype, objtfunc->functype) &&
(tfunc->args->qual & Q_CONST) == (objtfunc->args->qual & Q_CONST) && (tfunc->args->qual & Q_CONST) == (objtfunc->args->qual & Q_CONST) &&
(tfunc->qual & Q_CONST) == (objtfunc->qual & Q_CONST) (tfunc->qual & Q_CONST) == (objtfunc->qual & Q_CONST)
) )
@ -1770,9 +1770,9 @@ Object *CExpr_ConversionIteratorNext(ConversionIterator *iter) {
restart: restart:
if ((obj = OBJECT(CScope_NextObjectIteratorObject(&iter->objiter)))) { if ((obj = OBJECT(CScope_NextObjectIteratorObject(&iter->objiter)))) {
if ( if (
IS_TYPE_FUNC(obj->type) && IS_TYPE_FUNC(obj->type) &&
(TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_40) && (TYPE_FUNC(obj->type)->flags & FUNC_CONVERSION) &&
!CExpr_ConversionIteratorIsHidden(ci->parent, TYPE_FUNC(obj->type)) !CExpr_ConversionIteratorIsHidden(ci->parent, TYPE_FUNC(obj->type))
) { ) {
return obj; return obj;
} }
@ -1903,7 +1903,7 @@ short user_assign_check(ENode *expr, Type *type, UInt32 qual, Boolean flag1, Boo
continue; continue;
if (!(arg = r14c->args->next)) if (!(arg = r14c->args->next))
continue; continue;
if ((TYPE_CLASS(type)->flags & CLASS_FLAGS_20) && !(arg = arg->next)) if ((TYPE_CLASS(type)->flags & CLASS_HAS_VBASES) && !(arg = arg->next))
continue; continue;
if (arg == &elipsis) if (arg == &elipsis)
continue; continue;
@ -1955,9 +1955,9 @@ short user_assign_check(ENode *expr, Type *type, UInt32 qual, Boolean flag1, Boo
if (flag1) { if (flag1) {
if (r24) { if (r24) {
r13 = TYPE_METHOD(r26->type); r13 = TYPE_METHOD(r26->type);
CError_ASSERT(2537, r13->flags & FUNC_FLAGS_METHOD); CError_ASSERT(2537, r13->flags & FUNC_METHOD);
r15b = create_objectrefnode(r26); r15b = create_objectrefnode(r26);
r26->flags |= OBJECT_FLAGS_1; r26->flags |= OBJECT_USED;
r14d = lalloc(sizeof(ENodeList)); r14d = lalloc(sizeof(ENodeList));
r14d->next = NULL; r14d->next = NULL;
expr = getnodeaddress(expr, 0); 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 = lalloc(sizeof(ENodeList));
r13b->next = NULL; r13b->next = NULL;
r13b->node = r25; 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 = lalloc(sizeof(ENodeList));
r13b->next->node = r25; r13b->next->node = r25;
r13b->next->next = NULL; 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) { static void MatchOverloadFunc(Object *obj, FuncArg *args, ENodeList *argexprs, Match13 *match) {
Match13 match2; 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)); memclrw(&match2, sizeof(Match13));
while (1) { while (1) {
if (!args || args->type == &stvoid) { 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) { Boolean CExpr_GetFuncMatchArgs(Object *obj, ENodeList *argexprs, ENode *expr, FuncMatchArgs *result) {
ENode *intexpr; ENode *intexpr;
if (!(TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_METHOD)) { if (!(TYPE_FUNC(obj->type)->flags & FUNC_METHOD)) {
result->exprs = argexprs; result->exprs = argexprs;
result->args = TYPE_FUNC(obj->type)->args; result->args = TYPE_FUNC(obj->type)->args;
return 1; return 1;
} }
if (TYPE_METHOD(obj->type)->x26) { if (TYPE_METHOD(obj->type)->is_static) {
result->exprs = argexprs; result->exprs = argexprs;
result->args = TYPE_FUNC(obj->type)->args; result->args = TYPE_FUNC(obj->type)->args;
return 1; return 1;
} }
if (TYPE_FUNC(obj->type)->flags & FUNC_FLAGS_1000) { if (TYPE_FUNC(obj->type)->flags & FUNC_IS_CTOR) {
result->exprs = argexprs; result->exprs = argexprs;
result->args = TYPE_FUNC(obj->type)->args->next; result->args = TYPE_FUNC(obj->type)->args->next;
return 1; return 1;
@ -2397,7 +2397,7 @@ static void CExpr_MatchArgList(NameSpaceObjectList *list, TemplArg *templargs, E
if (obj->otype != OT_OBJECT) if (obj->otype != OT_OBJECT)
continue; continue;
if (IS_TYPE_FUNC(obj->type) && (!flag || !(obj->qual & Q_EXPLICIT))) { 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)) if (CExpr_GetFuncMatchArgs(obj, argexprs, expr, &fma))
MatchOverloadFunc(obj, fma.args, fma.exprs, match); MatchOverloadFunc(obj, fma.args, fma.exprs, match);
} else { } 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.funcref->rtype = CDecl_NewPointerType(TYPE(tfunc));
callexpr->data.funccall.args = argexprs; callexpr->data.funccall.args = argexprs;
callexpr->data.funccall.functype = tfunc; callexpr->data.funccall.functype = tfunc;
funcexpr->data.objref->flags |= OBJECT_FLAGS_1; funcexpr->data.objref->flags |= OBJECT_USED;
return CExpr_AdjustFunctionCall(callexpr); return CExpr_AdjustFunctionCall(callexpr);
} }
@ -2562,7 +2562,7 @@ ENode *CExpr_GenericFuncCall(BClassList *path, ENode *funcexpr, Boolean flag1, O
return nullnode(); return nullnode();
} }
if (IS_TYPEFUNC_METHOD(tfunc) && !TYPE_METHOD(tfunc)->x26) { if (IS_TYPEFUNC_METHOD(tfunc) && !TYPE_METHOD(tfunc)->is_static) {
had_alias = 0; had_alias = 0;
buildpath = NULL; buildpath = NULL;
access = obj->access; access = obj->access;
@ -2592,9 +2592,9 @@ ENode *CExpr_GenericFuncCall(BClassList *path, ENode *funcexpr, Boolean flag1, O
} }
if ( if (
(tfunc->flags & FUNC_FLAGS_8) && (tfunc->flags & FUNC_PURE) &&
cscope_currentfunc && cscope_currentfunc &&
(TYPE_FUNC(cscope_currentfunc->type)->flags & (FUNC_FLAGS_1000 | FUNC_FLAGS_2000)) && (TYPE_FUNC(cscope_currentfunc->type)->flags & (FUNC_IS_CTOR | FUNC_IS_DTOR)) &&
cscope_currentclass == TYPE_METHOD(tfunc)->theclass && cscope_currentclass == TYPE_METHOD(tfunc)->theclass &&
ENODE_IS(funcexpr, EINDIRECT) && ENODE_IS(funcexpr, EINDIRECT) &&
ENODE_IS(funcexpr->data.monadic, 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; 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 (((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); CError_Error(CErrorStr236);
} }
@ -2624,7 +2624,7 @@ ENode *CExpr_GenericFuncCall(BClassList *path, ENode *funcexpr, Boolean flag1, O
scan_arg = tfunc->args; scan_arg = tfunc->args;
scan_expr = nodes; scan_expr = nodes;
if (tfunc->flags & FUNC_FLAGS_METHOD) { if (tfunc->flags & FUNC_METHOD) {
CError_ASSERT(3599, TYPE_METHOD(tfunc)->theclass->sominfo == NULL); CError_ASSERT(3599, TYPE_METHOD(tfunc)->theclass->sominfo == NULL);
} }
} }
@ -2735,7 +2735,7 @@ ENode *CExpr_MakeFunctionCall(ENode *funcexpr, ENodeList *arg_exprs) {
if ( if (
funcexpr->data.objlist.list->object->otype == OT_OBJECT && 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))) (expr = CodeGen_HandleIntrinsicCall(OBJECT(funcexpr->data.objlist.list->object), arg_exprs)))
return expr; return expr;
@ -2763,7 +2763,7 @@ ENode *CExpr_MakeFunctionCall(ENode *funcexpr, ENodeList *arg_exprs) {
save_isambig = 0; 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))) { if (!(expr = CodeGen_HandleIntrinsicCall(funcexpr->data.objref, arg_exprs))) {
expr = CExpr_GenericFuncCall( expr = CExpr_GenericFuncCall(
save_path, save_expr, save_1D, funcexpr->data.objref, 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) { Boolean CExpr_CheckOperator(short token, ENode *left, ENode *right, Conversion *conv) {
Match13 match; Match13 match;
CScopeParseResult pr; NameResult pr;
CScopeParseResult pr2; NameResult pr2;
ENode *expr; ENode *expr;
Object *obj; Object *obj;
ENodeList *nodes; ENodeList *nodes;
@ -3389,7 +3389,7 @@ ENode *CExpr_ConstructObject(TypeClass *tclass, ENode *addr_expr, ENodeList *arg
} }
if ((ctorlist = CClass_Constructor(tclass))) { if ((ctorlist = CClass_Constructor(tclass))) {
if (tclass->flags & CLASS_FLAGS_20) { if (tclass->flags & CLASS_HAS_VBASES) {
ENodeList *list = lalloc(sizeof(ENodeList)); ENodeList *list = lalloc(sizeof(ENodeList));
list->next = args; list->next = args;
args = list; args = list;
@ -3430,7 +3430,7 @@ static ENode *CExpr_DeleteFuncCall(Object *obj, ENode *arg, Type *type, Boolean
expr->rtype = &stvoid; expr->rtype = &stvoid;
expr->data.funccall.funcref = create_objectrefnode(obj); expr->data.funccall.funcref = create_objectrefnode(obj);
expr->data.funccall.functype = TYPE_FUNC(obj->type); expr->data.funccall.functype = TYPE_FUNC(obj->type);
obj->flags |= OBJECT_FLAGS_1; obj->flags |= OBJECT_USED;
list = lalloc(sizeof(ENodeList)); list = lalloc(sizeof(ENodeList));
list->node = arg; list->node = arg;
@ -3504,7 +3504,7 @@ static ENode *CExpr_PlacementDeleteCall(Type *type, ENode *expr, Object *obj, Bo
result->rtype = &stvoid; result->rtype = &stvoid;
result->data.funccall.funcref = create_objectrefnode(funcobj); result->data.funccall.funcref = create_objectrefnode(funcobj);
result->data.funccall.functype = TYPE_FUNC(funcobj->type); result->data.funccall.functype = TYPE_FUNC(funcobj->type);
funcobj->flags |= OBJECT_FLAGS_1; funcobj->flags |= OBJECT_USED;
list = lalloc(sizeof(ENodeList)); list = lalloc(sizeof(ENodeList));
list->node = create_objectnode(obj); list->node = create_objectnode(obj);
@ -3567,7 +3567,7 @@ static UInt32 cv_qualifier_list(void) {
} }
static void scan_new_declarator(DeclInfo *di, Boolean flag) { static void scan_new_declarator(DeclInfo *di, Boolean flag) {
CScopeParseResult pr; NameResult pr;
SInt32 size; SInt32 size;
ENode *expr; ENode *expr;
@ -3641,7 +3641,7 @@ static ENode *CExpr_NewAlloc(Type *type, ENodeList *args, Boolean flag1, Boolean
Object *obj; Object *obj;
Boolean found; Boolean found;
HashNameNode *name; HashNameNode *name;
CScopeParseResult pr; NameResult pr;
found = 0; found = 0;
if (!flag1 && IS_TYPE_CLASS(type)) { 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); obj = OBJECT(pr.obj_10);
CError_ASSERT(4935, list || obj); CError_ASSERT(4935, list || obj);
found = 1; found = 1;
} else if (TYPE_CLASS(type)->flags & CLASS_FLAGS_1) { } else if (TYPE_CLASS(type)->flags & CLASS_HANDLEOBJECT) {
CError_ASSERT(4942, !flag2); CError_ASSERT(4942, !flag2);
obj = newh_func; obj = newh_func;
found = 1; found = 1;
@ -3784,7 +3784,7 @@ static ENode *CExpr_NewArray(Type *type, UInt32 qual, ENodeList *nodelist, Boole
if (CClass_Constructor(TYPE_CLASS(innertype))) { if (CClass_Constructor(TYPE_CLASS(innertype))) {
ctor = CClass_DefaultConstructor(TYPE_CLASS(innertype)); ctor = CClass_DefaultConstructor(TYPE_CLASS(innertype));
if (ctor) { if (ctor) {
ctor->flags |= OBJECT_FLAGS_1; ctor->flags |= OBJECT_USED;
} else { } else {
ctor = CClass_DummyDefaultConstructor(TYPE_CLASS(innertype)); ctor = CClass_DummyDefaultConstructor(TYPE_CLASS(innertype));
if (!ctor) if (!ctor)
@ -4151,7 +4151,7 @@ ENode *scandelete(Boolean flag) {
if (TYPE_CLASS(innertype)->objcinfo) if (TYPE_CLASS(innertype)->objcinfo)
return CObjC_Delete(TYPE_CLASS(innertype), expr); 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); CError_Warning(CErrorStr136, innertype, 0);
obj = CParser_FindDeallocationObject(innertype, NULL, 0, flag, &outflag); 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 = CABI_DestroyObject(dtor, expr, 2, 0, 0);
result_expr->rtype = TYPE(&void_ptr); result_expr->rtype = TYPE(&void_ptr);
result_expr = funccallexpr(obj, result_expr, NULL, NULL, NULL); result_expr = funccallexpr(obj, result_expr, NULL, NULL, NULL);
obj->flags |= OBJECT_FLAGS_1; obj->flags |= OBJECT_USED;
} }
if (is_virtual) { if (is_virtual) {

View File

@ -81,8 +81,8 @@ static Type *CExpr_GetImplictObjectParamType(Object *object, UInt32 *qual) {
Type *type; Type *type;
CError_ASSERT(98, IS_TYPE_FUNC(object->type)); CError_ASSERT(98, IS_TYPE_FUNC(object->type));
CError_ASSERT(99, TYPE_FUNC(object->type)->flags & FUNC_FLAGS_METHOD); CError_ASSERT(99, TYPE_FUNC(object->type)->flags & FUNC_METHOD);
CError_ASSERT(100, !TYPE_METHOD(object->type)->x26); CError_ASSERT(100, !TYPE_METHOD(object->type)->is_static);
CError_ASSERT(101, TYPE_METHOD(object->type)->args); CError_ASSERT(101, TYPE_METHOD(object->type)->args);
type = CDecl_NewRefPointerType(TYPE(TYPE_METHOD(object->type)->theclass)); type = CDecl_NewRefPointerType(TYPE(TYPE_METHOD(object->type)->theclass));
@ -567,7 +567,7 @@ static Boolean CExpr_OverloadFuncMatch(NameSpaceObjectList *list, TemplArg *temp
*outExpr = expr; *outExpr = expr;
expr->rtype = CDecl_NewPointerType(object26->type); expr->rtype = CDecl_NewPointerType(object26->type);
expr->flags = object->qual & ENODE_FLAG_QUALS; expr->flags = object->qual & ENODE_FLAG_QUALS;
object26->flags |= OBJECT_FLAGS_1; object26->flags |= OBJECT_USED;
if (object26->datatype == DINLINEFUNC) if (object26->datatype == DINLINEFUNC)
CError_Error(CErrorStr175); CError_Error(CErrorStr175);
} }
@ -613,7 +613,7 @@ static Boolean CExpr_StandardConversionMatch(ENode *expr, Type *type2, UInt32 qu
if ( if (
IS_TYPE_INT(expr->rtype) && IS_TYPE_INT(expr->rtype) &&
ENODE_IS_INDIRECT_TO(expr, EOBJREF) && 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) CInt64_IsZero(&expr->data.monadic->data.objref->u.data.u.intconst)
) )
return CExpr_SetupStandardConversionResult(expr, type2, qual2, SSCR_2, x14, refFlag, result); 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; flag22 = 1;
while ((object26 = CExpr_ConversionIteratorNext(&convIter))) { while ((object26 = CExpr_ConversionIteratorNext(&convIter))) {
tfunc23 = TYPE_FUNC(object26->type); tfunc23 = TYPE_FUNC(object26->type);
if (tfunc23->flags & FUNC_FLAGS_100000) { if (tfunc23->flags & FUNC_IS_TEMPL) {
object26 = CTempl_DeduceFromConversion(object26, type2, qual2); object26 = CTempl_DeduceFromConversion(object26, type2, qual2);
if (!object26) if (!object26)
continue; continue;
@ -996,7 +996,7 @@ static ENode *CExpr_UserConversion(ENode *expr, Type *type2, UInt32 qual2, Impli
(isExplicit || !(object26->qual & Q_EXPLICIT)) (isExplicit || !(object26->qual & Q_EXPLICIT))
) )
{ {
if (tfunc23->flags & FUNC_FLAGS_100000) { if (tfunc23->flags & FUNC_IS_TEMPL) {
myarglist.next = NULL; myarglist.next = NULL;
myarglist.node = expr; myarglist.node = expr;
object26 = CTempl_DeduceFromFunctionCall(object26, NULL, &myarglist); object26 = CTempl_DeduceFromFunctionCall(object26, NULL, &myarglist);
@ -1009,7 +1009,7 @@ static ENode *CExpr_UserConversion(ENode *expr, Type *type2, UInt32 qual2, Impli
continue; continue;
if (!(arg21 = arg21->next)) if (!(arg21 = arg21->next))
continue; continue;
if ((TYPE_CLASS(type2)->flags & CLASS_FLAGS_20) && !(arg21 = arg21->next)) if ((TYPE_CLASS(type2)->flags & CLASS_HAS_VBASES) && !(arg21 = arg21->next))
continue; continue;
if (arg21 == &elipsis) if (arg21 == &elipsis)
continue; continue;
@ -1086,7 +1086,7 @@ static ENode *CExpr_UserConversion(ENode *expr, Type *type2, UInt32 qual2, Impli
CError_ASSERT(1416, IS_TYPEFUNC_METHOD(tfunc23)); CError_ASSERT(1416, IS_TYPEFUNC_METHOD(tfunc23));
funcref = create_objectrefnode(object28); funcref = create_objectrefnode(object28);
object28->flags |= OBJECT_FLAGS_1; object28->flags |= OBJECT_USED;
arglist = lalloc(sizeof(ENodeList)); arglist = lalloc(sizeof(ENodeList));
arglist->next = NULL; arglist->next = NULL;
@ -1135,7 +1135,7 @@ static ENode *CExpr_UserConversion(ENode *expr, Type *type2, UInt32 qual2, Impli
arglist->next = NULL; arglist->next = NULL;
arglist->node = expr; 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 = lalloc(sizeof(ENodeList));
arglist->next->node = expr; arglist->next->node = expr;
arglist->next->next = NULL; 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; 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; convs->type = ICT_0;
} else if (TYPE_METHOD(func->type)->x26) { } else if (TYPE_METHOD(func->type)->is_static) {
convs->type = ICT_0; 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; convs->type = ICT_0;
args = args->next; args = args->next;
} else { } else {
@ -1770,7 +1770,7 @@ void CExpr_FuncArgMatch(NameSpaceObjectList *list, TemplArg *templargs, ENodeLis
(!flag || !(object->qual & Q_EXPLICIT)) (!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) { for (j = list; j; j = j->next) {
if (j == i) if (j == i)
continue; continue;
@ -1785,10 +1785,10 @@ void CExpr_FuncArgMatch(NameSpaceObjectList *list, TemplArg *templargs, ENodeLis
FuncArg *argsA; FuncArg *argsA;
FuncArg *argsB; FuncArg *argsB;
argsA = TYPE_FUNC(object->type)->args; argsA = TYPE_FUNC(object->type)->args;
if (argsA && !TYPE_METHOD(object->type)->x26) if (argsA && !TYPE_METHOD(object->type)->is_static)
argsA = argsA->next; argsA = argsA->next;
argsB = TYPE_FUNC(object2->type)->args; argsB = TYPE_FUNC(object2->type)->args;
if (argsB && !TYPE_METHOD(object2->type)->x26) if (argsB && !TYPE_METHOD(object2->type)->is_static)
argsB = argsB->next; argsB = argsB->next;
if (is_arglistsame(argsA, argsB)) if (is_arglistsame(argsA, argsB))
break; break;
@ -1799,7 +1799,7 @@ void CExpr_FuncArgMatch(NameSpaceObjectList *list, TemplArg *templargs, ENodeLis
continue; continue;
} }
if (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100000) { if (TYPE_FUNC(object->type)->flags & FUNC_IS_TEMPL) {
specialfunc = object; specialfunc = object;
object = CTempl_DeduceFromFunctionCall(object, templargs, argexprs); object = CTempl_DeduceFromFunctionCall(object, templargs, argexprs);
if (!object) if (!object)
@ -2235,7 +2235,7 @@ Boolean CExpr_OperatorMatch(short token, ENode *left, ENode *right, Conversion *
UInt32 leftQual; UInt32 leftQual;
Type *rightType; Type *rightType;
UInt32 rightQual; UInt32 rightQual;
CScopeParseResult pr; NameResult pr;
NameSpaceObjectList myList; NameSpaceObjectList myList;
Match myMatch; 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) { for (list = pr.nsol_14; list; list = list->next) {
object = OBJECT(list->object); object = OBJECT(list->object);
if (object->otype == OT_OBJECT && IS_TYPE_FUNC(object->type)) { 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; specialfunc = object;
object = CTempl_DeduceFromFunctionCall(object, NULL, argExprs->next); object = CTempl_DeduceFromFunctionCall(object, NULL, argExprs->next);
if (!object) 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) { for (list = pr.nsol_14; list; list = list->next) {
object = OBJECT(list->object); object = OBJECT(list->object);
if (object->otype == OT_OBJECT && IS_TYPE_NONMETHOD(object->type)) { 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; specialfunc = object;
object = CTempl_DeduceFromFunctionCall(object, NULL, argExprs); object = CTempl_DeduceFromFunctionCall(object, NULL, argExprs);
if (!object) if (!object)
@ -2422,7 +2422,7 @@ static ENode *CExpr_ClassCopyInit(TypeClass *tclass, ENode *expr1, ENode *expr2)
CError_ASSERT(3199, arg); CError_ASSERT(3199, arg);
arg = arg->next; arg = arg->next;
if (tclass->flags & CLASS_FLAGS_20) { if (tclass->flags & CLASS_HAS_VBASES) {
CError_ASSERT(3203, arg); CError_ASSERT(3203, arg);
arg = arg->next; arg = arg->next;
} }
@ -2497,7 +2497,7 @@ static ENode *CExpr_ClassCopyInit(TypeClass *tclass, ENode *expr1, ENode *expr2)
argExprs = lalloc(sizeof(ENodeList)); argExprs = lalloc(sizeof(ENodeList));
argExprs->node = expr2; argExprs->node = expr2;
if (tclass->flags & CLASS_FLAGS_20) { if (tclass->flags & CLASS_HAS_VBASES) {
argExprs->next = lalloc(sizeof(ENodeList)); argExprs->next = lalloc(sizeof(ENodeList));
argExprs->next->next = NULL; argExprs->next->next = NULL;
argExprs->next->node = intconstnode(TYPE(&stsignedshort), 1); argExprs->next->node = intconstnode(TYPE(&stsignedshort), 1);

View File

@ -601,9 +601,9 @@ void CFunc_WarnUnused(void) {
ObjectList *list; ObjectList *list;
for (list = locals; list; list = list->next) { for (list = locals; list; list = list->next) {
if ( if (
!(list->object->flags & OBJECT_FLAGS_1) && !(list->object->flags & OBJECT_USED) &&
!IsTempName(list->object->name) && !IsTempName(list->object->name) &&
!(list->object->qual & Q_10000) !(list->object->qual & Q_INLINE_DATA)
) )
{ {
CError_SetErrorToken(&list->object->u.var.info->deftoken); CError_SetErrorToken(&list->object->u.var.info->deftoken);
@ -616,7 +616,7 @@ void CFunc_WarnUnused(void) {
ObjectList *list; ObjectList *list;
for (list = arguments; list; list = list->next) { for (list = arguments; list; list = list->next) {
if ( if (
!(list->object->flags & OBJECT_FLAGS_1) && !(list->object->flags & OBJECT_USED) &&
!IsTempName(list->object->name) && !IsTempName(list->object->name) &&
list->object->name != this_name_node && list->object->name != this_name_node &&
list->object->name != self_name_node list->object->name != self_name_node
@ -1064,7 +1064,7 @@ static void CFunc_LocalDataDeclarator(DeclInfo *di, TStreamElement *deftoken, Bo
if (object) { if (object) {
if ( if (
!is_typesame(di->thetype, object->type) || !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); 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); CError_Error(CErrorStr174);
if (CanCreateObject(di->thetype)) { 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); CParser_NewAliasObject(object, 0);
object->nspace = cscope_root; object->nspace = cscope_root;
object->datatype = DDATA; object->datatype = DDATA;
@ -1184,7 +1184,7 @@ static ENode *CFunc_ParseLocalDeclarationList(Boolean flag1, Boolean flag2, Bool
CPrep_GetFileOffsetInfo2(&cparser_fileoffset, &sourceoffset, &sourcefilepath); CPrep_GetFileOffsetInfo2(&cparser_fileoffset, &sourceoffset, &sourcefilepath);
memclrw(&di, sizeof(di)); memclrw(&di, sizeof(di));
di.x4E = cfunc_is_extern_c; di.is_extern_c = cfunc_is_extern_c;
CParser_GetDeclSpecs(&di, 0); CParser_GetDeclSpecs(&di, 0);
if (IS_TYPE_TEMPLATE(di.thetype)) { 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; 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); CError_Error(CErrorStr127);
if (newlist) { if (newlist) {
@ -2659,7 +2659,7 @@ static void CFunc_CheckCtorInitializer(TypeClass *tclass, CtorChain *chain) {
ObjMemberVar *ivar; ObjMemberVar *ivar;
CtorChain *scan; CtorChain *scan;
if (tclass->mode != CLASS_MODE_1) { if (tclass->mode != CLASS_MODE_UNION) {
for (ivar = tclass->ivars; ivar; ivar = ivar->next) { for (ivar = tclass->ivars; ivar; ivar = ivar->next) {
if (IS_TYPE_REFERENCE(ivar->type)) { if (IS_TYPE_REFERENCE(ivar->type)) {
for (scan = chain; scan; scan = scan->next) { for (scan = chain; scan; scan = scan->next) {
@ -2862,13 +2862,13 @@ static void CFunc_ParseCtorInitializer(void) {
} }
static void CFunc_FunctionRedefinedCheck(Object *func) { 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); 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); 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) { 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) if (cscope_currentclass)
CClass_MemberDef(func, 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)); CError_ASSERT(3392, IS_TYPE_FUNC(func->type));
if (di->x45 && (func->qual & Q_ASM)) if (di->x45 && (func->qual & Q_ASM))
@ -3035,11 +3035,11 @@ void CFunc_ParseFuncDef(Object *func, DeclInfo *di, TypeClass *tclass, Boolean i
CheckCLabels(); 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); 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); 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); CInit_DeclareData(nameobj_pretty->u.alias.object, prettyname, NULL, strlen(prettyname) + 1);
if (!fatalerrors) { if (!fatalerrors) {
@ -3079,7 +3079,7 @@ void InitExpr_Register(ENode *expr, Object *object) {
if ( if (
cparamblkptr->precompile == 1 && cparamblkptr->precompile == 1 &&
object->sclass != TK_STATIC && object->sclass != TK_STATIC &&
!(object->qual & (Q_20000 | Q_OVERLOAD)) !(object->qual & (Q_20000 | Q_WEAK))
) )
{ {
CError_Error(CErrorStr180); CError_Error(CErrorStr180);
@ -3184,7 +3184,7 @@ void CFunc_GenerateDummyCtorFunc(Object *func, Object *real_ctor) {
expr->data.funccall.functype = TYPE_FUNC(func->type); expr->data.funccall.functype = TYPE_FUNC(func->type);
CError_ASSERT(3716, IS_TYPE_FUNC(real_ctor->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(3718, arg0 = TYPE_FUNC(real_ctor->type)->args);
CError_ASSERT(3720, arg1 = arg0->next); CError_ASSERT(3720, arg1 = arg0->next);
CError_ASSERT(3721, arguments); CError_ASSERT(3721, arguments);
@ -3193,7 +3193,7 @@ void CFunc_GenerateDummyCtorFunc(Object *func, Object *real_ctor) {
expr->data.funccall.args = list; expr->data.funccall.args = list;
list->node = create_objectnode(arguments->object); 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(3727, arg1 = arg1->next);
CError_ASSERT(3728, arguments->next); CError_ASSERT(3728, arguments->next);
list->next = lalloc(sizeof(ENodeList)); list->next = lalloc(sizeof(ENodeList));

View File

@ -71,7 +71,7 @@ static Object *CIRTrans_GetRuntimeFunction(StrangeRuntimeFunction *rtfunc, Type
object->nspace = cscope_root; object->nspace = cscope_root;
object->name = GetHashNameNodeExport(rtfunc->name); object->name = GetHashNameNodeExport(rtfunc->name);
object->flags = OBJECT_FLAGS_10; object->flags = OBJECT_INTERNAL;
if (type) { if (type) {
switch (type->size) { switch (type->size) {

View File

@ -427,7 +427,7 @@ static Object *CInit_CreateStaticDataObject(Type *type, UInt32 qual, HashNameNod
di.name = name ? name : CParser_GetUniqueName(); di.name = name ? name : CParser_GetUniqueName();
di.qual = qual; di.qual = qual;
di.storageclass = TK_STATIC; di.storageclass = TK_STATIC;
di.x4E = 1; di.is_extern_c = 1;
obj = CParser_NewGlobalDataObject(&di); obj = CParser_NewGlobalDataObject(&di);
obj->nspace = cscope_root; obj->nspace = cscope_root;
@ -637,13 +637,13 @@ static void CInit_SetBitfield(TypeBitfield *tbitfield, UInt8 *buffer, CInt64 val
int step; int step;
if (copts.littleendian) { if (copts.littleendian) {
pos = tbitfield->unkA; pos = tbitfield->offset;
step = 1; step = 1;
} else { } else {
pos = tbitfield->unkB + tbitfield->unkA - 1; pos = tbitfield->bitlength + tbitfield->offset - 1;
step = -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 (CInt64_GetULong(&val) & 1) {
if (copts.littleendian) { if (copts.littleendian) {
buffer[pos >> 3] |= 1 << (pos & 7); buffer[pos >> 3] |= 1 << (pos & 7);
@ -868,7 +868,7 @@ static void CInit_InitTypeStruct(CInit_Stuff *s, CInit_Stuff2 *s2, const TypeStr
do { do {
member = member->next; member = member->next;
} while (member && (member->qual & Q_OVERLOAD)); } while (member && (member->qual & Q_WEAK));
if (!member || tstruct->stype == STRUCT_TYPE_UNION) { if (!member || tstruct->stype == STRUCT_TYPE_UNION) {
if (flag) { if (flag) {
@ -967,7 +967,7 @@ static ObjMemberVar *CInit_FindNextMember(ObjMemberVar *ivar) {
return scan; return scan;
if (scan->offset > ivar->offset) if (scan->offset > ivar->offset)
return scan; 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; return scan;
} }
} }
@ -1042,7 +1042,7 @@ static void CInit_InitTypeClass(CInit_Stuff *s, CInit_Stuff2 *s2, TypeClass *tcl
} }
last_offset = ivar->offset; 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) { if (flag) {
switch (CInit_ParseNextInit(s2)) { switch (CInit_ParseNextInit(s2)) {
case Stage3: case Stage3:
@ -1739,7 +1739,7 @@ static void CInit_Struct(TypeStruct *tstruct, Boolean flag) {
do { do {
member = member->next; member = member->next;
} while (member && (member->qual & Q_OVERLOAD)); } while (member && (member->qual & Q_WEAK));
if (!member) { if (!member) {
if (!in_block) if (!in_block)
@ -2066,7 +2066,7 @@ static ENode *CInit_GenericData(Object *obj, Type *type, UInt32 qual, ExprCB exp
break; break;
r31->u.data.u.intconst = tmpexpr->data.intval; r31->u.data.u.intconst = tmpexpr->data.intval;
common_8068C: common_8068C:
r31->qual |= Q_10000; r31->qual |= Q_INLINE_DATA;
if (!obj) { if (!obj) {
r31->sclass = TK_STATIC; r31->sclass = TK_STATIC;
r31->datatype = DDATA; r31->datatype = DDATA;
@ -2117,7 +2117,7 @@ static ENode *CInit_GenericData(Object *obj, Type *type, UInt32 qual, ExprCB exp
void CInit_ExportConst(Object *obj) { void CInit_ExportConst(Object *obj) {
char buffer[64]; char buffer[64];
if (obj->flags & OBJECT_FLAGS_4) if (obj->flags & OBJECT_DEFINED)
return; return;
switch (obj->type->type) { switch (obj->type->type) {
@ -2766,9 +2766,9 @@ void CInit_InitializeData(Object *obj) {
} }
} }
} else { } else {
if (obj->flags & OBJECT_FLAGS_4) if (obj->flags & OBJECT_DEFINED)
CError_Error(CErrorStr329, obj); CError_Error(CErrorStr329, obj);
obj->flags = obj->flags | OBJECT_FLAGS_4; obj->flags = obj->flags | OBJECT_DEFINED;
needs_construction = 0; needs_construction = 0;
if (IS_TYPE_ARRAY(obj->type)) { if (IS_TYPE_ARRAY(obj->type)) {
@ -2809,7 +2809,7 @@ void CInit_InitializeData(Object *obj) {
return; return;
} }
if (obj->flags & OBJECT_FLAGS_4) if (obj->flags & OBJECT_DEFINED)
CError_Error(CErrorStr329, obj); CError_Error(CErrorStr329, obj);
if (CInit_IsSimpleStructArrayInit(obj->type)) { 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) { if (cparamblkptr->precompile == 1) {
PreComp_StaticData(obj, data, list, size); PreComp_StaticData(obj, data, list, size);
} else { } else {
obj->flags = obj->flags | OBJECT_FLAGS_4; obj->flags = obj->flags | OBJECT_DEFINED;
if (!fatalerrors) { if (!fatalerrors) {
for (scan = list; scan; scan = scan->next) for (scan = list; scan; scan = scan->next)
CInline_ObjectAddrRef(scan->obj); CInline_ObjectAddrRef(scan->obj);
@ -3074,7 +3074,7 @@ void CInit_DefineTentativeData(void) {
ObjectList *list; ObjectList *list;
for (list = cinit_tentative; list; list = list->next) { 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); CInit_DeclareData(list->object, NULL, NULL, list->object->type->size);
} }

View File

@ -3468,7 +3468,7 @@ void CInline_AddInlineFunctionAction(Object *object, TypeClass *tclass, FileOffs
CError_ASSERT(4132, IS_TYPE_FUNC(object->type)); 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)); action = galloc(sizeof(CI_Action));
memclrw(action, sizeof(CI_Action)); memclrw(action, sizeof(CI_Action));
@ -3539,7 +3539,7 @@ static void CInline_AddFRefList_Object(Object *object) {
if ( if (
!(object->datatype == DFUNC || object->datatype == DVFUNC) || !(object->datatype == DFUNC || object->datatype == DVFUNC) ||
(object->flags & OBJECT_FLAGS_4) || (object->flags & OBJECT_DEFINED) ||
IS_TEMPL_FUNC(object->type) IS_TEMPL_FUNC(object->type)
) )
return; return;
@ -3764,8 +3764,8 @@ void CInline_ObjectAddrRef(Object *object) {
if ( if (
(object->qual & Q_INLINE) && (object->qual & Q_INLINE) &&
(funcdata = object->u.func.u.ifuncdata) && (funcdata = object->u.func.u.ifuncdata) &&
!(object->flags & OBJECT_FLAGS_4) && !(object->flags & OBJECT_DEFINED) &&
!(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100000) !(TYPE_FUNC(object->type)->flags & FUNC_IS_TEMPL)
) )
{ {
CI_Export *export = galloc(sizeof(CI_Export)); CI_Export *export = galloc(sizeof(CI_Export));
@ -3777,12 +3777,12 @@ void CInline_ObjectAddrRef(Object *object) {
export->next = cinline_exportlist; export->next = cinline_exportlist;
cinline_exportlist = export; cinline_exportlist = export;
object->flags |= OBJECT_FLAGS_4; object->flags |= OBJECT_DEFINED;
return; return;
} }
else if ( else if (
(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100) && (TYPE_FUNC(object->type)->flags & FUNC_AUTO_GENERATED) &&
!(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_2) !(TYPE_FUNC(object->type)->flags & FUNC_DEFINED)
) )
{ {
CInline_AddDefaultFunctionAction(object); CInline_AddDefaultFunctionAction(object);
@ -3800,11 +3800,11 @@ void CInline_ObjectAddrRef(Object *object) {
return; return;
case DDATA: case DDATA:
if (object->qual & Q_10000) if (object->qual & Q_INLINE_DATA)
CInit_ExportConst(object); CInit_ExportConst(object);
if (object->flags & OBJECT_FLAGS_8) { if (object->flags & OBJECT_LAZY) {
object->flags &= ~OBJECT_FLAGS_8; object->flags &= ~OBJECT_LAZY;
CParser_CallBackAction(object); CParser_CallBackAction(object);
} }
return; return;
@ -3821,15 +3821,15 @@ static Boolean CInline_CheckDependencies(ObjectList *list) {
object = list->object; object = list->object;
if ( if (
(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100) && (TYPE_FUNC(object->type)->flags & FUNC_AUTO_GENERATED) &&
!(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_2) !(TYPE_FUNC(object->type)->flags & FUNC_DEFINED)
) )
{ {
CInline_AddDefaultFunctionAction(object); CInline_AddDefaultFunctionAction(object);
result = 1; result = 1;
} }
else if ( else if (
(object->qual & Q_400000) && (object->qual & Q_IS_TEMPLATED) &&
CTempl_InlineFunctionCheck(object) 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_freflist = NULL;
CInline_AddFRefList_Statement(stmt); CInline_AddFRefList_Statement(stmt);
@ -3972,8 +3972,8 @@ void CInline_GenFunc(Statement *stmt, Object *object, UInt8 unk) {
static void CInline_GenerateDefaultFunc(Object *object) { static void CInline_GenerateDefaultFunc(Object *object) {
TypeClass *tclass; TypeClass *tclass;
CError_ASSERT(4770, TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100); CError_ASSERT(4770, TYPE_FUNC(object->type)->flags & FUNC_AUTO_GENERATED);
CError_ASSERT(4771, TYPE_FUNC(object->type)->flags & FUNC_FLAGS_METHOD); CError_ASSERT(4771, TYPE_FUNC(object->type)->flags & FUNC_METHOD);
tclass = TYPE_METHOD(object->type)->theclass; tclass = TYPE_METHOD(object->type)->theclass;
@ -3997,7 +3997,7 @@ static TemplClassInst *CInline_FindNestedTemplInst(TypeClass *tclass) {
NameSpace *nspace; NameSpace *nspace;
while (tclass) { while (tclass) {
if ((tclass->flags & CLASS_FLAGS_800)) if ((tclass->flags & CLASS_IS_TEMPL_INST))
return TEMPL_CLASS_INST(tclass); return TEMPL_CLASS_INST(tclass);
if (!copts.template_patch) if (!copts.template_patch)
@ -4040,7 +4040,7 @@ static void CInline_GenerateInlineFunc(CI_Action *action) {
symdecltoken = *CPrep_CurStreamElement(); 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))) { if (IS_TYPE_METHOD(object->type) && (inst = CInline_FindNestedTemplInst(TYPE_METHOD(object->type)->theclass))) {
CTempl_ParseInstanceScopeFunction(object, inst, NULL); CTempl_ParseInstanceScopeFunction(object, inst, NULL);
} else { } else {
@ -4086,17 +4086,17 @@ Boolean CInline_GenerateDeferredFuncs(void) {
CInline_GenerateDefaultFunc(action->obj); CInline_GenerateDefaultFunc(action->obj);
break; break;
case CI_ActionInlineFunc: case CI_ActionInlineFunc:
if (!(action->obj->flags & OBJECT_FLAGS_4)) if (!(action->obj->flags & OBJECT_DEFINED))
CInline_GenerateInlineFunc(action); CInline_GenerateInlineFunc(action);
break; break;
case CI_ActionMemberFunc: case CI_ActionMemberFunc:
if (!(TYPE_FUNC(action->obj->type)->flags & FUNC_FLAGS_2)) if (!(TYPE_FUNC(action->obj->type)->flags & FUNC_DEFINED))
CTempl_InstantiateMember( CTempl_InstantiateMember(
action->u.memberfunc.templ, action->u.memberfunc.inst, action->u.memberfunc.templ, action->u.memberfunc.inst,
action->u.memberfunc.tmemb, action->obj, 0); action->u.memberfunc.tmemb, action->obj, 0);
break; break;
case CI_ActionTemplateFunc: 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); CTempl_GenFuncInstance(action->u.templatefunc.func, action->u.templatefunc.inst, 0);
break; break;
default: default:
@ -4128,7 +4128,7 @@ static InitExpr *CInline_InitTemplateData(InitExpr *init) {
data = CParser_NewCompilerDefDataObject(); data = CParser_NewCompilerDefDataObject();
data->type = TYPE(&stsignedchar); data->type = TYPE(&stsignedchar);
data->name = CParser_NameConcat("__init__", CMangler_GetLinkName(object)->name); 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); CInit_DeclareData(data, NULL, NULL, data->type->size);
stmt = CFunc_AppendStatement(ST_IFGOTO); stmt = CFunc_AppendStatement(ST_IFGOTO);
@ -4180,7 +4180,7 @@ void CInline_Finish(void) {
init = init_expressions; init = init_expressions;
while (init) { 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); init = CInline_InitTemplateData(init);
} else { } else {
stmt = CFunc_AppendStatement(ST_EXPRESSION); stmt = CFunc_AppendStatement(ST_EXPRESSION);

View File

@ -1268,26 +1268,26 @@ SInt32 CMach_StructLayoutBitfield(TypeBitfield *tbitfield, UInt32 qual) {
if (!cmach_curbfsize) { if (!cmach_curbfsize) {
cmach_structoffset += padding_at_start; cmach_structoffset += padding_at_start;
if (!tbitfield->unkB) if (!tbitfield->bitlength)
return cmach_structoffset; return cmach_structoffset;
cmach_curbfsize = tbitfield->unkB; cmach_curbfsize = tbitfield->bitlength;
cmach_curbfbasesize = basesize; cmach_curbfbasesize = basesize;
cmach_curbfoffset = cmach_structoffset; cmach_curbfoffset = cmach_structoffset;
cmach_structoffset += basesize; cmach_structoffset += basesize;
tbitfield->unkA = 0; tbitfield->offset = 0;
return cmach_curbfoffset; return cmach_curbfoffset;
} else { } 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_structoffset += padding_at_start;
cmach_curbfsize = 0; cmach_curbfsize = 0;
cmach_curbfbasesize = basesize; cmach_curbfbasesize = basesize;
if (!tbitfield->unkB) if (!tbitfield->bitlength)
return cmach_structoffset; return cmach_structoffset;
cmach_curbfoffset = cmach_structoffset; cmach_curbfoffset = cmach_structoffset;
cmach_structoffset += basesize; cmach_structoffset += basesize;
} }
tbitfield->unkA = cmach_curbfsize; tbitfield->offset = cmach_curbfsize;
cmach_curbfsize += tbitfield->unkB; cmach_curbfsize += tbitfield->bitlength;
return cmach_curbfoffset; return cmach_curbfoffset;
} }
} }

View File

@ -539,7 +539,7 @@ static void CMangler_MangleFunction(Object *obj, NameSpace *nspace) {
AppendGListName(&name_mangle_list, obj->name->name); AppendGListName(&name_mangle_list, obj->name->name);
if (obj->u.func.inst) { if (obj->u.func.inst) {
if (tfunc->flags & FUNC_FLAGS_40) if (tfunc->flags & FUNC_CONVERSION)
CMangler_MangleTypeAppend(tfunc->functype, tfunc->qual); CMangler_MangleTypeAppend(tfunc->functype, tfunc->qual);
CMangler_AppendTemplateArgumentList(obj->u.func.inst->args); CMangler_AppendTemplateArgumentList(obj->u.func.inst->args);
} }
@ -557,10 +557,10 @@ static void CMangler_MangleFunction(Object *obj, NameSpace *nspace) {
if (arg) { if (arg) {
if (obj->name == constructor_name_node) { if (obj->name == constructor_name_node) {
arg = arg->next; arg = arg->next;
if (arg && (nspace->theclass->flags & CLASS_FLAGS_20)) if (arg && (nspace->theclass->flags & CLASS_HAS_VBASES))
arg = arg->next; arg = arg->next;
} else { } 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); CMangler_MangleQualifier(arg->qual);
arg = arg->next; arg = arg->next;
} }
@ -625,7 +625,7 @@ static HashNameNode *CMangler_FunctionLinkName(Object *obj) {
if (is_pascal_object(obj) && (!nspace || !nspace->theclass)) { if (is_pascal_object(obj) && (!nspace || !nspace->theclass)) {
AppendGListData(&name_mangle_list, "_", 1); AppendGListData(&name_mangle_list, "_", 1);
AppendGListID(&name_mangle_list, obj->name->name); 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); AppendGListData(&name_mangle_list, "_", 1);
CMangler_MangleFunction(obj, nspace); CMangler_MangleFunction(obj, nspace);
AppendGListByte(&name_mangle_list, 0); AppendGListByte(&name_mangle_list, 0);
@ -670,7 +670,7 @@ static HashNameNode *CMangler_DataLinkName(Object *obj) {
while (nspace && nspace->name == NULL) while (nspace && nspace->name == NULL)
nspace = nspace->parent; nspace = nspace->parent;
if (nspace && (obj->qual & Q_80000)) { if (nspace && (obj->qual & Q_MANGLE_NAME)) {
AppendGListName(&name_mangle_list, "__"); AppendGListName(&name_mangle_list, "__");
CMangler_MangleNameSpaceName(nspace->parent, nspace->name->name); CMangler_MangleNameSpaceName(nspace->parent, nspace->name->name);
} }

View File

@ -673,8 +673,8 @@ static TypeClass *CObjC_NewObjCClass(HashNameNode *name) {
info = galloc(sizeof(ObjCInfo)); info = galloc(sizeof(ObjCInfo));
memclrw(info, sizeof(ObjCInfo)); memclrw(info, sizeof(ObjCInfo));
tclass = CDecl_DefineClass(cscope_root, name, NULL, CLASS_MODE_2, 1, 1); tclass = CDecl_DefineClass(cscope_root, name, NULL, CLASS_MODE_CLASS, 1, 1);
tclass->flags |= CLASS_FLAGS_10; tclass->flags |= CLASS_SINGLE_OBJECT;
tclass->objcinfo = info; tclass->objcinfo = info;
info->classobject = CObjC_MakeObject("L_OBJC_CLASS_", name->name, 40); info->classobject = CObjC_MakeObject("L_OBJC_CLASS_", name->name, 40);
@ -1017,7 +1017,7 @@ static TypeFunc *CObjC_GetMethodFuncType(ObjCMethod *meth) {
functype->type = TYPEFUNC; functype->type = TYPEFUNC;
functype->functype = meth->return_type; functype->functype = meth->return_type;
functype->qual = meth->return_qual; functype->qual = meth->return_qual;
functype->flags = FUNC_FLAGS_4000; functype->flags = FUNC_OBJC_METHOD;
CDecl_SetFuncFlags(functype, 1); CDecl_SetFuncFlags(functype, 1);
CObjC_AppendArgument(functype, CObjC_GetSelfName(), CObjC_GetObjCType_id(1), 0); 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()) == '(') {
if ((tk = lex()) == TK_IDENTIFIER) { if ((tk = lex()) == TK_IDENTIFIER) {
if ((tclass = CObjC_FindObjCClass(tkidentifier, 1))) { if ((tclass = CObjC_FindObjCClass(tkidentifier, 1))) {
if (tclass->flags & CLASS_FLAGS_2) { if (tclass->flags & CLASS_COMPLETED) {
tstruct->size = tclass->size; tstruct->size = tclass->size;
tstruct->align = tclass->align; tstruct->align = tclass->align;
CObjC_AddClassMembers(tstruct, tclass); CObjC_AddClassMembers(tstruct, tclass);
@ -1208,7 +1208,7 @@ Type *CObjC_ParseID(void) {
type->pointer = *TYPE_POINTER(CObjC_GetObjCType_id(1)); type->pointer = *TYPE_POINTER(CObjC_GetObjCType_id(1));
type->protocols = CObjC_ParserProtocolList(); type->protocols = CObjC_ParserProtocolList();
type->pointer.qual |= Q_100000; type->pointer.qual |= Q_IS_OBJC_ID;
return TYPE(type); return TYPE(type);
} else { } else {
@ -1367,7 +1367,7 @@ static void CObjC_EncodeTypeClass(TypeClass *tclass, Boolean flag) {
ObjMemberVar *ivar; ObjMemberVar *ivar;
if (CClass_IsPODClass(tclass)) { 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) if (cobjc_encodemethod)
AppendGListByte(&name_mangle_list, '?'); AppendGListByte(&name_mangle_list, '?');
@ -1380,7 +1380,7 @@ static void CObjC_EncodeTypeClass(TypeClass *tclass, Boolean flag) {
CObjC_EncodeType(ivar->type, ivar->qual, 1); 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 { } else {
AppendGListByte(&name_mangle_list, '?'); AppendGListByte(&name_mangle_list, '?');
} }
@ -1540,7 +1540,7 @@ static void CObjC_EncodeType(Type *type, UInt32 qual, Boolean flag) {
case TYPEBITFIELD: case TYPEBITFIELD:
AppendGListByte(&name_mangle_list, 'b'); AppendGListByte(&name_mangle_list, 'b');
sprintf(buf, "%" PRId32, TYPE_BITFIELD(type)->unkB); sprintf(buf, "%" PRId32, TYPE_BITFIELD(type)->bitlength);
AppendGListName(&name_mangle_list, buf); AppendGListName(&name_mangle_list, buf);
return; return;
@ -2310,7 +2310,7 @@ static void CObjC_ParseInstanceVariables(TypeClass *tclass, Boolean checkOnly) {
CError_Error(CErrorStr131); CError_Error(CErrorStr131);
bdi.xCD = 0; bdi.xCD = 0;
} }
if (bdi.declinfo2.x3E) { if (bdi.declinfo2.operator_token) {
CError_Error(CErrorStr131); CError_Error(CErrorStr131);
bdi.xCD = 0; bdi.xCD = 0;
} }
@ -2397,7 +2397,7 @@ static void CObjC_ParseInterfaceImplementation(void) {
return; return;
} }
flag2 = (tclass->flags & CLASS_FLAGS_2) ? 1 : 0; flag2 = (tclass->flags & CLASS_COMPLETED) ? 1 : 0;
if (flag2 && isInterface) { if (flag2 && isInterface) {
CError_Error(CErrorStr132, tclass->classname->name); CError_Error(CErrorStr132, tclass->classname->name);
return; return;
@ -2410,7 +2410,7 @@ static void CObjC_ParseInterfaceImplementation(void) {
} }
if ((tclassbase = CObjC_FindObjCClass(tkidentifier, 1))) { if ((tclassbase = CObjC_FindObjCClass(tkidentifier, 1))) {
if (tclassbase->flags & CLASS_FLAGS_2) { if (tclassbase->flags & CLASS_COMPLETED) {
if (!flag2) { if (!flag2) {
base = galloc(sizeof(ClassList)); base = galloc(sizeof(ClassList));
memclrw(base, sizeof(ClassList)); memclrw(base, sizeof(ClassList));
@ -2445,9 +2445,9 @@ static void CObjC_ParseInterfaceImplementation(void) {
CObjC_ParseInstanceVariables(tclass, flag2); CObjC_ParseInstanceVariables(tclass, flag2);
if (!flag2) { if (!flag2) {
DeclE decle; ClassLayout layout;
memclrw(&decle, sizeof(decle)); memclrw(&layout, sizeof(layout));
CABI_LayoutClass(&decle, tclass); CABI_LayoutClass(&layout, tclass);
} }
cobjc_currentclass = tclass; cobjc_currentclass = tclass;
@ -2696,7 +2696,7 @@ ENode *CObjC_MakeSendMsgExpr(ENode *objexpr, TypeClass *tclass, ObjCNamedArg *na
} }
if (!meth) { 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 (protlist = TYPE_OBJC_ID(objexpr->rtype)->protocols; protlist; protlist = protlist->next) {
for (meth = protlist->protocol->methods; meth; meth = meth->next) { for (meth = protlist->protocol->methods; meth; meth = meth->next) {
if (CObjC_SelectorCompare(meth, namedArgs, unnamedArgs != NULL)) { if (CObjC_SelectorCompare(meth, namedArgs, unnamedArgs != NULL)) {

View File

@ -155,7 +155,7 @@ Object *CParser_NewRTFunc(Type *rettype, HashNameNode *name, Boolean flag, int a
obj->name = name; obj->name = name;
obj->type = TYPE(tfunc); obj->type = TYPE(tfunc);
if (flag == 1) if (flag == 1)
obj->qual = Q_80000; obj->qual = Q_MANGLE_NAME;
return obj; return obj;
} }
@ -657,18 +657,18 @@ static void CParser_SetCFMFlags(Object *object, DeclInfo *declinfo) {
if (object->datatype == DDATA) { if (object->datatype == DDATA) {
if (copts.cfm_export) if (copts.cfm_export)
object->flags = object->flags | OBJECT_FLAGS_40; object->flags = object->flags | OBJECT_EXPORT;
if (copts.cfm_internal) if (copts.cfm_internal)
object->flags = object->flags | OBJECT_FLAGS_10; object->flags = object->flags | OBJECT_INTERNAL;
} else if (copts.cfm_internal) { } else if (copts.cfm_internal) {
object->flags = object->flags | OBJECT_FLAGS_10; object->flags = object->flags | OBJECT_INTERNAL;
} else { } else {
if (copts.cfm_import) if (copts.cfm_import)
object->flags = object->flags | OBJECT_FLAGS_20; object->flags = object->flags | OBJECT_IMPORT;
if (copts.cfm_export) if (copts.cfm_export)
object->flags = object->flags | OBJECT_FLAGS_40; object->flags = object->flags | OBJECT_EXPORT;
if (copts.cfm_lib_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->name = declinfo->name;
object->qual = declinfo->qual; object->qual = declinfo->qual;
object->sclass = declinfo->storageclass; object->sclass = declinfo->storageclass;
if (copts.cplusplus && !declinfo->x4E) if (copts.cplusplus && !declinfo->is_extern_c)
object->qual |= Q_80000; object->qual |= Q_MANGLE_NAME;
} }
CParser_UpdateObject(object, declinfo); CParser_UpdateObject(object, declinfo);
@ -762,8 +762,8 @@ Object *CParser_NewFunctionObject(DeclInfo *declinfo) {
object->name = declinfo->name; object->name = declinfo->name;
object->qual = declinfo->qual; object->qual = declinfo->qual;
object->sclass = declinfo->storageclass; object->sclass = declinfo->storageclass;
if (copts.cplusplus && !declinfo->x4E) if (copts.cplusplus && !declinfo->is_extern_c)
object->qual |= Q_80000; object->qual |= Q_MANGLE_NAME;
} }
CParser_UpdateObject(object, declinfo); CParser_UpdateObject(object, declinfo);
@ -825,7 +825,7 @@ Object *CParser_FindDeallocationObject(Type *type, FuncArg *args, Boolean flag1,
NameSpaceObjectList *list; NameSpaceObjectList *list;
NameSpaceObjectList *scan; NameSpaceObjectList *scan;
NameSpaceObjectList mylist; NameSpaceObjectList mylist;
CScopeParseResult pr; NameResult pr;
Boolean first_time; Boolean first_time;
Boolean retry_flag; Boolean retry_flag;
Object *obj; Object *obj;
@ -845,7 +845,7 @@ Object *CParser_FindDeallocationObject(Type *type, FuncArg *args, Boolean flag1,
CError_ASSERT(1202, pr.nsol_14); CError_ASSERT(1202, pr.nsol_14);
list = 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); CError_ASSERT(1210, !args && !flag1);
return delh_func; 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)) if (!is_typesame(TYPE_FUNC(a)->functype, TYPE_FUNC(b)->functype))
return 0; 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 0;
CError_ASSERT(1345, arg_a = TYPE_FUNC(a)->args); 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)) if (!is_typesame(TYPE_FUNC(a)->functype, TYPE_FUNC(b)->functype))
return 0; 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 0;
} }
return is_arglistequal(TYPE_FUNC(a)->args, TYPE_FUNC(b)->args); return is_arglistequal(TYPE_FUNC(a)->args, TYPE_FUNC(b)->args);
@ -1095,7 +1095,7 @@ short iscpp_typeequal(Type *a, Type *b) {
case TYPEFUNC: case TYPEFUNC:
if (!is_typesame(TYPE_FUNC(a)->functype, TYPE_FUNC(b)->functype)) if (!is_typesame(TYPE_FUNC(a)->functype, TYPE_FUNC(b)->functype))
return 0; 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 0;
return is_arglistequal(TYPE_FUNC(a)->args, TYPE_FUNC(b)->args); return is_arglistequal(TYPE_FUNC(a)->args, TYPE_FUNC(b)->args);
case TYPETEMPLATE: case TYPETEMPLATE:
@ -1232,9 +1232,9 @@ Boolean is_arglistsame(FuncArg *a, FuncArg *b) {
short is_typesame(Type *a, Type *b) { short is_typesame(Type *a, Type *b) {
restart: restart:
if (a->type != b->type) { 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); 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 CTemplTool_IsSameTemplateType(a, b);
return 0; return 0;
} }
@ -1274,7 +1274,7 @@ restart:
return 0; return 0;
if (TYPE_FUNC(a)->qual != TYPE_FUNC(b)->qual) if (TYPE_FUNC(a)->qual != TYPE_FUNC(b)->qual)
return 0; 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 0;
return is_arglistsame(TYPE_FUNC(a)->args, TYPE_FUNC(b)->args); return is_arglistsame(TYPE_FUNC(a)->args, TYPE_FUNC(b)->args);
default: default:
@ -1534,7 +1534,7 @@ Type *CParser_ParseTypeID(UInt32 *qual, Boolean *flag) {
} }
CParser_GetDeclSpecs(&di, 0); 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); CParser_RemoveTryBlock(&tryblock);
*qual = di.qual; *qual = di.qual;
*flag = 1; *flag = 1;
@ -1730,7 +1730,7 @@ Boolean CParser_HasInternalLinkage(const Object *obj) {
if (obj->datatype == DLOCAL) if (obj->datatype == DLOCAL)
return 1; return 1;
if (obj->qual & (Q_20000 | Q_OVERLOAD)) if (obj->qual & (Q_20000 | Q_WEAK))
return 0; return 0;
if (obj->sclass == TK_STATIC) if (obj->sclass == TK_STATIC)
return 1; return 1;
@ -1744,7 +1744,7 @@ Boolean CParser_HasInternalLinkage(const Object *obj) {
Boolean CParser_HasInternalLinkage2(const Object *obj) { Boolean CParser_HasInternalLinkage2(const Object *obj) {
if (obj->datatype == DLOCAL) if (obj->datatype == DLOCAL)
return 1; return 1;
if (obj->qual & (Q_20000 | Q_OVERLOAD)) if (obj->qual & (Q_20000 | Q_WEAK))
return 0; return 0;
if (obj->sclass == TK_STATIC) if (obj->sclass == TK_STATIC)
return 1; return 1;
@ -1758,7 +1758,7 @@ Boolean CParser_HasInternalLinkage2(const Object *obj) {
Boolean CParser_IsVirtualFunction(Object *obj, TypeClass **tclass, SInt32 *index) { Boolean CParser_IsVirtualFunction(Object *obj, TypeClass **tclass, SInt32 *index) {
if (obj->datatype == DVFUNC) { if (obj->datatype == DVFUNC) {
*tclass = TYPE_METHOD(obj->type)->theclass; *tclass = TYPE_METHOD(obj->type)->theclass;
*index = TYPE_METHOD(obj->type)->x1E; *index = TYPE_METHOD(obj->type)->vtbl_index;
return 1; return 1;
} }
@ -1766,7 +1766,7 @@ Boolean CParser_IsVirtualFunction(Object *obj, TypeClass **tclass, SInt32 *index
} }
Boolean is_pascal_object(Object *obj) { 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) { 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__")) { } else if (!strcmp(tkidentifier->name, "nothrow") || !strcmp(tkidentifier->name, "__nothrow__")) {
if (declinfo && declinfo->thetype && IS_TYPE_FUNC(declinfo->thetype)) 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 else
CError_Error(CErrorStr359); CError_Error(CErrorStr359);
} else if (!strcmp("function_summary", tkidentifier->name)) { } 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)) { } else if (!strcmp("lib_export", tkidentifier->name)) {
declinfo->exportflags = declinfo->exportflags | EXPORT_FLAGS_IMPORT | EXPORT_FLAGS_EXPORT; declinfo->exportflags = declinfo->exportflags | EXPORT_FLAGS_IMPORT | EXPORT_FLAGS_EXPORT;
} else if (!strcmp("weak", tkidentifier->name)) { } else if (!strcmp("weak", tkidentifier->name)) {
declinfo->qual |= Q_OVERLOAD; declinfo->qual |= Q_WEAK;
} else { } else {
CodeGen_ParseDeclSpec(tkidentifier, declinfo); CodeGen_ParseDeclSpec(tkidentifier, declinfo);
} }
@ -2600,12 +2600,10 @@ void CParser_GetDeclSpecs(DeclInfo *di, Boolean flag) {
Boolean r24; Boolean r24;
Boolean r23; Boolean r23;
SInt32 state; SInt32 state;
CScopeParseResult pr; NameResult pr;
di->file = CPrep_BrowserCurrentFile(); di->file = CPrep_BrowserCurrentFile();
CPrep_BrowserFilePosition( CPrep_BrowserFilePosition(&di->file2, &di->sourceoffset);
(CPrepFileInfo **) &di->file2,
&di->x60);
r24 = 1; r24 = 1;
r23 = copts.cplusplus; r23 = copts.cplusplus;
@ -2798,7 +2796,7 @@ restart:
if (typetoken || signedness || typesize) if (typetoken || signedness || typesize)
CError_Error(CErrorStr121); CError_Error(CErrorStr121);
tk = lex(); tk = lex();
CDecl_ParseClass(di, CLASS_MODE_2, 1, 0); CDecl_ParseClass(di, CLASS_MODE_CLASS, 1, 0);
if (tk == TK_UU_ATTRIBUTE_UU) if (tk == TK_UU_ATTRIBUTE_UU)
CParser_ParseAttribute(di->thetype, NULL); CParser_ParseAttribute(di->thetype, NULL);
if (!(tk != TK_CONST && tk != TK_VOLATILE && tk != TK_UU_FAR && tk != TK_UU_DECLSPEC)) { if (!(tk != TK_CONST && tk != TK_VOLATILE && tk != TK_UU_FAR && tk != TK_UU_DECLSPEC)) {
@ -2888,20 +2886,20 @@ restart:
some_shared_label: some_shared_label:
CPrep_TokenStreamGetState(&state); CPrep_TokenStreamGetState(&state);
if (CScope_ParseDeclName(&pr)) { if (CScope_ParseDeclName(&pr)) {
if (pr.x8) { if (pr.type) {
if (IS_TYPE_TEMPLATE(pr.x8)) { if (IS_TYPE_TEMPLATE(pr.type)) {
switch (TYPE_TEMPLATE(pr.x8)->dtype) { switch (TYPE_TEMPLATE(pr.type)->dtype) {
case TEMPLDEP_ARGUMENT: case TEMPLDEP_ARGUMENT:
switch (TYPE_TEMPLATE(pr.x8)->u.pid.type) { switch (TYPE_TEMPLATE(pr.type)->u.pid.type) {
case TPT_TYPE: case TPT_TYPE:
break; break;
case TPT_NONTYPE: case TPT_NONTYPE:
CError_Error(CErrorStr348); CError_Error(CErrorStr348);
pr.x8 = TYPE(&stsignedint); pr.type = TYPE(&stsignedint);
break; break;
case TPT_TEMPLATE: case TPT_TEMPLATE:
CError_Error(CErrorStr230); CError_Error(CErrorStr230);
pr.x8 = TYPE(&stsignedint); pr.type = TYPE(&stsignedint);
break; break;
default: default:
CError_FATAL(4109); CError_FATAL(4109);
@ -2921,23 +2919,23 @@ restart:
} }
} }
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)) {
if (!CParser_CheckTemplateClassUsage(TEMPL_CLASS(pr.x8), 0)) { if (!CParser_CheckTemplateClassUsage(TEMPL_CLASS(pr.type), 0)) {
if (di->x56) { if (di->x56) {
if (di->qual) if (di->qual)
CError_Error(CErrorStr121); CError_Error(CErrorStr121);
di->thetype = pr.x8; di->thetype = pr.type;
di->x57 = 1; di->x57 = 1;
tk = lex(); tk = lex();
return; return;
} else { } else {
CError_Error(CErrorStr230); 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; di->x49 = pr.x20;
typetoken = -1; typetoken = -1;
tk = lex(); tk = lex();
@ -2946,9 +2944,9 @@ restart:
goto bailOut; goto bailOut;
} else if (pr.nsol_14) { } else if (pr.nsol_14) {
if (pr.x1D) { 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; 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; r23 = 0;
} else { } else {
CError_Error(CErrorStr121); CError_Error(CErrorStr121);
@ -2958,9 +2956,9 @@ restart:
switch (pr.obj_10->otype) { switch (pr.obj_10->otype) {
case OT_OBJECT: case OT_OBJECT:
if (pr.x1D) { 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); 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; r23 = 0;
} else { } else {
CError_Error(CErrorStr121); CError_Error(CErrorStr121);
@ -3097,8 +3095,8 @@ static void CParser_GlobalCleanup(Boolean flag) {
Boolean CParser_IsAnonymousUnion(DeclInfo *di, Boolean flag) { Boolean CParser_IsAnonymousUnion(DeclInfo *di, Boolean flag) {
return IS_TYPE_CLASS(di->thetype) && return IS_TYPE_CLASS(di->thetype) &&
((TYPE_CLASS(di->thetype)->mode == CLASS_MODE_1 || (flag && copts.cpp_extensions))) && ((TYPE_CLASS(di->thetype)->mode == CLASS_MODE_UNION || (flag && copts.cpp_extensions))) &&
IsTempName(TYPE_CLASS(di->thetype)->classname); IsTempName(TYPE_CLASS(di->thetype)->classname);
} }
void CParser_CheckAnonymousUnion(DeclInfo *di, Boolean flag) { void CParser_CheckAnonymousUnion(DeclInfo *di, Boolean flag) {
@ -3156,7 +3154,7 @@ void CParser_NewCallBackAction(Object *obj, TypeClass *tclass) {
act->obj = obj; act->obj = obj;
act->tclass = tclass; act->tclass = tclass;
callbackactions = act; callbackactions = act;
obj->flags = obj->flags | OBJECT_FLAGS_8; obj->flags = obj->flags | OBJECT_LAZY;
} }
void CParser_NewClassAction(TypeClass *tclass) { void CParser_NewClassAction(TypeClass *tclass) {
@ -3192,7 +3190,7 @@ static Object *CParser_FindOverloadFunc(NameSpaceObjectList *list, TypeFunc *tfu
Object *CParser_ParseObject(void) { Object *CParser_ParseObject(void) {
DeclInfo di; DeclInfo di;
CScopeParseResult pr; NameResult pr;
NameSpaceObjectList *list; NameSpaceObjectList *list;
Object *obj; Object *obj;
@ -3243,21 +3241,21 @@ void CParser_ParseGlobalDeclaration(void) {
} }
static void CParser_ParseLinkageSpecification(DeclInfo *di) { static void CParser_ParseLinkageSpecification(DeclInfo *di) {
UInt32 r29; UInt32 qual;
UInt8 r28; UInt8 r28;
if (!strcmp(tkstring, "C") || !strcmp(tkstring, "Objective C")) { if (!strcmp(tkstring, "C") || !strcmp(tkstring, "Objective C")) {
r29 = 0; qual = 0;
r28 = 1; r28 = 1;
} else if (!strcmp(tkstring, "C++")) { } else if (!strcmp(tkstring, "C++")) {
r29 = 0; qual = 0;
r28 = 0; r28 = 0;
} else if (!strcmp(tkstring, "Pascal")) { } else if (!strcmp(tkstring, "Pascal")) {
r29 = 8; qual = Q_PASCAL;
r28 = 1; r28 = 1;
} else { } else {
CError_Error(CErrorStr121); CError_Error(CErrorStr121);
r29 = 0; qual = 0;
r28 = 1; r28 = 1;
} }
@ -3276,8 +3274,8 @@ static void CParser_ParseLinkageSpecification(DeclInfo *di) {
symdecltoken = *CPrep_CurStreamElement(); symdecltoken = *CPrep_CurStreamElement();
memclrw(di, sizeof(DeclInfo)); memclrw(di, sizeof(DeclInfo));
di->x4E = r28; di->is_extern_c = r28;
di->qual = r29; di->qual = qual;
CParser_ParseDeclaration(di); CParser_ParseDeclaration(di);
} }
} else if (tk == TK_EXTERN && copts.cpp_extensions && lookahead() == TK_STRING) { } else if (tk == TK_EXTERN && copts.cpp_extensions && lookahead() == TK_STRING) {
@ -3285,8 +3283,8 @@ static void CParser_ParseLinkageSpecification(DeclInfo *di) {
CParser_ParseLinkageSpecification(di); CParser_ParseLinkageSpecification(di);
} else { } else {
memclrw(di, sizeof(DeclInfo)); memclrw(di, sizeof(DeclInfo));
di->x4E = r28; di->is_extern_c = r28;
di->qual = r29; di->qual = qual;
CParser_GetDeclSpecs(di, 1); CParser_GetDeclSpecs(di, 1);
if (di->storageclass != TK_TYPEDEF) { if (di->storageclass != TK_TYPEDEF) {

View File

@ -205,7 +205,7 @@ static OLinkList *CPrec_OLinkListCopy(OLinkList *list) {
void PreComp_StaticData(Object *obj, const void *data, OLinkList *links, SInt32 size) { void PreComp_StaticData(Object *obj, const void *data, OLinkList *links, SInt32 size) {
StaticData *entry; 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); CError_Error(CErrorStr180);
entry = galloc(sizeof(StaticData)); entry = galloc(sizeof(StaticData));
@ -702,7 +702,7 @@ static TypePointer *CPrec_GetTypePointerPatch(TypePointer *tptr) {
TypePointer *scan1; TypePointer *scan1;
TypePointer *scan2; TypePointer *scan2;
if (tptr->qual & Q_100000) { if (tptr->qual & Q_IS_OBJC_ID) {
p = CPrec_AppendAlign(); p = CPrec_AppendAlign();
CPrec_NewAddrPatch(tptr, p); CPrec_NewAddrPatch(tptr, p);
CPrec_AppendData(tptr, sizeof(TypeObjCID)); CPrec_AppendData(tptr, sizeof(TypeObjCID));
@ -872,14 +872,14 @@ static TypeFunc *CPrec_GetTypeFuncPatch(TypeFunc *type) {
TypeFunc *p = CPrec_AppendAlign(); TypeFunc *p = CPrec_AppendAlign();
CPrec_NewAddrPatch(type, p); 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)); CPrec_NewPointerPatch(&p->functype, CPrec_GetTypePatch(type->functype));
if (type->args) 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) if (type->exspecs)
CPrec_NewPointerPatch(&p->exspecs, CPrec_GetExceptSpecPatch(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)); CPrec_NewPointerPatch(&TYPE_METHOD(p)->theclass, CPrec_GetTypePatch((Type *) TYPE_METHOD(type)->theclass));
return p; return p;
@ -1683,7 +1683,7 @@ static TypeClass *CPrec_GetTypeClassPatch(TypeClass *tclass) {
hasNextTempl = hasNextTemplInst = 0; hasNextTempl = hasNextTemplInst = 0;
CPrec_NewAddrPatch(tclass, current); CPrec_NewAddrPatch(tclass, current);
if (tclass->flags & CLASS_FLAGS_100) { if (tclass->flags & CLASS_IS_TEMPL) {
// template class // template class
CPrec_AppendData(tclass, sizeof(TemplClass)); CPrec_AppendData(tclass, sizeof(TemplClass));
if (TEMPL_CLASS(tclass)->next) 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)); CPrec_NewPointerPatch(&TEMPL_CLASS(current)->pspecs, CPrec_GetTemplPartialSpecPatch(TEMPL_CLASS(tclass)->pspecs));
if (TEMPL_CLASS(tclass)->actions) if (TEMPL_CLASS(tclass)->actions)
CPrec_NewPointerPatch(&TEMPL_CLASS(current)->actions, CPrec_GetTemplateActionPatch(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 // template class instance
CPrec_AppendData(tclass, sizeof(TemplClassInst)); CPrec_AppendData(tclass, sizeof(TemplClassInst));
if (TEMPL_CLASS_INST(tclass)->next) if (TEMPL_CLASS_INST(tclass)->next)
@ -2308,7 +2308,7 @@ static Object *CPrec_GetObjectPatch(Object *obj) {
obj->toc = NULL; 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_AppendData(obj, sizeof(ObjectTemplated));
CPrec_NewPointerPatch(&OBJECT_TEMPL(p)->parent, CPrec_GetObjectPatch(OBJECT_TEMPL(obj)->parent)); CPrec_NewPointerPatch(&OBJECT_TEMPL(p)->parent, CPrec_GetObjectPatch(OBJECT_TEMPL(obj)->parent));
} else { } else {
@ -2346,7 +2346,7 @@ static Object *CPrec_GetObjectPatch(Object *obj) {
case DDATA: case DDATA:
CError_ASSERT(3622, !obj->u.data.info); CError_ASSERT(3622, !obj->u.data.info);
if (obj->qual & Q_10000) { if (obj->qual & Q_INLINE_DATA) {
switch (obj->type->type) { switch (obj->type->type) {
case TYPEINT: case TYPEINT:
case TYPEENUM: case TYPEENUM:

View File

@ -267,7 +267,7 @@ static Object *CRTTI_ConstructTypeInfoObject(Type *type, UInt32 qual) {
if (IS_TYPE_CLASS(type) && type->size == 0) { if (IS_TYPE_CLASS(type) && type->size == 0) {
CDecl_CompleteType(type); CDecl_CompleteType(type);
if (!(TYPE_CLASS(type)->flags & CLASS_FLAGS_2)) if (!(TYPE_CLASS(type)->flags & CLASS_COMPLETED))
CError_Error(CErrorStr136, type, 0); CError_Error(CErrorStr136, type, 0);
} }
@ -544,7 +544,7 @@ static void CRTTI_IncompleteCheck(Type *type) {
if (IS_TYPE_CLASS(type) && type->size == 0) { if (IS_TYPE_CLASS(type) && type->size == 0) {
CDecl_CompleteType(type); CDecl_CompleteType(type);
if (!(TYPE_CLASS(type)->flags & CLASS_FLAGS_2)) if (!(TYPE_CLASS(type)->flags & CLASS_COMPLETED))
CError_Error(CErrorStr136, type, 0); CError_Error(CErrorStr136, type, 0);
} }
} }
@ -701,7 +701,7 @@ ENode *CRTTI_Parse_dynamic_cast(void) {
if (IS_TYPE_CLASS(TPTR_TARGET(di.thetype))) { if (IS_TYPE_CLASS(TPTR_TARGET(di.thetype))) {
destclass = TYPE_CLASS(TPTR_TARGET(di.thetype)); destclass = TYPE_CLASS(TPTR_TARGET(di.thetype));
CDecl_CompleteType(TYPE(destclass)); CDecl_CompleteType(TYPE(destclass));
if (!(destclass->flags & CLASS_FLAGS_2)) { if (!(destclass->flags & CLASS_COMPLETED)) {
CError_Error(CErrorStr136, destclass, 0); CError_Error(CErrorStr136, destclass, 0);
return expr; 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); CError_Error(CErrorStr136, srcclass, 0);
return expr; return expr;
} }

View File

@ -206,7 +206,7 @@ static Type *CSOM_FindClassType(HashNameNode *name) {
CW_INLINE UInt16 CSOM_GetTokenTableIndex(const Object *object) { CW_INLINE UInt16 CSOM_GetTokenTableIndex(const Object *object) {
CError_ASSERT(173, IS_TYPE_METHOD(object->type)); 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) { static SInt32 CSOM_GetTokenOffset(Object *object) {
@ -313,7 +313,7 @@ static void CSOM_GetFuncSig(TypeFunc *tfunc, Boolean flag) {
if (flag) { if (flag) {
if ((arg = tfunc->args)) { if ((arg = tfunc->args)) {
if (TYPE_METHOD(tfunc)->x26 == 0) if (TYPE_METHOD(tfunc)->is_static == 0)
arg = arg->next; arg = arg->next;
if (arg && CMach_GetFunctionResultClass(tfunc) != 0) if (arg && CMach_GetFunctionResultClass(tfunc) != 0)
arg = arg->next; arg = arg->next;
@ -370,7 +370,7 @@ void CSOM_MakeSOMClass(TypeClass *tclass) {
tclass->sominfo = info; tclass->sominfo = info;
info->classdataobject = CSOM_MakeObject(tclass->classname->name, "ClassData", 28); 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 ( if (
IS_TYPE_FUNC(type) && IS_TYPE_FUNC(type) &&
!(TYPE_FUNC(type)->flags & FUNC_FLAGS_20) && !(TYPE_FUNC(type)->flags & FUNC_FLAGS_20) &&
!TYPE_METHOD(type)->x26 && !TYPE_METHOD(type)->is_static &&
(!(object->qual & Q_INLINE) || object->datatype == DVFUNC) (!(object->qual & Q_INLINE) || object->datatype == DVFUNC)
) )
return 1; return 1;
@ -401,10 +401,10 @@ static Object **CSOM_GetLexicalOrderMethodArray(TypeClass *tclass, int *resultCo
if (IS_TYPE_METHOD(object->type)) { if (IS_TYPE_METHOD(object->type)) {
if (CSOM_IsTokenListFunc(object)) { if (CSOM_IsTokenListFunc(object)) {
if (TYPE_METHOD(object->type)->x1E > count) if (TYPE_METHOD(object->type)->vtbl_index > count)
count = TYPE_METHOD(object->type)->x1E; count = TYPE_METHOD(object->type)->vtbl_index;
} else { } 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; break;
if (CSOM_IsTokenListFunc(object)) if (CSOM_IsTokenListFunc(object))
array[TYPE_METHOD(object->type)->x1E] = object; array[TYPE_METHOD(object->type)->vtbl_index] = object;
} }
return array; return array;
@ -445,7 +445,7 @@ void CSOM_ClassComplete(TypeClass *tclass) {
for (order = tclass->sominfo->order, counter = 0; order; order = order->next, counter++) { for (order = tclass->sominfo->order, counter = 0; order; order = order->next, counter++) {
if (order->name == name) { if (order->name == name) {
order->state = SOMMS_Method; order->state = SOMMS_Method;
TYPE_METHOD(object->type)->x1E = counter; TYPE_METHOD(object->type)->vtbl_index = counter;
break; break;
} }
} }
@ -480,7 +480,7 @@ void CSOM_ClassComplete(TypeClass *tclass) {
if (object) { if (object) {
if (counter == 0 && copts.pedantic) if (counter == 0 && copts.pedantic)
CError_Warning(CErrorStr291); 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)); CError_ASSERT(529, IS_TYPE_FUNC(object->type));
TYPE_FUNC(object->type)->flags |= FUNC_FLAGS_4; TYPE_FUNC(object->type)->flags |= FUNC_FLAGS_4;
tclass->action = 1; tclass->action = CLASS_ACTION_1;
while (1) { while (1) {
if (!(object = OBJECT(CScope_NextObjectIteratorObject(&iter)))) if (!(object = OBJECT(CScope_NextObjectIteratorObject(&iter))))
break; break;
@ -535,7 +535,7 @@ void CSOM_ClassComplete(TypeClass *tclass) {
if ( if (
IS_TYPE_FUNC(object->type) && 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)->flags & FUNC_FLAGS_20) &&
!( !(
TYPE_FUNC(object->type)->args && 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); CError_Error(CErrorStr280);
} }
@ -747,7 +747,7 @@ static void CSOM_GenerateOverrideIntroLists(SOMGenerator *gen, TypeClass *tclass
CSOM_NameTranslate(object->name) == order->name 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; method->u.object = object;
break; break;
} }
@ -1934,7 +1934,7 @@ static ENode *CSOM_SOMGlueCall(TypeClass *tclass, SInt32 offset, Object *object)
stubObj->u.func.linkname = stubObj->name; stubObj->u.func.linkname = stubObj->name;
stubObj->type = object->type; stubObj->type = object->type;
stubObj->qual = object->qual | Q_20000; stubObj->qual = object->qual | Q_20000;
stubObj->flags = OBJECT_FLAGS_10; stubObj->flags = OBJECT_INTERNAL;
CScope_AddObject(stubObj->nspace, stubObj->name, OBJ_BASE(stubObj)); CScope_AddObject(stubObj->nspace, stubObj->name, OBJ_BASE(stubObj));
stub = galloc(sizeof(CSOMStub)); stub = galloc(sizeof(CSOMStub));

View File

@ -23,7 +23,7 @@
TemplClass *CTemplClass_GetMasterTemplate(TemplClass *tmclass) { TemplClass *CTemplClass_GetMasterTemplate(TemplClass *tmclass) {
if (tmclass->inst_parent) { if (tmclass->inst_parent) {
tmclass = TEMPL_CLASS(tmclass->theclass.nspace->theclass); 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; return tmclass;
@ -89,7 +89,7 @@ void CTemplClass_RegisterFriend(TemplClass *tmclass, DeclInfo *di) {
if (tk == '{' && IS_TYPE_FUNC(di->thetype)) { if (tk == '{' && IS_TYPE_FUNC(di->thetype)) {
di->qual |= Q_INLINE; 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; tfriend->fileoffset = cparser_fileoffset;
CPrep_StreamGetBlock(&tfriend->stream, NULL, 1); CPrep_StreamGetBlock(&tfriend->stream, NULL, 1);
@ -182,11 +182,11 @@ void CTemplClass_RegisterObjectDef(TemplClass *tmclass, ObjBase *refobj) {
CTemplClass_AppendTemplateAction(tmclass, action); CTemplClass_AppendTemplateAction(tmclass, action);
} }
void CTemplClass_CompleteClass(TemplClass *templ, DeclE *de) { void CTemplClass_CompleteClass(TemplClass *templ, ClassLayout *de) {
templ->lex_order_count = de->x8; templ->lex_order_count = de->lex_order_count;
if (de->xC) if (de->has_vtable)
templ->flags |= TEMPLCLASS_FLAGS_1; templ->flags |= TEMPLCLASS_HAS_VTABLE;
templ->theclass.flags |= CLASS_FLAGS_2; templ->theclass.flags |= CLASS_COMPLETED;
} }
static TemplClassInst *CTemplClass_NewInstance(TemplClass *templ, TemplArg *inst_args, TemplArg *oargs) { 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.type = TYPECLASS;
inst->theclass.flags = CLASS_FLAGS_800; inst->theclass.flags = CLASS_IS_TEMPL_INST;
inst->theclass.nspace = nspace; inst->theclass.nspace = nspace;
inst->theclass.classname = templ->theclass.classname; inst->theclass.classname = templ->theclass.classname;
inst->theclass.mode = templ->theclass.mode; inst->theclass.mode = templ->theclass.mode;
@ -285,8 +285,8 @@ static void CTemplClass_ParseBody(TemplClass *templ, short mode, SInt32 *offset)
memclrw(&di, sizeof(di)); memclrw(&di, sizeof(di));
di.file = CPrep_BrowserCurrentFile(); di.file = CPrep_BrowserCurrentFile();
CPrep_BrowserFilePosition(&di.file2, &di.x60); CPrep_BrowserFilePosition(&di.file2, &di.sourceoffset);
di.x60 = *offset; di.sourceoffset = *offset;
di.x28 = templ; di.x28 = templ;
CDecl_ParseClass(&di, mode, 1, 0); CDecl_ParseClass(&di, mode, 1, 0);
@ -296,7 +296,7 @@ static void CTemplClass_ParseBody(TemplClass *templ, short mode, SInt32 *offset)
if (tk != ';') if (tk != ';')
CError_Error(CErrorStr123); 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) { 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; templ->templ__params = params;
CDecl_DefineClass(nspace, TEMPL_CLASS(type)->theclass.classname, TYPE_CLASS(templ), mode, 0, 0); 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); templ->pspec_owner = TEMPL_CLASS(type);
pspec = galloc(sizeof(TemplPartialSpec)); pspec = galloc(sizeof(TemplPartialSpec));
@ -405,7 +405,7 @@ void CTemplClass_ParsePartialSpecialization(DeclFucker *what_is_this, TemplParam
pspec->next = TEMPL_CLASS(type)->pspecs; pspec->next = TEMPL_CLASS(type)->pspecs;
TEMPL_CLASS(type)->pspecs = pspec; TEMPL_CLASS(type)->pspecs = pspec;
} else { } 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); CError_Error(CErrorStr132, TEMPL_CLASS(type)->theclass.classname->name);
return; return;
} }
@ -451,11 +451,11 @@ void CTemplClass_ParseClass(DeclFucker *what_is_this, TemplParam *params, short
templ->templ__params = params; templ->templ__params = params;
CDecl_DefineClass(nspace, tkidentifier, TYPE_CLASS(templ), mode, 0, 1); 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; templ->theclass.eflags = classDeclSpec;
tk = lex(); tk = lex();
if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_100)) { if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL)) {
TemplateAction *action; TemplateAction *action;
templ->templ_parent = TEMPL_CLASS(nspace->theclass); templ->templ_parent = TEMPL_CLASS(nspace->theclass);
@ -484,7 +484,7 @@ void CTemplClass_ParseClass(DeclFucker *what_is_this, TemplParam *params, short
tk = lex(); tk = lex();
if ((templ->theclass.flags & CLASS_FLAGS_2) && tk != ';') { if ((templ->theclass.flags & CLASS_COMPLETED) && tk != ';') {
CError_Error(CErrorStr132, templ->theclass.classname->name); CError_Error(CErrorStr132, templ->theclass.classname->name);
return; return;
} }
@ -793,7 +793,7 @@ TemplClass *CTemplClass_DefineNestedClass(TemplClass *parent, HashNameNode *name
templ->templ__params = NULL; templ->templ__params = NULL;
CDecl_DefineClass(parent->theclass.nspace, name, TYPE_CLASS(templ), mode, 0, 1); 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; templ->align = copts.structalignment;
action = galloc(sizeof(TemplateAction)); 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)); 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)); 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 ( if (
(TYPE_FUNC(dest->type)->flags & FUNC_FLAGS_1000) && (TYPE_FUNC(dest->type)->flags & FUNC_IS_CTOR) &&
deduce->x17 && deduce->x17 &&
!action !action
) )
@ -1211,11 +1211,11 @@ static void CTemplClass_CopyObject(TypeDeduce *deduce, Object *src) {
if (flag) if (flag)
dest->object.nspace = deduce->inst->theclass.nspace; dest->object.nspace = deduce->inst->theclass.nspace;
dest->object.qual |= Q_400000; dest->object.qual |= Q_IS_TEMPLATED;
dest->parent = src; dest->parent = src;
if (IS_TYPE_FUNC(dest->object.type)) 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) { switch (dest->object.datatype) {
case DDATA: 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); CError_ASSERT(1651, !dest->object.u.func.u.templ && !dest->object.u.func.defargdata);
if ( if (
(TYPE_FUNC(dest->object.type)->flags & FUNC_FLAGS_1000) && (TYPE_FUNC(dest->object.type)->flags & FUNC_IS_CTOR) &&
deduce->x17 && deduce->x17 &&
!action !action
) )
@ -1251,7 +1251,7 @@ static void CTemplClass_CopyObject(TypeDeduce *deduce, Object *src) {
TYPE_FUNC(dest->object.type)->args->next = arg; 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)); CError_ASSERT(1665, IS_TYPE_FUNC(src->type));
if (CTemplTool_IsTemplateArgumentDependentType(TYPE_FUNC(src->type)->functype)) { if (CTemplTool_IsTemplateArgumentDependentType(TYPE_FUNC(src->type)->functype)) {
CError_ASSERT(1668, action); CError_ASSERT(1668, action);
@ -1319,19 +1319,19 @@ static void CTemplClass_CompleteObject(TypeDeduce *deduce, TemplateAction *actio
deduce->x15 = 0; deduce->x15 = 0;
CError_ASSERT(1753, IS_TYPE_FUNC(dest->type)); 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 { } else {
dest->type = CTemplTool_DeduceTypeCopy(deduce, dest->type, &dest->qual); dest->type = CTemplTool_DeduceTypeCopy(deduce, dest->type, &dest->qual);
dest->qual |= Q_400000; dest->qual |= Q_IS_TEMPLATED;
if (IS_TYPE_FUNC(dest->type)) if (IS_TYPE_FUNC(dest->type))
TYPE_FUNC(dest->type)->flags &= ~FUNC_FLAGS_2; TYPE_FUNC(dest->type)->flags &= ~FUNC_DEFINED;
switch (dest->datatype) { switch (dest->datatype) {
case DFUNC: case DFUNC:
case DVFUNC: case DVFUNC:
CError_ASSERT(1769, IS_TYPE_FUNC(dest->type)); 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)); CError_ASSERT(1772, IS_TYPE_FUNC(dest->type));
if (CTemplTool_IsTemplateArgumentDependentType(TYPE_FUNC(src->type)->functype)) { if (CTemplTool_IsTemplateArgumentDependentType(TYPE_FUNC(src->type)->functype)) {
dest->name = CMangler_ConversionFuncName( 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; FuncArg *arg;
CError_ASSERT(1786, TYPE_FUNC(dest->type)->args); CError_ASSERT(1786, TYPE_FUNC(dest->type)->args);
arg = CParser_NewFuncArg(); 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)) { 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->u.data.u.intconst = expr->data.intval;
object->qual |= Q_10000 | Q_20000; object->qual |= Q_INLINE_DATA | Q_20000;
} else { } else {
CError_Error(CErrorStr354, object->name->name); CError_Error(CErrorStr354, object->name->name);
} }
@ -1473,14 +1473,14 @@ Boolean CTempl_InstantiateTemplateClass(TypeClass *tclass) {
TypeDeduce deduce; TypeDeduce deduce;
TemplStack stack; TemplStack stack;
CScopeSave saveScope; CScopeSave saveScope;
DeclE declE; ClassLayout layout;
TemplClass *templ; TemplClass *templ;
TStreamElement *saveErrorRef; TStreamElement *saveErrorRef;
TemplArg *inst_args; 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; return 1;
inst = TEMPL_CLASS_INST(tclass); inst = TEMPL_CLASS_INST(tclass);
@ -1498,7 +1498,7 @@ Boolean CTempl_InstantiateTemplateClass(TypeClass *tclass) {
inst->inst_args = inst_args; inst->inst_args = inst_args;
} }
if (!(templ->theclass.flags & CLASS_FLAGS_2)) if (!(templ->theclass.flags & CLASS_COMPLETED))
return 0; return 0;
if (inst->is_instantiated) if (inst->is_instantiated)
@ -1522,11 +1522,11 @@ Boolean CTempl_InstantiateTemplateClass(TypeClass *tclass) {
CError_ASSERT(2049, !templ->theclass.vtable); CError_ASSERT(2049, !templ->theclass.vtable);
inst->theclass.flags |= templ->theclass.flags & 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); 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) { for (action = templ->actions; action; action = action->next) {
switch (action->type) { switch (action->type) {
@ -1610,13 +1610,13 @@ Boolean CTempl_InstantiateTemplateClass(TypeClass *tclass) {
} }
} }
memclrw(&declE, sizeof(declE)); memclrw(&layout, sizeof(layout));
declE.x8 = templ->lex_order_count; layout.lex_order_count = templ->lex_order_count;
declE.xC = templ->flags & TEMPLCLASS_FLAGS_1; layout.has_vtable = templ->flags & TEMPLCLASS_HAS_VTABLE;
saveAlignMode = copts.structalignment; saveAlignMode = copts.structalignment;
copts.structalignment = templ->align; copts.structalignment = templ->align;
CDecl_CompleteClass(&declE, TYPE_CLASS(inst)); CDecl_CompleteClass(&layout, TYPE_CLASS(inst));
copts.structalignment = saveAlignMode; copts.structalignment = saveAlignMode;
if (templ->theclass.align > inst->theclass.align) { if (templ->theclass.align > inst->theclass.align) {

View File

@ -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) { static void CTemplFunc_SetupTypeDeduce(TypeDeduce *deduce, TemplateFunction *templ, TemplArg *args) {
memclrw(deduce, sizeof(TypeDeduce)); 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->tmclass = TEMPL_CLASS(templ->tfunc->nspace->theclass);
deduce->params = templ->params; deduce->params = templ->params;
deduce->args = args; deduce->args = args;
@ -110,12 +110,12 @@ static TemplFuncInstance *CTempl_GetCreateFuncInstance(Object *funcobj, TemplArg
instobj->access = funcobj->access; instobj->access = funcobj->access;
instobj->nspace = funcobj->nspace; instobj->nspace = funcobj->nspace;
instobj->sclass = funcobj->sclass; instobj->sclass = funcobj->sclass;
instobj->qual = funcobj->qual | Q_80000; instobj->qual = funcobj->qual | Q_MANGLE_NAME;
instobj->name = templ->name; instobj->name = templ->name;
instobj->u.func.inst = inst; instobj->u.func.inst = inst;
CTemplFunc_SetupTypeDeduce(&deduce, templ, inst->args); 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.tmclass = TEMPL_CLASS_INST(funcobj->nspace->theclass)->templ;
deduce.inst = TEMPL_CLASS_INST(funcobj->nspace->theclass); deduce.inst = TEMPL_CLASS_INST(funcobj->nspace->theclass);
} }
@ -124,13 +124,13 @@ static TemplFuncInstance *CTempl_GetCreateFuncInstance(Object *funcobj, TemplArg
inst->object = instobj; inst->object = instobj;
if (IS_TYPE_FUNC(instobj->type)) { if (IS_TYPE_FUNC(instobj->type)) {
TYPE_FUNC(instobj->type)->flags &= ~FUNC_FLAGS_2; TYPE_FUNC(instobj->type)->flags &= ~FUNC_DEFINED;
if (TYPE_FUNC(instobj->type)->flags & FUNC_FLAGS_1000) { if (TYPE_FUNC(instobj->type)->flags & FUNC_IS_CTOR) {
FuncArg *funcarg; 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); 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); CError_ASSERT(156, funcarg = funcarg->next);
if (funcarg->next) if (funcarg->next)
@ -1268,7 +1268,7 @@ static int CTemplFunc_TemplateNestLevel(NameSpace *nspace) {
int level = 0; int level = 0;
while (nspace) { while (nspace) {
if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_900)) if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL_ANY))
level++; level++;
nspace = nspace->parent; nspace = nspace->parent;
} }
@ -1288,17 +1288,17 @@ static Boolean CTemplFunc_SameFuncType(TypeFunc *a, TypeFunc *b) {
if (a->qual != b->qual) if (a->qual != b->qual)
return 0; 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; return 0;
arg1 = a->args; 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); CError_ASSERT(1808, arg1);
arg1 = arg1->next; arg1 = arg1->next;
} }
arg2 = b->args; 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); CError_ASSERT(1814, arg2);
arg2 = arg2->next; arg2 = arg2->next;
} }

View File

@ -278,12 +278,12 @@ static ENode *CTempl_ParseTemplArgExpr(Type *type, UInt32 qual) {
} }
static Type *CTempl_ParseTemplArgTempl(TemplParam *params) { static Type *CTempl_ParseTemplArgTempl(TemplParam *params) {
CScopeParseResult pr; NameResult pr;
if ( if (
(tk != TK_IDENTIFIER && tk != TK_COLON_COLON) || (tk != TK_IDENTIFIER && tk != TK_COLON_COLON) ||
!CScope_ParseDeclName(&pr) || !CScope_ParseDeclName(&pr) ||
!pr.x8 !pr.type
) )
{ {
CError_Error(CErrorStr121); CError_Error(CErrorStr121);
@ -291,26 +291,26 @@ static Type *CTempl_ParseTemplArgTempl(TemplParam *params) {
return NULL; return NULL;
} }
if (IS_TEMPL_CLASS(pr.x8)) { if (IS_TEMPL_CLASS(pr.type)) {
if (params && !CTemplTool_EqualParams(params->data.templparam.plist, TEMPL_CLASS(pr.x8)->templ__params, 0)) { if (params && !CTemplTool_EqualParams(params->data.templparam.plist, TEMPL_CLASS(pr.type)->templ__params, 0)) {
CError_Error(CErrorStr235); CError_Error(CErrorStr235);
tk = lex(); tk = lex();
return NULL; return NULL;
} }
} else { } else {
if (!CTemplTool_IsTemplateArgumentDependentType(pr.x8)) if (!CTemplTool_IsTemplateArgumentDependentType(pr.type))
CError_Error(CErrorStr146); CError_Error(CErrorStr146);
} }
tk = lex(); tk = lex();
return pr.x8; return pr.type;
} }
static UInt8 CTempl_GetTemplateNestIndex(NameSpace *nspace) { static UInt8 CTempl_GetTemplateNestIndex(NameSpace *nspace) {
UInt8 count = 0; UInt8 count = 0;
while (nspace) { while (nspace) {
if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_900)) if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL_ANY))
count++; count++;
nspace = nspace->parent; 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) { static void *CTempl_ParseMemberFunction(int unk1, int unk2, int unk3, Object *func) {
// no idea what should've been here, it's not called // 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; return NULL;
} }
@ -792,7 +792,7 @@ static void CTempl_ParseMember(TemplParam *params, TemplClass *templ, DeclInfo *
Boolean saveForceLoc; Boolean saveForceLoc;
TemplateMember *member; 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); di->thetype = CTemplTool_ResolveMemberSelfRefs(templ, di->thetype, &di->qual);
if (IS_TYPE_FUNC(di->thetype)) { if (IS_TYPE_FUNC(di->thetype)) {
@ -811,12 +811,12 @@ static void CTempl_ParseMember(TemplParam *params, TemplClass *templ, DeclInfo *
} }
if ( if (
(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_2) && (TYPE_FUNC(object->type)->flags & FUNC_DEFINED) &&
(!(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100000) || object->u.func.u.templ->instances) (!(TYPE_FUNC(object->type)->flags & FUNC_IS_TEMPL) || object->u.func.u.templ->instances)
) )
CError_Error(CErrorStr333, object); 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); CPrep_StreamGetBlock(&stream, NULL, 1);
saveForceLoc = gForceSourceLoc; saveForceLoc = gForceSourceLoc;
@ -859,7 +859,7 @@ static void CTempl_ParseMember(TemplParam *params, TemplClass *templ, DeclInfo *
object->u.func.u.templ->stream = stream; object->u.func.u.templ->stream = stream;
} else { } else {
if (!(templ->theclass.flags & CLASS_FLAGS_100)) { if (!(templ->theclass.flags & CLASS_IS_TEMPL)) {
CError_Error(CErrorStr190); CError_Error(CErrorStr190);
return; return;
} }
@ -903,9 +903,9 @@ static TemplateFunction *CTempl_DeclareTemplateFunction(DeclInfo *di, TemplParam
object->name = di->name; object->name = di->name;
object->u.func.linkname = CParser_GetUniqueName(); object->u.func.linkname = CParser_GetUniqueName();
object->type = di->thetype; object->type = di->thetype;
object->qual = di->qual | Q_80000; object->qual = di->qual | Q_MANGLE_NAME;
object->sclass = di->storageclass; 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; object->u.func.u.templ = templ;
if (di->qual & Q_INLINE) if (di->qual & Q_INLINE)
@ -931,10 +931,10 @@ static void CTempl_ParseTemplateFunction(TemplateFunction *templ, TypeClass *tcl
object->sclass = TK_STATIC; 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); 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); CPrep_StreamGetBlock(&templ->stream, NULL, 0);
@ -972,7 +972,7 @@ static HashNameNode *CTempl_FindConversionFuncName(TypeClass *tclass, Type *type
return NULL; return NULL;
} while ( } while (
!IS_TYPE_FUNC(object->type) || !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)) || (TYPE_FUNC(object->type)->qual & (Q_CONST | Q_VOLATILE)) != (qual & (Q_CONST | Q_VOLATILE)) ||
!is_typesame(TYPE_FUNC(object->type)->functype, type) !is_typesame(TYPE_FUNC(object->type)->functype, type)
); );
@ -987,7 +987,7 @@ static void CTempl_ParseConversionFunctionTemplate(DeclInfo *di, DeclFucker *wha
return; return;
} }
tclass->flags = tclass->flags | CLASS_FLAGS_40; tclass->flags = tclass->flags | CLASS_IS_CONVERTIBLE;
CError_QualifierCheck(di->qual & ~Q_INLINE); CError_QualifierCheck(di->qual & ~Q_INLINE);
conversion_type_name(di); 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)); CError_ASSERT(1344, IS_TYPE_FUNC(di.x10->type));
tfunc = 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.thetype = tfunc->functype;
di.qual |= tfunc->qual; di.qual |= tfunc->qual;
di.nspace = di.x10->nspace; di.nspace = di.x10->nspace;
di.name = di.x10->name; 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.thetype = TYPE(&void_ptr);
di.nspace = di.x10->nspace; di.nspace = di.x10->nspace;
di.name = di.x10->name; 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) { if (tk == TK_OPERATOR && di.x4A) {
CTempl_ParseConversionFunctionTemplate(&di, what_is_this, params, tclass, startOffset, access); 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; 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)); 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; di.name = constructor_name_node;
what_is_this->nspace->tparams = NULL; 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)) { if (IS_TYPE_FUNC(di.thetype)) {
di.name = constructor_name_node; 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)); 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); CTempl_ParseMember(params, TEMPL_CLASS(tclass2), &di, startOffset);
} else { } else {
CError_Error(CErrorStr241); CError_Error(CErrorStr241);
@ -1228,7 +1228,7 @@ static void CTempl_ParseFunctionOrMemberTemplate(DeclFucker *what_is_this, Templ
CDecl_AddArgument(TYPE_FUNC(di.thetype), TYPE(&stsignedshort)); CDecl_AddArgument(TYPE_FUNC(di.thetype), TYPE(&stsignedshort));
di.name = destructor_name_node; 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); CTempl_ParseMember(params, TEMPL_CLASS(tclass2), &di, startOffset);
} else { } else {
CError_Error(CErrorStr241); CError_Error(CErrorStr241);
@ -1360,7 +1360,7 @@ static void CTempl_ExplicitInstantiation(void) {
if (tk == ';') { if (tk == ';') {
if (IS_TEMPL_CLASS_INST(di.thetype)) { if (IS_TEMPL_CLASS_INST(di.thetype)) {
CTempl_InstantiateTemplateClass(TYPE_CLASS(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) if (flag)
CTempl_GenClassInstance(TEMPL_CLASS_INST(di.thetype), 1); CTempl_GenClassInstance(TEMPL_CLASS_INST(di.thetype), 1);
else else
@ -1525,13 +1525,13 @@ void CTempl_Parse(TemplClass *templ, AccessType access) {
switch (tk) { switch (tk) {
case TK_CLASS: case TK_CLASS:
mode = CLASS_MODE_2; mode = CLASS_MODE_CLASS;
break; break;
case TK_UNION: case TK_UNION:
mode = CLASS_MODE_1; mode = CLASS_MODE_UNION;
break; break;
case TK_STRUCT: case TK_STRUCT:
mode = CLASS_MODE_0; mode = CLASS_MODE_STRUCT;
break; break;
default: default:
mode = -1; mode = -1;
@ -1587,7 +1587,7 @@ void CTempl_ParseInstanceScopeFunction(Object *funcobj, TemplClassInst *inst, Ty
TemplStack stack; TemplStack stack;
params = inst->templ->templ__params; 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) { for (member = CTemplClass_GetMasterTemplate(inst->templ)->members, parent = OBJECT_TEMPL(funcobj)->parent; member; member = member->next) {
if (member->object == parent) { if (member->object == parent) {
if (member->params) if (member->params)
@ -1656,12 +1656,12 @@ Boolean CTempl_GenFuncInstance(TemplateFunction *templ, TemplFuncInstance *inst,
} }
if (inst->object->sclass != TK_STATIC) if (inst->object->sclass != TK_STATIC)
inst->object->qual |= Q_OVERLOAD; inst->object->qual |= Q_WEAK;
memclrw(&di, sizeof(di)); memclrw(&di, sizeof(di));
di.file2 = templ->srcfile; di.file2 = templ->srcfile;
di.file = CPrep_BrowserCurrentFile(); di.file = CPrep_BrowserCurrentFile();
di.x60 = templ->startoffset; di.sourceoffset = templ->startoffset;
CTemplTool_PushInstance(&stack, NULL, inst->object); CTemplTool_PushInstance(&stack, NULL, inst->object);
CTemplTool_MergeArgNames(TYPE_FUNC(templ->tfunc->type), TYPE_FUNC(inst->object->type)); 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; copts.filesyminfo = saveDebugInfo;
if (di.file->recordbrowseinfo) 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; return 1;
} }
@ -1719,12 +1719,12 @@ void CTempl_InstantiateMember(TemplClass *templ, TemplClassInst *inst, TemplateM
} }
if (object->sclass != TK_STATIC) if (object->sclass != TK_STATIC)
object->qual |= Q_OVERLOAD; object->qual |= Q_WEAK;
memclrw(&di, sizeof(di)); memclrw(&di, sizeof(di));
di.file2 = tmemb->srcfile; di.file2 = tmemb->srcfile;
di.file = CPrep_BrowserCurrentFile(); di.file = CPrep_BrowserCurrentFile();
di.x60 = tmemb->startoffset; di.sourceoffset = tmemb->startoffset;
switch (object->datatype) { switch (object->datatype) {
case DFUNC: case DFUNC:
@ -1782,24 +1782,24 @@ static Boolean CTempl_GenClassInstance(TemplClassInst *inst, Boolean flag) {
if (IS_TYPE_FUNC(object->type) && object->datatype != DALIAS) { if (IS_TYPE_FUNC(object->type) && object->datatype != DALIAS) {
if ( if (
(flag || (object->flags & OBJECT_FLAGS_2)) && (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) && CTempl_GenMemberInstance(inst, OBJECT_TEMPL(object), flag) &&
(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_2) (TYPE_FUNC(object->type)->flags & FUNC_DEFINED)
) )
result = 1; result = 1;
} else { } else {
if ( if (
!inst->x49 && !inst->static_instantiated &&
object->datatype == DDATA && object->datatype == DDATA &&
!(object->qual & Q_10000) && !(object->qual & Q_INLINE_DATA) &&
!(object->flags & OBJECT_FLAGS_4) && !(object->flags & OBJECT_DEFINED) &&
CTempl_GenMemberInstance(inst, OBJECT_TEMPL(object), flag) CTempl_GenMemberInstance(inst, OBJECT_TEMPL(object), flag)
) )
result = 1; result = 1;
} }
} }
inst->x49 = 1; inst->static_instantiated = 1;
return result; return result;
} }
@ -1814,7 +1814,7 @@ Boolean CTempl_Instantiate(void) {
for (templ = ctempl_templates; templ; templ = templ->next) { for (templ = ctempl_templates; templ; templ = templ->next) {
for (inst = templ->instances; inst; inst = inst->next) { for (inst = templ->instances; inst; inst = inst->next) {
if ( if (
(inst->theclass.flags & CLASS_FLAGS_800) && (inst->theclass.flags & CLASS_IS_TEMPL_INST) &&
!inst->is_specialized && !inst->is_specialized &&
CTempl_GenClassInstance(inst, 0) CTempl_GenClassInstance(inst, 0)
) )
@ -1824,7 +1824,7 @@ Boolean CTempl_Instantiate(void) {
for (pspec = templ->pspecs; pspec; pspec = pspec->next) { for (pspec = templ->pspecs; pspec; pspec = pspec->next) {
for (inst = pspec->templ->instances; inst; inst = inst->next) { for (inst = pspec->templ->instances; inst; inst = inst->next) {
if ( if (
(inst->theclass.flags & CLASS_FLAGS_800) && (inst->theclass.flags & CLASS_IS_TEMPL_INST) &&
!inst->is_specialized && !inst->is_specialized &&
CTempl_GenClassInstance(inst, 0) CTempl_GenClassInstance(inst, 0)
) )
@ -1839,7 +1839,7 @@ Boolean CTempl_Instantiate(void) {
!instf->is_instantiated && !instf->is_instantiated &&
!instf->is_specialized && !instf->is_specialized &&
(instf->object->flags & OBJECT_FLAGS_2) && (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; instf->is_instantiated = 1;
@ -1857,9 +1857,9 @@ Boolean CTempl_InlineFunctionCheck(Object *funcobj) {
TemplateMember *member; TemplateMember *member;
Object *parent; 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); inst = TEMPL_CLASS_INST(TYPE_METHOD(funcobj->type)->theclass);
if (!inst->is_specialized) { if (!inst->is_specialized) {
parent = OBJECT_TEMPL(funcobj)->parent; parent = OBJECT_TEMPL(funcobj)->parent;

View File

@ -376,7 +376,7 @@ static FuncArg *CTemplTool_GetFirstRealArg(TypeFunc *tfunc) {
if (IS_TYPEFUNC_NONSTATIC_METHOD(tfunc)) { if (IS_TYPEFUNC_NONSTATIC_METHOD(tfunc)) {
CError_ASSERT(502, arg); CError_ASSERT(502, arg);
arg = arg->next; 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); CError_ASSERT(507, arg);
arg = arg->next; arg = arg->next;
} }
@ -543,7 +543,7 @@ void CTemplTool_SetupOuterTemplateArgumentNameSpace(NameSpace *nspace) {
NameSpace *newns; NameSpace *newns;
while (nspace) { while (nspace) {
if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_800)) { if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL_INST)) {
newns = CTemplTool_SetupTemplateArgumentNameSpace( newns = CTemplTool_SetupTemplateArgumentNameSpace(
TEMPL_CLASS_INST(nspace->theclass)->templ->templ__params, TEMPL_CLASS_INST(nspace->theclass)->templ->templ__params,
TEMPL_CLASS_INST(nspace->theclass)->inst_args, TEMPL_CLASS_INST(nspace->theclass)->inst_args,
@ -570,7 +570,7 @@ NameSpace *CTemplTool_InsertTemplateArgumentNameSpace(TemplParam *params, TemplC
void CTemplTool_RemoveOuterTemplateArgumentNameSpace(NameSpace *nspace) { void CTemplTool_RemoveOuterTemplateArgumentNameSpace(NameSpace *nspace) {
while (nspace->parent) { 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->parent = nspace->parent->parent;
nspace = nspace->parent; nspace = nspace->parent;
} }
@ -595,7 +595,7 @@ Boolean CTemplTool_IsTemplateArgumentDependentType(Type *type) {
case TYPESTRUCT: case TYPESTRUCT:
return 0; return 0;
case TYPECLASS: case TYPECLASS:
return (TYPE_CLASS(type)->flags & CLASS_FLAGS_100) ? 1 : 0; return (TYPE_CLASS(type)->flags & CLASS_IS_TEMPL) ? 1 : 0;
case TYPEMEMBERPOINTER: case TYPEMEMBERPOINTER:
if (CTemplTool_IsTemplateArgumentDependentType(TYPE_MEMBER_POINTER(type)->ty1)) if (CTemplTool_IsTemplateArgumentDependentType(TYPE_MEMBER_POINTER(type)->ty1))
return 1; return 1;
@ -1004,7 +1004,7 @@ static TemplClassInst *CTemplTool_FindNestedClassInstance(TemplClass *a, TemplCl
if (i < 0) if (i < 0)
break; 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)); CTempl_InstantiateTemplateClass(TYPE_CLASS(inst));
} }
@ -1067,7 +1067,7 @@ static Type *CTemplTool_FindTemplateInstance(TypeDeduce *deduce, TemplClass *tem
if (dtempl->flags & TEMPLCLASS_FLAGS_2) { if (dtempl->flags & TEMPLCLASS_FLAGS_2) {
scantempl = TEMPL_CLASS(dtempl->theclass.nspace->theclass); 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; scaninst = dinst;
while (1) { while (1) {
@ -1127,7 +1127,7 @@ ENode *CTemplTool_DeduceExpr(TypeDeduce *deduce, ENode *expr) {
ENode *newExpr; ENode *newExpr;
NameSpaceObjectList *nsObjectList; NameSpaceObjectList *nsObjectList;
TStreamElement *saved; TStreamElement *saved;
CScopeParseResult pr; NameResult pr;
Type *type; Type *type;
UInt32 qual; UInt32 qual;
@ -1310,7 +1310,7 @@ ENode *CTemplTool_DeduceDefaultArg(Object *func, ENode *expr) {
if (func->u.func.inst) if (func->u.func.inst)
deduce.args = func->u.func.inst->args; 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.inst = TEMPL_CLASS_INST(TYPE_METHOD(func->type)->theclass);
deduce.tmclass = TEMPL_CLASS_INST(TYPE_METHOD(func->type)->theclass)->templ; 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->type = TYPEBITFIELD;
tbitfield->size = type->size; tbitfield->size = type->size;
tbitfield->bitfieldtype = type; tbitfield->bitfieldtype = type;
tbitfield->unkB = sizeval; tbitfield->bitlength = sizeval;
return TYPE(tbitfield); return TYPE(tbitfield);
} }
@ -1817,7 +1817,7 @@ Type *CTemplTool_DeduceTypeCopy(TypeDeduce *deduce, Type *type, UInt32 *resultQu
case TYPEENUM: case TYPEENUM:
if ( if (
TYPE_ENUM(type)->nspace->theclass && 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 !deduce->x14
) )
{ {
@ -1834,10 +1834,10 @@ Type *CTemplTool_DeduceTypeCopy(TypeDeduce *deduce, Type *type, UInt32 *resultQu
case TYPECLASS: case TYPECLASS:
if (!deduce->x14) { 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)); 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(2492, deduce->inst);
CError_ASSERT(2493, TYPE_CLASS(type)->classname); CError_ASSERT(2493, TYPE_CLASS(type)->classname);
@ -1904,11 +1904,11 @@ Type *CTemplTool_DeduceTypeCopy(TypeDeduce *deduce, Type *type, UInt32 *resultQu
return deduced; return deduced;
case TYPEFUNC: case TYPEFUNC:
if (TYPE_FUNC(type)->flags & FUNC_FLAGS_METHOD) { if (TYPE_FUNC(type)->flags & FUNC_METHOD) {
qual2 = 0; qual2 = 0;
deduced = galloc(sizeof(TypeMemberFunc)); deduced = galloc(sizeof(TypeMemberFunc));
*TYPE_METHOD(deduced) = *TYPE_METHOD(type); *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)); 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)); CError_ASSERT(2556, IS_TYPE_CLASS(TYPE_METHOD(deduced)->theclass));
} else { } else {
@ -1916,7 +1916,7 @@ Type *CTemplTool_DeduceTypeCopy(TypeDeduce *deduce, Type *type, UInt32 *resultQu
*TYPE_FUNC(deduced) = *TYPE_FUNC(type); *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; qual2 = TYPE_FUNC(type)->qual;
TYPE_FUNC(deduced)->functype = CTemplTool_DeduceTypeQualCopy(deduce, TYPE_FUNC(type)->functype, &qual2); TYPE_FUNC(deduced)->functype = CTemplTool_DeduceTypeQualCopy(deduce, TYPE_FUNC(type)->functype, &qual2);

View File

@ -85,7 +85,7 @@ void assign_local_addresses(void) {
for (list = locals; list; list = list->next) { for (list = locals; list; list = list->next) {
vi = CodeGen_GetNewVarInfo(); vi = CodeGen_GetNewVarInfo();
list->object->u.var.info = vi; list->object->u.var.info = vi;
list->object->flags |= OBJECT_FLAGS_1; list->object->flags |= OBJECT_USED;
vi->used = 1; vi->used = 1;
} }
@ -241,7 +241,7 @@ void Assembler(Object *func) {
cprep_eoltokens = 0; cprep_eoltokens = 0;
name = CMangler_GetLinkName(func)->name; name = CMangler_GetLinkName(func)->name;
func->flags |= OBJECT_FLAGS_4; func->flags |= OBJECT_DEFINED;
if (fralloc_parameter_area_size) if (fralloc_parameter_area_size)
update_out_param_size(fralloc_parameter_area_size); update_out_param_size(fralloc_parameter_area_size);

View File

@ -480,7 +480,7 @@ static Boolean needs_TOC_reload(Object *func) {
} }
static void load_virtual_function(TypeClass *tclass, SInt32 offset, int reg, Operand *opnd) { 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, reg, NULL, 0);
load_store_register(PC_LWZ, 12, 12, NULL, tclass->vtable->offset); load_store_register(PC_LWZ, 12, 12, NULL, tclass->vtable->offset);
} else { } else {

View File

@ -417,8 +417,8 @@ static void local_struct_add(StabType *list) {
StabAppendType(TYPE_BITFIELD(type)->bitfieldtype); StabAppendType(TYPE_BITFIELD(type)->bitfieldtype);
sprintf(buf, sprintf(buf,
",%d,%d;", ",%d,%d;",
TYPE_BITFIELD(type)->unkA + member->offset * 8, TYPE_BITFIELD(type)->offset + member->offset * 8,
TYPE_BITFIELD(type)->unkB); TYPE_BITFIELD(type)->bitlength);
AppendGListName(&stab_string, buf); AppendGListName(&stab_string, buf);
} else { } else {
StabAppendType(type); StabAppendType(type);
@ -508,7 +508,7 @@ static void local_class_add(StabClass *list) {
list->id2 = list->id; list->id2 = list->id;
if (TYPE_CLASS(type)->flags & CLASS_FLAGS_1) { if (TYPE_CLASS(type)->flags & CLASS_HANDLEOBJECT) {
AppendGListName(&stab_string, "*"); AppendGListName(&stab_string, "*");
StabAppendNextTypeDefinition(); StabAppendNextTypeDefinition();
} }
@ -574,8 +574,8 @@ static void local_class_add(StabClass *list) {
if (IS_TYPE_BITFIELD(ivarType)) { if (IS_TYPE_BITFIELD(ivarType)) {
StabAppendType(TYPE_BITFIELD(ivarType)->bitfieldtype); StabAppendType(TYPE_BITFIELD(ivarType)->bitfieldtype);
sprintf(buf, ",%d,%d;", sprintf(buf, ",%d,%d;",
TYPE_BITFIELD(ivarType)->unkA + ivar->offset * 8, TYPE_BITFIELD(ivarType)->offset + ivar->offset * 8,
TYPE_BITFIELD(ivarType)->unkB); TYPE_BITFIELD(ivarType)->bitlength);
AppendGListName(&stab_string, buf); AppendGListName(&stab_string, buf);
} else { } else {
StabAppendType(ivarType); StabAppendType(ivarType);
@ -1106,7 +1106,7 @@ void GenStab_Var(Object *object) {
StabAppendType(object->type); StabAppendType(object->type);
output_stab_string(Output_LSYM_Stab, 0, local_offset_32(object)); 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"); AppendGListName(&stab_string, ":S");
StabAppendType(object->type); StabAppendType(object->type);
output_stab_string(Output_STSYM_Stab, 0, CMangler_GetLinkName(object)->id); output_stab_string(Output_STSYM_Stab, 0, CMangler_GetLinkName(object)->id);

View File

@ -103,7 +103,7 @@ Boolean InlineAsm_LookupSymbolOrTag(HashNameNode *name, IALookupResult *result,
result->has_value = 1; result->has_value = 1;
result->value = OBJECT(obj)->u.address; result->value = OBJECT(obj)->u.address;
} else { } 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)); CInit_ExportConst(OBJECT(obj));
result->object = OBJECT(obj); result->object = OBJECT(obj);
} }

View File

@ -630,7 +630,7 @@ static void memoryoperand(IAOperand *op, InlineAsm *ia, Boolean flag, short effe
CError_Error(CErrorStr155); CError_Error(CErrorStr155);
} }
expr.object->flags |= OBJECT_FLAGS_1; expr.object->flags |= OBJECT_USED;
return; 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.obj = expr.xC;
op[0].u.obj.offset = expr.value; op[0].u.obj.offset = expr.value;
expr.xC->flags |= OBJECT_FLAGS_1; expr.xC->flags |= OBJECT_USED;
return; return;
} }
@ -732,7 +732,7 @@ static void registeroperand(IAOperand *op, char rclass, short effect) {
op->u.reg.num = num; op->u.reg.num = num;
op->u.reg.effect = effect; op->u.reg.effect = effect;
if (obj) { if (obj) {
reg->object->flags |= OBJECT_FLAGS_1; reg->object->flags |= OBJECT_USED;
Registers_GetVarInfo(obj)->flags |= VarInfoFlag40; Registers_GetVarInfo(obj)->flags |= VarInfoFlag40;
} }
} else if (rclass == RegClass_CRFIELD) { } 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); 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) { switch (ia->opcode) {
case PC_ADDI: case PC_ADDI:
case PC_ADDIC: case PC_ADDIC:
@ -1574,10 +1574,10 @@ static IAEntryPoint *InlineAsm_CreateEntryPoint(HashNameNode *name, Boolean flag
IALookupResult result; IALookupResult result;
if (InlineAsm_LookupSymbol(name, &result) && (obj = result.object)) { 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); CError_Error(CErrorStr122, name->name);
obj->flags |= OBJECT_FLAGS_4; obj->flags |= OBJECT_DEFINED;
obj->sclass = flag ? TK_STATIC : TK_EXTERN; obj->sclass = flag ? TK_STATIC : TK_EXTERN;
ep = lalloc(sizeof(IAEntryPoint)); ep = lalloc(sizeof(IAEntryPoint));

View File

@ -2246,7 +2246,7 @@ int is_intrinsic_function_call(ENode *funccall) {
return return
ENODE_IS(funcref, EOBJREF) && ENODE_IS(funcref, EOBJREF) &&
funcref->data.objref->datatype == DFUNC && 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) { static void abs_intrinsic(ENode *expr, short outputReg, Operand *output) {
@ -4552,7 +4552,7 @@ void Intrinsics_SetupRuntimeObjects(void) {
for (i = 0; i < MaxIntrinsics; i++) { for (i = 0; i < MaxIntrinsics; i++) {
CError_ASSERT(6600, intrinsics[i]); CError_ASSERT(6600, intrinsics[i]);
intrinsics[i]->u.func.u.intrinsicid = 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]); CScope_AddGlobalObject(intrinsics[i]);
} }

View File

@ -629,7 +629,7 @@ void IRO_SpellType(Type *type, char *buf) {
break; break;
case TYPEBITFIELD: case TYPEBITFIELD:
IRO_SpellType(TYPE_BITFIELD(type)->bitfieldtype, mybuf); 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; break;
case TYPELABEL: case TYPELABEL:
strcpy(buf, "label"); strcpy(buf, "label");

View File

@ -133,7 +133,7 @@ void IRO_TruncateBitfieldValueToType(CInt64 *val, Type *type, Type *type2) {
CInt64 work; CInt64 work;
work = cint64_zero; work = cint64_zero;
limit = TYPE_BITFIELD(type2)->unkB; limit = TYPE_BITFIELD(type2)->bitlength;
for (i = 0; i < limit; i++) for (i = 0; i < limit; i++)
work = CInt64_Or(work, CInt64_Shl(cint64_one, IRO_MakeULong(i))); work = CInt64_Or(work, CInt64_Shl(cint64_one, IRO_MakeULong(i)));
*val = CInt64_And(*val, work); *val = CInt64_And(*val, work);

View File

@ -655,7 +655,7 @@ static void DoTransformations11(IROLinear *nd) {
left->u.monadic->u.monadic->nodetype == EBITFIELD && left->u.monadic->u.monadic->nodetype == EBITFIELD &&
IS_TYPE_BITFIELD(left->u.monadic->u.monadic->rtype) 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 else
tmp2 = type->size * 8; tmp2 = type->size * 8;
} else { } else {

View File

@ -123,9 +123,9 @@ Boolean IRO_TypesEqual(Type *a, Type *b) {
if (IS_TYPE_BITFIELD(a)) { if (IS_TYPE_BITFIELD(a)) {
if (IS_TYPE_BITFIELD(b)) { if (IS_TYPE_BITFIELD(b)) {
if ( if (
(TYPE_BITFIELD(a)->bitfieldtype == TYPE_BITFIELD(b)->bitfieldtype) && (TYPE_BITFIELD(a)->bitfieldtype == TYPE_BITFIELD(b)->bitfieldtype) &&
(TYPE_BITFIELD(a)->unkA == TYPE_BITFIELD(b)->unkA) && (TYPE_BITFIELD(a)->offset == TYPE_BITFIELD(b)->offset) &&
(TYPE_BITFIELD(a)->unkB == TYPE_BITFIELD(b)->unkB)) (TYPE_BITFIELD(a)->bitlength == TYPE_BITFIELD(b)->bitlength))
return 1; return 1;
} }
return 0; return 0;

View File

@ -1296,8 +1296,8 @@ static Boolean CheckAddressConsistency(IROLinear *nd, VarRecord *var, SInt32 add
flag = 0; flag = 0;
inner = nd->u.monadic; inner = nd->u.monadic;
if (inner->type == IROLinearOp1Arg && inner->nodetype == EBITFIELD) { if (inner->type == IROLinearOp1Arg && inner->nodetype == EBITFIELD) {
start_bit = TYPE_BITFIELD(inner->rtype)->unkA + 8 * addend; start_bit = TYPE_BITFIELD(inner->rtype)->offset + 8 * addend;
end_bit = start_bit + TYPE_BITFIELD(inner->rtype)->unkB - 1; end_bit = start_bit + TYPE_BITFIELD(inner->rtype)->bitlength - 1;
} else { } else {
start_bit = 8 * addend; start_bit = 8 * addend;
end_bit = start_bit + 8 * type->size - 1; end_bit = start_bit + 8 * type->size - 1;

View File

@ -126,7 +126,7 @@ static Section ObjGen_CheckCoalesceSection(Object *object) {
if ( if (
!CParser_HasInternalLinkage(object) && !CParser_HasInternalLinkage(object) &&
(object->qual & (Q_20000 | Q_OVERLOAD)) && (object->qual & (Q_20000 | Q_WEAK)) &&
(s = def_section_info[object->section].x1) != SECT_DEFAULT (s = def_section_info[object->section].x1) != SECT_DEFAULT
) )
return s; return s;
@ -191,22 +191,22 @@ static char ObjGen_ComputePrivFlag(UInt8 objectFlags) {
case 0: case 0:
case 1: case 1:
if ( if (
(objectFlags & OBJECT_FLAGS_1) && (objectFlags & OBJECT_USED) &&
(objectFlags & OBJECT_FLAGS_2) && (objectFlags & OBJECT_FLAGS_2) &&
!(objectFlags & OBJECT_FLAGS_4) !(objectFlags & OBJECT_DEFINED)
) )
return 0; return 0;
return 1; return 1;
case 3: case 3:
case 4: case 4:
if ((objectFlags & OBJECT_FLAGS_10) == OBJECT_FLAGS_10) if ((objectFlags & OBJECT_INTERNAL) == OBJECT_INTERNAL)
return 1; return 1;
if ((objectFlags & OBJECT_FLAGS_40) == OBJECT_FLAGS_40) if ((objectFlags & OBJECT_EXPORT) == OBJECT_EXPORT)
return 0; return 0;
if ( if (
(objectFlags & OBJECT_FLAGS_1) && (objectFlags & OBJECT_USED) &&
(objectFlags & OBJECT_FLAGS_2) && (objectFlags & OBJECT_FLAGS_2) &&
!(objectFlags & OBJECT_FLAGS_4) !(objectFlags & OBJECT_DEFINED)
) )
return 0; return 0;
return 1; return 1;
@ -272,7 +272,7 @@ SInt32 ObjGen_GetHashNodeRelocID(Object *object, MachOSection *section, SInt32 v
r.x2 = 1; r.x2 = 1;
r.privFlag = ObjGen_ComputePrivFlag(object->flags); r.privFlag = ObjGen_ComputePrivFlag(object->flags);
if (!CParser_HasInternalLinkage(object)) 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.name = name->name;
r.x4 = value; r.x4 = value;
@ -282,7 +282,7 @@ SInt32 ObjGen_GetHashNodeRelocID(Object *object, MachOSection *section, SInt32 v
} else if (section) { } else if (section) {
other_rd = &RELOC_DATA(name->id); other_rd = &RELOC_DATA(name->id);
other_rd->privFlag = ObjGen_ComputePrivFlag(object->flags); 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; other_rd->x3 = 1;
switch (other_rd->type) { switch (other_rd->type) {
case RT_0: 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.x3 = 1;
r.x4 = value; r.x4 = value;
@ -1023,7 +1023,7 @@ static void patchuplazyptr(Object *object) {
RelocDataT *rd; RelocDataT *rd;
Object *toc; 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; toc = object->toc;
if (toc->section == SECT_NONLAZY_PTRS) { if (toc->section == SECT_NONLAZY_PTRS) {
toc->section = SECT_CONST_PTR; toc->section = SECT_CONST_PTR;

View File

@ -1000,9 +1000,9 @@ void extract_bitfield(Operand *input_op, TypeBitfield *tbitfield, short output_r
int tmp_reg; int tmp_reg;
int output; int output;
offset = tbitfield->unkB; offset = tbitfield->bitlength;
output = output_reg ? output_reg : used_virtual_registers[RegClass_GPR]++; 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)) { if (is_unsigned(tbitfield->bitfieldtype)) {
emitpcode(PC_RLWINM, output, input_op->reg, (r27 + offset) & 31, 32 - offset, 31); emitpcode(PC_RLWINM, output, input_op->reg, (r27 + offset) & 31, 32 - offset, 31);
} else if (r27 == 0) { } 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) { void insert_bitfield(short reg, Operand *op, TypeBitfield *tbitfield) {
int offset = tbitfield->unkB; int offset = tbitfield->bitlength;
int r7 = tbitfield->unkA + (32 - (tbitfield->bitfieldtype->size * 8)); int r7 = tbitfield->offset + (32 - (tbitfield->bitfieldtype->size * 8));
emitpcode(PC_RLWIMI, op->reg, reg, 32 - (r7 + offset), r7, r7 + offset - 1); emitpcode(PC_RLWIMI, op->reg, reg, 32 - (r7 + offset), r7, r7 + offset - 1);
} }

View File

@ -352,7 +352,7 @@ static Object *create_switch_table(void) {
obj->toc = NULL; obj->toc = NULL;
obj->sclass = TK_STATIC; obj->sclass = TK_STATIC;
obj->qual = Q_CONST; 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->u.data.linkname = obj->name;
obj->type = NULL; obj->type = NULL;
createIndirect(obj, 0, 0); createIndirect(obj, 0, 0);

View File

@ -197,7 +197,7 @@ Object *createfloatconstant(Type *type, Float *data) {
obj->u.data.info = NULL; obj->u.data.info = NULL;
obj->u.data.linkname = obj->name; obj->u.data.linkname = obj->name;
obj->sclass = TK_STATIC; obj->sclass = TK_STATIC;
obj->qual = Q_CONST | Q_10000; obj->qual = Q_CONST | Q_INLINE_DATA;
obj->datatype = DDATA; obj->datatype = DDATA;
if (type->size == 8) if (type->size == 8)
obj->section = SECT_8BYTE_LITERALS; obj->section = SECT_8BYTE_LITERALS;
@ -242,7 +242,7 @@ Object *createvectorconstant(Type *type, MWVector128 *data) {
obj->u.data.info = NULL; obj->u.data.info = NULL;
obj->u.data.linkname = obj->name; obj->u.data.linkname = obj->name;
obj->sclass = TK_STATIC; obj->sclass = TK_STATIC;
obj->qual = Q_CONST | Q_10000; obj->qual = Q_CONST | Q_INLINE_DATA;
obj->datatype = DDATA; obj->datatype = DDATA;
if (type->size == 16) if (type->size == 16)
obj->section = SECT_16BYTE_LITERALS; obj->section = SECT_16BYTE_LITERALS;
@ -337,7 +337,7 @@ static Object *CreatePooledFloatConst(Type *type, Float *data, SInt32 *pOffset)
di.name = GetHashNameNodeExport("@doubleBase0"); di.name = GetHashNameNodeExport("@doubleBase0");
di.qual = Q_CONST; di.qual = Q_CONST;
di.storageclass = TK_STATIC; di.storageclass = TK_STATIC;
di.x4E = 1; di.is_extern_c = 1;
di.section = SECT_CONST; di.section = SECT_CONST;
object = CParser_NewGlobalDataObject(&di); object = CParser_NewGlobalDataObject(&di);
object->nspace = cscope_root; object->nspace = cscope_root;
@ -385,7 +385,7 @@ static Object *CreatePooledFloatConst(Type *type, Float *data, SInt32 *pOffset)
di.name = GetHashNameNodeExport("@floatBase0"); di.name = GetHashNameNodeExport("@floatBase0");
di.qual = Q_CONST; di.qual = Q_CONST;
di.storageclass = TK_STATIC; di.storageclass = TK_STATIC;
di.x4E = 1; di.is_extern_c = 1;
di.section = SECT_CONST; di.section = SECT_CONST;
object = CParser_NewGlobalDataObject(&di); object = CParser_NewGlobalDataObject(&di);
object->nspace = cscope_root; object->nspace = cscope_root;
@ -461,7 +461,7 @@ static void RewriteVectorConst(ENode *expr) {
di.name = GetHashNameNodeExport("@vectorBase0"); di.name = GetHashNameNodeExport("@vectorBase0");
di.qual = Q_CONST; di.qual = Q_CONST;
di.storageclass = TK_STATIC; di.storageclass = TK_STATIC;
di.x4E = 1; di.is_extern_c = 1;
di.section = SECT_CONST; di.section = SECT_CONST;
object = CParser_NewGlobalDataObject(&di); object = CParser_NewGlobalDataObject(&di);
object->nspace = cscope_root; object->nspace = cscope_root;
@ -511,7 +511,7 @@ static Object *createcodelabel(CLabel *label) {
obj->sclass = TK_STATIC; obj->sclass = TK_STATIC;
obj->qual = Q_CONST; obj->qual = Q_CONST;
obj->datatype = DDATA; obj->datatype = DDATA;
obj->flags |= OBJECT_FLAGS_2 | OBJECT_FLAGS_4; obj->flags |= OBJECT_FLAGS_2 | OBJECT_DEFINED;
list = galloc(sizeof(CodeLabelList)); list = galloc(sizeof(CodeLabelList));
memclrw(list, sizeof(CodeLabelList)); memclrw(list, sizeof(CodeLabelList));
@ -2244,7 +2244,7 @@ Object *createstaticinitobject(void) {
tfunc->type = TYPEFUNC; tfunc->type = TYPEFUNC;
tfunc->functype = &stvoid; tfunc->functype = &stvoid;
tfunc->args = NULL; tfunc->args = NULL;
tfunc->flags = FUNC_FLAGS_2; tfunc->flags = FUNC_DEFINED;
obj = galloc(sizeof(Object)); obj = galloc(sizeof(Object));
memclrw(obj, sizeof(Object)); memclrw(obj, sizeof(Object));

View File

@ -577,8 +577,8 @@ static void spell(Type *type, char *buf) {
sprintf(buf, sprintf(buf,
"bitfield(%s){%d:%d}", "bitfield(%s){%d:%d}",
mybuf, mybuf,
TYPE_BITFIELD(type)->unkA, TYPE_BITFIELD(type)->offset,
TYPE_BITFIELD(type)->unkB); TYPE_BITFIELD(type)->bitlength);
break; break;
case TYPELABEL: case TYPELABEL:
strcpy(buf, "label"); strcpy(buf, "label");

View File

@ -22,7 +22,7 @@ extern SInt16 CABI_StructSizeAlignValue(Type *type, SInt32 size);
extern void CABI_ReverseBitField(TypeBitfield *tbitfield); extern void CABI_ReverseBitField(TypeBitfield *tbitfield);
extern void CABI_AddVTable(TypeClass *tclass); extern void CABI_AddVTable(TypeClass *tclass);
extern SInt32 CABI_GetVTableOffset(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 void CABI_MakeDefaultArgConstructor(TypeClass *tclass, Object *func);
extern ENode *CABI_MakeThisExpr(TypeClass *tclass, SInt32 offset); extern ENode *CABI_MakeThisExpr(TypeClass *tclass, SInt32 offset);
extern SInt32 CABI_GetCtorOffsetOffset(TypeClass *tclass, TypeClass *base); extern SInt32 CABI_GetCtorOffsetOffset(TypeClass *tclass, TypeClass *base);

View File

@ -7,13 +7,6 @@
#pragma options align=mac68k #pragma options align=mac68k
#endif #endif
/*typedef struct VTableObjectLink {
struct VTableObjectLink *next;
Object *methodobj;
SInt32 offset;
SInt32 xC;
} VTableObjectLink;*/
extern void CClass_Init(void); extern void CClass_Init(void);
extern void CClass_GenThunks(void); extern void CClass_GenThunks(void);
extern UInt8 CClass_GetOverrideKind(TypeFunc *a, TypeFunc *b, Boolean errorflag); extern UInt8 CClass_GetOverrideKind(TypeFunc *a, TypeFunc *b, Boolean errorflag);

View File

@ -10,12 +10,12 @@
#endif #endif
// named because it's 0xE bytes big (hurr) // named because it's 0xE bytes big (hurr)
struct DeclE { struct ClassLayout {
ObjBase **objlist; ObjBase **objlist;
ObjMemberVar *vtable_ivar; ObjMemberVar *vtable_ivar;
unsigned short x8; // lex_order_count? UInt16 lex_order_count;
unsigned short xA; UInt16 xA;
Boolean xC; Boolean has_vtable;
}; };
// what the fuck am I? // what the fuck am I?
@ -41,8 +41,7 @@ struct DeclInfo {
DeclFucker *fucker34; DeclFucker *fucker34;
TemplateFunction *x38; TemplateFunction *x38;
UInt8 x3C; // related to template nindex UInt8 x3C; // related to template nindex
Boolean x3D; short operator_token; // when an operator name like "operator +" is scanned, this is the token
short x3E;
short storageclass; short storageclass;
UInt8 section; UInt8 section;
UInt8 exportflags; UInt8 exportflags;
@ -54,9 +53,9 @@ struct DeclInfo {
Boolean x49; Boolean x49;
Boolean x4A; // objc related Boolean x4A; // objc related
Boolean x4B; Boolean x4B;
Boolean x4C; Boolean in_friend_decl; // set to 1 when parsing a 'friend' declaration
Boolean x4D; Boolean x4D;
Boolean x4E; // is_extern_c? Boolean is_extern_c;
Boolean x4F; Boolean x4F;
Boolean x50; Boolean x50;
Boolean x51; Boolean x51;
@ -66,10 +65,9 @@ struct DeclInfo {
Boolean x55; Boolean x55;
Boolean x56; Boolean x56;
Boolean x57; Boolean x57;
//FileOffsetInfo fileoffsetinfo;
CPrepFileInfo *file; CPrepFileInfo *file;
CPrepFileInfo *file2; CPrepFileInfo *file2;
SInt32 x60; // file offset? SInt32 sourceoffset;
Boolean x64; Boolean x64;
}; };
@ -125,7 +123,7 @@ extern void CDecl_CheckCtorIntegrity(FuncArg *args, TypeClass *tclass);
extern void CDecl_MakeVBaseList(TypeClass *tclass); extern void CDecl_MakeVBaseList(TypeClass *tclass);
extern Boolean CDecl_CheckNewBase(TypeClass *tclass, TypeClass *baseclass, Boolean is_virtual); extern Boolean CDecl_CheckNewBase(TypeClass *tclass, TypeClass *baseclass, Boolean is_virtual);
extern TypeMemberFunc *CDecl_MakeDefaultDtorType(TypeClass *tclass, 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 TypeClass *CDecl_DefineClass(NameSpace *nspace, HashNameNode *name, TypeClass *tclass, short mode, Boolean flag2, Boolean flag3);
extern void CDecl_ParseClassDeclSpec(UInt8 *declspec); extern void CDecl_ParseClassDeclSpec(UInt8 *declspec);
extern void CDecl_ParseClass(DeclInfo *declinfo, short mode, Boolean flag1, UInt8 class_declspec); extern void CDecl_ParseClass(DeclInfo *declinfo, short mode, Boolean flag1, UInt8 class_declspec);

View File

@ -85,7 +85,7 @@ extern ENode *argumentpromotion(ENode *expr, Type *type, short qual, Boolean fla
extern ENode *classargument(ENode *expr); extern ENode *classargument(ENode *expr);
extern ENodeList *CExpr_ScanExpressionList(Boolean is_parens); extern ENodeList *CExpr_ScanExpressionList(Boolean is_parens);
extern ENode *CExpr_DoExplicitConversion(Type *type, UInt32 qual, ENodeList *list); 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 scansizeof(void);
extern SInt32 scanalignof(void); extern SInt32 scanalignof(void);
extern ENode *getnodeaddress(ENode *expr, Boolean flag); extern ENode *getnodeaddress(ENode *expr, Boolean flag);

View File

@ -20,12 +20,11 @@ struct CScopeSave {
Boolean is_member_func; Boolean is_member_func;
}; // assumed name }; // assumed name
// this might be called NameResult typedef struct NameResult {
typedef struct CScopeParseResult {
NameSpace *nspace_0; NameSpace *nspace_0;
HashNameNode *name_4; HashNameNode *name_4;
Type *x8; Type *type;
UInt32 xC; // qual UInt32 qual;
ObjBase *obj_10; ObjBase *obj_10;
NameSpaceObjectList *nsol_14; NameSpaceObjectList *nsol_14;
BClassList *bcl_18; BClassList *bcl_18;
@ -35,12 +34,12 @@ typedef struct CScopeParseResult {
Boolean x1F; Boolean x1F;
Boolean x20; Boolean x20;
Boolean x21; Boolean x21;
} CScopeParseResult; } NameResult;
typedef struct CScopeNSIterator { typedef struct CScopeNSIterator {
NameSpace *nspace; NameSpace *nspace;
NameSpaceLookupList *lookup; NameSpaceLookupList *lookup;
CScopeParseResult *result; NameResult *result;
} CScopeNSIterator; } CScopeNSIterator;
typedef struct CScopeObjectIterator { 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_AddObject(NameSpace *nspace, HashNameNode *name, ObjBase *obj);
extern void CScope_AddGlobalObject(Object *obj); extern void CScope_AddGlobalObject(Object *obj);
extern NameSpaceLookupList *CScope_BuildNameSpaceLookupList(NameSpace *nspace); 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_GetType(NameSpace *nspace, HashNameNode *name, UInt32 *qual);
extern Type *CScope_GetTagType(NameSpace *nspace, HashNameNode *name); extern Type *CScope_GetTagType(NameSpace *nspace, HashNameNode *name);
extern Boolean CScope_ParseExprName(CScopeParseResult *result); extern Boolean CScope_ParseExprName(NameResult *result);
extern Boolean CScope_ParseDeclName(CScopeParseResult *result); extern Boolean CScope_ParseDeclName(NameResult *result);
extern Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1, Boolean flag2); extern Boolean CScope_ParseQualifiedNameSpace(NameResult *result, Boolean flag1, Boolean flag2);
extern Boolean CScope_ParseElaborateName(CScopeParseResult *result); extern Boolean CScope_ParseElaborateName(NameResult *result);
extern Boolean CScope_FindObject(NameSpace *nspace, CScopeParseResult *result, HashNameNode *name); extern Boolean CScope_FindObject(NameSpace *nspace, NameResult *result, HashNameNode *name);
extern Boolean CScope_FindNonClassObject(NameSpace *nspace, CScopeParseResult *result, HashNameNode *name); extern Boolean CScope_FindNonClassObject(NameSpace *nspace, NameResult *result, HashNameNode *name);
extern NameSpaceObjectList *CScope_FindObjectList(CScopeParseResult *result, HashNameNode *name); extern NameSpaceObjectList *CScope_FindObjectList(NameResult *result, HashNameNode *name);
extern Boolean CScope_PossibleTypeName(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 void CScope_InitObjectIterator(CScopeObjectIterator *iterator, NameSpace *nspace);
extern ObjBase *CScope_NextObjectIteratorObject(CScopeObjectIterator *iterator); extern ObjBase *CScope_NextObjectIteratorObject(CScopeObjectIterator *iterator);
extern NameSpaceObjectList *CScope_NextObjectIteratorObjectList(CScopeObjectIterator *iterator); extern NameSpaceObjectList *CScope_NextObjectIteratorObjectList(CScopeObjectIterator *iterator);
extern void CScope_DefineTypeTag(NameSpace *nspace, HashNameNode *name, Type *type); extern void CScope_DefineTypeTag(NameSpace *nspace, HashNameNode *name, Type *type);
extern Type *CScope_GetLocalTagType(NameSpace *nspace, HashNameNode *name); 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 NameSpaceObjectList *CScope_GetLocalObject(NameSpace *nspace, HashNameNode *name);
extern BClassList *CScope_GetClassAccessPath(BClassList *list, TypeClass *tclass); 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_AddClassUsingDeclaration(TypeClass *tclass, TypeClass *tclass2, HashNameNode *name, AccessType access);
extern void CScope_ParseUsingDeclaration(NameSpace *nspace, AccessType access, Boolean flag); extern void CScope_ParseUsingDeclaration(NameSpace *nspace, AccessType access, Boolean flag);
extern void CScope_ParseNameSpaceAlias(HashNameNode *name); extern void CScope_ParseNameSpaceAlias(HashNameNode *name);

View File

@ -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_RegisterEnumerator(TemplClass *tmclass, ObjEnumConst *objenumconst, ENode *initexpr);
extern void CTemplClass_RegisterObjectInit(TemplClass *tmclass, Object *object, ENode *initexpr); extern void CTemplClass_RegisterObjectInit(TemplClass *tmclass, Object *object, ENode *initexpr);
extern void CTemplClass_RegisterObjectDef(TemplClass *tmclass, ObjBase *refobj); 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 TemplClassInst *CTemplClass_GetInstance(TemplClass *tmclass, TemplArg *args1, TemplArg *args2);
extern TemplateMember *CTemplClass_DefineMember(TemplClass *tmclass, Object *object, FileOffsetInfo *foi, TokenStream *stream); 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); extern void CTemplClass_ParsePartialSpecialization(DeclFucker *what_is_this, TemplParam *params, short mode, SInt32 *offset);

View File

@ -113,11 +113,11 @@ typedef struct Alias Alias;
typedef struct BClassList BClassList; typedef struct BClassList BClassList;
typedef struct CI_FuncData CI_FuncData; typedef struct CI_FuncData CI_FuncData;
typedef struct CLabel CLabel; typedef struct CLabel CLabel;
typedef struct ClassLayout ClassLayout;
typedef struct ClassList ClassList; typedef struct ClassList ClassList;
typedef struct CompilerLinkerParamBlk CompilerLinkerParamBlk; typedef struct CompilerLinkerParamBlk CompilerLinkerParamBlk;
typedef struct CPrepFileInfo CPrepFileInfo; typedef struct CPrepFileInfo CPrepFileInfo;
typedef struct CScopeSave CScopeSave; typedef struct CScopeSave CScopeSave;
typedef struct DeclE DeclE;
typedef struct DeclFucker DeclFucker; typedef struct DeclFucker DeclFucker;
typedef struct DeclInfo DeclInfo; typedef struct DeclInfo DeclInfo;
typedef struct DeclThing DeclThing; // rename me please typedef struct DeclThing DeclThing; // rename me please
@ -176,7 +176,6 @@ typedef struct Statement Statement;
typedef struct StructMember StructMember; typedef struct StructMember StructMember;
typedef struct SwitchCase SwitchCase; typedef struct SwitchCase SwitchCase;
typedef struct SwitchInfo SwitchInfo; typedef struct SwitchInfo SwitchInfo;
typedef struct Template Template;
typedef struct TemplateAction TemplateAction; typedef struct TemplateAction TemplateAction;
typedef struct TemplateFriend TemplateFriend; typedef struct TemplateFriend TemplateFriend;
typedef struct TemplateMember TemplateMember; typedef struct TemplateMember TemplateMember;
@ -185,7 +184,6 @@ typedef struct TemplClass TemplClass;
typedef struct TemplClassInst TemplClassInst; typedef struct TemplClassInst TemplClassInst;
typedef struct TemplateFunction TemplateFunction; typedef struct TemplateFunction TemplateFunction;
typedef struct TemplFuncInstance TemplFuncInstance; typedef struct TemplFuncInstance TemplFuncInstance;
typedef struct TemplInstance TemplInstance;
typedef struct TemplParam TemplParam; typedef struct TemplParam TemplParam;
typedef struct TemplPartialSpec TemplPartialSpec; typedef struct TemplPartialSpec TemplPartialSpec;
typedef struct TemplStack TemplStack; typedef struct TemplStack TemplStack;
@ -252,13 +250,13 @@ enum {
Q_BYCOPY = 0x2000, Q_BYCOPY = 0x2000,
Q_BYREF = 0x4000, Q_BYREF = 0x4000,
Q_ONEWAY = 0x8000, Q_ONEWAY = 0x8000,
Q_10000 = 0x10000, Q_INLINE_DATA = 0x10000, // this object contains constant data in its union
Q_20000 = 0x20000, Q_20000 = 0x20000,
Q_OVERLOAD = 0x40000, // weak Q_WEAK = 0x40000, // weak
Q_80000 = 0x80000, Q_MANGLE_NAME = 0x80000, // adds C++ mangling info to a name
Q_100000 = 0x100000, // Objective-C ID Q_IS_OBJC_ID = 0x100000, // Objective-C ID
Q_RESTRICT = 0x200000, Q_RESTRICT = 0x200000,
Q_400000 = 0x400000, // is templated from another object? Q_IS_TEMPLATED = 0x400000, // is templated from another object?
Q_1000000 = 0x1000000, Q_1000000 = 0x1000000,
Q_ALIGNED_1 = 0x2000000, Q_ALIGNED_1 = 0x2000000,
Q_ALIGNED_2 = 0x4000000, Q_ALIGNED_2 = 0x4000000,

View File

@ -188,14 +188,14 @@ struct ObjectTemplated {
}; };
enum { enum {
OBJECT_FLAGS_1 = 1, OBJECT_USED = 1,
OBJECT_FLAGS_2 = 2, OBJECT_FLAGS_2 = 2, // this object has been used in certain contexts (figure me out?)
OBJECT_FLAGS_4 = 4, OBJECT_DEFINED = 4,
OBJECT_FLAGS_8 = 8, OBJECT_LAZY = 8, // this object will be created by a CParser callback action only if referenced
OBJECT_FLAGS_10 = 0x10, // internal OBJECT_INTERNAL = 0x10,
OBJECT_FLAGS_20 = 0x20, // import OBJECT_IMPORT = 0x20,
OBJECT_FLAGS_40 = 0x40, // export OBJECT_EXPORT = 0x40,
OBJECT_FLAGS_60 = 0x60 // lib export OBJECT_LIB_EXPORT = 0x60
}; };
#define OBJ_BASE(obj) ((ObjBase *) (obj)) #define OBJ_BASE(obj) ((ObjBase *) (obj))
@ -209,7 +209,7 @@ enum {
#define OBJECT_TEMPL(obj) ((ObjectTemplated *) (obj)) #define OBJECT_TEMPL(obj) ((ObjectTemplated *) (obj))
struct VarInfo { // OK! struct VarInfo {
Object *func; Object *func;
SInt32 usage; SInt32 usage;
TStreamElement deftoken; TStreamElement deftoken;

View File

@ -9,7 +9,7 @@
#pragma options align=mac68k #pragma options align=mac68k
#endif #endif
struct PackedDeclInfo { // ok struct PackedDeclInfo {
Type *thetype; Type *thetype;
UInt32 qual; UInt32 qual;
NameSpace *nspace; NameSpace *nspace;
@ -21,20 +21,13 @@ struct PackedDeclInfo { // ok
Boolean has_expltargs; Boolean has_expltargs;
}; };
struct Template { struct TemplateFriend {
Template *parent;
TemplInstance *parentinst;
TemplParam *params;
Boolean is_class;
};
struct TemplateFriend { // verified via CPrec
PackedDeclInfo decl; PackedDeclInfo decl;
FileOffsetInfo fileoffset; FileOffsetInfo fileoffset;
TokenStream stream; TokenStream stream;
}; };
struct TemplateMember { // verified via CPrec struct TemplateMember {
struct TemplateMember *next; struct TemplateMember *next;
TemplParam *params; TemplParam *params;
Object *object; Object *object;
@ -45,17 +38,7 @@ struct TemplateMember { // verified via CPrec
SInt32 endoffset; SInt32 endoffset;
}; };
struct TemplInstance { struct TemplParam {
// Template *templ;
TemplInstance *parent;
TemplArg *args;
Boolean is_instantiated;
Boolean is_specialized;
Boolean is_extern;
Boolean static_instantiated;
};
struct TemplParam { // verified via CPrec
TemplParam *next; TemplParam *next;
HashNameNode *name; HashNameNode *name;
TemplParamID pid; TemplParamID pid;
@ -76,7 +59,7 @@ struct TemplParam { // verified via CPrec
} data; } data;
}; };
struct TemplArg { // verified by CPrec struct TemplArg {
TemplArg *next; TemplArg *next;
TemplParamID pid; TemplParamID pid;
union { union {
@ -123,7 +106,7 @@ struct TypeDeduce {
Boolean x19; Boolean x19;
}; };
struct TemplPartialSpec { // confirmed via CPrec (but templ might be a different type?) struct TemplPartialSpec {
TemplPartialSpec *next; TemplPartialSpec *next;
TemplClass *templ; TemplClass *templ;
TemplArg *args; TemplArg *args;
@ -146,47 +129,48 @@ struct TemplStack {
struct TemplClass { struct TemplClass {
TypeClass theclass; TypeClass theclass;
TemplClass *next; TemplClass *next;
TemplClass *templ_parent; // confirmed by v8 TemplClass *templ_parent;
TemplClassInst *inst_parent; // confirmed by v8 TemplClassInst *inst_parent;
TemplParam *templ__params; TemplParam *templ__params;
TemplateMember *members; TemplateMember *members;
TemplClassInst *instances; TemplClassInst *instances;
TemplClass *pspec_owner; TemplClass *pspec_owner;
TemplPartialSpec *pspecs; TemplPartialSpec *pspecs;
TemplateAction *actions; TemplateAction *actions;
UInt16 lex_order_count; // confirmed by v8 UInt16 lex_order_count;
SInt8 align; SInt8 align;
UInt8 flags; UInt8 flags;
}; };
// TemplClass::flags
enum { enum {
TEMPLCLASS_FLAGS_1 = 1, TEMPLCLASS_HAS_VTABLE = 1,
TEMPLCLASS_FLAGS_2 = 2 TEMPLCLASS_FLAGS_2 = 2
}; };
struct TemplClassInst { struct TemplClassInst {
TypeClass theclass; TypeClass theclass;
TemplClassInst *next; // confirmed by v8 TemplClassInst *next;
TemplClassInst *parent; // confirmed by v8 TemplClassInst *parent;
TemplClass *templ; TemplClass *templ;
TemplArg *inst_args; TemplArg *inst_args;
TemplArg *oargs; TemplArg *oargs;
Boolean is_instantiated; Boolean is_instantiated;
Boolean is_specialized; Boolean is_specialized;
Boolean is_extern; Boolean is_extern;
Boolean x49; Boolean static_instantiated;
}; };
#define TEMPL_CLASS(ty) ( (TemplClass *) (ty) ) #define TEMPL_CLASS(ty) ( (TemplClass *) (ty) )
#define TEMPL_CLASS_INST(ty) ( (TemplClassInst *) (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(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_FLAGS_800) ) #define IS_TEMPL_CLASS_INST(ty) ( IS_TYPE_CLASS(ty) && (TYPE_CLASS(ty)->flags & CLASS_IS_TEMPL_INST) )
/*************/ /*************/
/* Functions */ /* Functions */
/*************/ /*************/
struct TemplateFunction { // verified via CPrec struct TemplateFunction {
TemplateFunction *next; TemplateFunction *next;
TemplateFunction *unk4; // parent? TemplateFunction *unk4; // parent?
HashNameNode *name; HashNameNode *name;
@ -200,19 +184,18 @@ struct TemplateFunction { // verified via CPrec
SInt32 endoffset; SInt32 endoffset;
}; };
struct TemplFuncInstance { // verified via CPrec struct TemplFuncInstance {
TemplFuncInstance *next; TemplFuncInstance *next;
Object *object; Object *object;
TemplArg *args; TemplArg *args;
Boolean is_instantiated; Boolean is_instantiated;
Boolean is_specialized; Boolean is_specialized;
Boolean is_extern; Boolean is_extern;
Boolean static_instantiated;
}; };
#define TEMPL_FUNC(ty) ( (TemplateFunction *) (ty) ) #define TEMPL_FUNC(ty) ( (TemplateFunction *) (ty) )
#define TEMPL_FUNC_INST(ty) ( (TemplFuncInstance *) (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 */ /* Actions */
@ -230,7 +213,7 @@ typedef enum TemplateActionType {
TAT_ILLEGAL TAT_ILLEGAL
} TemplateActionType; } TemplateActionType;
struct TemplateAction { // verified via CPrec struct TemplateAction {
TemplateAction *next; TemplateAction *next;
TStreamElement source_ref; TStreamElement source_ref;
union { union {

View File

@ -70,7 +70,7 @@ struct TypeIntegral {
}; };
struct TypeEnum { // checked via CPrec struct TypeEnum {
TypeType type; TypeType type;
SInt32 size; SInt32 size;
NameSpace *nspace; NameSpace *nspace;
@ -115,7 +115,7 @@ enum {
}; };
struct ClassList { // checked via CPrec struct ClassList {
ClassList *next; ClassList *next;
TypeClass *base; TypeClass *base;
SInt32 offset; SInt32 offset;
@ -124,16 +124,15 @@ struct ClassList { // checked via CPrec
Boolean is_virtual; Boolean is_virtual;
}; };
struct VClassList { // checked via CPrec struct VClassList {
VClassList *next; VClassList *next;
TypeClass *base; TypeClass *base;
SInt32 offset; // offset within the class instance SInt32 offset; // offset within the class instance
SInt32 voffset; // offset within the vtable SInt32 voffset; // offset within the vtable
Boolean has_override; Boolean has_override;
char alignsave;
}; };
typedef struct ClassFriend { // checked via CPrec typedef struct ClassFriend {
struct ClassFriend *next; struct ClassFriend *next;
union { union {
TypeClass *theclass; TypeClass *theclass;
@ -142,12 +141,12 @@ typedef struct ClassFriend { // checked via CPrec
Boolean isclass; Boolean isclass;
} ClassFriend; } ClassFriend;
struct BClassList { // checked via CPrec struct BClassList {
struct BClassList *next; struct BClassList *next;
Type *type; Type *type;
}; };
typedef struct VTable { // checked via CPrec typedef struct VTable {
Object *object; Object *object;
TypeClass *owner; TypeClass *owner;
SInt32 offset; SInt32 offset;
@ -174,25 +173,23 @@ struct TypeClass {
}; };
typedef enum { typedef enum {
CLASS_MODE_0 = 0, // struct CLASS_MODE_STRUCT = 0,
CLASS_MODE_1 = 1, // union CLASS_MODE_UNION = 1,
CLASS_MODE_2 = 2 // class CLASS_MODE_CLASS = 2
} ClassMode; } ClassMode;
enum { enum {
CLASS_FLAGS_1 = 1, CLASS_HANDLEOBJECT = 1, // class is a HandleObject
CLASS_FLAGS_2 = 2, // completed class? CLASS_COMPLETED = 2, // completed class?
CLASS_FLAGS_ABSTRACT = 8, CLASS_ABSTRACT = 8,
CLASS_FLAGS_10 = 0x10, CLASS_SINGLE_OBJECT = 0x10, // inherits from SingleObject/SingleInheritance
CLASS_FLAGS_20 = 0x20, CLASS_HAS_VBASES = 0x20,
CLASS_FLAGS_40 = 0x40, CLASS_IS_CONVERTIBLE = 0x40, // defines at least one conversion function
CLASS_FLAGS_80 = 0x80, CLASS_IS_TEMPL = 0x100, // is TemplClass
CLASS_FLAGS_100 = 0x100, // is TemplClass CLASS_IS_TEMPL_INST = 0x800, // is TemplClassInst
CLASS_FLAGS_800 = 0x800, // is TemplClassInst CLASS_IS_TEMPL_ANY = CLASS_IS_TEMPL | CLASS_IS_TEMPL_INST,
CLASS_FLAGS_900 = 0x900, CLASS_EMPTY = 0x1000, // is 0 bytes (forced to 1 byte for ABI reasons)
CLASS_FLAGS_1000 = 0x1000, // is empty class CLASS_COM_OBJECT = 0x2000, // inherits from __comobject
CLASS_FLAGS_2000 = 0x2000,
CLASS_FLAGS_4000 = 0x4000,
CLASS_FLAGS_8000 = 0x8000 CLASS_FLAGS_8000 = 0x8000
}; };
@ -225,7 +222,6 @@ struct FuncArg { // ok
UInt32 qual; UInt32 qual;
SInt16 sclass; SInt16 sclass;
Boolean is_array; Boolean is_array;
Boolean has_defdefarg;
}; };
struct TypeFunc { struct TypeFunc {
@ -237,37 +233,37 @@ struct TypeFunc {
UInt32 qual; UInt32 qual;
UInt32 flags; UInt32 flags;
}; };
// TypeFunc::flags
enum { enum {
FUNC_FLAGS_PASCAL = 1, // on TypeFunc::flags FUNC_PASCAL = 1,
FUNC_FLAGS_2 = 2, // member function that has an inline definition? FUNC_DEFINED = 2, // does the function have a body?
FUNC_FLAGS_4 = 4, FUNC_FLAGS_4 = 4,
FUNC_FLAGS_8 = 8, // abstract FUNC_PURE = 8, // abstract
FUNC_FLAGS_METHOD = 0x10, FUNC_METHOD = 0x10,
FUNC_FLAGS_20 = 0x20, 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_80 = 0x80,
FUNC_FLAGS_100 = 0x100, FUNC_AUTO_GENERATED = 0x100, // an auto-generated ctor, dtor or assignment operator
FUNC_FLAGS_200 = 0x200, // intrinsic? FUNC_INTRINSIC = 0x200,
FUNC_FLAGS_NOTHROW = 0x400, FUNC_NOTHROW = 0x400,
FUNC_FLAGS_800 = 0x800, // autoinlined? FUNC_FLAGS_800 = 0x800, // autoinlined?
FUNC_FLAGS_1000 = 0x1000, // is ctor FUNC_IS_CTOR = 0x1000, // is ctor
FUNC_FLAGS_2000 = 0x2000, // is dtor FUNC_IS_DTOR = 0x2000, // is dtor
FUNC_FLAGS_4000 = 0x4000, // objc method? FUNC_OBJC_METHOD = 0x4000,
FUNC_FLAGS_CONST = 0x8000, FUNC_CONST = 0x8000,
FUNC_FLAGS_VOLATILE = 0x10000, FUNC_VOLATILE = 0x10000,
FUNC_FLAGS_CV = FUNC_FLAGS_CONST | FUNC_FLAGS_VOLATILE, FUNC_FLAGS_CV = FUNC_CONST | FUNC_VOLATILE,
FUNC_FLAGS_100000 = 0x100000, // is template? FUNC_IS_TEMPL = 0x100000, // the definition of a template
FUNC_FLAGS_200000 = 0x200000, FUNC_FLAGS_200000 = 0x200000,
FUNC_FLAGS_400000 = 0x400000, // covariant? FUNC_FLAGS_400000 = 0x400000, // covariant?
FUNC_FLAGS_800000 = 0x800000, FUNC_IS_TEMPL_INSTANCE = 0x800000, // a concrete instance of a template
FUNC_FLAGS_900000 = 0x900000, FUNC_IS_TEMPL_ANY = FUNC_IS_TEMPL | FUNC_IS_TEMPL_INSTANCE,
FUNC_FLAGS_4000000 = 0x4000000, FUNC_FLAGS_4000000 = 0x4000000,
FUNC_FLAGS_10000000 = 0x10000000, 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 { struct TypeMemberFunc {
TypeType type; TypeType type;
SInt32 size; SInt32 size;
@ -277,9 +273,9 @@ struct TypeMemberFunc {
UInt32 qual; UInt32 qual;
UInt32 flags; UInt32 flags;
TypeClass *theclass; TypeClass *theclass;
SInt32 x1E; // vtable offset? SInt32 vtbl_index; // index of this method within the vtable
SInt32 x22; // browser index? SInt32 funcid; // ID used for tracking this method within browse data
Boolean x26; // is static Boolean is_static; // is static
}; };
@ -287,24 +283,18 @@ struct TypeBitfield {
TypeType type; TypeType type;
SInt32 size; SInt32 size;
Type *bitfieldtype; Type *bitfieldtype;
char unkA; // offset in bits char offset; // offset in bits
char unkB; // size in bits char bitlength; // size in bits
}; };
// Label
typedef enum TypeTemplDepType { typedef enum TypeTemplDepType {
TEMPLDEP_ARGUMENT, TEMPLDEP_ARGUMENT,
TEMPLDEP_QUALNAME, TEMPLDEP_QUALNAME,
TEMPLDEP_TEMPLATE, TEMPLDEP_TEMPLATE,
TEMPLDEP_ARRAY, TEMPLDEP_ARRAY,
TEMPLDEP_QUALTEMPL, TEMPLDEP_QUALTEMPL,
TEMPLDEP_BITFIELD, TEMPLDEP_BITFIELD
TEMPLDEP_VALUEDEP, // not in v7?
TEMPLDEP_ENUMVAL, // not in v7?
TEMPLDEP_TYPEOF // not in v7?
} TypeTemplDepType; } TypeTemplDepType;
struct TypeTemplDep { struct TypeTemplDep {
@ -333,13 +323,6 @@ struct TypeTemplDep {
Type *type; Type *type;
ENode *size; ENode *size;
} bitfield; } bitfield;
// the following ones may not be in v7
Type *vdep;
ENode *tof;
struct {
TypeEnum *etype;
ENode *expr;
} enumval;
} u; } u;
}; };
@ -362,7 +345,7 @@ struct TypePointer {
}; };
/// Always has Q_100000 set /// Always has Q_IS_OBJC_ID set
struct TypeObjCID { struct TypeObjCID {
TypePointer pointer; TypePointer pointer;
ObjCProtocolList *protocols; ObjCProtocolList *protocols;
@ -403,13 +386,13 @@ struct TypeList {
#define IS_TYPE_SOM_CLASS(ty) ( (ty)->type == TYPECLASS && TYPE_CLASS((ty))->sominfo ) #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_OBJC_CLASS(ty) ( (ty)->type == TYPECLASS && TYPE_CLASS((ty))->objcinfo )
#define IS_TYPE_FUNC(ty) ( (ty)->type == TYPEFUNC ) #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_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_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_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)->x26 ) #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)->x26 ) #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)->x26 ) #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_TEMPLATE(ty) ( (ty)->type == TYPETEMPLATE )
#define IS_TYPE_POINTER(ty) ( (ty)->type == TYPEPOINTER || (ty)->type == TYPEARRAY ) #define IS_TYPE_POINTER(ty) ( (ty)->type == TYPEPOINTER || (ty)->type == TYPEARRAY )
#define IS_TYPE_POINTER_ONLY(ty) ( (ty)->type == TYPEPOINTER ) #define IS_TYPE_POINTER_ONLY(ty) ( (ty)->type == TYPEPOINTER )