MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / overflow_status printer_print_const

Function overflow_status printer_print_const

src/rustDemangle.cpp:1331–1469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1329}
1330
1331static NODISCARD overflow_status printer_print_const(struct printer *printer, bool in_value) {
1332 uint8_t tag;
1333
1334 PARSE(printer, parser_ch, &tag);
1335 PARSE(printer, parser_push_depth);
1336
1337 struct buf hex;
1338 uint64_t val;
1339 size_t count;
1340
1341 bool opened_brace = false;
1342#define OPEN_BRACE_IF_OUTSIDE_EXPR \
1343 do { if (!in_value) { \
1344 opened_brace = true; \
1345 PRINT_STR(printer, "{"); \
1346 } } while(0)
1347
1348 switch(tag) {
1349 case 'p':
1350 PRINT_STR(printer, "_");
1351 break;
1352 // Primitive leaves with hex-encoded values (see `basic_type`).
1353 case 'a':
1354 case 's':
1355 case 'l':
1356 case 'x':
1357 case 'n':
1358 case 'i':
1359 if (printer_eat(printer, 'n')) {
1360 PRINT_STR(printer, "-");
1361 }
1362 /* fallthrough */
1363 case 'h':
1364 case 't':
1365 case 'm':
1366 case 'y':
1367 case 'o':
1368 case 'j':
1369 PRINT(printer_print_const_uint(printer, tag));
1370 break;
1371 case 'b':
1372 PARSE(printer, parser_hex_nibbles, &hex);
1373 if (try_parse_uint(hex.start, hex.len, &val)) {
1374 if (val == 0) {
1375 PRINT_STR(printer, "false");
1376 } else if (val == 1) {
1377 PRINT_STR(printer, "true");
1378 } else {
1379 INVALID(printer);
1380 }
1381 } else {
1382 INVALID(printer);
1383 }
1384 break;
1385 case 'c':
1386 PARSE(printer, parser_hex_nibbles, &hex);
1387 if (try_parse_uint(hex.start, hex.len, &val)
1388 && val < UINT32_MAX

Callers

nothing calls this directly

Calls 5

printer_eatFunction · 0.85
try_parse_uintFunction · 0.85
validate_charFunction · 0.85
char_to_stringFunction · 0.85
printer_pop_depthFunction · 0.85

Tested by

no test coverage detected