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

Method TypedValueToString

IDEHelper/Compiler/CeDebugger.cpp:2831–3833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2829}
2830
2831String CeDebugger::TypedValueToString(const BfTypedValue& origTypedValue, const StringImpl& expr, CeFormatInfo& formatInfo, bool fullPrecision, CeTypeModKind typeModKind)
2832{
2833 BfTypedValue typedValue = origTypedValue;
2834
2835 auto module = mCeMachine->mCeModule;
2836
2837 String retVal;
2838 if (typedValue.IsNoValueType())
2839 {
2840 String typeName = TypeToString(typedValue);
2841
2842 retVal += typeName;
2843 retVal += "\n";
2844 retVal += typeName;
2845 retVal += "\n";
2846 retVal += GetMemberList(typedValue.mType, 0, 0, true);
2847 return retVal;
2848 }
2849
2850 auto constant = module->mBfIRBuilder->GetConstant(typedValue.mValue);
2851 auto ceContext = mCeMachine->mCurContext;
2852 if (constant == NULL)
2853 {
2854 return "!Invalid expression";
2855 }
2856
2857 bool didAlloc = false;
2858 addr_ce addr = 0;
2859
2860 defer(
2861 {
2862 if (didAlloc)
2863 mCurDbgState->mCeContext->CeFree(addr);
2864 }
2865 );
2866
2867 if (constant->mConstType == BfConstType_AggCE)
2868 {
2869 auto aggCE = (BfConstantAggCE*)constant;
2870 addr = aggCE->mCEAddr;
2871 }
2872 else if ((typedValue.IsAddr()) || (typedValue.mType->IsObjectOrInterface()) || (typedValue.mType->IsPointer()))
2873 {
2874 CeTypedValue typedVal = GetAddr(constant, typedValue.mType);
2875 addr = (addr_ce)typedVal.mAddr;
2876 if (!typedVal)
2877 {
2878 return "!Invalid addr type";
2879 }
2880 }
2881 else
2882 {
2883 int allocSize = typedValue.mType->mSize;
2884 auto typeInst = typedValue.mType->ToTypeInstance();
2885 if (typeInst != NULL)
2886 allocSize = typeInst->mInstSize;
2887 if (allocSize < 0)
2888 return "!Invalid size";

Callers

nothing calls this directly

Calls 15

TypeToStringFunction · 0.85
BfTypedValueClass · 0.85
StringClass · 0.85
IsNoValueTypeMethod · 0.80
CeFreeMethod · 0.80
IsAddrMethod · 0.80
CeMallocMethod · 0.80
GetMemoryPtrMethod · 0.80
CreatePointerTypeMethod · 0.80
SubstringMethod · 0.80
CreateConstAggCEMethod · 0.80
MapTypeMethod · 0.80

Tested by

no test coverage detected