/* Generated by libdrgn/build-aux/gen_constants.py. */

#include "drgnpy.h"

PyObject *AbsenceReason_class;
PyObject *Architecture_class;
PyObject *FindObjectFlags_class;
PyObject *KmodSearchMethod_class;
PyObject *ModuleFileStatus_class;
PyObject *PlatformFlags_class;
PyObject *PrimitiveType_class;
PyObject *ProgramFlags_class;
PyObject *Qualifiers_class;
PyObject *SupplementaryFileKind_class;
PyObject *SymbolBinding_class;
PyObject *SymbolKind_class;
PyObject *TypeKind_class;

static int add_AbsenceReason(PyObject *m, PyObject *enum_module)
{
	PyObject *tmp, *item;
	int ret = -1;

	tmp = PyList_New(3);
	if (!tmp)
		goto out;
	item = Py_BuildValue("sK", "OTHER", (unsigned long long)DRGN_ABSENCE_REASON_OTHER);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 0, item);
	item = Py_BuildValue("sK", "OPTIMIZED_OUT", (unsigned long long)DRGN_ABSENCE_REASON_OPTIMIZED_OUT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 1, item);
	item = Py_BuildValue("sK", "NOT_IMPLEMENTED", (unsigned long long)DRGN_ABSENCE_REASON_NOT_IMPLEMENTED);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 2, item);
	AbsenceReason_class = PyObject_CallMethod(enum_module, "Enum", "sO", "AbsenceReason", tmp);
	if (PyModule_AddObjectRef(m, "AbsenceReason", AbsenceReason_class))
		goto out;
	Py_DECREF(tmp);
	tmp = PyUnicode_FromString(drgn_AbsenceReason_DOC);
	if (!tmp)
		goto out;
	if (PyObject_SetAttrString(AbsenceReason_class, "__doc__", tmp) == -1)
		goto out;

	ret = 0;
out:
	Py_XDECREF(tmp);
	return ret;
}

static int add_Architecture(PyObject *m, PyObject *enum_module)
{
	PyObject *tmp, *item;
	int ret = -1;

	tmp = PyList_New(10);
	if (!tmp)
		goto out;
	item = Py_BuildValue("sK", "UNKNOWN", (unsigned long long)DRGN_ARCH_UNKNOWN);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 0, item);
	item = Py_BuildValue("sK", "X86_64", (unsigned long long)DRGN_ARCH_X86_64);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 1, item);
	item = Py_BuildValue("sK", "I386", (unsigned long long)DRGN_ARCH_I386);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 2, item);
	item = Py_BuildValue("sK", "AARCH64", (unsigned long long)DRGN_ARCH_AARCH64);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 3, item);
	item = Py_BuildValue("sK", "ARM", (unsigned long long)DRGN_ARCH_ARM);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 4, item);
	item = Py_BuildValue("sK", "PPC64", (unsigned long long)DRGN_ARCH_PPC64);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 5, item);
	item = Py_BuildValue("sK", "RISCV64", (unsigned long long)DRGN_ARCH_RISCV64);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 6, item);
	item = Py_BuildValue("sK", "RISCV32", (unsigned long long)DRGN_ARCH_RISCV32);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 7, item);
	item = Py_BuildValue("sK", "S390X", (unsigned long long)DRGN_ARCH_S390X);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 8, item);
	item = Py_BuildValue("sK", "S390", (unsigned long long)DRGN_ARCH_S390);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 9, item);
	Architecture_class = PyObject_CallMethod(enum_module, "Enum", "sO", "Architecture", tmp);
	if (PyModule_AddObjectRef(m, "Architecture", Architecture_class))
		goto out;
	Py_DECREF(tmp);
	tmp = PyUnicode_FromString(drgn_Architecture_DOC);
	if (!tmp)
		goto out;
	if (PyObject_SetAttrString(Architecture_class, "__doc__", tmp) == -1)
		goto out;

	ret = 0;
out:
	Py_XDECREF(tmp);
	return ret;
}

