Marcel Hlopko | e8f1c4e | 2021-07-28 18:12:49 +0000 | [diff] [blame] | 1 | // 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 Hlopko | 45b60ef | 2021-08-13 13:37:43 +0000 | [diff] [blame] | 5 | #include "rs_bindings_from_cc/frontend_action.h" |
Marcel Hlopko | e8f1c4e | 2021-07-28 18:12:49 +0000 | [diff] [blame] | 6 | |
| 7 | #include <memory> |
| 8 | |
Marcel Hlopko | 97a68a1 | 2022-03-09 11:38:51 +0000 | [diff] [blame] | 9 | #include "lifetime_annotations/lifetime_annotations.h" |
Marcel Hlopko | 3b254b3 | 2022-03-09 14:10:49 +0000 | [diff] [blame] | 10 | #include "rs_bindings_from_cc/ast_consumer.h" |
Marcel Hlopko | e8f1c4e | 2021-07-28 18:12:49 +0000 | [diff] [blame] | 11 | #include "third_party/llvm/llvm-project/clang/include/clang/AST/ASTConsumer.h" |
Marcel Hlopko | 45b60ef | 2021-08-13 13:37:43 +0000 | [diff] [blame] | 12 | #include "third_party/llvm/llvm-project/clang/include/clang/Frontend/CompilerInstance.h" |
Marcel Hlopko | e8f1c4e | 2021-07-28 18:12:49 +0000 | [diff] [blame] | 13 | |
Marcel Hlopko | f15e8ce | 2022-04-08 08:46:09 -0700 | [diff] [blame] | 14 | namespace crubit { |
Marcel Hlopko | e8f1c4e | 2021-07-28 18:12:49 +0000 | [diff] [blame] | 15 | |
Marcel Hlopko | 45b60ef | 2021-08-13 13:37:43 +0000 | [diff] [blame] | 16 | std::unique_ptr<clang::ASTConsumer> FrontendAction::CreateASTConsumer( |
Devin Jeanpierre | 31e104b | 2021-10-20 07:27:25 +0000 | [diff] [blame] | 17 | clang::CompilerInstance& instance, llvm::StringRef) { |
Michael Forster | a49d2e6 | 2022-01-28 07:26:40 +0000 | [diff] [blame] | 18 | AddLifetimeAnnotationHandlers(instance.getPreprocessor(), |
| 19 | invocation_.lifetime_context_); |
| 20 | return std::make_unique<AstConsumer>(instance, invocation_); |
Marcel Hlopko | e8f1c4e | 2021-07-28 18:12:49 +0000 | [diff] [blame] | 21 | } |
| 22 | |
Marcel Hlopko | f15e8ce | 2022-04-08 08:46:09 -0700 | [diff] [blame] | 23 | } // namespace crubit |