LibJSGCPluginAction.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. /*
  2. * Copyright (c) 2024, Matthew Olsson <mattco@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include "LibJSGCPluginAction.h"
  7. #include <clang/ASTMatchers/ASTMatchFinder.h>
  8. #include <clang/ASTMatchers/ASTMatchers.h>
  9. #include <clang/Basic/SourceManager.h>
  10. #include <clang/Frontend/CompilerInstance.h>
  11. #include <clang/Frontend/FrontendPluginRegistry.h>
  12. #include <clang/Lex/MacroArgs.h>
  13. #include <unordered_set>
  14. template<typename T>
  15. class SimpleCollectMatchesCallback : public clang::ast_matchers::MatchFinder::MatchCallback {
  16. public:
  17. explicit SimpleCollectMatchesCallback(std::string name)
  18. : m_name(std::move(name))
  19. {
  20. }
  21. void run(clang::ast_matchers::MatchFinder::MatchResult const& result) override
  22. {
  23. if (auto const* node = result.Nodes.getNodeAs<T>(m_name))
  24. m_matches.push_back(node);
  25. }
  26. auto const& matches() const { return m_matches; }
  27. private:
  28. std::string m_name;
  29. std::vector<T const*> m_matches;
  30. };
  31. bool record_inherits_from_cell(clang::CXXRecordDecl const& record)
  32. {
  33. if (!record.isCompleteDefinition())
  34. return false;
  35. bool inherits_from_cell = record.getQualifiedNameAsString() == "JS::Cell";
  36. record.forallBases([&](clang::CXXRecordDecl const* base) -> bool {
  37. if (base->getQualifiedNameAsString() == "JS::Cell") {
  38. inherits_from_cell = true;
  39. return false;
  40. }
  41. return true;
  42. });
  43. return inherits_from_cell;
  44. }
  45. std::vector<clang::QualType> get_all_qualified_types(clang::QualType const& type)
  46. {
  47. std::vector<clang::QualType> qualified_types;
  48. if (auto const* template_specialization = type->getAs<clang::TemplateSpecializationType>()) {
  49. auto specialization_name = template_specialization->getTemplateName().getAsTemplateDecl()->getQualifiedNameAsString();
  50. // Do not unwrap GCPtr/NonnullGCPtr/MarkedVector
  51. static std::unordered_set<std::string> gc_relevant_type_names {
  52. "JS::GCPtr",
  53. "JS::NonnullGCPtr",
  54. "JS::RawGCPtr",
  55. "JS::MarkedVector",
  56. "JS::Handle",
  57. "JS::SafeFunction",
  58. };
  59. if (gc_relevant_type_names.contains(specialization_name)) {
  60. qualified_types.push_back(type);
  61. } else {
  62. auto const template_arguments = template_specialization->template_arguments();
  63. for (size_t i = 0; i < template_arguments.size(); i++) {
  64. auto const& template_arg = template_arguments[i];
  65. if (template_arg.getKind() == clang::TemplateArgument::Type) {
  66. auto template_qualified_types = get_all_qualified_types(template_arg.getAsType());
  67. std::move(template_qualified_types.begin(), template_qualified_types.end(), std::back_inserter(qualified_types));
  68. }
  69. }
  70. }
  71. } else {
  72. qualified_types.push_back(type);
  73. }
  74. return qualified_types;
  75. }
  76. enum class OuterType {
  77. GCPtr,
  78. RawGCPtr,
  79. Handle,
  80. SafeFunction,
  81. Ptr,
  82. Ref,
  83. };
  84. struct QualTypeGCInfo {
  85. std::optional<OuterType> outer_type { {} };
  86. bool base_type_inherits_from_cell { false };
  87. };
  88. std::optional<QualTypeGCInfo> validate_qualified_type(clang::QualType const& type)
  89. {
  90. if (auto const* pointer_decl = type->getAs<clang::PointerType>()) {
  91. if (auto const* pointee = pointer_decl->getPointeeCXXRecordDecl())
  92. return QualTypeGCInfo { OuterType::Ptr, record_inherits_from_cell(*pointee) };
  93. } else if (auto const* reference_decl = type->getAs<clang::ReferenceType>()) {
  94. if (auto const* pointee = reference_decl->getPointeeCXXRecordDecl())
  95. return QualTypeGCInfo { OuterType::Ref, record_inherits_from_cell(*pointee) };
  96. } else if (auto const* specialization = type->getAs<clang::TemplateSpecializationType>()) {
  97. auto template_type_name = specialization->getTemplateName().getAsTemplateDecl()->getQualifiedNameAsString();
  98. OuterType outer_type;
  99. if (template_type_name == "JS::GCPtr" || template_type_name == "JS::NonnullGCPtr") {
  100. outer_type = OuterType::GCPtr;
  101. } else if (template_type_name == "JS::RawGCPtr") {
  102. outer_type = OuterType::RawGCPtr;
  103. } else if (template_type_name == "JS::Handle") {
  104. outer_type = OuterType::Handle;
  105. } else if (template_type_name == "JS::SafeFunction") {
  106. return QualTypeGCInfo { OuterType::SafeFunction, false };
  107. } else {
  108. return {};
  109. }
  110. auto template_args = specialization->template_arguments();
  111. if (template_args.size() != 1)
  112. return {}; // Not really valid, but will produce a compilation error anyway
  113. auto const& type_arg = template_args[0];
  114. auto const* record_type = type_arg.getAsType()->getAs<clang::RecordType>();
  115. if (!record_type)
  116. return {};
  117. auto const* record_decl = record_type->getAsCXXRecordDecl();
  118. if (!record_decl->hasDefinition())
  119. return {};
  120. return QualTypeGCInfo { outer_type, record_inherits_from_cell(*record_decl) };
  121. }
  122. return {};
  123. }
  124. std::optional<QualTypeGCInfo> validate_field_qualified_type(clang::FieldDecl const* field_decl)
  125. {
  126. auto type = field_decl->getType();
  127. if (auto const* elaborated_type = llvm::dyn_cast<clang::ElaboratedType>(type.getTypePtr()))
  128. type = elaborated_type->desugar();
  129. for (auto const& qualified_type : get_all_qualified_types(type)) {
  130. if (auto error = validate_qualified_type(qualified_type))
  131. return error;
  132. }
  133. return {};
  134. }
  135. bool LibJSGCVisitor::VisitCXXRecordDecl(clang::CXXRecordDecl* record)
  136. {
  137. using namespace clang::ast_matchers;
  138. if (!record || !record->isCompleteDefinition() || (!record->isClass() && !record->isStruct()))
  139. return true;
  140. // Cell triggers a bunch of warnings for its empty visit_edges implementation, but
  141. // it doesn't have any members anyways so it's fine to just ignore.
  142. auto qualified_name = record->getQualifiedNameAsString();
  143. if (qualified_name == "JS::Cell")
  144. return true;
  145. auto& diag_engine = m_context.getDiagnostics();
  146. std::vector<clang::FieldDecl const*> fields_that_need_visiting;
  147. auto record_is_cell = record_inherits_from_cell(*record);
  148. for (clang::FieldDecl const* field : record->fields()) {
  149. auto validation_results = validate_field_qualified_type(field);
  150. if (!validation_results)
  151. continue;
  152. auto [outer_type, base_type_inherits_from_cell] = *validation_results;
  153. if (outer_type == OuterType::Ptr || outer_type == OuterType::Ref) {
  154. if (base_type_inherits_from_cell) {
  155. auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Error, "%0 to JS::Cell type should be wrapped in %1");
  156. auto builder = diag_engine.Report(field->getLocation(), diag_id);
  157. if (outer_type == OuterType::Ref) {
  158. builder << "reference"
  159. << "JS::NonnullGCPtr";
  160. } else {
  161. builder << "pointer"
  162. << "JS::GCPtr";
  163. }
  164. }
  165. } else if (outer_type == OuterType::GCPtr || outer_type == OuterType::RawGCPtr) {
  166. if (!base_type_inherits_from_cell) {
  167. auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Error, "Specialization type must inherit from JS::Cell");
  168. diag_engine.Report(field->getLocation(), diag_id);
  169. } else if (outer_type == OuterType::GCPtr) {
  170. fields_that_need_visiting.push_back(field);
  171. }
  172. } else if (outer_type == OuterType::Handle || outer_type == OuterType::SafeFunction) {
  173. if (record_is_cell && m_detect_invalid_function_members) {
  174. // FIXME: Change this to an Error when all of the use cases get addressed and remove the plugin argument
  175. auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Warning, "Types inheriting from JS::Cell should not have %0 fields");
  176. auto builder = diag_engine.Report(field->getLocation(), diag_id);
  177. builder << (outer_type == OuterType::Handle ? "JS::Handle" : "JS::SafeFunction");
  178. }
  179. }
  180. }
  181. if (!record_is_cell)
  182. return true;
  183. validate_record_macros(*record);
  184. clang::DeclarationName name = &m_context.Idents.get("visit_edges");
  185. auto const* visit_edges_method = record->lookup(name).find_first<clang::CXXMethodDecl>();
  186. if (!visit_edges_method && !fields_that_need_visiting.empty()) {
  187. auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Error, "JS::Cell-inheriting class %0 contains a GC-allocated member %1 but has no visit_edges method");
  188. auto builder = diag_engine.Report(record->getLocation(), diag_id);
  189. builder << record->getName()
  190. << fields_that_need_visiting[0];
  191. }
  192. if (!visit_edges_method || !visit_edges_method->getBody())
  193. return true;
  194. // Search for a call to Base::visit_edges. Note that this also has the nice side effect of
  195. // ensuring the classes use JS_CELL/JS_OBJECT, as Base will not be defined if they do not.
  196. MatchFinder base_visit_edges_finder;
  197. SimpleCollectMatchesCallback<clang::MemberExpr> base_visit_edges_callback("member-call");
  198. auto base_visit_edges_matcher = cxxMethodDecl(
  199. ofClass(hasName(qualified_name)),
  200. functionDecl(hasName("visit_edges")),
  201. isOverride(),
  202. hasDescendant(memberExpr(member(hasName("visit_edges"))).bind("member-call")));
  203. base_visit_edges_finder.addMatcher(base_visit_edges_matcher, &base_visit_edges_callback);
  204. base_visit_edges_finder.matchAST(m_context);
  205. bool call_to_base_visit_edges_found = false;
  206. for (auto const* call_expr : base_visit_edges_callback.matches()) {
  207. // FIXME: Can we constrain the matcher above to avoid looking directly at the source code?
  208. auto const* source_chars = m_context.getSourceManager().getCharacterData(call_expr->getBeginLoc());
  209. if (strncmp(source_chars, "Base::", 6) == 0) {
  210. call_to_base_visit_edges_found = true;
  211. break;
  212. }
  213. }
  214. if (!call_to_base_visit_edges_found) {
  215. auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Error, "Missing call to Base::visit_edges");
  216. diag_engine.Report(visit_edges_method->getBeginLoc(), diag_id);
  217. }
  218. // Search for uses of all fields that need visiting. We don't ensure they are _actually_ visited
  219. // with a call to visitor.visit(...), as that is too complex. Instead, we just assume that if the
  220. // field is accessed at all, then it is visited.
  221. if (fields_that_need_visiting.empty())
  222. return true;
  223. MatchFinder field_access_finder;
  224. SimpleCollectMatchesCallback<clang::MemberExpr> field_access_callback("member-expr");
  225. auto field_access_matcher = memberExpr(
  226. hasAncestor(cxxMethodDecl(hasName("visit_edges"))),
  227. hasObjectExpression(hasType(pointsTo(cxxRecordDecl(hasName(record->getName()))))))
  228. .bind("member-expr");
  229. field_access_finder.addMatcher(field_access_matcher, &field_access_callback);
  230. field_access_finder.matchAST(visit_edges_method->getASTContext());
  231. std::unordered_set<std::string> fields_that_are_visited;
  232. for (auto const* member_expr : field_access_callback.matches())
  233. fields_that_are_visited.insert(member_expr->getMemberNameInfo().getAsString());
  234. auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Error, "GC-allocated member is not visited in %0::visit_edges");
  235. for (auto const* field : fields_that_need_visiting) {
  236. if (!fields_that_are_visited.contains(field->getNameAsString())) {
  237. auto builder = diag_engine.Report(field->getBeginLoc(), diag_id);
  238. builder << record->getName();
  239. }
  240. }
  241. return true;
  242. }
  243. struct CellTypeWithOrigin {
  244. clang::CXXRecordDecl const& base_origin;
  245. LibJSCellMacro::Type type;
  246. };
  247. std::optional<CellTypeWithOrigin> find_cell_type_with_origin(clang::CXXRecordDecl const& record)
  248. {
  249. for (auto const& base : record.bases()) {
  250. if (auto const* base_record = base.getType()->getAsCXXRecordDecl()) {
  251. auto base_name = base_record->getQualifiedNameAsString();
  252. if (base_name == "JS::Cell")
  253. return CellTypeWithOrigin { *base_record, LibJSCellMacro::Type::JSCell };
  254. if (base_name == "JS::Object")
  255. return CellTypeWithOrigin { *base_record, LibJSCellMacro::Type::JSObject };
  256. if (base_name == "JS::Environment")
  257. return CellTypeWithOrigin { *base_record, LibJSCellMacro::Type::JSEnvironment };
  258. if (base_name == "JS::PrototypeObject")
  259. return CellTypeWithOrigin { *base_record, LibJSCellMacro::Type::JSPrototypeObject };
  260. if (base_name == "Web::Bindings::PlatformObject")
  261. return CellTypeWithOrigin { *base_record, LibJSCellMacro::Type::WebPlatformObject };
  262. if (auto origin = find_cell_type_with_origin(*base_record))
  263. return CellTypeWithOrigin { *base_record, origin->type };
  264. }
  265. }
  266. return {};
  267. }
  268. LibJSGCVisitor::CellMacroExpectation LibJSGCVisitor::get_record_cell_macro_expectation(clang::CXXRecordDecl const& record)
  269. {
  270. auto origin = find_cell_type_with_origin(record);
  271. assert(origin.has_value());
  272. // Need to iterate the bases again to turn the record into the exact text that the user used as
  273. // the class base, since it doesn't have to be qualified (but might be).
  274. for (auto const& base : record.bases()) {
  275. if (auto const* base_record = base.getType()->getAsCXXRecordDecl()) {
  276. if (base_record == &origin->base_origin) {
  277. auto& source_manager = m_context.getSourceManager();
  278. auto char_range = source_manager.getExpansionRange({ base.getBaseTypeLoc(), base.getEndLoc() });
  279. auto exact_text = clang::Lexer::getSourceText(char_range, source_manager, m_context.getLangOpts());
  280. return { origin->type, exact_text.str() };
  281. }
  282. }
  283. }
  284. assert(false);
  285. }
  286. void LibJSGCVisitor::validate_record_macros(clang::CXXRecordDecl const& record)
  287. {
  288. auto& source_manager = m_context.getSourceManager();
  289. auto record_range = record.getSourceRange();
  290. // FIXME: The current macro detection doesn't recursively search through macro expansion,
  291. // so if the record itself is defined in a macro, the JS_CELL/etc won't be found
  292. if (source_manager.isMacroBodyExpansion(record_range.getBegin()))
  293. return;
  294. auto [expected_cell_macro_type, expected_base_name] = get_record_cell_macro_expectation(record);
  295. auto file_id = m_context.getSourceManager().getFileID(record.getLocation());
  296. auto it = m_macro_map.find(file_id.getHashValue());
  297. auto& diag_engine = m_context.getDiagnostics();
  298. auto report_missing_macro = [&] {
  299. auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Error, "Expected record to have a %0 macro invocation");
  300. auto builder = diag_engine.Report(record.getLocation(), diag_id);
  301. builder << LibJSCellMacro::type_name(expected_cell_macro_type);
  302. };
  303. if (it == m_macro_map.end()) {
  304. report_missing_macro();
  305. return;
  306. }
  307. std::vector<clang::SourceRange> sub_ranges;
  308. for (auto const& sub_decl : record.decls()) {
  309. if (auto const* sub_record = llvm::dyn_cast<clang::CXXRecordDecl>(sub_decl))
  310. sub_ranges.push_back(sub_record->getSourceRange());
  311. }
  312. bool found_macro = false;
  313. auto record_name = record.getDeclName().getAsString();
  314. if (record.getQualifier()) {
  315. // FIXME: There has to be a better way to get this info. getQualifiedNameAsString() gets too much info
  316. // (outer namespaces that aren't part of the class identifier), and getNameAsString() doesn't get
  317. // enough info (doesn't include parts before the namespace specifier).
  318. auto loc = record.getQualifierLoc();
  319. auto& sm = m_context.getSourceManager();
  320. auto begin_offset = sm.getFileOffset(loc.getBeginLoc());
  321. auto end_offset = sm.getFileOffset(loc.getEndLoc());
  322. auto const* file_buf = sm.getCharacterData(loc.getBeginLoc());
  323. auto prefix = std::string { file_buf, end_offset - begin_offset };
  324. record_name = prefix + "::" + record_name;
  325. }
  326. for (auto const& macro : it->second) {
  327. if (record_range.fullyContains(macro.range)) {
  328. bool macro_is_in_sub_decl = false;
  329. for (auto const& sub_range : sub_ranges) {
  330. if (sub_range.fullyContains(macro.range)) {
  331. macro_is_in_sub_decl = true;
  332. break;
  333. }
  334. }
  335. if (macro_is_in_sub_decl)
  336. continue;
  337. if (found_macro) {
  338. auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Error, "Record has multiple JS_CELL-like macro invocations");
  339. diag_engine.Report(record_range.getBegin(), diag_id);
  340. }
  341. found_macro = true;
  342. if (macro.type != expected_cell_macro_type) {
  343. auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Error, "Invalid JS-CELL-like macro invocation; expected %0");
  344. auto builder = diag_engine.Report(macro.range.getBegin(), diag_id);
  345. builder << LibJSCellMacro::type_name(expected_cell_macro_type);
  346. }
  347. // This is a compile error, no diagnostic needed
  348. if (macro.args.size() < 2)
  349. return;
  350. if (macro.args[0].text != record_name) {
  351. auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Error, "Expected first argument of %0 macro invocation to be %1");
  352. auto builder = diag_engine.Report(macro.args[0].location, diag_id);
  353. builder << LibJSCellMacro::type_name(expected_cell_macro_type) << record_name;
  354. }
  355. if (expected_cell_macro_type == LibJSCellMacro::Type::JSPrototypeObject) {
  356. // FIXME: Validate the args for this macro
  357. } else if (macro.args[1].text != expected_base_name) {
  358. auto diag_id = diag_engine.getCustomDiagID(clang::DiagnosticsEngine::Error, "Expected second argument of %0 macro invocation to be %1");
  359. auto builder = diag_engine.Report(macro.args[1].location, diag_id);
  360. builder << LibJSCellMacro::type_name(expected_cell_macro_type) << expected_base_name;
  361. }
  362. }
  363. }
  364. if (!found_macro)
  365. report_missing_macro();
  366. }
  367. LibJSGCASTConsumer::LibJSGCASTConsumer(clang::CompilerInstance& compiler, bool detect_invalid_function_members)
  368. : m_compiler(compiler)
  369. , m_detect_invalid_function_members(detect_invalid_function_members)
  370. {
  371. auto& preprocessor = compiler.getPreprocessor();
  372. preprocessor.addPPCallbacks(std::make_unique<LibJSPPCallbacks>(preprocessor, m_macro_map));
  373. }
  374. void LibJSGCASTConsumer::HandleTranslationUnit(clang::ASTContext& context)
  375. {
  376. LibJSGCVisitor visitor { context, m_macro_map, m_detect_invalid_function_members };
  377. visitor.TraverseDecl(context.getTranslationUnitDecl());
  378. }
  379. char const* LibJSCellMacro::type_name(Type type)
  380. {
  381. switch (type) {
  382. case Type::JSCell:
  383. return "JS_CELL";
  384. case Type::JSObject:
  385. return "JS_OBJECT";
  386. case Type::JSEnvironment:
  387. return "JS_ENVIRONMENT";
  388. case Type::JSPrototypeObject:
  389. return "JS_PROTOTYPE_OBJECT";
  390. case Type::WebPlatformObject:
  391. return "WEB_PLATFORM_OBJECT";
  392. default:
  393. __builtin_unreachable();
  394. }
  395. }
  396. void LibJSPPCallbacks::LexedFileChanged(clang::FileID curr_fid, LexedFileChangeReason reason, clang::SrcMgr::CharacteristicKind, clang::FileID, clang::SourceLocation)
  397. {
  398. if (reason == LexedFileChangeReason::EnterFile) {
  399. m_curr_fid_hash_stack.push_back(curr_fid.getHashValue());
  400. } else {
  401. assert(!m_curr_fid_hash_stack.empty());
  402. m_curr_fid_hash_stack.pop_back();
  403. }
  404. }
  405. void LibJSPPCallbacks::MacroExpands(clang::Token const& name_token, clang::MacroDefinition const&, clang::SourceRange range, clang::MacroArgs const* args)
  406. {
  407. if (auto* ident_info = name_token.getIdentifierInfo()) {
  408. static llvm::StringMap<LibJSCellMacro::Type> libjs_macro_types {
  409. { "JS_CELL", LibJSCellMacro::Type::JSCell },
  410. { "JS_OBJECT", LibJSCellMacro::Type::JSObject },
  411. { "JS_ENVIRONMENT", LibJSCellMacro::Type::JSEnvironment },
  412. { "JS_PROTOTYPE_OBJECT", LibJSCellMacro::Type::JSPrototypeObject },
  413. { "WEB_PLATFORM_OBJECT", LibJSCellMacro::Type::WebPlatformObject },
  414. };
  415. auto name = ident_info->getName();
  416. if (auto it = libjs_macro_types.find(name); it != libjs_macro_types.end()) {
  417. LibJSCellMacro macro { range, it->second, {} };
  418. for (size_t arg_index = 0; arg_index < args->getNumMacroArguments(); arg_index++) {
  419. auto const* first_token = args->getUnexpArgument(arg_index);
  420. auto stringified_token = clang::MacroArgs::StringifyArgument(first_token, m_preprocessor, false, range.getBegin(), range.getEnd());
  421. // The token includes leading and trailing quotes
  422. auto len = strlen(stringified_token.getLiteralData());
  423. std::string arg_text { stringified_token.getLiteralData() + 1, len - 2 };
  424. macro.args.push_back({ arg_text, first_token->getLocation() });
  425. }
  426. assert(!m_curr_fid_hash_stack.empty());
  427. auto curr_fid_hash = m_curr_fid_hash_stack.back();
  428. if (m_macro_map.find(curr_fid_hash) == m_macro_map.end())
  429. m_macro_map[curr_fid_hash] = {};
  430. m_macro_map[curr_fid_hash].push_back(macro);
  431. }
  432. }
  433. }
  434. static clang::FrontendPluginRegistry::Add<LibJSGCPluginAction> X("libjs_gc_scanner", "analyze LibJS GC usage");