static int add_FindObjectFlags(PyObject *m, PyObject *enum_module)
{
	PyObject *tmp, *item;
	int ret = -1;

	tmp = PyList_New(4);
	if (!tmp)
		goto out;
	item = Py_BuildValue("sK", "CONSTANT", (unsigned long long)DRGN_FIND_OBJECT_CONSTANT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 0, item);
	item = Py_BuildValue("sK", "FUNCTION", (unsigned long long)DRGN_FIND_OBJECT_FUNCTION);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 1, item);
	item = Py_BuildValue("sK", "VARIABLE", (unsigned long long)DRGN_FIND_OBJECT_VARIABLE);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 2, item);
	item = Py_BuildValue("sK", "ANY", (unsigned long long)DRGN_FIND_OBJECT_ANY);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 3, item);
	FindObjectFlags_class = PyObject_CallMethod(enum_module, "Flag", "sO", "FindObjectFlags", tmp);
	if (PyModule_AddObjectRef(m, "FindObjectFlags", FindObjectFlags_class))
		goto out;
	Py_DECREF(tmp);
	tmp = PyUnicode_FromString(drgn_FindObjectFlags_DOC);
	if (!tmp)
		goto out;
	if (PyObject_SetAttrString(FindObjectFlags_class, "__doc__", tmp) == -1)
		goto out;

	ret = 0;
out:
	Py_XDECREF(tmp);
	return ret;
}

static int add_KmodSearchMethod(PyObject *m, PyObject *enum_module)
{
	PyObject *tmp, *item;
	int ret = -1;

	tmp = PyList_New(5);
	if (!tmp)
		goto out;
	item = Py_BuildValue("sK", "NONE", (unsigned long long)DRGN_KMOD_SEARCH_NONE);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 0, item);
	item = Py_BuildValue("sK", "DEPMOD", (unsigned long long)DRGN_KMOD_SEARCH_DEPMOD);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 1, item);
	item = Py_BuildValue("sK", "WALK", (unsigned long long)DRGN_KMOD_SEARCH_WALK);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 2, item);
	item = Py_BuildValue("sK", "DEPMOD_OR_WALK", (unsigned long long)DRGN_KMOD_SEARCH_DEPMOD_OR_WALK);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 3, item);
	item = Py_BuildValue("sK", "DEPMOD_AND_WALK", (unsigned long long)DRGN_KMOD_SEARCH_DEPMOD_AND_WALK);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 4, item);
	KmodSearchMethod_class = PyObject_CallMethod(enum_module, "Enum", "sO", "KmodSearchMethod", tmp);
	if (PyModule_AddObjectRef(m, "KmodSearchMethod", KmodSearchMethod_class))
		goto out;
	Py_DECREF(tmp);
	tmp = PyUnicode_FromString(drgn_KmodSearchMethod_DOC);
	if (!tmp)
		goto out;
	if (PyObject_SetAttrString(KmodSearchMethod_class, "__doc__", tmp) == -1)
		goto out;

	ret = 0;
out:
	Py_XDECREF(tmp);
	return ret;
}

static int add_ModuleFileStatus(PyObject *m, PyObject *enum_module)
{
	PyObject *tmp, *item;
	int ret = -1;

	tmp = PyList_New(5);
	if (!tmp)
		goto out;
	item = Py_BuildValue("sK", "WANT", (unsigned long long)DRGN_MODULE_FILE_WANT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 0, item);
	item = Py_BuildValue("sK", "HAVE", (unsigned long long)DRGN_MODULE_FILE_HAVE);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 1, item);
	item = Py_BuildValue("sK", "DONT_WANT", (unsigned long long)DRGN_MODULE_FILE_DONT_WANT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 2, item);
	item = Py_BuildValue("sK", "DONT_NEED", (unsigned long long)DRGN_MODULE_FILE_DONT_NEED);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 3, item);
	item = Py_BuildValue("sK", "WANT_SUPPLEMENTARY", (unsigned long long)DRGN_MODULE_FILE_WANT_SUPPLEMENTARY);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 4, item);
	ModuleFileStatus_class = PyObject_CallMethod(enum_module, "Enum", "sO", "ModuleFileStatus", tmp);
	if (PyModule_AddObjectRef(m, "ModuleFileStatus", ModuleFileStatus_class))
		goto out;
	Py_DECREF(tmp);
	tmp = PyUnicode_FromString(drgn_ModuleFileStatus_DOC);
	if (!tmp)
		goto out;
	if (PyObject_SetAttrString(ModuleFileStatus_class, "__doc__", tmp) == -1)
		goto out;

	ret = 0;
out:
	Py_XDECREF(tmp);
	return ret;
}

static int add_PlatformFlags(PyObject *m, PyObject *enum_module)
{
	PyObject *tmp, *item;
	int ret = -1;

	tmp = PyList_New(2);
	if (!tmp)
		goto out;
	item = Py_BuildValue("sK", "IS_64_BIT", (unsigned long long)DRGN_PLATFORM_IS_64_BIT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 0, item);
	item = Py_BuildValue("sK", "IS_LITTLE_ENDIAN", (unsigned long long)DRGN_PLATFORM_IS_LITTLE_ENDIAN);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 1, item);
	PlatformFlags_class = PyObject_CallMethod(enum_module, "Flag", "sO", "PlatformFlags", tmp);
	if (PyModule_AddObjectRef(m, "PlatformFlags", PlatformFlags_class))
		goto out;
	Py_DECREF(tmp);
	tmp = PyUnicode_FromString(drgn_PlatformFlags_DOC);
	if (!tmp)
		goto out;
	if (PyObject_SetAttrString(PlatformFlags_class, "__doc__", tmp) == -1)
		goto out;

	ret = 0;
out:
	Py_XDECREF(tmp);
	return ret;
}

static int add_PrimitiveType(PyObject *m, PyObject *enum_module)
{
	PyObject *tmp, *item;
	int ret = -1;

	tmp = PyList_New(18);
	if (!tmp)
		goto out;
	item = Py_BuildValue("sK", "C_VOID", (unsigned long long)DRGN_C_TYPE_VOID);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 0, item);
	item = Py_BuildValue("sK", "C_CHAR", (unsigned long long)DRGN_C_TYPE_CHAR);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 1, item);
	item = Py_BuildValue("sK", "C_SIGNED_CHAR", (unsigned long long)DRGN_C_TYPE_SIGNED_CHAR);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 2, item);
	item = Py_BuildValue("sK", "C_UNSIGNED_CHAR", (unsigned long long)DRGN_C_TYPE_UNSIGNED_CHAR);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 3, item);
	item = Py_BuildValue("sK", "C_SHORT", (unsigned long long)DRGN_C_TYPE_SHORT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 4, item);
	item = Py_BuildValue("sK", "C_UNSIGNED_SHORT", (unsigned long long)DRGN_C_TYPE_UNSIGNED_SHORT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 5, item);
	item = Py_BuildValue("sK", "C_INT", (unsigned long long)DRGN_C_TYPE_INT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 6, item);
	item = Py_BuildValue("sK", "C_UNSIGNED_INT", (unsigned long long)DRGN_C_TYPE_UNSIGNED_INT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 7, item);
	item = Py_BuildValue("sK", "C_LONG", (unsigned long long)DRGN_C_TYPE_LONG);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 8, item);
	item = Py_BuildValue("sK", "C_UNSIGNED_LONG", (unsigned long long)DRGN_C_TYPE_UNSIGNED_LONG);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 9, item);
	item = Py_BuildValue("sK", "C_LONG_LONG", (unsigned long long)DRGN_C_TYPE_LONG_LONG);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 10, item);
	item = Py_BuildValue("sK", "C_UNSIGNED_LONG_LONG", (unsigned long long)DRGN_C_TYPE_UNSIGNED_LONG_LONG);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 11, item);
	item = Py_BuildValue("sK", "C_BOOL", (unsigned long long)DRGN_C_TYPE_BOOL);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 12, item);
	item = Py_BuildValue("sK", "C_FLOAT", (unsigned long long)DRGN_C_TYPE_FLOAT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 13, item);
	item = Py_BuildValue("sK", "C_DOUBLE", (unsigned long long)DRGN_C_TYPE_DOUBLE);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 14, item);
	item = Py_BuildValue("sK", "C_LONG_DOUBLE", (unsigned long long)DRGN_C_TYPE_LONG_DOUBLE);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 15, item);
	item = Py_BuildValue("sK", "C_SIZE_T", (unsigned long long)DRGN_C_TYPE_SIZE_T);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 16, item);
	item = Py_BuildValue("sK", "C_PTRDIFF_T", (unsigned long long)DRGN_C_TYPE_PTRDIFF_T);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 17, item);
	PrimitiveType_class = PyObject_CallMethod(enum_module, "Enum", "sO", "PrimitiveType", tmp);
	if (PyModule_AddObjectRef(m, "PrimitiveType", PrimitiveType_class))
		goto out;
	Py_DECREF(tmp);
	tmp = PyUnicode_FromString(drgn_PrimitiveType_DOC);
	if (!tmp)
		goto out;
	if (PyObject_SetAttrString(PrimitiveType_class, "__doc__", tmp) == -1)
		goto out;

	ret = 0;
out:
	Py_XDECREF(tmp);
	return ret;
}

static int add_ProgramFlags(PyObject *m, PyObject *enum_module)
{
	PyObject *tmp, *item;
	int ret = -1;

	tmp = PyList_New(3);
	if (!tmp)
		goto out;
	item = Py_BuildValue("sK", "IS_LINUX_KERNEL", (unsigned long long)DRGN_PROGRAM_IS_LINUX_KERNEL);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 0, item);
	item = Py_BuildValue("sK", "IS_LIVE", (unsigned long long)DRGN_PROGRAM_IS_LIVE);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 1, item);
	item = Py_BuildValue("sK", "IS_LOCAL", (unsigned long long)DRGN_PROGRAM_IS_LOCAL);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 2, item);
	ProgramFlags_class = PyObject_CallMethod(enum_module, "Flag", "sO", "ProgramFlags", tmp);
	if (PyModule_AddObjectRef(m, "ProgramFlags", ProgramFlags_class))
		goto out;
	Py_DECREF(tmp);
	tmp = PyUnicode_FromString(drgn_ProgramFlags_DOC);
	if (!tmp)
		goto out;
	if (PyObject_SetAttrString(ProgramFlags_class, "__doc__", tmp) == -1)
		goto out;

	ret = 0;
out:
	Py_XDECREF(tmp);
	return ret;
}

static int add_Qualifiers(PyObject *m, PyObject *enum_module)
{
	PyObject *tmp, *item;
	int ret = -1;

	tmp = PyList_New(5);
	if (!tmp)
		goto out;
	item = Py_BuildValue("sK", "NONE", (unsigned long long)0);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 0, item);
	item = Py_BuildValue("sK", "CONST", (unsigned long long)DRGN_QUALIFIER_CONST);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 1, item);
	item = Py_BuildValue("sK", "VOLATILE", (unsigned long long)DRGN_QUALIFIER_VOLATILE);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 2, item);
	item = Py_BuildValue("sK", "RESTRICT", (unsigned long long)DRGN_QUALIFIER_RESTRICT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 3, item);
	item = Py_BuildValue("sK", "ATOMIC", (unsigned long long)DRGN_QUALIFIER_ATOMIC);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 4, item);
	Qualifiers_class = PyObject_CallMethod(enum_module, "Flag", "sO", "Qualifiers", tmp);
	if (PyModule_AddObjectRef(m, "Qualifiers", Qualifiers_class))
		goto out;
	Py_DECREF(tmp);
	tmp = PyUnicode_FromString(drgn_Qualifiers_DOC);
	if (!tmp)
		goto out;
	if (PyObject_SetAttrString(Qualifiers_class, "__doc__", tmp) == -1)
		goto out;

	ret = 0;
out:
	Py_XDECREF(tmp);
	return ret;
}

