mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 07:21:04 +01:00
Split up C++ diagnostic emitter and factor it out. (#7558)
Split the diagnostic emitter into a separate emitter (regietered with Clang) and listener (registered with the emitter). The purpose of this split is to make the Clang emitter not depend on the `Check::Context`, so that we can use it, and hence the same Clang instance, with multiple `Check::Context`s. A fallback listener is registered to collect and emit any diagnostics produced while we don't have a `Check::Context` registered with the emitter. Assisted-by: Gemini via Antigravity
This commit is contained in:
@@ -18,6 +18,11 @@ CppContext::CppContext(clang::CompilerInstance& instance,
|
||||
|
||||
CppContext::~CppContext() = default;
|
||||
|
||||
auto CppContext::set_diagnostic_listener(
|
||||
std::unique_ptr<CppDiagnosticListener> listener) -> void {
|
||||
diagnostic_listener_ = std::move(listener);
|
||||
}
|
||||
|
||||
auto CppContext::clang_mangle_context() -> clang::MangleContext& {
|
||||
if (!clang_mangle_context_) {
|
||||
clang_mangle_context_.reset(ast_context().createMangleContext());
|
||||
|
||||
Reference in New Issue
Block a user