node_kind.h 782 B

1234567891011121314151617181920212223242526272829303132333435
  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. #ifndef CARBON_TOOLCHAIN_SEMANTICS_NODE_KIND_H_
  5. #define CARBON_TOOLCHAIN_SEMANTICS_NODE_KIND_H_
  6. #include <cstdint>
  7. #include "common/ostream.h"
  8. namespace Carbon::Semantics {
  9. // Type-safe storage of Node IDs.
  10. struct NodeId {
  11. explicit NodeId(int32_t id) : id(id) {}
  12. void Print(llvm::raw_ostream& out) const { out << "%" << id; }
  13. int32_t id;
  14. };
  15. // Meta node information for declarations.
  16. enum class NodeKind {
  17. BinaryOperator,
  18. Function,
  19. IntegerLiteral,
  20. Return,
  21. SetName,
  22. Invalid,
  23. };
  24. } // namespace Carbon::Semantics
  25. #endif // CARBON_TOOLCHAIN_SEMANTICS_NODE_KIND_H_