context.cpp 677 B

1234567891011121314151617181920212223
  1. // Part of the Carbon Language 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. #include "toolchain/check/cpp/context.h"
  5. #include "clang/AST/Mangle.h"
  6. namespace Carbon::Check {
  7. CppContext::CppContext(std::unique_ptr<clang::FrontendAction> action)
  8. : action_(std::move(action)) {}
  9. CppContext::~CppContext() = default;
  10. auto CppContext::clang_mangle_context() -> clang::MangleContext& {
  11. if (!clang_mangle_context_) {
  12. clang_mangle_context_.reset(ast_context().createMangleContext());
  13. }
  14. return *clang_mangle_context_;
  15. }
  16. } // namespace Carbon::Check