mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-24 02:52:44 +00:00
At present, we typically define a DiagnosticConverter, then store an instance of it and a DiagnosticEmitter that wraps it. This is relatively minor in general, but I've been trying to create more self-contained DiagnosticEmitter classes (which hold their own DiagnosticConverter, similar to NullDiagnosticEmitter), and there it just gets in the way. Since we don't reuse DiagnosticConverter instances, this combines the definition into DiagnosticEmitter. Mainly this means we don't have a separate object in play, and less to carry around. The most impact is probably to SemIRDiagnosticConverter, which was also the most complex. Now `SemIRLocDiagnosticEmitter`, this gets some different construction flow. Note in the PR I've split the file rename to its own commit, to try to help delta views. However, the most substantial parts of the refactoring are split into #4876, which this depends upon.
41 lines
1.4 KiB
C++
41 lines
1.4 KiB
C++
// 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
|
|
|
|
#ifndef CARBON_TOOLCHAIN_CHECK_CHECK_H_
|
|
#define CARBON_TOOLCHAIN_CHECK_CHECK_H_
|
|
|
|
#include "common/ostream.h"
|
|
#include "toolchain/base/shared_value_stores.h"
|
|
#include "toolchain/base/timings.h"
|
|
#include "toolchain/check/sem_ir_loc_diagnostic_emitter.h"
|
|
#include "toolchain/diagnostics/diagnostic_emitter.h"
|
|
#include "toolchain/parse/tree_and_subtrees.h"
|
|
#include "toolchain/sem_ir/file.h"
|
|
|
|
namespace Carbon::Check {
|
|
|
|
// Checking information that's tracked per file.
|
|
struct Unit {
|
|
DiagnosticConsumer* consumer;
|
|
SharedValueStores* value_stores;
|
|
// The `timings` may be null if nothing is to be recorded.
|
|
Timings* timings;
|
|
|
|
// Returns a lazily constructed TreeAndSubtrees.
|
|
Parse::GetTreeAndSubtreesFn tree_and_subtrees_getter;
|
|
|
|
// The unit's SemIR, provided as empty and filled in by CheckParseTrees.
|
|
SemIR::File* sem_ir;
|
|
};
|
|
|
|
// Checks a group of parse trees. This will use imports to decide the order of
|
|
// checking.
|
|
auto CheckParseTrees(llvm::MutableArrayRef<Unit> units, bool prelude_import,
|
|
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
|
|
llvm::raw_ostream* vlog_stream, bool fuzzing) -> void;
|
|
|
|
} // namespace Carbon::Check
|
|
|
|
#endif // CARBON_TOOLCHAIN_CHECK_CHECK_H_
|