blob: 8887adb4bc8ba0699cdad430970e5f0ef92e8f58 [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 Hlopko97a68a12022-03-09 11:38:51 +00009#include "lifetime_annotations/lifetime_annotations.h"
Marcel Hlopko3b254b32022-03-09 14:10:49 +000010#include "rs_bindings_from_cc/ast_consumer.h"
Marcel Hlopkoe8f1c4e2021-07-28 18:12:49 +000011#include "third_party/llvm/llvm-project/clang/include/clang/AST/ASTConsumer.h"
Marcel Hlopko45b60ef2021-08-13 13:37:43 +000012#include "third_party/llvm/llvm-project/clang/include/clang/Frontend/CompilerInstance.h"
Marcel Hlopkoe8f1c4e2021-07-28 18:12:49 +000013
Marcel Hlopkof15e8ce2022-04-08 08:46:09 -070014namespace crubit {
Marcel Hlopkoe8f1c4e2021-07-28 18:12:49 +000015
Marcel Hlopko45b60ef2021-08-13 13:37:43 +000016std::unique_ptr<clang::ASTConsumer> FrontendAction::CreateASTConsumer(
Devin Jeanpierre31e104b2021-10-20 07:27:25 +000017 clang::CompilerInstance& instance, llvm::StringRef) {
Michael Forstera49d2e62022-01-28 07:26:40 +000018 AddLifetimeAnnotationHandlers(instance.getPreprocessor(),
19 invocation_.lifetime_context_);
20 return std::make_unique<AstConsumer>(instance, invocation_);
Marcel Hlopkoe8f1c4e2021-07-28 18:12:49 +000021}
22
Marcel Hlopkof15e8ce2022-04-08 08:46:09 -070023} // namespace crubit