Skip to content

Commit

Permalink
Change branch-to-fatal to check condition (#4256)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwblaikie authored Aug 27, 2024
1 parent 5177ebb commit 4c9021c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions toolchain/lower/file_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,12 @@ auto FileContext::BuildFunctionDecl(SemIR::FunctionId function_id)
if (SemIR::IsEntryPoint(sem_ir(), function_id)) {
// TODO: Add an implicit `return 0` if `Run` doesn't return `i32`.
mangled_name = "main";
} else if (auto name =
sem_ir().names().GetAsStringIfIdentifier(function.name_id)) {
} else {
// TODO: Decide on a name mangling scheme.
auto name = sem_ir().names().GetAsStringIfIdentifier(function.name_id);
CARBON_CHECK(name) << "Unexpected special name for function: "
<< function.name_id;
mangled_name = *name;
} else {
CARBON_FATAL() << "Unexpected special name for function: "
<< function.name_id;
}

llvm::FunctionType* function_type = llvm::FunctionType::get(
Expand Down

0 comments on commit 4c9021c

Please sign in to comment.