Files
carbon-lang/toolchain/check/check.h
T
Jon Ross-Perkins 1b55ad86dd Extend SharedValueStores to SemIR (#3313)
Building on #3311, change SemIR to use the SharedValueStore. Since this
removes hermeticity, raw output no longer prints ints, reals, and
strings. TokenizedBuffer accessors are modified to return IDs because
values are often passed through in semantics without needing to read
them.

I would've put SharedValueStores on Context, except for the
GetArrayBoundValue convenience method. I felt awkward removing that, so
it's on File, at least for now. That's then used by the formatter and
Lower too. The flipside of this is that TokenizedBuffer has a
SharedValueStores only for printing, so maybe that's similar enough to
what File is doing.

This doesn't start shifting other SemIR members to ValueStore, but that
seems like a next step.
2023-10-20 17:53:00 +00:00

34 lines
1.3 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/value_store.h"
#include "toolchain/diagnostics/diagnostic_emitter.h"
#include "toolchain/lex/tokenized_buffer.h"
#include "toolchain/parse/tree.h"
#include "toolchain/sem_ir/file.h"
namespace Carbon::Check {
// Constructs builtins. A single instance should be reused with CheckParseTree
// calls associated with a given compilation.
inline auto MakeBuiltins(SharedValueStores& value_stores) -> SemIR::File {
return SemIR::File(value_stores);
}
// Produces and checks the IR for the provided Parse::Tree.
extern auto CheckParseTree(SharedValueStores& value_stores,
const SemIR::File& builtin_ir,
const Lex::TokenizedBuffer& tokens,
const Parse::Tree& parse_tree,
DiagnosticConsumer& consumer,
llvm::raw_ostream* vlog_stream) -> SemIR::File;
} // namespace Carbon::Check
#endif // CARBON_TOOLCHAIN_CHECK_CHECK_H_