Skip to content
Permalink
Browse files

- report implicitly initialized variable in code generator once

Vectors are no longer reported several times
Previously, warnings were issued per every register
  • Loading branch information...
alexey-lysiuk committed Jun 8, 2019
1 parent 0244560 commit 4a2ae357a2136cc9d152de86ed2e070d117c53ab
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/scripting/backend/codegen.cpp
@@ -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)
{
@@ -11390,6 +11393,11 @@ ExpEmit FxLocalVariableDeclaration::Emit(VMFunctionBuilder *build)
break;
}
}

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

0 comments on commit 4a2ae35

Please sign in to comment.
You can’t perform that action at this time.