Skip to content

Commit e2c0517

Browse files
committed
Merge branch 'toolchain-overload-diagnostics' of github.com:zygoloid/carbon-lang into toolchain-overload-diagnostics
2 parents b0896e3 + c86f78b commit e2c0517

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

toolchain/check/context.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class Context {
158158
}
159159

160160
auto cpp_carbon_file_locations()
161-
-> llvm::SmallVector<clang::SourceLocation, 0>& {
161+
-> llvm::SmallVector<clang::SourceLocation>& {
162162
return cpp_carbon_file_locations_;
163163
}
164164

@@ -394,7 +394,7 @@ class Context {
394394

395395
// Per-Carbon-file start locations for corresponding Clang source buffers.
396396
// Owned and managed by code in cpp/location.cpp.
397-
llvm::SmallVector<clang::SourceLocation, 0> cpp_carbon_file_locations_;
397+
llvm::SmallVector<clang::SourceLocation> cpp_carbon_file_locations_;
398398

399399
// Declaration instructions of entities that should have definitions by the
400400
// end of the current source file.

toolchain/check/cpp/location.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct FileInfo {
2020
// and Clang's source manager.
2121
static auto GetFileInfo(Context& context, SemIR::CheckIRId ir_id) -> FileInfo {
2222
const SemIR::File* sem_ir = &context.sem_ir();
23-
unsigned file_index = 0;
23+
int file_index = 0;
2424

2525
// If the file is imported, locate it in our imports map.
2626
if (ir_id != context.sem_ir().check_ir_id()) {
@@ -35,9 +35,9 @@ static auto GetFileInfo(Context& context, SemIR::CheckIRId ir_id) -> FileInfo {
3535
// If we've seen this file before, reuse the same FileID.
3636
auto& file_start_locs = context.cpp_carbon_file_locations();
3737
if (file_start_locs.size() <= file_index) {
38+
// Never valid; prepare a slot for the caching below.
3839
file_start_locs.resize(file_index + 1);
39-
}
40-
if (file_start_locs[file_index].isValid()) {
40+
} else if (file_start_locs[file_index].isValid()) {
4141
return {.sem_ir = sem_ir, .start_loc = file_start_locs[file_index]};
4242
}
4343

0 commit comments

Comments
 (0)