LibGC: Add missing root type switch cases in graph dump

Also, remove the default case so that we don't end up with missing
cases again.
This commit is contained in:
Zaggy1024
2026-03-02 16:26:29 -06:00
committed by Gregory Bertilson
parent 7339c26059
commit d0e7ffdf37
Notes: github-actions[bot] 2026-03-03 17:28:01 +00:00

View File

@@ -208,11 +208,14 @@ public:
auto node = AK::JsonObject();
if (it.value.root_origin.has_value()) {
auto type = it.value.root_origin->type;
auto location = it.value.root_origin->location;
auto const* location = it.value.root_origin->location;
switch (type) {
case HeapRoot::Type::ConservativeVector:
node.set("root"sv, "ConservativeVector"sv);
break;
case HeapRoot::Type::HeapFunctionCapturedPointer:
node.set("root"sv, "HeapFunctionCapturedPointer"sv);
break;
case HeapRoot::Type::MustSurviveGC:
node.set("root"sv, "MustSurviveGC"sv);
break;
@@ -222,6 +225,9 @@ public:
case HeapRoot::Type::RootVector:
node.set("root"sv, "RootVector"sv);
break;
case HeapRoot::Type::RootHashMap:
node.set("root"sv, "RootHashMap"sv);
break;
case HeapRoot::Type::RegisterPointer:
node.set("root"sv, "RegisterPointer"sv);
if (it.value.root_origin->stack_frame_index.has_value())
@@ -235,9 +241,8 @@ public:
case HeapRoot::Type::VM:
node.set("root"sv, "VM"sv);
break;
default:
VERIFY_NOT_REACHED();
}
VERIFY(node.has("root"sv));
}
node.set("class_name"sv, it.value.class_name);
node.set("edges"sv, edges);