diff --git a/Meta/Lagom/ClangPlugins/LibJSGCPluginAction.cpp b/Meta/Lagom/ClangPlugins/LibJSGCPluginAction.cpp index 6faf85d24cc..9f018c09cb5 100644 --- a/Meta/Lagom/ClangPlugins/LibJSGCPluginAction.cpp +++ b/Meta/Lagom/ClangPlugins/LibJSGCPluginAction.cpp @@ -90,6 +90,7 @@ enum class OuterType { Root, Ptr, Ref, + Value, }; struct QualTypeGCInfo { @@ -133,6 +134,9 @@ static std::optional validate_qualified_type(clang::QualType con return {}; return QualTypeGCInfo { outer_type, record_inherits_from_cell(*record_decl) }; + } else if (auto const* record = type->getAsCXXRecordDecl()) { + if (record->getQualifiedNameAsString() == "JS::Value") + return QualTypeGCInfo { OuterType::Value, true }; } return {}; @@ -202,11 +206,11 @@ bool LibJSGCVisitor::VisitCXXRecordDecl(clang::CXXRecordDecl* record) << "GC::Ptr"; } } - } else if (outer_type == OuterType::GCPtr || outer_type == OuterType::RawPtr) { + } else if (outer_type == OuterType::GCPtr || outer_type == OuterType::RawPtr || outer_type == OuterType::Value) { if (!base_type_inherits_from_cell) { auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Error, "Specialization type must inherit from GC::Cell"); diag_engine.Report(field->getLocation(), diag_id); - } else if (outer_type == OuterType::GCPtr) { + } else if (outer_type != OuterType::RawPtr) { fields_that_need_visiting.push_back(field); } } else if (outer_type == OuterType::Root) { diff --git a/Tests/ClangPlugins/LibJSGCTests/missing_member_in_visit_edges.cpp b/Tests/ClangPlugins/LibJSGCTests/missing_member_in_visit_edges.cpp index 9d32737b1fd..f2b5fac8026 100644 --- a/Tests/ClangPlugins/LibJSGCTests/missing_member_in_visit_edges.cpp +++ b/Tests/ClangPlugins/LibJSGCTests/missing_member_in_visit_edges.cpp @@ -18,4 +18,7 @@ class TestClass : public JS::Object { // expected-error@+1 {{GC-allocated member is not visited in TestClass::visit_edges}} GC::Ptr m_object; + + // expected-error@+1 {{GC-allocated member is not visited in TestClass::visit_edges}} + JS::Value m_value; };