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:
Richard Smith
2024-12-17 00:47:51 +00:00
committed by GitHub
parent b25117b508
commit 3645143e27
20 changed files with 620 additions and 80 deletions
+5 -2
View File
@@ -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;
}