mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 15:51:07 +01:00
Factor out a Check::CppContext holding C++-specific check state (#6482)
* Move `Sema` access from `CppFile` into `CppContext`. * Move the mangle context from `SemIR::File` into `CppContext`. * Move source location mapping state from `Context` into `CppContext`. Also factor out the `GenerateAst` function that builds the `CppContext` and `CppFile` into its own file.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#include "toolchain/check/cpp/context.h"
|
||||
|
||||
#include "clang/AST/Mangle.h"
|
||||
|
||||
namespace Carbon::Check {
|
||||
|
||||
CppContext::CppContext(clang::ASTUnit* ast_unit) : ast_unit_(ast_unit) {}
|
||||
|
||||
CppContext::~CppContext() = default;
|
||||
|
||||
auto CppContext::clang_mangle_context() -> clang::MangleContext& {
|
||||
if (!clang_mangle_context_) {
|
||||
clang_mangle_context_.reset(ast_context().createMangleContext());
|
||||
}
|
||||
return *clang_mangle_context_;
|
||||
}
|
||||
|
||||
} // namespace Carbon::Check
|
||||
Reference in New Issue
Block a user