mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 20:45:14 +00:00
LibJSGCVerifier: Detect missing JS_CELL() calls
This commit is contained in:
parent
5023e5fda3
commit
abb4b6d117
Notes:
sideshowbarker
2024-07-17 20:33:50 +09:00
Author: https://github.com/mattco98 Commit: https://github.com/SerenityOS/serenity/commit/abb4b6d117 Pull-request: https://github.com/SerenityOS/serenity/pull/23878 Issue: https://github.com/SerenityOS/serenity/issues/23805 Reviewed-by: https://github.com/awesomekling
2 changed files with 16 additions and 0 deletions
|
@ -308,6 +308,20 @@ void CollectCellsHandler::check_cells(clang::ast_matchers::MatchFinder::MatchRes
|
|||
|
||||
emit_record_json_data(*record);
|
||||
|
||||
bool has_base = false;
|
||||
for (auto const& decl : record->decls()) {
|
||||
if (auto* alias_decl = llvm::dyn_cast<clang::TypeAliasDecl>(decl); alias_decl && alias_decl->getQualifiedNameAsString().ends_with("::Base")) {
|
||||
has_base = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_base) {
|
||||
auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Warning, "JS::Cell-inheriting class %0 is missing a JS_CELL() call in its header file");
|
||||
auto builder = diag_engine.Report(record->getLocation(), diag_id);
|
||||
builder << record->getName();
|
||||
}
|
||||
|
||||
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()) {
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace Web::HTML {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#img-req-data
|
||||
class DecodedImageData : public JS::Cell {
|
||||
JS_CELL(DecodedImageData, JS::Cell);
|
||||
|
||||
public:
|
||||
virtual ~DecodedImageData();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue