Files
carbon-lang/toolchain/sem_ir/builtin_function_kind.def
T
a3d77d9b74 Factor out some parts of builtin handling and add declaration checking. (#3815)
In preparation for adding more builtins, factor out the handling of
builtin function kinds into separate files.

Add checking for builtin function signatures. The mechanism used here is
intended to provide a lot of flexibility for declaring generic builtin
functions and pretty arbitrary constraints on the types of parameters of
builtin functions. For now, these constraints are checked when the
builtin function is declared. The hope is that this will suffice, but if
not, it should be straightforward to switch to doing some of the
checking on call and share logic between the checks.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
2024-03-26 22:58:11 +00:00

23 lines
850 B
Modula-2

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// This is an X-macro header. It does not use `#include` guards, and instead is
// designed to be `#include`ed after the x-macro is defined in order for its
// inclusion to expand to the desired output. Macro definitions are cleaned up
// at the end of this file.
//
// Supported x-macro is:
// - CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(Name)
// Defines a builtin function type.
#if !defined(CARBON_SEM_IR_BUILTIN_FUNCTION_KIND)
#error \
"Must define CARBON_SEM_IR_BUILTIN_FUNCTION_KIND x-macro to use this file."
#endif
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(None)
CARBON_SEM_IR_BUILTIN_FUNCTION_KIND(IntAdd)
#undef CARBON_SEM_IR_BUILTIN_FUNCTION_KIND