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

Method FixName

IDEHelper/DbgModule.cpp:1261–1319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1259}
1260
1261void DbgType::FixName()
1262{
1263 if (mFixedName)
1264 return;
1265
1266 int depthCount = 0;
1267
1268 auto dbgModule = mCompileUnit->mDbgModule;
1269 if ((dbgModule->mDbgFlavor == DbgFlavor_MS) && (mName != NULL) && (strlen(mName) > 0))
1270 {
1271 bool modified = false;
1272
1273 if (!dbgModule->DbgIsStrMutable(mName))
1274 mName = dbgModule->DbgDupString(mName);
1275
1276 const char* typeNamePtr = mTypeName;
1277 char* nameP = (char*)mName;
1278
1279 // Fix the name
1280 char* inPtr = nameP;
1281 char* outPtr = nameP;
1282
1283 while (true)
1284 {
1285 char c = *(inPtr++);
1286 if ((c == '<') || (c == '('))
1287 depthCount++;
1288 else if ((c == '>') || (c == ')'))
1289 depthCount--;
1290
1291 if ((c == ':') && (inPtr[0] == ':'))
1292 {
1293 if (mLanguage == DbgLanguage_Beef)
1294 {
1295 modified = true;
1296 inPtr++;
1297 *(outPtr++) = '.';
1298 if (depthCount == 0)
1299 typeNamePtr = outPtr;
1300 }
1301 else if (depthCount == 0)
1302 mTypeName = inPtr + 1;
1303 }
1304 else if (modified)
1305 *(outPtr++) = c;
1306 else
1307 outPtr++;
1308 if (c == 0)
1309 break;
1310 }
1311
1312 if ((modified) && (mName != mTypeName) && (typeNamePtr != NULL))
1313 {
1314 mTypeName = typeNamePtr;
1315 }
1316 }
1317
1318 mFixedName = true;

Callers 2

DbgTypedValueToStringMethod · 0.80
EqualsMethod · 0.80

Calls 2

DbgDupStringMethod · 0.80
DbgIsStrMutableMethod · 0.45

Tested by

no test coverage detected