1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Better ToString support for values

This commit is contained in:
Brian Fiete 2020-06-16 07:50:40 -07:00
parent cbacf99a61
commit 014ce28195
5 changed files with 43 additions and 34 deletions

View file

@ -1197,9 +1197,16 @@ String BfIRBuilder::ToString(BfIRValue irValue)
{
auto val = mBeIRCodeGen->GetBeValue(irValue.mId);
String str;
BeDumpContext dc;
dc.mModule = mBeIRCodeGen->mBeModule;
BeDumpContext dc;
dc.ToString(str, val);
auto type = val->GetType();
if (type != NULL)
{
str += "\n";
dc.ToString(str, type);
}
return str;
}
#endif
@ -1267,8 +1274,7 @@ String BfIRBuilder::ToString(BfIRType irType)
}
String str;
BeDumpContext dc;
dc.mModule = mBeIRCodeGen->mBeModule;
BeDumpContext dc;
dc.ToString(str, beType);
return str;
}
@ -1302,8 +1308,7 @@ String BfIRBuilder::ToString(BfIRFunction irFunc)
return "null";
String str;
BeDumpContext dc;
dc.mModule = mBeIRCodeGen->mBeModule;
BeDumpContext dc;
dc.ToString(str, val);
return str;
}
@ -1349,8 +1354,7 @@ String BfIRBuilder::ToString(BfIRMDNode irMDNode)
if (md == NULL)
return "null";
String str;
BeDumpContext dc;
dc.mModule = mBeIRCodeGen->mBeModule;
BeDumpContext dc;
dc.ToString(str, md);
return str;
}
@ -5060,3 +5064,4 @@ void BfIRBuilder::DbgCreateAnnotation(BfIRMDNode scope, const StringImpl& name,
NEW_CMD_INSERTED;
}

View file

@ -1260,7 +1260,7 @@ public:
void DbgCreateGlobalVariable(BfIRMDNode context, const StringImpl& name, const StringImpl& linkageName, BfIRMDNode file, int lineNumber,
BfIRMDNode type, bool isLocalToUnit, BfIRValue val, BfIRMDNode Decl = BfIRMDNode());
BfIRMDNode DbgCreateLexicalBlock(BfIRMDNode scope, BfIRMDNode file, int line, int col);
void DbgCreateAnnotation(BfIRMDNode scope, const StringImpl& name, BfIRValue value);
void DbgCreateAnnotation(BfIRMDNode scope, const StringImpl& name, BfIRValue value);
};
NS_BF_END