summaryrefslogtreecommitdiff
path: root/compiler_and_linker/unsorted/CTemplateClass.c
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-20 11:56:38 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-20 11:56:38 +0000
commit0905072b3ccfcb394b1dca2405a55cff4e2b9271 (patch)
treec7c6f87ecf257c4e7b6a92355e75030165731371 /compiler_and_linker/unsorted/CTemplateClass.c
parent7d986adf37220e1981a707745b784b078de4e3bc (diff)
downloadMWCC-0905072b3ccfcb394b1dca2405a55cff4e2b9271.tar.gz
MWCC-0905072b3ccfcb394b1dca2405a55cff4e2b9271.zip
tons more renaming of stuff
Diffstat (limited to 'compiler_and_linker/unsorted/CTemplateClass.c')
-rw-r--r--compiler_and_linker/unsorted/CTemplateClass.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/compiler_and_linker/unsorted/CTemplateClass.c b/compiler_and_linker/unsorted/CTemplateClass.c
index 45d07b8..8b3b889 100644
--- a/compiler_and_linker/unsorted/CTemplateClass.c
+++ b/compiler_and_linker/unsorted/CTemplateClass.c
@@ -23,7 +23,7 @@
TemplClass *CTemplClass_GetMasterTemplate(TemplClass *tmclass) {
if (tmclass->inst_parent) {
tmclass = TEMPL_CLASS(tmclass->theclass.nspace->theclass);
- CError_ASSERT(42, tmclass->theclass.flags & CLASS_FLAGS_100);
+ CError_ASSERT(42, tmclass->theclass.flags & CLASS_IS_TEMPL);
}
return tmclass;
@@ -89,7 +89,7 @@ void CTemplClass_RegisterFriend(TemplClass *tmclass, DeclInfo *di) {
if (tk == '{' && IS_TYPE_FUNC(di->thetype)) {
di->qual |= Q_INLINE;
- TYPE_FUNC(di->thetype)->flags |= FUNC_FLAGS_2 | FUNC_FLAGS_800000;
+ TYPE_FUNC(di->thetype)->flags |= FUNC_DEFINED | FUNC_IS_TEMPL_INSTANCE;
tfriend->fileoffset = cparser_fileoffset;
CPrep_StreamGetBlock(&tfriend->stream, NULL, 1);
@@ -182,11 +182,11 @@ void CTemplClass_RegisterObjectDef(TemplClass *tmclass, ObjBase *refobj) {
CTemplClass_AppendTemplateAction(tmclass, action);
}
-void CTemplClass_CompleteClass(TemplClass *templ, DeclE *de) {
- templ->lex_order_count = de->x8;
- if (de->xC)
- templ->flags |= TEMPLCLASS_FLAGS_1;
- templ->theclass.flags |= CLASS_FLAGS_2;
+void CTemplClass_CompleteClass(TemplClass *templ, ClassLayout *de) {
+ templ->lex_order_count = de->lex_order_count;
+ if (de->has_vtable)
+ templ->flags |= TEMPLCLASS_HAS_VTABLE;
+ templ->theclass.flags |= CLASS_COMPLETED;
}
static TemplClassInst *CTemplClass_NewInstance(TemplClass *templ, TemplArg *inst_args, TemplArg *oargs) {
@@ -224,7 +224,7 @@ static TemplClassInst *CTemplClass_NewInstance(TemplClass *templ, TemplArg *inst
}
inst->theclass.type = TYPECLASS;
- inst->theclass.flags = CLASS_FLAGS_800;
+ inst->theclass.flags = CLASS_IS_TEMPL_INST;
inst->theclass.nspace = nspace;
inst->theclass.classname = templ->theclass.classname;
inst->theclass.mode = templ->theclass.mode;
@@ -285,8 +285,8 @@ static void CTemplClass_ParseBody(TemplClass *templ, short mode, SInt32 *offset)
memclrw(&di, sizeof(di));
di.file = CPrep_BrowserCurrentFile();
- CPrep_BrowserFilePosition(&di.file2, &di.x60);
- di.x60 = *offset;
+ CPrep_BrowserFilePosition(&di.file2, &di.sourceoffset);
+ di.sourceoffset = *offset;
di.x28 = templ;
CDecl_ParseClass(&di, mode, 1, 0);
@@ -296,7 +296,7 @@ static void CTemplClass_ParseBody(TemplClass *templ, short mode, SInt32 *offset)
if (tk != ';')
CError_Error(CErrorStr123);
- CBrowse_NewTemplateClass(templ, di.file2, di.x60, CPrep_BrowserFileOffset() + 1);
+ CBrowse_NewTemplateClass(templ, di.file2, di.sourceoffset, CPrep_BrowserFileOffset() + 1);
}
void CTemplClass_ParsePartialSpecialization(DeclFucker *what_is_this, TemplParam *params, short mode, SInt32 *offset) {
@@ -394,7 +394,7 @@ void CTemplClass_ParsePartialSpecialization(DeclFucker *what_is_this, TemplParam
templ->templ__params = params;
CDecl_DefineClass(nspace, TEMPL_CLASS(type)->theclass.classname, TYPE_CLASS(templ), mode, 0, 0);
- templ->theclass.flags = CLASS_FLAGS_100;
+ templ->theclass.flags = CLASS_IS_TEMPL;
templ->pspec_owner = TEMPL_CLASS(type);
pspec = galloc(sizeof(TemplPartialSpec));
@@ -405,7 +405,7 @@ void CTemplClass_ParsePartialSpecialization(DeclFucker *what_is_this, TemplParam
pspec->next = TEMPL_CLASS(type)->pspecs;
TEMPL_CLASS(type)->pspecs = pspec;
} else {
- if ((pspec->templ->theclass.flags & CLASS_FLAGS_2) && tk != ';') {
+ if ((pspec->templ->theclass.flags & CLASS_COMPLETED) && tk != ';') {
CError_Error(CErrorStr132, TEMPL_CLASS(type)->theclass.classname->name);
return;
}
@@ -451,11 +451,11 @@ void CTemplClass_ParseClass(DeclFucker *what_is_this, TemplParam *params, short
templ->templ__params = params;
CDecl_DefineClass(nspace, tkidentifier, TYPE_CLASS(templ), mode, 0, 1);
- templ->theclass.flags = CLASS_FLAGS_100;
+ templ->theclass.flags = CLASS_IS_TEMPL;
templ->theclass.eflags = classDeclSpec;
tk = lex();
- if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_100)) {
+ if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL)) {
TemplateAction *action;
templ->templ_parent = TEMPL_CLASS(nspace->theclass);
@@ -484,7 +484,7 @@ void CTemplClass_ParseClass(DeclFucker *what_is_this, TemplParam *params, short
tk = lex();
- if ((templ->theclass.flags & CLASS_FLAGS_2) && tk != ';') {
+ if ((templ->theclass.flags & CLASS_COMPLETED) && tk != ';') {
CError_Error(CErrorStr132, templ->theclass.classname->name);
return;
}
@@ -793,7 +793,7 @@ TemplClass *CTemplClass_DefineNestedClass(TemplClass *parent, HashNameNode *name
templ->templ__params = NULL;
CDecl_DefineClass(parent->theclass.nspace, name, TYPE_CLASS(templ), mode, 0, 1);
- templ->theclass.flags = CLASS_FLAGS_100;
+ templ->theclass.flags = CLASS_IS_TEMPL;
templ->align = copts.structalignment;
action = galloc(sizeof(TemplateAction));
@@ -925,7 +925,7 @@ static void CTemplClass_CopyBaseClasses(TypeDeduce *deduce, TemplClassInst *inst
}
}
- if (inst->theclass.flags & CLASS_FLAGS_20)
+ if (inst->theclass.flags & CLASS_HAS_VBASES)
CDecl_MakeVBaseList(TYPE_CLASS(inst));
}
@@ -1159,10 +1159,10 @@ static void CTemplClass_CopyMemberTemplate(TypeDeduce *deduce, Object *src) {
CError_ASSERT(1553, IS_TYPE_FUNC(dest->type));
- TYPE_FUNC(dest->type)->flags |= FUNC_FLAGS_100000;
+ TYPE_FUNC(dest->type)->flags |= FUNC_IS_TEMPL;
if (
- (TYPE_FUNC(dest->type)->flags & FUNC_FLAGS_1000) &&
+ (TYPE_FUNC(dest->type)->flags & FUNC_IS_CTOR) &&
deduce->x17 &&
!action
)
@@ -1211,11 +1211,11 @@ static void CTemplClass_CopyObject(TypeDeduce *deduce, Object *src) {
if (flag)
dest->object.nspace = deduce->inst->theclass.nspace;
- dest->object.qual |= Q_400000;
+ dest->object.qual |= Q_IS_TEMPLATED;
dest->parent = src;
if (IS_TYPE_FUNC(dest->object.type))
- TYPE_FUNC(dest->object.type)->flags &= ~FUNC_FLAGS_2;
+ TYPE_FUNC(dest->object.type)->flags &= ~FUNC_DEFINED;
switch (dest->object.datatype) {
case DDATA:
@@ -1238,7 +1238,7 @@ static void CTemplClass_CopyObject(TypeDeduce *deduce, Object *src) {
CError_ASSERT(1651, !dest->object.u.func.u.templ && !dest->object.u.func.defargdata);
if (
- (TYPE_FUNC(dest->object.type)->flags & FUNC_FLAGS_1000) &&
+ (TYPE_FUNC(dest->object.type)->flags & FUNC_IS_CTOR) &&
deduce->x17 &&
!action
)
@@ -1251,7 +1251,7 @@ static void CTemplClass_CopyObject(TypeDeduce *deduce, Object *src) {
TYPE_FUNC(dest->object.type)->args->next = arg;
}
- if (TYPE_FUNC(dest->object.type)->flags & FUNC_FLAGS_40) {
+ if (TYPE_FUNC(dest->object.type)->flags & FUNC_CONVERSION) {
CError_ASSERT(1665, IS_TYPE_FUNC(src->type));
if (CTemplTool_IsTemplateArgumentDependentType(TYPE_FUNC(src->type)->functype)) {
CError_ASSERT(1668, action);
@@ -1319,19 +1319,19 @@ static void CTemplClass_CompleteObject(TypeDeduce *deduce, TemplateAction *actio
deduce->x15 = 0;
CError_ASSERT(1753, IS_TYPE_FUNC(dest->type));
- TYPE_FUNC(dest->type)->flags |= FUNC_FLAGS_100000;
+ TYPE_FUNC(dest->type)->flags |= FUNC_IS_TEMPL;
} else {
dest->type = CTemplTool_DeduceTypeCopy(deduce, dest->type, &dest->qual);
- dest->qual |= Q_400000;
+ dest->qual |= Q_IS_TEMPLATED;
if (IS_TYPE_FUNC(dest->type))
- TYPE_FUNC(dest->type)->flags &= ~FUNC_FLAGS_2;
+ TYPE_FUNC(dest->type)->flags &= ~FUNC_DEFINED;
switch (dest->datatype) {
case DFUNC:
case DVFUNC:
CError_ASSERT(1769, IS_TYPE_FUNC(dest->type));
- if (TYPE_FUNC(dest->type)->flags & FUNC_FLAGS_40) {
+ if (TYPE_FUNC(dest->type)->flags & FUNC_CONVERSION) {
CError_ASSERT(1772, IS_TYPE_FUNC(dest->type));
if (CTemplTool_IsTemplateArgumentDependentType(TYPE_FUNC(src->type)->functype)) {
dest->name = CMangler_ConversionFuncName(
@@ -1340,7 +1340,7 @@ static void CTemplClass_CompleteObject(TypeDeduce *deduce, TemplateAction *actio
}
}
- if ((TYPE_FUNC(dest->type)->flags & FUNC_FLAGS_1000) && deduce->x17) {
+ if ((TYPE_FUNC(dest->type)->flags & FUNC_IS_CTOR) && deduce->x17) {
FuncArg *arg;
CError_ASSERT(1786, TYPE_FUNC(dest->type)->args);
arg = CParser_NewFuncArg();
@@ -1360,7 +1360,7 @@ static void CTemplClass_CompleteObjectInit(TypeDeduce *deduce, TemplateAction *a
if (ENODE_IS(expr, EINTCONST) && (object->qual & Q_CONST) && IS_TYPE_INT_OR_ENUM(object->type)) {
object->u.data.u.intconst = expr->data.intval;
- object->qual |= Q_10000 | Q_20000;
+ object->qual |= Q_INLINE_DATA | Q_20000;
} else {
CError_Error(CErrorStr354, object->name->name);
}
@@ -1473,14 +1473,14 @@ Boolean CTempl_InstantiateTemplateClass(TypeClass *tclass) {
TypeDeduce deduce;
TemplStack stack;
CScopeSave saveScope;
- DeclE declE;
+ ClassLayout layout;
TemplClass *templ;
TStreamElement *saveErrorRef;
TemplArg *inst_args;
- CError_ASSERT(1989, tclass->flags & CLASS_FLAGS_800);
+ CError_ASSERT(1989, tclass->flags & CLASS_IS_TEMPL_INST);
- if (tclass->flags & CLASS_FLAGS_2)
+ if (tclass->flags & CLASS_COMPLETED)
return 1;
inst = TEMPL_CLASS_INST(tclass);
@@ -1498,7 +1498,7 @@ Boolean CTempl_InstantiateTemplateClass(TypeClass *tclass) {
inst->inst_args = inst_args;
}
- if (!(templ->theclass.flags & CLASS_FLAGS_2))
+ if (!(templ->theclass.flags & CLASS_COMPLETED))
return 0;
if (inst->is_instantiated)
@@ -1522,11 +1522,11 @@ Boolean CTempl_InstantiateTemplateClass(TypeClass *tclass) {
CError_ASSERT(2049, !templ->theclass.vtable);
inst->theclass.flags |= templ->theclass.flags &
- (CLASS_FLAGS_ABSTRACT | CLASS_FLAGS_10 | CLASS_FLAGS_20 | CLASS_FLAGS_40 | CLASS_FLAGS_2000);
+ (CLASS_ABSTRACT | CLASS_SINGLE_OBJECT | CLASS_HAS_VBASES | CLASS_IS_CONVERTIBLE | CLASS_COM_OBJECT);
CTemplClass_CopyBaseClasses(&deduce, inst, templ);
- deduce.x17 = (inst->theclass.flags & CLASS_FLAGS_20) && !(templ->theclass.flags & CLASS_FLAGS_20);
+ deduce.x17 = (inst->theclass.flags & CLASS_HAS_VBASES) && !(templ->theclass.flags & CLASS_HAS_VBASES);
for (action = templ->actions; action; action = action->next) {
switch (action->type) {
@@ -1610,13 +1610,13 @@ Boolean CTempl_InstantiateTemplateClass(TypeClass *tclass) {
}
}
- memclrw(&declE, sizeof(declE));
- declE.x8 = templ->lex_order_count;
- declE.xC = templ->flags & TEMPLCLASS_FLAGS_1;
+ memclrw(&layout, sizeof(layout));
+ layout.lex_order_count = templ->lex_order_count;
+ layout.has_vtable = templ->flags & TEMPLCLASS_HAS_VTABLE;
saveAlignMode = copts.structalignment;
copts.structalignment = templ->align;
- CDecl_CompleteClass(&declE, TYPE_CLASS(inst));
+ CDecl_CompleteClass(&layout, TYPE_CLASS(inst));
copts.structalignment = saveAlignMode;
if (templ->theclass.align > inst->theclass.align) {