Instantiator
Generate c++ template instantiations
Loading...
Searching...
No Matches
ASTBuilderAction.hpp
Go to the documentation of this file.
1#ifndef ASTBUILDER_ACTION_HPP_
2#define ASTBUILDER_ACTION_HPP_
3
4#include <filesystem>
5#include <memory>
6
7#include "clang/Frontend/ASTUnit.h"
8#include "clang/Frontend/CompilerInstance.h"
9#include "clang/Frontend/CompilerInvocation.h"
10#include "clang/Serialization/PCHContainerOperations.h"
11#include "clang/Tooling/Tooling.h"
12
13// forward declaration
14namespace clang {
15class FileManager;
16class DiagnosticConsumer;
17} // namespace clang
18
24class ASTBuilderAction : public clang::tooling::ToolAction
25{
26 std::unique_ptr<clang::ASTUnit>& AST;
27 const clang::tooling::CompilationDatabase& db;
28 std::filesystem::path file;
29 std::filesystem::path tmpdir;
30
31public:
32 ASTBuilderAction(std::unique_ptr<clang::ASTUnit>& AST,
33 const clang::tooling::CompilationDatabase& db,
34 const std::filesystem::path& filename,
35 const std::filesystem::path& tmpdir)
36 : AST(AST)
37 , db(db)
38 , file(filename)
39 , tmpdir(tmpdir)
40 {}
41
42 bool runInvocation(std::shared_ptr<clang::CompilerInvocation> Invocation,
43 clang::FileManager* Files,
44 std::shared_ptr<clang::PCHContainerOperations> PCHContainerOps,
45 clang::DiagnosticConsumer* DiagConsumer) override;
46};
47
48#endif
Action to compute a single AST of file filename.
const clang::tooling::CompilationDatabase & db
std::filesystem::path file
ASTBuilderAction(std::unique_ptr< clang::ASTUnit > &AST, const clang::tooling::CompilationDatabase &db, const std::filesystem::path &filename, const std::filesystem::path &tmpdir)
std::filesystem::path tmpdir
std::unique_ptr< clang::ASTUnit > & AST
bool runInvocation(std::shared_ptr< clang::CompilerInvocation > Invocation, clang::FileManager *Files, std::shared_ptr< clang::PCHContainerOperations > PCHContainerOps, clang::DiagnosticConsumer *DiagConsumer) override