mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 21:51:12 +01:00
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>
23 lines
850 B
Modula-2
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
|