mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:30:12 +01:00
Expand use of CheckIRId stores (#5820)
This is trying to make it clearer when vectors are being indexed with `CheckIRId`. The only one that I still kind of want to change is the `SmallVector<std::unique_ptr<CompilationUnit>>`, but because it's a `unique_ptr` that's a little more complex. I may not bother. Note, some of the changes around nuanced `SmallVector` interactions were based on trying to copy the way `SmallVector` itself takes arguments, like with range passing.
This commit is contained in:
@@ -361,7 +361,7 @@ static auto MaybeDumpFormattedSemIR(
|
||||
// Handles options for dumping SemIR, including verbose output.
|
||||
static auto MaybeDumpSemIR(
|
||||
llvm::ArrayRef<Unit> units,
|
||||
llvm::ArrayRef<Parse::GetTreeAndSubtreesFn> tree_and_subtrees_getters,
|
||||
const Parse::GetTreeAndSubtreesStore& tree_and_subtrees_getters,
|
||||
const CheckParseTreesOptions& options) -> void {
|
||||
if (!options.vlog_stream && !options.dump_stream &&
|
||||
!options.raw_dump_stream) {
|
||||
@@ -375,22 +375,21 @@ static auto MaybeDumpSemIR(
|
||||
|
||||
for (const auto& unit : units) {
|
||||
bool include_in_dumps =
|
||||
options.include_in_dumps[unit.sem_ir->check_ir_id().index];
|
||||
options.include_in_dumps->Get(unit.sem_ir->check_ir_id());
|
||||
if (include_in_dumps && options.raw_dump_stream) {
|
||||
unit.sem_ir->Print(*options.raw_dump_stream,
|
||||
options.dump_raw_sem_ir_builtins);
|
||||
}
|
||||
|
||||
MaybeDumpFormattedSemIR(
|
||||
*unit.sem_ir,
|
||||
tree_and_subtrees_getters[unit.sem_ir->check_ir_id().index],
|
||||
*unit.sem_ir, tree_and_subtrees_getters.Get(unit.sem_ir->check_ir_id()),
|
||||
include_in_dumps, options);
|
||||
}
|
||||
}
|
||||
|
||||
auto CheckParseTrees(
|
||||
llvm::MutableArrayRef<Unit> units,
|
||||
llvm::ArrayRef<Parse::GetTreeAndSubtreesFn> tree_and_subtrees_getters,
|
||||
const Parse::GetTreeAndSubtreesStore& tree_and_subtrees_getters,
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
|
||||
const CheckParseTreesOptions& options,
|
||||
std::shared_ptr<clang::CompilerInvocation> clang_invocation) -> void {
|
||||
@@ -399,7 +398,7 @@ auto CheckParseTrees(
|
||||
llvm::SmallVector<UnitAndImports, 0> unit_infos(
|
||||
llvm::map_range(units, [&](Unit& unit) {
|
||||
return UnitAndImports(
|
||||
&unit, tree_and_subtrees_getters[unit.sem_ir->check_ir_id().index]);
|
||||
&unit, tree_and_subtrees_getters.Get(unit.sem_ir->check_ir_id()));
|
||||
}));
|
||||
|
||||
Map<ImportKey, UnitAndImports*> api_map =
|
||||
@@ -448,7 +447,7 @@ auto CheckParseTrees(
|
||||
for (int check_index = 0;
|
||||
check_index < static_cast<int>(ready_to_check.size()); ++check_index) {
|
||||
auto* unit_info = ready_to_check[check_index];
|
||||
CheckUnit(unit_info, tree_and_subtrees_getters, fs, clang_invocation,
|
||||
CheckUnit(unit_info, &tree_and_subtrees_getters, fs, clang_invocation,
|
||||
options.vlog_stream)
|
||||
.Run();
|
||||
for (auto* incoming_import : unit_info->incoming_imports) {
|
||||
@@ -497,7 +496,7 @@ auto CheckParseTrees(
|
||||
// incomplete imports.
|
||||
for (auto& unit_info : unit_infos) {
|
||||
if (unit_info.imports_remaining > 0) {
|
||||
CheckUnit(&unit_info, tree_and_subtrees_getters, fs, clang_invocation,
|
||||
CheckUnit(&unit_info, &tree_and_subtrees_getters, fs, clang_invocation,
|
||||
options.vlog_stream)
|
||||
.Run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user