mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add solutions for advent of code 2024 day 1 to examples/. (#4673)
In order to support these examples, this adds two new builtins to the toolchain: `print.char` and `read.char`, which map to the libc functions `putchar` and `getchar`.
This commit is contained in:
@@ -1107,8 +1107,11 @@ static auto MakeConstantForBuiltinCall(Context& context, SemIRLoc loc,
|
||||
case SemIR::BuiltinFunctionKind::None:
|
||||
CARBON_FATAL("Not a builtin function.");
|
||||
|
||||
case SemIR::BuiltinFunctionKind::PrintInt: {
|
||||
// Providing a constant result would allow eliding the function call.
|
||||
case SemIR::BuiltinFunctionKind::PrintChar:
|
||||
case SemIR::BuiltinFunctionKind::PrintInt:
|
||||
case SemIR::BuiltinFunctionKind::ReadChar: {
|
||||
// These are runtime-only builtins.
|
||||
// TODO: Consider tracking this on the `BuiltinFunctionKind`.
|
||||
return SemIR::ConstantId::NotConstant;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user