MCPcopy Create free account
hub / github.com/beefytech/Beef / ToString

Method ToString

IDEHelper/Compiler/BfIRBuilder.cpp:288–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288String BfIRConstHolder::ToString(BfIRValue irValue)
289{
290 if ((irValue.mFlags & BfIRValueFlags_Const) != 0)
291 {
292 auto constant = GetConstantById(irValue.mId);
293
294 if (constant->mTypeCode == BfTypeCode_None)
295 {
296 return "void";
297 }
298 else if (constant->mTypeCode == BfTypeCode_NullPtr)
299 {
300 String ret;
301 if (constant->mIRType)
302 {
303 ret += ToString(constant->mIRType);
304 ret += " ";
305 }
306 ret += "null";
307 return ret;
308 }
309 else if (constant->mTypeCode == BfTypeCode_Boolean)
310 {
311 return constant->mBool ? "true" : "false";
312 }
313 else if (constant->mTypeCode == BfTypeCode_Float)
314 {
315 return StrFormat("Constant %ff", constant->mDouble);
316 }
317 else if (constant->mTypeCode == BfTypeCode_Double)
318 {
319 return StrFormat("Constant %f", constant->mDouble);
320 }
321 else if (IsInt(constant->mTypeCode))
322 {
323 return StrFormat("Constant %lld", constant->mInt64);
324 }
325 else if (constant->mTypeCode == BfTypeCode_CharPtr)
326 {
327 return StrFormat("CharPtr %d", constant->mInt64);
328 }
329 else if (constant->mTypeCode == BfTypeCode_StringId)
330 {
331 return StrFormat("StringId %d", constant->mInt64);
332 }
333 else if (constant->mConstType == BfConstType_GlobalVar)
334 {
335 auto gvConst = (BfGlobalVar*)constant;
336 return String("GlobalVar ") + gvConst->mName;
337 }
338 else if (constant->mConstType == BfConstType_BitCast)
339 {
340 auto bitcast = (BfConstantBitCast*)constant;
341 BfIRValue targetConst(BfIRValueFlags_Const, bitcast->mTarget);
342 return ToString(bitcast->mToType) += " bitcast " + ToString(targetConst);
343 }
344 else if (constant->mConstType == BfConstType_Box)
345 {

Callers 3

CreateNamespaceScopeMethod · 0.45
CreateTypeDeclarationMethod · 0.45
DbgGetStaticFieldNameMethod · 0.45

Calls 14

StringClass · 0.85
GetLLVMValueMethod · 0.80
GetBeValueMethod · 0.80
GetLLVMTypeMethod · 0.80
GetTypeEntryMethod · 0.80
GetBeTypeMethod · 0.80
GetLLVMMetadataMethod · 0.80
GetBeMetadataMethod · 0.80
ToStringFunction · 0.70
sizeMethod · 0.45
TypeToStringMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected