mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibJSGCVerifier: Warn about missing visit_edges impls with GC members
Previously we would only warn about missing calls to visit inside visit_edges implementations, now we warn as well when there's no visit_edges implementation at all.
This commit is contained in:
parent
c84cd1d668
commit
f921952cc3
Notes:
sideshowbarker
2024-07-17 07:11:12 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/f921952cc3 Pull-request: https://github.com/SerenityOS/serenity/pull/23854 Issue: https://github.com/SerenityOS/serenity/issues/23848 Reviewed-by: https://github.com/mattco98 ✅ Reviewed-by: https://github.com/trflynn89
1 changed files with 6 additions and 0 deletions
|
@ -210,6 +210,12 @@ void CollectCellsHandler::run(clang::ast_matchers::MatchFinder::MatchResult cons
|
|||
|
||||
clang::DeclarationName const name = &result.Context->Idents.get("visit_edges");
|
||||
auto const* visit_edges_method = record->lookup(name).find_first<clang::CXXMethodDecl>();
|
||||
if (!visit_edges_method && !fields_that_need_visiting.empty()) {
|
||||
auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Warning, "JS::Cell-inheriting class %0 contains a GC-allocated member %1 but has no visit_edges method");
|
||||
auto builder = diag_engine.Report(record->getLocation(), diag_id);
|
||||
builder << record->getName()
|
||||
<< fields_that_need_visiting[0];
|
||||
}
|
||||
if (!visit_edges_method || !visit_edges_method->getBody())
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in a new issue