Mark unsigned constants in AST dumps.

- Add the u suffix to unsigned integer constants printed in AST dumps.
This commit is contained in:
Randy Heit 2013-09-10 21:48:15 -05:00
parent 1b4851224e
commit 52d5e74e7e

View file

@ -140,10 +140,18 @@ public:
{ {
Add(&c, 1); Add(&c, 1);
} }
void AddInt(int i) void AddInt(int i, bool un=false)
{ {
char buf[16]; char buf[16];
size_t len = mysnprintf(buf, countof(buf), "%d", i); size_t len;
if (!un)
{
len = mysnprintf(buf, countof(buf), "%d", i);
}
else
{
len = mysnprintf(buf, countof(buf), "%uu", i);
}
Add(buf, len); Add(buf, len);
} }
void AddHex(unsigned x) void AddHex(unsigned x)
@ -528,9 +536,9 @@ static void PrintExprConstant(FLispString &out, ZCC_TreeNode *node)
{ {
out.AddFloat(enode->DoubleVal); out.AddFloat(enode->DoubleVal);
} }
else else if (enode->Type->IsKindOf(RUNTIME_CLASS(PInt)))
{ {
out.AddInt(enode->IntVal); out.AddInt(enode->IntVal, static_cast<PInt *>(enode->Type)->Unsigned);
} }
out.Close(); out.Close();
} }