summaryrefslogtreecommitdiff
path: root/compiler_and_linker/unsorted/CException.c
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-10 11:05:21 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-10 11:05:21 +0000
commitaec1b8dddc68ecb8288ec6132932e4c7b4bca09f (patch)
tree8138328fe43bcc5fff690dc60caac79aa570ab2b /compiler_and_linker/unsorted/CException.c
parentfcfbafff31869ed808bff0639532db1828660e92 (diff)
downloadMWCC-aec1b8dddc68ecb8288ec6132932e4c7b4bca09f.tar.gz
MWCC-aec1b8dddc68ecb8288ec6132932e4c7b4bca09f.zip
getting close to done
Diffstat (limited to 'compiler_and_linker/unsorted/CException.c')
-rw-r--r--compiler_and_linker/unsorted/CException.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/compiler_and_linker/unsorted/CException.c b/compiler_and_linker/unsorted/CException.c
index 2fdd2d3..d8a100c 100644
--- a/compiler_and_linker/unsorted/CException.c
+++ b/compiler_and_linker/unsorted/CException.c
@@ -25,13 +25,6 @@ typedef struct UniqueObj {
SInt32 uniqueid;
} UniqueObj;
-typedef struct DtorTemp {
- struct DtorTemp *next;
- Object *object;
- Object *dtor;
- Object *temp;
-} DtorTemp;
-
ExceptionAction *cexcept_dobjstack;
Boolean cexcept_hasdobjects;
Boolean cexcept_magic;
@@ -311,7 +304,7 @@ ENode *CExcept_RegisterDestructorObject(Object *local, SInt32 offset, Object *dt
cexcept_dobjstack = action;
expr = create_objectrefnode(local);
- dtorObject = CABI_GetDestructorObject(dtor, 1);
+ dtorObject = CABI_GetDestructorObject(dtor, CABIDestroy1);
if (offset == 0) {
action->type = EAT_DESTROYLOCAL;
@@ -339,7 +332,7 @@ void CExcept_RegisterLocalArray(Statement *stmt, Object *localarray, Object *dto
action->prev = cexcept_dobjstack;
cexcept_dobjstack = action;
- dtorObject = CABI_GetDestructorObject(dtor, 1);
+ dtorObject = CABI_GetDestructorObject(dtor, CABIDestroy1);
action->type = EAT_DESTROYLOCALARRAY;
action->data.destroy_local_array.localarray = localarray;
@@ -493,10 +486,10 @@ void CExcept_RegisterMember(Statement *stmt, Object *objectptr, SInt32 offset, O
if (cond == NULL) {
if (isMember) {
action->type = EAT_DESTROYMEMBER;
- action->data.destroy_member.dtor = CABI_GetDestructorObject(dtor, 1);
+ action->data.destroy_member.dtor = CABI_GetDestructorObject(dtor, CABIDestroy1);
} else {
action->type = EAT_DESTROYBASE;
- action->data.destroy_member.dtor = CABI_GetDestructorObject(dtor, 0);
+ action->data.destroy_member.dtor = CABI_GetDestructorObject(dtor, CABIDestroy0);
}
action->data.destroy_member.objectptr = objectptr;
action->data.destroy_member.offset = offset;
@@ -505,7 +498,7 @@ void CExcept_RegisterMember(Statement *stmt, Object *objectptr, SInt32 offset, O
action->type = EAT_DESTROYMEMBERCOND;
action->data.destroy_member_cond.objectptr = objectptr;
action->data.destroy_member_cond.cond = cond;
- action->data.destroy_member_cond.dtor = CABI_GetDestructorObject(dtor, 1);
+ action->data.destroy_member_cond.dtor = CABI_GetDestructorObject(dtor, CABIDestroy1);
action->data.destroy_member_cond.offset = offset;
}
@@ -521,7 +514,7 @@ void CExcept_RegisterMemberArray(Statement *stmt, Object *objectptr, SInt32 offs
action->type = EAT_DESTROYMEMBERARRAY;
action->data.destroy_member_array.objectptr = objectptr;
- action->data.destroy_member_array.dtor = CABI_GetDestructorObject(dtor, 1);
+ action->data.destroy_member_array.dtor = CABI_GetDestructorObject(dtor, CABIDestroy1);
action->data.destroy_member_array.offset = offset;
action->data.destroy_member_array.elements = elements;
action->data.destroy_member_array.element_size = element_size;
@@ -537,7 +530,7 @@ static Statement *CExcept_DestroyLocal(ExceptionAction *ea, Statement *stmt, Obj
if (offset)
expr = makediadicnode(expr, intconstnode(TYPE(&stunsignedlong), offset), EADD);
- expr = CABI_DestroyObject(dtor, expr, 1, 1, 0);
+ expr = CABI_DestroyObject(dtor, expr, CABIDestroy1, 1, 0);
CError_ASSERT(687, expr->type == EFUNCCALL && expr->data.funccall.funcref->type == EOBJREF);
if (expr->data.funccall.funcref->data.objref->datatype == DVFUNC)
@@ -565,7 +558,7 @@ static Statement *CExcept_DestroyLocalArray(ExceptionAction *ea, Statement *stmt
newStmt = CFunc_InsertStatement(ST_EXPRESSION, stmt);
if (dtor)
- dtorExpr = create_objectrefnode(CABI_GetDestructorObject(dtor, 1));
+ dtorExpr = create_objectrefnode(CABI_GetDestructorObject(dtor, CABIDestroy1));
else
dtorExpr = nullnode();
@@ -956,7 +949,7 @@ ENode *CExcept_ScanThrowExpression(void) {
Xthrw_func,
expr,
resultExpr,
- create_objectrefnode(CABI_GetDestructorObject(func, 1)),
+ create_objectrefnode(CABI_GetDestructorObject(func, CABIDestroy1)),
NULL);
} else {
expr = funccallexpr(
@@ -1318,7 +1311,7 @@ static ENode *CExcept_TempTrans_ETEMP(ENode *expr) {
cexcept_eabefore = ea;
ea->type = EAT_DESTROYLOCAL;
ea->data.destroy_local.local = dtorTemp->object;
- ea->data.destroy_local.dtor = CABI_GetDestructorObject(dtorTemp->dtor, 1);
+ ea->data.destroy_local.dtor = CABI_GetDestructorObject(dtorTemp->dtor, CABIDestroy1);
ea = lalloc(sizeof(ExceptionAction));
*ea = *cexcept_eabefore;
@@ -1635,7 +1628,7 @@ static ENode *CExcept_TempTransFuncCall(ENode *expr, Boolean isCond) {
ea->type = EAT_DESTROYLOCALCOND;
ea->data.destroy_local_cond.local = dtorTemp->object;
- ea->data.destroy_local_cond.dtor = CABI_GetDestructorObject(dtorTemp->dtor, 1);
+ ea->data.destroy_local_cond.dtor = CABI_GetDestructorObject(dtorTemp->dtor, CABIDestroy1);
ea->data.destroy_local_cond.cond = dtorTemp->temp;
ea = lalloc(sizeof(ExceptionAction));
@@ -1653,7 +1646,7 @@ static ENode *CExcept_TempTransFuncCall(ENode *expr, Boolean isCond) {
ea->type = EAT_DESTROYLOCAL;
ea->data.destroy_local.local = dtorTemp->object;
- ea->data.destroy_local.dtor = CABI_GetDestructorObject(dtorTemp->dtor, 1);
+ ea->data.destroy_local.dtor = CABI_GetDestructorObject(dtorTemp->dtor, CABIDestroy1);
ea = lalloc(sizeof(ExceptionAction));
*ea = *cexcept_eabefore;
@@ -1896,7 +1889,7 @@ static Statement *CExcept_DtorTransform(Statement *stmt) {
}
curStmt = CFunc_InsertStatement(ST_EXPRESSION, curStmt);
- curStmt->expr = CABI_DestroyObject(dtorTemp->dtor, create_objectrefnode(dtorTemp->object), 1, 1, 0);
+ curStmt->expr = CABI_DestroyObject(dtorTemp->dtor, create_objectrefnode(dtorTemp->object), CABIDestroy1, 1, 0);
curStmt->dobjstack = cexcept_eaafter;
if (dtorTemp->temp) {