semantics_node_kind.cpp 904 B

123456789101112131415161718192021222324
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #include "toolchain/semantics/semantics_node_kind.h"
  5. namespace Carbon {
  6. CARBON_DEFINE_ENUM_CLASS_NAMES(SemanticsNodeKind) = {
  7. #define CARBON_SEMANTICS_NODE_KIND(Name) CARBON_ENUM_CLASS_NAME_STRING(Name)
  8. #include "toolchain/semantics/semantics_node_kind.def"
  9. };
  10. auto SemanticsNodeKind::terminator_kind() const -> SemanticsTerminatorKind {
  11. static constexpr SemanticsTerminatorKind Table[] = {
  12. #define CARBON_SEMANTICS_NODE_KIND(Name) SemanticsTerminatorKind::NotTerminator,
  13. #define CARBON_SEMANTICS_NODE_KIND_WITH_TERMINATOR_KIND(Name, TerminatorKind) \
  14. SemanticsTerminatorKind::TerminatorKind,
  15. #include "toolchain/semantics/semantics_node_kind.def"
  16. };
  17. return Table[AsInt()];
  18. }
  19. } // namespace Carbon