mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 19:51:09 +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:
@@ -96,16 +96,6 @@ auto AddIdentifierName(Context& context, llvm::StringRef name)
|
||||
return SemIR::NameId::ForIdentifier(context.identifiers().Add(name));
|
||||
}
|
||||
|
||||
// Adds the given source location and an `ImportIRInst` referring to it in
|
||||
// `ImportIRId::Cpp`.
|
||||
static auto AddImportIRInst(SemIR::File& file,
|
||||
clang::SourceLocation clang_source_loc)
|
||||
-> SemIR::ImportIRInstId {
|
||||
SemIR::ClangSourceLocId clang_source_loc_id =
|
||||
file.clang_source_locs().Add(clang_source_loc);
|
||||
return file.import_ir_insts().Add(SemIR::ImportIRInst(clang_source_loc_id));
|
||||
}
|
||||
|
||||
// Adds a namespace for the `Cpp` import and returns its `NameScopeId`.
|
||||
static auto AddNamespace(Context& context, PackageNameId cpp_package_id,
|
||||
llvm::ArrayRef<Parse::Tree::PackagingNames> imports)
|
||||
|
||||
Reference in New Issue
Block a user