blob: 4dd9dc57e1d0665fa15ef0e454b7540d7da1f4ef [file] [log] [blame]
Marcel Hlopkoe8f1c4e2021-07-28 18:12:49 +00001// 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
Marcel Hlopko45b60ef2021-08-13 13:37:43 +00005#include "rs_bindings_from_cc/frontend_action.h"
Marcel Hlopkoe8f1c4e2021-07-28 18:12:49 +00006
7#include <memory>
8
Marcel Hlopko3b254b32022-03-09 14:10:49 +00009#include "rs_bindings_from_cc/ast_consumer.h"
Lukasz Anforowiczcec7a8a2022-04-27 10:24:51 -070010#include "clang/AST/ASTConsumer.h"
11#include "clang/Frontend/CompilerInstance.h"
Marcel Hlopkoe8f1c4e2021-07-28 18:12:49 +000012
Marcel Hlopkof15e8ce2022-04-08 08:46:09 -070013namespace crubit {
Marcel Hlopkoe8f1c4e2021-07-28 18:12:49 +000014
Marcel Hlopko45b60ef2021-08-13 13:37:43 +000015std::unique_ptr<clang::ASTConsumer> FrontendAction::CreateASTConsumer(
Devin Jeanpierre31e104b2021-10-20 07:27:25 +000016 clang::CompilerInstance& instance, llvm::StringRef) {
Michael Forstera49d2e62022-01-28 07:26:40 +000017 AddLifetimeAnnotationHandlers(instance.getPreprocessor(),
18 invocation_.lifetime_context_);
19 return std::make_unique<AstConsumer>(instance, invocation_);
Marcel Hlopkoe8f1c4e2021-07-28 18:12:49 +000020}
21
Marcel Hlopkof15e8ce2022-04-08 08:46:09 -070022} // namespace crubit