mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:14:42 +01:00
Add value store to be shared across compile stages. (#3311)
This updates lexing to use the data. I'll do checking separately, just to split changes. Note the ValueStore structure is also set up such that SemIR::File can use it for other fields. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
629c63c7d1
commit
d13f76e001
@@ -11,6 +11,7 @@
|
||||
#include "common/check.h"
|
||||
#include "llvm/ADT/Sequence.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "toolchain/base/value_store.h"
|
||||
#include "toolchain/diagnostics/diagnostic_emitter.h"
|
||||
#include "toolchain/diagnostics/null_diagnostics.h"
|
||||
#include "toolchain/lex/token_kind.h"
|
||||
@@ -374,14 +375,14 @@ class LexerBenchHelper {
|
||||
|
||||
auto Lex() -> TokenizedBuffer {
|
||||
DiagnosticConsumer& consumer = NullDiagnosticConsumer();
|
||||
return TokenizedBuffer::Lex(source_, consumer);
|
||||
return TokenizedBuffer::Lex(value_stores_, source_, consumer);
|
||||
}
|
||||
|
||||
auto DiagnoseErrors() -> std::string {
|
||||
std::string result;
|
||||
llvm::raw_string_ostream out(result);
|
||||
StreamDiagnosticConsumer consumer(out);
|
||||
auto buffer = TokenizedBuffer::Lex(source_, consumer);
|
||||
auto buffer = TokenizedBuffer::Lex(value_stores_, source_, consumer);
|
||||
consumer.Flush();
|
||||
CARBON_CHECK(buffer.has_errors())
|
||||
<< "Asked to diagnose errors but none found!";
|
||||
@@ -398,6 +399,7 @@ class LexerBenchHelper {
|
||||
fs_, filename_, ConsoleDiagnosticConsumer()));
|
||||
}
|
||||
|
||||
SharedValueStores value_stores_;
|
||||
llvm::vfs::InMemoryFileSystem fs_;
|
||||
std::string filename_ = "test.carbon";
|
||||
SourceBuffer source_;
|
||||
|
||||
Reference in New Issue
Block a user