summaryrefslogtreecommitdiff
path: root/compiler_and_linker/unsorted/CTemplateNew.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/CTemplateNew.c
parent7d986adf37220e1981a707745b784b078de4e3bc (diff)
downloadMWCC-0905072b3ccfcb394b1dca2405a55cff4e2b9271.tar.gz
MWCC-0905072b3ccfcb394b1dca2405a55cff4e2b9271.zip
tons more renaming of stuff
Diffstat (limited to 'compiler_and_linker/unsorted/CTemplateNew.c')
-rw-r--r--compiler_and_linker/unsorted/CTemplateNew.c96
1 files changed, 48 insertions, 48 deletions
diff --git a/compiler_and_linker/unsorted/CTemplateNew.c b/compiler_and_linker/unsorted/CTemplateNew.c
index 9c94349..c33534a 100644
--- a/compiler_and_linker/unsorted/CTemplateNew.c
+++ b/compiler_and_linker/unsorted/CTemplateNew.c
@@ -278,12 +278,12 @@ static ENode *CTempl_ParseTemplArgExpr(Type *type, UInt32 qual) {
}
static Type *CTempl_ParseTemplArgTempl(TemplParam *params) {
- CScopeParseResult pr;
+ NameResult pr;
if (
(tk != TK_IDENTIFIER && tk != TK_COLON_COLON) ||
!CScope_ParseDeclName(&pr) ||
- !pr.x8
+ !pr.type
)
{
CError_Error(CErrorStr121);
@@ -291,26 +291,26 @@ static Type *CTempl_ParseTemplArgTempl(TemplParam *params) {
return NULL;
}
- if (IS_TEMPL_CLASS(pr.x8)) {
- if (params && !CTemplTool_EqualParams(params->data.templparam.plist, TEMPL_CLASS(pr.x8)->templ__params, 0)) {
+ if (IS_TEMPL_CLASS(pr.type)) {
+ if (params && !CTemplTool_EqualParams(params->data.templparam.plist, TEMPL_CLASS(pr.type)->templ__params, 0)) {
CError_Error(CErrorStr235);
tk = lex();
return NULL;
}
} else {
- if (!CTemplTool_IsTemplateArgumentDependentType(pr.x8))
+ if (!CTemplTool_IsTemplateArgumentDependentType(pr.type))
CError_Error(CErrorStr146);
}
tk = lex();
- return pr.x8;
+ return pr.type;
}
static UInt8 CTempl_GetTemplateNestIndex(NameSpace *nspace) {
UInt8 count = 0;
while (nspace) {
- if (nspace->theclass && (nspace->theclass->flags & CLASS_FLAGS_900))
+ if (nspace->theclass && (nspace->theclass->flags & CLASS_IS_TEMPL_ANY))
count++;
nspace = nspace->parent;
}
@@ -778,7 +778,7 @@ Boolean CTempl_IsQualifiedMember(DeclInfo *di, Type *type, NameSpace **resultnsp
static void *CTempl_ParseMemberFunction(int unk1, int unk2, int unk3, Object *func) {
// no idea what should've been here, it's not called
- CError_ASSERT(974, TYPE_FUNC(func->type)->flags & FUNC_FLAGS_METHOD);
+ CError_ASSERT(974, TYPE_FUNC(func->type)->flags & FUNC_METHOD);
return NULL;
}
@@ -792,7 +792,7 @@ static void CTempl_ParseMember(TemplParam *params, TemplClass *templ, DeclInfo *
Boolean saveForceLoc;
TemplateMember *member;
- if (templ->theclass.flags & CLASS_FLAGS_100)
+ if (templ->theclass.flags & CLASS_IS_TEMPL)
di->thetype = CTemplTool_ResolveMemberSelfRefs(templ, di->thetype, &di->qual);
if (IS_TYPE_FUNC(di->thetype)) {
@@ -811,12 +811,12 @@ static void CTempl_ParseMember(TemplParam *params, TemplClass *templ, DeclInfo *
}
if (
- (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_2) &&
- (!(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_100000) || object->u.func.u.templ->instances)
+ (TYPE_FUNC(object->type)->flags & FUNC_DEFINED) &&
+ (!(TYPE_FUNC(object->type)->flags & FUNC_IS_TEMPL) || object->u.func.u.templ->instances)
)
CError_Error(CErrorStr333, object);
- TYPE_FUNC(object->type)->flags |= FUNC_FLAGS_800000 | FUNC_FLAGS_2;
+ TYPE_FUNC(object->type)->flags |= FUNC_IS_TEMPL_INSTANCE | FUNC_DEFINED;
CPrep_StreamGetBlock(&stream, NULL, 1);
saveForceLoc = gForceSourceLoc;
@@ -859,7 +859,7 @@ static void CTempl_ParseMember(TemplParam *params, TemplClass *templ, DeclInfo *
object->u.func.u.templ->stream = stream;
} else {
- if (!(templ->theclass.flags & CLASS_FLAGS_100)) {
+ if (!(templ->theclass.flags & CLASS_IS_TEMPL)) {
CError_Error(CErrorStr190);
return;
}
@@ -903,9 +903,9 @@ static TemplateFunction *CTempl_DeclareTemplateFunction(DeclInfo *di, TemplParam
object->name = di->name;
object->u.func.linkname = CParser_GetUniqueName();
object->type = di->thetype;
- object->qual = di->qual | Q_80000;
+ object->qual = di->qual | Q_MANGLE_NAME;
object->sclass = di->storageclass;
- TYPE_FUNC(object->type)->flags |= FUNC_FLAGS_100000;
+ TYPE_FUNC(object->type)->flags |= FUNC_IS_TEMPL;
object->u.func.u.templ = templ;
if (di->qual & Q_INLINE)
@@ -931,10 +931,10 @@ static void CTempl_ParseTemplateFunction(TemplateFunction *templ, TypeClass *tcl
object->sclass = TK_STATIC;
}
- if (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_2)
+ if (TYPE_FUNC(object->type)->flags & FUNC_DEFINED)
CError_Error(CErrorStr333, object);
- TYPE_FUNC(object->type)->flags |= FUNC_FLAGS_2 | FUNC_FLAGS_800000;
+ TYPE_FUNC(object->type)->flags |= FUNC_DEFINED | FUNC_IS_TEMPL_INSTANCE;
CPrep_StreamGetBlock(&templ->stream, NULL, 0);
@@ -972,7 +972,7 @@ static HashNameNode *CTempl_FindConversionFuncName(TypeClass *tclass, Type *type
return NULL;
} while (
!IS_TYPE_FUNC(object->type) ||
- !(TYPE_FUNC(object->type)->flags & FUNC_FLAGS_40) ||
+ !(TYPE_FUNC(object->type)->flags & FUNC_CONVERSION) ||
(TYPE_FUNC(object->type)->qual & (Q_CONST | Q_VOLATILE)) != (qual & (Q_CONST | Q_VOLATILE)) ||
!is_typesame(TYPE_FUNC(object->type)->functype, type)
);
@@ -987,7 +987,7 @@ static void CTempl_ParseConversionFunctionTemplate(DeclInfo *di, DeclFucker *wha
return;
}
- tclass->flags = tclass->flags | CLASS_FLAGS_40;
+ tclass->flags = tclass->flags | CLASS_IS_CONVERTIBLE;
CError_QualifierCheck(di->qual & ~Q_INLINE);
conversion_type_name(di);
@@ -1063,12 +1063,12 @@ static void CTempl_ParseFunctionOrMemberTemplate(DeclFucker *what_is_this, Templ
CError_ASSERT(1344, IS_TYPE_FUNC(di.x10->type));
tfunc = TYPE_FUNC(di.x10->type);
- if (tfunc->flags & FUNC_FLAGS_40) {
+ if (tfunc->flags & FUNC_CONVERSION) {
di.thetype = tfunc->functype;
di.qual |= tfunc->qual;
di.nspace = di.x10->nspace;
di.name = di.x10->name;
- } else if (tfunc->flags & FUNC_FLAGS_1000) {
+ } else if (tfunc->flags & FUNC_IS_CTOR) {
di.thetype = TYPE(&void_ptr);
di.nspace = di.x10->nspace;
di.name = di.x10->name;
@@ -1102,7 +1102,7 @@ static void CTempl_ParseFunctionOrMemberTemplate(DeclFucker *what_is_this, Templ
}
}
- CError_QualifierCheck(di.qual & ~(Q_CONST | Q_VOLATILE | Q_ASM | Q_PASCAL | Q_INLINE | Q_EXPLICIT | Q_20000 | Q_OVERLOAD | Q_ALIGNED_MASK));
+ CError_QualifierCheck(di.qual & ~(Q_CONST | Q_VOLATILE | Q_ASM | Q_PASCAL | Q_INLINE | Q_EXPLICIT | Q_20000 | Q_WEAK | Q_ALIGNED_MASK));
if (tk == TK_OPERATOR && di.x4A) {
CTempl_ParseConversionFunctionTemplate(&di, what_is_this, params, tclass, startOffset, access);
@@ -1126,10 +1126,10 @@ static void CTempl_ParseFunctionOrMemberTemplate(DeclFucker *what_is_this, Templ
TYPE_FUNC(di.thetype)->args = NULL;
}
- if (tclass->flags & CLASS_FLAGS_20)
+ if (tclass->flags & CLASS_HAS_VBASES)
CDecl_AddArgument(TYPE_FUNC(di.thetype), TYPE(&stsignedshort));
- TYPE_FUNC(di.thetype)->flags |= FUNC_FLAGS_1000;
+ TYPE_FUNC(di.thetype)->flags |= FUNC_IS_CTOR;
di.name = constructor_name_node;
what_is_this->nspace->tparams = NULL;
@@ -1165,10 +1165,10 @@ static void CTempl_ParseFunctionOrMemberTemplate(DeclFucker *what_is_this, Templ
if (IS_TYPE_FUNC(di.thetype)) {
di.name = constructor_name_node;
- if (tclass2->flags & CLASS_FLAGS_20)
+ if (tclass2->flags & CLASS_HAS_VBASES)
CDecl_AddArgument(TYPE_FUNC(di.thetype), TYPE(&stsignedshort));
- TYPE_FUNC(di.thetype)->flags |= FUNC_FLAGS_1000;
+ TYPE_FUNC(di.thetype)->flags |= FUNC_IS_CTOR;
CTempl_ParseMember(params, TEMPL_CLASS(tclass2), &di, startOffset);
} else {
CError_Error(CErrorStr241);
@@ -1228,7 +1228,7 @@ static void CTempl_ParseFunctionOrMemberTemplate(DeclFucker *what_is_this, Templ
CDecl_AddArgument(TYPE_FUNC(di.thetype), TYPE(&stsignedshort));
di.name = destructor_name_node;
- TYPE_FUNC(di.thetype)->flags |= FUNC_FLAGS_2000;
+ TYPE_FUNC(di.thetype)->flags |= FUNC_IS_DTOR;
CTempl_ParseMember(params, TEMPL_CLASS(tclass2), &di, startOffset);
} else {
CError_Error(CErrorStr241);
@@ -1360,7 +1360,7 @@ static void CTempl_ExplicitInstantiation(void) {
if (tk == ';') {
if (IS_TEMPL_CLASS_INST(di.thetype)) {
CTempl_InstantiateTemplateClass(TYPE_CLASS(di.thetype));
- if ((TYPE_CLASS(di.thetype)->flags & CLASS_FLAGS_2) && !(TYPE_CLASS(di.thetype)->eflags & CLASS_EFLAGS_IMPORT)) {
+ if ((TYPE_CLASS(di.thetype)->flags & CLASS_COMPLETED) && !(TYPE_CLASS(di.thetype)->eflags & CLASS_EFLAGS_IMPORT)) {
if (flag)
CTempl_GenClassInstance(TEMPL_CLASS_INST(di.thetype), 1);
else
@@ -1525,13 +1525,13 @@ void CTempl_Parse(TemplClass *templ, AccessType access) {
switch (tk) {
case TK_CLASS:
- mode = CLASS_MODE_2;
+ mode = CLASS_MODE_CLASS;
break;
case TK_UNION:
- mode = CLASS_MODE_1;
+ mode = CLASS_MODE_UNION;
break;
case TK_STRUCT:
- mode = CLASS_MODE_0;
+ mode = CLASS_MODE_STRUCT;
break;
default:
mode = -1;
@@ -1587,7 +1587,7 @@ void CTempl_ParseInstanceScopeFunction(Object *funcobj, TemplClassInst *inst, Ty
TemplStack stack;
params = inst->templ->templ__params;
- if (funcobj->qual & Q_400000) {
+ if (funcobj->qual & Q_IS_TEMPLATED) {
for (member = CTemplClass_GetMasterTemplate(inst->templ)->members, parent = OBJECT_TEMPL(funcobj)->parent; member; member = member->next) {
if (member->object == parent) {
if (member->params)
@@ -1656,12 +1656,12 @@ Boolean CTempl_GenFuncInstance(TemplateFunction *templ, TemplFuncInstance *inst,
}
if (inst->object->sclass != TK_STATIC)
- inst->object->qual |= Q_OVERLOAD;
+ inst->object->qual |= Q_WEAK;
memclrw(&di, sizeof(di));
di.file2 = templ->srcfile;
di.file = CPrep_BrowserCurrentFile();
- di.x60 = templ->startoffset;
+ di.sourceoffset = templ->startoffset;
CTemplTool_PushInstance(&stack, NULL, inst->object);
CTemplTool_MergeArgNames(TYPE_FUNC(templ->tfunc->type), TYPE_FUNC(inst->object->type));
@@ -1682,7 +1682,7 @@ Boolean CTempl_GenFuncInstance(TemplateFunction *templ, TemplFuncInstance *inst,
copts.filesyminfo = saveDebugInfo;
if (di.file->recordbrowseinfo)
- CBrowse_NewFunction(inst->object, di.file, di.file2, di.x60, templ->endoffset);
+ CBrowse_NewFunction(inst->object, di.file, di.file2, di.sourceoffset, templ->endoffset);
return 1;
}
@@ -1719,12 +1719,12 @@ void CTempl_InstantiateMember(TemplClass *templ, TemplClassInst *inst, TemplateM
}
if (object->sclass != TK_STATIC)
- object->qual |= Q_OVERLOAD;
+ object->qual |= Q_WEAK;
memclrw(&di, sizeof(di));
di.file2 = tmemb->srcfile;
di.file = CPrep_BrowserCurrentFile();
- di.x60 = tmemb->startoffset;
+ di.sourceoffset = tmemb->startoffset;
switch (object->datatype) {
case DFUNC:
@@ -1782,24 +1782,24 @@ static Boolean CTempl_GenClassInstance(TemplClassInst *inst, Boolean flag) {
if (IS_TYPE_FUNC(object->type) && object->datatype != DALIAS) {
if (
(flag || (object->flags & OBJECT_FLAGS_2)) &&
- !(TYPE_FUNC(object->type)->flags & (FUNC_FLAGS_2 | FUNC_FLAGS_100)) &&
+ !(TYPE_FUNC(object->type)->flags & (FUNC_DEFINED | FUNC_AUTO_GENERATED)) &&
CTempl_GenMemberInstance(inst, OBJECT_TEMPL(object), flag) &&
- (TYPE_FUNC(object->type)->flags & FUNC_FLAGS_2)
+ (TYPE_FUNC(object->type)->flags & FUNC_DEFINED)
)
result = 1;
} else {
if (
- !inst->x49 &&
+ !inst->static_instantiated &&
object->datatype == DDATA &&
- !(object->qual & Q_10000) &&
- !(object->flags & OBJECT_FLAGS_4) &&
+ !(object->qual & Q_INLINE_DATA) &&
+ !(object->flags & OBJECT_DEFINED) &&
CTempl_GenMemberInstance(inst, OBJECT_TEMPL(object), flag)
)
result = 1;
}
}
- inst->x49 = 1;
+ inst->static_instantiated = 1;
return result;
}
@@ -1814,7 +1814,7 @@ Boolean CTempl_Instantiate(void) {
for (templ = ctempl_templates; templ; templ = templ->next) {
for (inst = templ->instances; inst; inst = inst->next) {
if (
- (inst->theclass.flags & CLASS_FLAGS_800) &&
+ (inst->theclass.flags & CLASS_IS_TEMPL_INST) &&
!inst->is_specialized &&
CTempl_GenClassInstance(inst, 0)
)
@@ -1824,7 +1824,7 @@ Boolean CTempl_Instantiate(void) {
for (pspec = templ->pspecs; pspec; pspec = pspec->next) {
for (inst = pspec->templ->instances; inst; inst = inst->next) {
if (
- (inst->theclass.flags & CLASS_FLAGS_800) &&
+ (inst->theclass.flags & CLASS_IS_TEMPL_INST) &&
!inst->is_specialized &&
CTempl_GenClassInstance(inst, 0)
)
@@ -1839,7 +1839,7 @@ Boolean CTempl_Instantiate(void) {
!instf->is_instantiated &&
!instf->is_specialized &&
(instf->object->flags & OBJECT_FLAGS_2) &&
- !(TYPE_FUNC(instf->object->type)->flags & FUNC_FLAGS_2)
+ !(TYPE_FUNC(instf->object->type)->flags & FUNC_DEFINED)
)
{
instf->is_instantiated = 1;
@@ -1857,9 +1857,9 @@ Boolean CTempl_InlineFunctionCheck(Object *funcobj) {
TemplateMember *member;
Object *parent;
- CError_ASSERT(2422, IS_TYPE_FUNC(funcobj->type) && (funcobj->qual & Q_400000));
+ CError_ASSERT(2422, IS_TYPE_FUNC(funcobj->type) && (funcobj->qual & Q_IS_TEMPLATED));
- if (!(TYPE_FUNC(funcobj->type)->flags & FUNC_FLAGS_2)) {
+ if (!(TYPE_FUNC(funcobj->type)->flags & FUNC_DEFINED)) {
inst = TEMPL_CLASS_INST(TYPE_METHOD(funcobj->type)->theclass);
if (!inst->is_specialized) {
parent = OBJECT_TEMPL(funcobj)->parent;