blob: f1062b8b2f98bd5ce8720c8632f0b9f6009c8eac [file] [log] [blame]
Ben Clayton015fbe72023-08-09 07:46:44 +00001{{- /*
2--------------------------------------------------------------------------------
3Template file for use with tools/src/cmd/gen to generate parameter_usage.h
4
5To update the generated file, run:
6 ./tools/run gen
7
8See:
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/core/core.def" -}}
15
16#ifndef SRC_TINT_LANG_CORE_PARAMETER_USAGE_H_
17#define SRC_TINT_LANG_CORE_PARAMETER_USAGE_H_
18
Stephan Hartmann9141e912023-08-14 15:56:22 +000019#include <cstdint>
Ben Clayton015fbe72023-08-09 07:46:44 +000020#include <string>
21
22#include "src/tint/utils/traits/traits.h"
23
24namespace tint::core {
25
26/// ParameterUsage is extra metadata for identifying a parameter based on its
27/// overload position
Ben Clayton0f8b6ef2023-08-10 14:12:42 +000028enum class ParameterUsage : uint8_t {
Ben Clayton015fbe72023-08-09 07:46:44 +000029{{- range $I.Sem.UniqueParameterNames }}
30 k{{PascalCase .}},
31{{- end }}
Ben Clayton0f8b6ef2023-08-10 14:12:42 +000032 kNone,
Ben Clayton015fbe72023-08-09 07:46:44 +000033};
34
35/// @param value the enum value
36/// @returns the string for the given enum value
37std::string_view ToString(ParameterUsage value);
38
39/// @param out the stream to write to
40/// @param value the ParameterUsage
41/// @returns @p out so calls can be chained
42template <typename STREAM, typename = traits::EnableIfIsOStream<STREAM>>
43auto& operator<<(STREAM& out, ParameterUsage value) {
44 return out << ToString(value);
45}
46
47} // namespace tint::core
48
49#endif // SRC_TINT_LANG_CORE_PARAMETER_USAGE_H_