Skip to content

Commit cc868af

Browse files
zygoloidjonmeow
andauthored
Apply suggestions from code review
Co-authored-by: Jon Ross-Perkins <[email protected]>
1 parent a6ec370 commit cc868af

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

toolchain/check/cpp/location.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ auto GetCppLocation(Context& context, SemIR::LocId loc_id)
4343
// final entry.
4444
auto absolute_node_id = absolute_node_ids.back();
4545
const auto* ir = GetFile(context, absolute_node_id.check_ir_id());
46-
if (!ir) {
47-
return clang::SourceLocation();
48-
}
46+
CHECK(ir, "Node location points at nonexistent IR");
4947
const auto& tree = ir->parse_tree();
5048
const auto& source = tree.tokens().source();
5149
auto offset =
@@ -58,7 +56,7 @@ auto GetCppLocation(Context& context, SemIR::LocId loc_id)
5856
auto file = src_mgr.getFileManager().getOptionalFileRef(source.filename());
5957
if (!file) {
6058
file = src_mgr.getFileManager().getVirtualFileRef(
61-
source.filename(), static_cast<off_t>(0), static_cast<time_t>(0));
59+
source.filename(), source.text.size(), /*ModificationTime=*/0);
6260
}
6361
src_mgr.overrideFileContents(
6462
*file, llvm::MemoryBufferRef(source.text(), source.filename()));

0 commit comments

Comments
 (0)