Skip to content

Commit

Permalink
- report implicitly initialized variable in code generator once
Browse files Browse the repository at this point in the history
Vectors are no longer reported several times
Previously, warnings were issued per every register
  • Loading branch information
alexey-lysiuk authored and madame-rachelle committed Jun 8, 2019
1 parent c731bb4 commit 5df1222
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/scripting/backend/codegen.cpp
Expand Up @@ -11358,14 +11358,17 @@ ExpEmit FxLocalVariableDeclaration::Emit(VMFunctionBuilder *build)
auto& registers = build->Registers[regType];
RegNum = registers.Get(RegCount);

// Check for reused registers and clean them if needed
bool useDirtyRegisters = false;

for (int reg = RegNum, end = RegNum + RegCount; reg < end; ++reg)
{
if (!registers.IsDirty(reg))
{
continue;
}

ScriptPosition.Message(MSG_DEBUGMSG, "Implicit initialization of variable %s\n", Name.GetChars());
useDirtyRegisters = true;

switch (regType)
{
Expand All @@ -11390,6 +11393,11 @@ ExpEmit FxLocalVariableDeclaration::Emit(VMFunctionBuilder *build)
break;
}
}

if (useDirtyRegisters)
{
ScriptPosition.Message(MSG_DEBUGMSG, "Implicit initialization of variable %s", Name.GetChars());
}
}
else
{
Expand Down

0 comments on commit 5df1222

Please sign in to comment.