static int add_SupplementaryFileKind(PyObject *m, PyObject *enum_module)
{
	PyObject *tmp, *item;
	int ret = -1;

	tmp = PyList_New(1);
	if (!tmp)
		goto out;
	item = Py_BuildValue("sK", "GNU_DEBUGALTLINK", (unsigned long long)DRGN_SUPPLEMENTARY_FILE_GNU_DEBUGALTLINK);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 0, item);
	SupplementaryFileKind_class = PyObject_CallMethod(enum_module, "Enum", "sO", "SupplementaryFileKind", tmp);
	if (PyModule_AddObjectRef(m, "SupplementaryFileKind", SupplementaryFileKind_class))
		goto out;
	Py_DECREF(tmp);
	tmp = PyUnicode_FromString(drgn_SupplementaryFileKind_DOC);
	if (!tmp)
		goto out;
	if (PyObject_SetAttrString(SupplementaryFileKind_class, "__doc__", tmp) == -1)
		goto out;

	ret = 0;
out:
	Py_XDECREF(tmp);
	return ret;
}

static int add_SymbolBinding(PyObject *m, PyObject *enum_module)
{
	PyObject *tmp, *item;
	int ret = -1;

	tmp = PyList_New(5);
	if (!tmp)
		goto out;
	item = Py_BuildValue("sK", "UNKNOWN", (unsigned long long)DRGN_SYMBOL_BINDING_UNKNOWN);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 0, item);
	item = Py_BuildValue("sK", "LOCAL", (unsigned long long)DRGN_SYMBOL_BINDING_LOCAL);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 1, item);
	item = Py_BuildValue("sK", "GLOBAL", (unsigned long long)DRGN_SYMBOL_BINDING_GLOBAL);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 2, item);
	item = Py_BuildValue("sK", "WEAK", (unsigned long long)DRGN_SYMBOL_BINDING_WEAK);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 3, item);
	item = Py_BuildValue("sK", "UNIQUE", (unsigned long long)DRGN_SYMBOL_BINDING_UNIQUE);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 4, item);
	SymbolBinding_class = PyObject_CallMethod(enum_module, "Enum", "sO", "SymbolBinding", tmp);
	if (PyModule_AddObjectRef(m, "SymbolBinding", SymbolBinding_class))
		goto out;
	Py_DECREF(tmp);
	tmp = PyUnicode_FromString(drgn_SymbolBinding_DOC);
	if (!tmp)
		goto out;
	if (PyObject_SetAttrString(SymbolBinding_class, "__doc__", tmp) == -1)
		goto out;

	ret = 0;
out:
	Py_XDECREF(tmp);
	return ret;
}

static int add_SymbolKind(PyObject *m, PyObject *enum_module)
{
	PyObject *tmp, *item;
	int ret = -1;

	tmp = PyList_New(8);
	if (!tmp)
		goto out;
	item = Py_BuildValue("sK", "UNKNOWN", (unsigned long long)DRGN_SYMBOL_KIND_UNKNOWN);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 0, item);
	item = Py_BuildValue("sK", "OBJECT", (unsigned long long)DRGN_SYMBOL_KIND_OBJECT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 1, item);
	item = Py_BuildValue("sK", "FUNC", (unsigned long long)DRGN_SYMBOL_KIND_FUNC);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 2, item);
	item = Py_BuildValue("sK", "SECTION", (unsigned long long)DRGN_SYMBOL_KIND_SECTION);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 3, item);
	item = Py_BuildValue("sK", "FILE", (unsigned long long)DRGN_SYMBOL_KIND_FILE);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 4, item);
	item = Py_BuildValue("sK", "COMMON", (unsigned long long)DRGN_SYMBOL_KIND_COMMON);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 5, item);
	item = Py_BuildValue("sK", "TLS", (unsigned long long)DRGN_SYMBOL_KIND_TLS);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 6, item);
	item = Py_BuildValue("sK", "IFUNC", (unsigned long long)DRGN_SYMBOL_KIND_IFUNC);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 7, item);
	SymbolKind_class = PyObject_CallMethod(enum_module, "Enum", "sO", "SymbolKind", tmp);
	if (PyModule_AddObjectRef(m, "SymbolKind", SymbolKind_class))
		goto out;
	Py_DECREF(tmp);
	tmp = PyUnicode_FromString(drgn_SymbolKind_DOC);
	if (!tmp)
		goto out;
	if (PyObject_SetAttrString(SymbolKind_class, "__doc__", tmp) == -1)
		goto out;

	ret = 0;
