summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Tools/LibJSGCVerifier/src/CellsHandler.h
blob: cde264c0e143f8d5bf7b5393fe3e78e8295311e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <clang/ASTMatchers/ASTMatchFinder.h>
#include <clang/ASTMatchers/ASTMatchers.h>
#include <clang/Tooling/Tooling.h>
#include <unordered_set>

class CollectCellsHandler
    : public clang::tooling::SourceFileCallbacks
    , public clang::ast_matchers::MatchFinder::MatchCallback {
public:
    CollectCellsHandler();
    virtual ~CollectCellsHandler() override = default;

    virtual bool handleBeginSource(clang::CompilerInstance&) override;

    virtual void run(clang::ast_matchers::MatchFinder::MatchResult const& result) override;

    clang::ast_matchers::MatchFinder& finder() { return m_finder; }

private:
    std::unordered_set<std::string> m_visited_classes;
    clang::ast_matchers::MatchFinder m_finder;
};