mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:24:42 +01:00
Encapsulate clang::ASTUnit in SemIR::CppFile. (#6459)
This intends to avoid proliferation of dependencies on the exact API of `clang::ASTUnit`, and would enable us to more easily switch to a different approach that gives us more control over the construction of the Clang AST. Also remove some unnecessary tracking of the `CppFile` and instead always retrieve it from the `SemIR::File`. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
78025fed70
commit
d208e950c7
@@ -148,14 +148,12 @@ 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());
|
||||
std::unique_ptr<clang::ASTUnit> clang_ast_unt;
|
||||
// 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,
|
||||
.total_ir_count = 1,
|
||||
.clang_ast_unit = &clang_ast_unt}}};
|
||||
.total_ir_count = 1}}};
|
||||
|
||||
auto getter = [this]() -> const Parse::TreeAndSubtrees& {
|
||||
return *tree_and_subtrees_;
|
||||
|
||||
Reference in New Issue
Block a user