Fix dbj file reference with optimized variable

This commit is contained in:
drmortalwombat 2024-01-06 14:03:29 +01:00
parent 1c1d7fefaa
commit d676ccc1bd

View File

@ -1435,6 +1435,7 @@ bool Compiler::WriteDbjFile(const char* filename)
InterVariable* v(p->mLocalVars[i]); InterVariable* v(p->mLocalVars[i]);
if (v && v->mIdent) if (v && v->mIdent)
{ {
bool skipped = false;
if (v->mLinkerObject) if (v->mLinkerObject)
{ {
if (v->mLinkerObject->mFlags & LOBJF_PLACED) if (v->mLinkerObject->mFlags & LOBJF_PLACED)
@ -1450,11 +1451,13 @@ bool Compiler::WriteDbjFile(const char* filename)
} }
else else
{ {
skipped = true;
// Prepared space on the stack but not used // Prepared space on the stack but not used
} }
} }
else if (v->mTemp) else if (v->mTemp)
{ {
skipped = true;
// Promoted to local variable // Promoted to local variable
} }
else if (p->mFramePointer) else if (p->mFramePointer)
@ -1480,11 +1483,14 @@ bool Compiler::WriteDbjFile(const char* filename)
types.IndexOrPush(v->mDeclaration->mBase)); types.IndexOrPush(v->mDeclaration->mBase));
} }
if (!skipped)
{
if (v->mDeclaration) if (v->mDeclaration)
DumpReferences(file, v->mDeclaration); DumpReferences(file, v->mDeclaration);
fprintf(file, "}"); fprintf(file, "}");
} }
} }
}
fprintf(file, "]"); fprintf(file, "]");
DumpReferences(file, p->mDeclaration); DumpReferences(file, p->mDeclaration);