mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Fix language-server crash with cpp_ast (#5604)
Removes the nullptr default for safety. Note, I think cpp support doesn't allow things like `<version>` or inline code yet, and language-server support doesn't allow non-hermetic files, so the best I can test is an error.
This commit is contained in:
@@ -140,14 +140,17 @@ auto Context::File::SetText(Context& context, std::optional<int64_t> version,
|
||||
|
||||
SemIR::File sem_ir(tree_.get(), SemIR::CheckIRId(0), tree_->packaging_decl(),
|
||||
*value_stores_, uri_.file().str());
|
||||
auto getter = [this]() -> const Parse::TreeAndSubtrees& {
|
||||
return *tree_and_subtrees_;
|
||||
};
|
||||
std::unique_ptr<clang::ASTUnit> cpp_ast;
|
||||
// TODO: Support cross-file checking when multiple files have edits.
|
||||
llvm::SmallVector<Check::Unit> units = {{{.consumer = &consumer,
|
||||
.value_stores = value_stores_.get(),
|
||||
.timings = nullptr,
|
||||
.sem_ir = &sem_ir}}};
|
||||
.sem_ir = &sem_ir,
|
||||
.cpp_ast = &cpp_ast}}};
|
||||
|
||||
auto getter = [this]() -> const Parse::TreeAndSubtrees& {
|
||||
return *tree_and_subtrees_;
|
||||
};
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> fs =
|
||||
new llvm::vfs::InMemoryFileSystem;
|
||||
// TODO: Include the prelude.
|
||||
|
||||
Reference in New Issue
Block a user