dan sinclair | 0ebbc5c | 2023-11-29 17:53:24 +0000 | [diff] [blame] | 1 | {{- /* |
| 2 | -------------------------------------------------------------------------------- |
| 3 | Template file for use with tools/src/cmd/gen to generate builtin_fn.h |
| 4 | |
| 5 | To update the generated file, run: |
| 6 | ./tools/run gen |
| 7 | |
| 8 | See: |
| 9 | * tools/src/cmd/gen for structures used by this template |
| 10 | * https://golang.org/pkg/text/template/ for documentation on the template syntax |
| 11 | -------------------------------------------------------------------------------- |
| 12 | */ -}} |
| 13 | |
| 14 | {{- $I := LoadIntrinsics "src/tint/lang/msl/msl.def" -}} |
| 15 | |
| 16 | #ifndef SRC_TINT_LANG_MSL_BUILTIN_FN_H_ |
| 17 | #define SRC_TINT_LANG_MSL_BUILTIN_FN_H_ |
| 18 | |
| 19 | #include <cstdint> |
| 20 | #include <string> |
| 21 | |
| 22 | #include "src/tint/utils/traits/traits.h" |
| 23 | |
| 24 | // \cond DO_NOT_DOCUMENT |
| 25 | namespace tint::msl { |
| 26 | |
| 27 | /// Enumerator of all builtin functions |
| 28 | enum class BuiltinFn : uint8_t { |
| 29 | {{- range $I.Sem.Builtins }} |
| 30 | k{{PascalCase .Name}}, |
| 31 | {{- end }} |
| 32 | kNone, |
| 33 | }; |
| 34 | |
| 35 | /// @returns the name of the builtin function type. |
| 36 | const char* str(BuiltinFn i); |
| 37 | |
| 38 | /// Emits the name of the builtin function type. |
| 39 | template <typename STREAM, typename = traits::EnableIfIsOStream<STREAM>> |
| 40 | auto& operator<<(STREAM& o, BuiltinFn i) { |
| 41 | return o << str(i); |
| 42 | } |
| 43 | |
| 44 | } // namespace tint::msl |
| 45 | // \endcond |
| 46 | |
| 47 | #endif // SRC_TINT_LANG_MSL_BUILTIN_FN_H_ |