blob: 42c6779d9998a972be84437972529cc3c489e041 [file] [log] [blame]
Marco Polettib5239c92022-05-11 09:46:05 -07001// Part of the Crubit project, under the Apache License v2.0 with LLVM
2// Exceptions. See /LICENSE for license information.
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef CRUBIT_MIGRATOR_RS_FROM_CC_FRONTEND_ACTION_H_
6#define CRUBIT_MIGRATOR_RS_FROM_CC_FRONTEND_ACTION_H_
7
8#include <memory>
9
10#include "lifetime_annotations/lifetime_annotations.h"
11#include "migrator/rs_from_cc/converter.h"
12#include "clang/AST/ASTConsumer.h"
13#include "clang/Frontend/CompilerInstance.h"
14#include "clang/Frontend/FrontendAction.h"
15
16namespace crubit_rs_from_cc {
17
18// Creates an `ASTConsumer` that generates the Rust code in the invocation
19// object.
20class FrontendAction : public clang::ASTFrontendAction {
21 public:
22 explicit FrontendAction(Converter::Invocation& invocation)
23 : invocation_(invocation) {}
24
25 std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(
26 clang::CompilerInstance& instance, llvm::StringRef) override;
27
28 private:
29 Converter::Invocation& invocation_;
30};
31
32} // namespace crubit_rs_from_cc
33
34#endif // CRUBIT_MIGRATOR_RS_FROM_CC_FRONTEND_ACTION_H_