#pragma once

/*#-
This template file is distributed under the MIT License. See LICENSE.md for details.
The notice below applies to the generated files.
#*/
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//

// This file is autogenerated! Do not edit it directly

#include "llvm/Support/YAMLTraits.h"
#include "revng/ADT/KeyedObjectContainer.h"
#include "revng/TupleTree/EnumTraits.h"
#include "revng/TupleTree/NamedEnumScalarTraits.h"
#include "revng/Support/Assert.h"

namespace /*= enum.namespace =*/::/*= enum.name =*/ {
/*= enum.doc | docstring =*/
enum Values
/**- if enum.underlying_type is defined **/ : /*= enum.underlying_type =*//** endif **/{
  Invalid,
  /** for member in enum.members **/
  /*=- member.doc | docstring =*/
  /*=- member.name =*/,
  /** endfor **/
  Count
};

inline llvm::StringRef getName(Values V) {
  switch (V) {
    case Invalid:
      return "Invalid";
    /**- for member in enum.members **/
    case /*= member.name =*/:
      return "/*= member.name =*/";
    /**- endfor **/
    default:
      revng_abort();
      break;
  }
}

inline Values fromName(llvm::StringRef Name) {
  /**- for member in enum.members **/
  /**- if loop.first **/
  if (Name == "/*= member.name =*/") {
    return /*= member.name =*/;
  }
  /**- else **/
  else if (Name == "/*= member.name =*/") {
    return /*= member.name =*/;
  }
  /**- endif -**/
  /**- endfor -**/
  else {
    return Invalid;
  }
}
} // namespace /*= enum.namespace =*/::/*= enum.name =*/

template<>
struct KeyedObjectTraits</*= enum | fullname =*/>
  : public IdentityKeyedObjectTraits</*= enum | fullname =*/> {};

namespace llvm::yaml {
template<>
struct ScalarEnumerationTraits</*= enum | fullname =*/>
  : public NamedEnumScalarTraits</*= enum | fullname =*/> {
};
} // namespace llvm::yaml

LLVM_YAML_IS_SEQUENCE_VECTOR(/*= enum | fullname =*/)

/*# length + 1 to account for the implicit Invalid member -#*/
template<>
inline constexpr size_t EnumElementsCount</*= enum | fullname =*/> = /*= enum.members|length + 1 =*/;

template<>
inline llvm::StringRef getEnumName</*= enum | fullname =*/>() { return "/*= enum.name =*/"; }