out:
	Py_XDECREF(tmp);
	return ret;
}

static int add_TypeKind(PyObject *m, PyObject *enum_module)
{
	PyObject *tmp, *item;
	int ret = -1;

	tmp = PyList_New(12);
	if (!tmp)
		goto out;
	item = Py_BuildValue("sK", "VOID", (unsigned long long)DRGN_TYPE_VOID);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 0, item);
	item = Py_BuildValue("sK", "INT", (unsigned long long)DRGN_TYPE_INT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 1, item);
	item = Py_BuildValue("sK", "BOOL", (unsigned long long)DRGN_TYPE_BOOL);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 2, item);
	item = Py_BuildValue("sK", "FLOAT", (unsigned long long)DRGN_TYPE_FLOAT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 3, item);
	item = Py_BuildValue("sK", "STRUCT", (unsigned long long)DRGN_TYPE_STRUCT);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 4, item);
	item = Py_BuildValue("sK", "UNION", (unsigned long long)DRGN_TYPE_UNION);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 5, item);
	item = Py_BuildValue("sK", "CLASS", (unsigned long long)DRGN_TYPE_CLASS);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 6, item);
	item = Py_BuildValue("sK", "ENUM", (unsigned long long)DRGN_TYPE_ENUM);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 7, item);
	item = Py_BuildValue("sK", "TYPEDEF", (unsigned long long)DRGN_TYPE_TYPEDEF);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 8, item);
	item = Py_BuildValue("sK", "POINTER", (unsigned long long)DRGN_TYPE_POINTER);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 9, item);
	item = Py_BuildValue("sK", "ARRAY", (unsigned long long)DRGN_TYPE_ARRAY);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 10, item);
	item = Py_BuildValue("sK", "FUNCTION", (unsigned long long)DRGN_TYPE_FUNCTION);
	if (!item)
		goto out;
	PyList_SET_ITEM(tmp, 11, item);
	TypeKind_class = PyObject_CallMethod(enum_module, "Enum", "sO", "TypeKind", tmp);
	if (PyModule_AddObjectRef(m, "TypeKind", TypeKind_class))
		goto out;
	Py_DECREF(tmp);
	tmp = PyUnicode_FromString(drgn_TypeKind_DOC);
	if (!tmp)
		goto out;
	if (PyObject_SetAttrString(TypeKind_class, "__doc__", tmp) == -1)
		goto out;

	ret = 0;
out:
	Py_XDECREF(tmp);
	return ret;
}

int add_module_constants(PyObject *m)
{
	PyObject *enum_module;
	int ret;

	enum_module = PyImport_ImportModule("enum");
	if (!enum_module)
		return -1;

	if (add_AbsenceReason(m, enum_module) == -1 ||
	    add_Architecture(m, enum_module) == -1 ||
	    add_FindObjectFlags(m, enum_module) == -1 ||
	    add_KmodSearchMethod(m, enum_module) == -1 ||
	    add_ModuleFileStatus(m, enum_module) == -1 ||
	    add_PlatformFlags(m, enum_module) == -1 ||
	    add_PrimitiveType(m, enum_module) == -1 ||
	    add_ProgramFlags(m, enum_module) == -1 ||
	    add_Qualifiers(m, enum_module) == -1 ||
	    add_SupplementaryFileKind(m, enum_module) == -1 ||
	    add_SymbolBinding(m, enum_module) == -1 ||
	    add_SymbolKind(m, enum_module) == -1 ||
	    add_TypeKind(m, enum_module) == -1)
		ret = -1;
	else
		ret = 0;
	Py_DECREF(enum_module);
	return ret;
}
