mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 10:51:06 +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
@@ -89,13 +89,15 @@ static auto getName(Parse::Tree& p, Parse::Node node)
|
||||
void LanguageServer::OnDocumentSymbol(
|
||||
clang::clangd::DocumentSymbolParams const& params,
|
||||
clang::clangd::Callback<std::vector<clang::clangd::DocumentSymbol>> cb) {
|
||||
SharedValueStores value_stores;
|
||||
llvm::vfs::InMemoryFileSystem vfs;
|
||||
auto file = params.textDocument.uri.file().str();
|
||||
vfs.addFile(file, /*mtime=*/0,
|
||||
llvm::MemoryBuffer::getMemBufferCopy(files_.at(file)));
|
||||
|
||||
auto buf = SourceBuffer::CreateFromFile(vfs, file, NullDiagnosticConsumer());
|
||||
auto lexed = Lex::TokenizedBuffer::Lex(*buf, NullDiagnosticConsumer());
|
||||
auto lexed =
|
||||
Lex::TokenizedBuffer::Lex(value_stores, *buf, NullDiagnosticConsumer());
|
||||
auto parsed = Parse::Tree::Parse(lexed, NullDiagnosticConsumer(), nullptr);
|
||||
std::vector<clang::clangd::DocumentSymbol> result;
|
||||
for (const auto& node : parsed.postorder()) {
|
||||
|
||||
Reference in New Issue
Block a user