/* gcp-c-semantic-value.c generated by valac 0.17.4.20-387e, the Vala compiler
 * generated from gcp-c-semantic-value.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <gcp.h>
#include <clang-c/Index.h>
#include <gee.h>
#include <gio/gio.h>
#include <gobject/gvaluecollector.h>


#define GCP_C_TYPE_SEMANTIC_VALUE (gcp_c_semantic_value_get_type ())
#define GCP_C_SEMANTIC_VALUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_C_TYPE_SEMANTIC_VALUE, GcpCSemanticValue))
#define GCP_C_SEMANTIC_VALUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_C_TYPE_SEMANTIC_VALUE, GcpCSemanticValueClass))
#define GCP_C_IS_SEMANTIC_VALUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_C_TYPE_SEMANTIC_VALUE))
#define GCP_C_IS_SEMANTIC_VALUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_C_TYPE_SEMANTIC_VALUE))
#define GCP_C_SEMANTIC_VALUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_C_TYPE_SEMANTIC_VALUE, GcpCSemanticValueClass))

typedef struct _GcpCSemanticValue GcpCSemanticValue;
typedef struct _GcpCSemanticValueClass GcpCSemanticValueClass;
typedef struct _GcpCSemanticValuePrivate GcpCSemanticValuePrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR (gcp_c_semantic_value_translator_get_type ())
#define GCP_C_SEMANTIC_VALUE_TRANSLATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR, GcpCSemanticValueTranslator))
#define GCP_C_SEMANTIC_VALUE_TRANSLATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR, GcpCSemanticValueTranslatorClass))
#define GCP_C_SEMANTIC_VALUE_IS_TRANSLATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR))
#define GCP_C_SEMANTIC_VALUE_IS_TRANSLATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR))
#define GCP_C_SEMANTIC_VALUE_TRANSLATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR, GcpCSemanticValueTranslatorClass))

typedef struct _GcpCSemanticValueTranslator GcpCSemanticValueTranslator;
typedef struct _GcpCSemanticValueTranslatorClass GcpCSemanticValueTranslatorClass;
#define _gcp_c_semantic_value_translator_unref0(var) ((var == NULL) ? NULL : (var = (gcp_c_semantic_value_translator_unref (var), NULL)))
typedef struct _GcpCSemanticValueTranslatorPrivate GcpCSemanticValueTranslatorPrivate;
typedef struct _GcpCSemanticValueParamSpecTranslator GcpCSemanticValueParamSpecTranslator;

struct _GcpCSemanticValue {
	GcpSemanticValue parent_instance;
	GcpCSemanticValuePrivate * priv;
};

struct _GcpCSemanticValueClass {
	GcpSemanticValueClass parent_class;
};

struct _GcpCSemanticValuePrivate {
	CXCursor d_cursor;
	GcpSemanticValue* d_next;
	GcpSemanticValue* d_previous;
	GcpSemanticValue* d_up;
	GcpSemanticValue* d_down;
	GeeArrayList* d_references;
};

typedef void (*GcpCSemanticValueCursorMappedFunc) (CXCursor cursor, GcpCSemanticValue* val, void* user_data);
struct _GcpCSemanticValueTranslator {
	GTypeInstance parent_instance;
	volatile int ref_count;
	GcpCSemanticValueTranslatorPrivate * priv;
};

struct _GcpCSemanticValueTranslatorClass {
	GTypeClass parent_class;
	void (*finalize) (GcpCSemanticValueTranslator *self);
};

struct _GcpCSemanticValueTranslatorPrivate {
	GcpCSemanticValueCursorMappedFunc d_mapped;
	gpointer d_mapped_target;
	GDestroyNotify d_mapped_target_destroy_notify;
	GcpCSemanticValue* d_parent;
	GcpCSemanticValue* d_current;
	GFile* d_source;
};

struct _GcpCSemanticValueParamSpecTranslator {
	GParamSpec parent_instance;
};


static gpointer gcp_c_semantic_value_parent_class = NULL;
static gpointer gcp_c_semantic_value_translator_parent_class = NULL;
static GType gcp_c_semantic_value_translator_type_id = 0;
static GType gcp_c_semantic_value_type_id = 0;

GType gcp_c_semantic_value_get_type (void) G_GNUC_CONST;
GType gcp_c_semantic_value_register_type (GTypeModule * module);
#define GCP_C_SEMANTIC_VALUE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCP_C_TYPE_SEMANTIC_VALUE, GcpCSemanticValuePrivate))
enum  {
	GCP_C_SEMANTIC_VALUE_DUMMY_PROPERTY,
	GCP_C_SEMANTIC_VALUE_DEFINITION,
	GCP_C_SEMANTIC_VALUE_DECLARATION,
	GCP_C_SEMANTIC_VALUE_NEXT,
	GCP_C_SEMANTIC_VALUE_PREVIOUS,
	GCP_C_SEMANTIC_VALUE_UP,
	GCP_C_SEMANTIC_VALUE_DOWN,
	GCP_C_SEMANTIC_VALUE_NUM_REFERENCES
};
GcpCSemanticValue* gcp_c_semantic_value_new (CXCursor cursor);
GcpCSemanticValue* gcp_c_semantic_value_construct (GType object_type, CXCursor cursor);
GcpSourceRange* gcp_c_translator_source_range (CXSourceRange range);
GcpSemanticValueKind gcp_c_translator_semantic_kind (CXCursor cursor);
GcpSemanticValueReferenceType gcp_c_translator_semantic_reference_type (CXCursor cursor);
CXCursor gcp_c_semantic_value_get_cursor (GcpCSemanticValue* self);
void gcp_c_semantic_value_set_next (GcpCSemanticValue* self, GcpCSemanticValue* val);
void gcp_c_semantic_value_set_previous (GcpCSemanticValue* self, GcpCSemanticValue* val);
void gcp_c_semantic_value_set_up (GcpCSemanticValue* self, GcpCSemanticValue* val);
void gcp_c_semantic_value_set_down (GcpCSemanticValue* self, GcpCSemanticValue* val);
static GcpSemanticValue* gcp_c_semantic_value_real_reference (GcpSemanticValue* base, gint idx);
void gcp_c_semantic_value_add_reference (GcpCSemanticValue* self, GcpCSemanticValue* val);
GcpCSemanticValue* gcp_c_semantic_value_translate (CXCursor cursor, GFile* source, GcpCSemanticValueCursorMappedFunc mapped, void* mapped_target, GDestroyNotify mapped_target_destroy_notify);
static GcpCSemanticValueTranslator* gcp_c_semantic_value_translator_new (GcpCSemanticValueCursorMappedFunc mapped, void* mapped_target, GDestroyNotify mapped_target_destroy_notify, GFile* source);
static GcpCSemanticValueTranslator* gcp_c_semantic_value_translator_construct (GType object_type, GcpCSemanticValueCursorMappedFunc mapped, void* mapped_target, GDestroyNotify mapped_target_destroy_notify, GFile* source);
static gpointer gcp_c_semantic_value_translator_ref (gpointer instance);
static void gcp_c_semantic_value_translator_unref (gpointer instance);
static GParamSpec* gcp_c_semantic_value_param_spec_translator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) G_GNUC_UNUSED;
static void gcp_c_semantic_value_value_set_translator (GValue* value, gpointer v_object) G_GNUC_UNUSED;
static void gcp_c_semantic_value_value_take_translator (GValue* value, gpointer v_object) G_GNUC_UNUSED;
static gpointer gcp_c_semantic_value_value_get_translator (const GValue* value) G_GNUC_UNUSED;
GType gcp_c_semantic_value_translator_get_type (void) G_GNUC_CONST;
GType gcp_c_semantic_value_translator_register_type (GTypeModule * module);
static void gcp_c_semantic_value_translator_translate (GcpCSemanticValueTranslator* self, GcpCSemanticValue* parent);
#define GCP_C_SEMANTIC_VALUE_TRANSLATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR, GcpCSemanticValueTranslatorPrivate))
enum  {
	GCP_C_SEMANTIC_VALUE_TRANSLATOR_DUMMY_PROPERTY
};
static enum CXChildVisitResult gcp_c_semantic_value_translator_visit_children (GcpCSemanticValueTranslator* self, CXCursor child, CXCursor parent);
static enum CXChildVisitResult _gcp_c_semantic_value_translator_visit_children_cx_children_visitor_callback (CXCursor cursor, CXCursor parent, gpointer self);
GcpSourceLocation* gcp_c_translator_source_location (CXSourceLocation location);
static void gcp_c_semantic_value_translator_finalize (GcpCSemanticValueTranslator* obj);
static void gcp_c_semantic_value_finalize (GObject* obj);
static void _vala_gcp_c_semantic_value_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);


GcpCSemanticValue* gcp_c_semantic_value_construct (GType object_type, CXCursor cursor) {
	GcpCSemanticValue * self = NULL;
	CXSourceRange _tmp0_ = {0};
	GcpSourceRange* _tmp1_ = NULL;
	GcpSourceRange* _tmp2_;
	CXCursor _tmp3_;
	GcpSemanticValueKind _tmp4_ = 0;
	CXCursor _tmp5_;
	GcpSemanticValueReferenceType _tmp6_ = 0;
	GeeArrayList* _tmp7_;
	CXCursor _tmp8_;
	_tmp0_ = clang_getCursorExtent (cursor);
	_tmp1_ = gcp_c_translator_source_range (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = cursor;
	_tmp4_ = gcp_c_translator_semantic_kind (_tmp3_);
	_tmp5_ = cursor;
	_tmp6_ = gcp_c_translator_semantic_reference_type (_tmp5_);
	self = (GcpCSemanticValue*) gcp_semantic_value_construct (object_type, _tmp2_, _tmp4_, _tmp6_);
	_g_object_unref0 (_tmp2_);
	_tmp7_ = gee_array_list_new (G_TYPE_POINTER, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->d_references);
	self->priv->d_references = _tmp7_;
	_tmp8_ = cursor;
	self->priv->d_cursor = _tmp8_;
	return self;
}


GcpCSemanticValue* gcp_c_semantic_value_new (CXCursor cursor) {
	return gcp_c_semantic_value_construct (GCP_C_TYPE_SEMANTIC_VALUE, cursor);
}


CXCursor gcp_c_semantic_value_get_cursor (GcpCSemanticValue* self) {
	CXCursor result = {0};
	CXCursor _tmp0_;
	g_return_val_if_fail (self != NULL, result);
	_tmp0_ = self->priv->d_cursor;
	result = _tmp0_;
	return result;
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


void gcp_c_semantic_value_set_next (GcpCSemanticValue* self, GcpCSemanticValue* val) {
	GcpCSemanticValue* _tmp0_;
	GcpSemanticValue* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = val;
	_tmp1_ = _g_object_ref0 ((GcpSemanticValue*) _tmp0_);
	_g_object_unref0 (self->priv->d_next);
	self->priv->d_next = _tmp1_;
}


void gcp_c_semantic_value_set_previous (GcpCSemanticValue* self, GcpCSemanticValue* val) {
	GcpCSemanticValue* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = val;
	self->priv->d_previous = (GcpSemanticValue*) _tmp0_;
}


void gcp_c_semantic_value_set_up (GcpCSemanticValue* self, GcpCSemanticValue* val) {
	GcpCSemanticValue* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = val;
	self->priv->d_up = (GcpSemanticValue*) _tmp0_;
}


void gcp_c_semantic_value_set_down (GcpCSemanticValue* self, GcpCSemanticValue* val) {
	GcpCSemanticValue* _tmp0_;
	GcpSemanticValue* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = val;
	_tmp1_ = _g_object_ref0 ((GcpSemanticValue*) _tmp0_);
	_g_object_unref0 (self->priv->d_down);
	self->priv->d_down = _tmp1_;
}


static GcpSemanticValue* gcp_c_semantic_value_real_reference (GcpSemanticValue* base, gint idx) {
	GcpCSemanticValue * self;
	GcpSemanticValue* result = NULL;
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gpointer _tmp2_ = NULL;
	GcpSemanticValue* _tmp3_;
	self = (GcpCSemanticValue*) base;
	_tmp0_ = self->priv->d_references;
	_tmp1_ = idx;
	_tmp2_ = gee_abstract_list_get ((GeeAbstractList*) _tmp0_, _tmp1_);
	_tmp3_ = _g_object_ref0 ((GcpSemanticValue*) _tmp2_);
	result = _tmp3_;
	return result;
}


void gcp_c_semantic_value_add_reference (GcpCSemanticValue* self, GcpCSemanticValue* val) {
	GeeArrayList* _tmp0_;
	GcpCSemanticValue* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (val != NULL);
	_tmp0_ = self->priv->d_references;
	_tmp1_ = val;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp1_);
}


GcpCSemanticValue* gcp_c_semantic_value_translate (CXCursor cursor, GFile* source, GcpCSemanticValueCursorMappedFunc mapped, void* mapped_target, GDestroyNotify mapped_target_destroy_notify) {
	GcpCSemanticValue* result = NULL;
	GcpCSemanticValueCursorMappedFunc _tmp0_;
	void* _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	GFile* _tmp1_;
	GcpCSemanticValueTranslator* _tmp2_;
	GcpCSemanticValueTranslator* tr;
	CXCursor _tmp3_;
	GcpCSemanticValue* _tmp4_;
	GcpCSemanticValue* ret;
	_tmp0_ = mapped;
	_tmp0__target = mapped_target;
	_tmp0__target_destroy_notify = mapped_target_destroy_notify;
	mapped_target_destroy_notify = NULL;
	_tmp1_ = source;
	_tmp2_ = gcp_c_semantic_value_translator_new (_tmp0_, _tmp0__target, _tmp0__target_destroy_notify, _tmp1_);
	tr = _tmp2_;
	_tmp3_ = cursor;
	_tmp4_ = gcp_c_semantic_value_new (_tmp3_);
	ret = _tmp4_;
	gcp_c_semantic_value_translator_translate (tr, ret);
	result = ret;
	_gcp_c_semantic_value_translator_unref0 (tr);
	(mapped_target_destroy_notify == NULL) ? NULL : (mapped_target_destroy_notify (mapped_target), NULL);
	mapped = NULL;
	mapped_target = NULL;
	mapped_target_destroy_notify = NULL;
	return result;
}


static GcpSemanticValue* gcp_c_semantic_value_real_get_definition (GcpSemanticValue* base) {
	GcpSemanticValue* result;
	GcpCSemanticValue* self;
	self = (GcpCSemanticValue*) base;
	{
		GeeArrayList* _tmp0_;
		GeeArrayList* _tmp1_;
		GeeArrayList* _v_list;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _v_size;
		gint _v_index;
		_tmp0_ = self->priv->d_references;
		_tmp1_ = _g_object_ref0 (_tmp0_);
		_v_list = _tmp1_;
		_tmp2_ = _v_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_v_size = _tmp4_;
		_v_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			GeeArrayList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_ = NULL;
			GcpCSemanticValue* _tmp11_;
			GcpCSemanticValue* v;
			GcpCSemanticValue* _tmp12_;
			GcpSemanticValueReferenceType _tmp13_;
			GcpSemanticValueReferenceType _tmp14_;
			_tmp5_ = _v_index;
			_v_index = _tmp5_ + 1;
			_tmp6_ = _v_index;
			_tmp7_ = _v_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _v_list;
			_tmp9_ = _v_index;
			_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_);
			_tmp11_ = _g_object_ref0 (_tmp10_);
			v = _tmp11_;
			_tmp12_ = v;
			_tmp13_ = gcp_semantic_value_get_reference_type ((GcpSemanticValue*) _tmp12_);
			_tmp14_ = _tmp13_;
			if ((_tmp14_ & GCP_SEMANTIC_VALUE_REFERENCE_TYPE_DEFINITION) != 0) {
				result = (GcpSemanticValue*) v;
				_g_object_unref0 (_v_list);
				return result;
			}
			_g_object_unref0 (v);
		}
		_g_object_unref0 (_v_list);
	}
	result = NULL;
	return result;
}


static GcpSemanticValue* gcp_c_semantic_value_real_get_declaration (GcpSemanticValue* base) {
	GcpSemanticValue* result;
	GcpCSemanticValue* self;
	self = (GcpCSemanticValue*) base;
	{
		GeeArrayList* _tmp0_;
		GeeArrayList* _tmp1_;
		GeeArrayList* _v_list;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _v_size;
		gint _v_index;
		_tmp0_ = self->priv->d_references;
		_tmp1_ = _g_object_ref0 (_tmp0_);
		_v_list = _tmp1_;
		_tmp2_ = _v_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_v_size = _tmp4_;
		_v_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			GeeArrayList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_ = NULL;
			GcpCSemanticValue* _tmp11_;
			GcpCSemanticValue* v;
			GcpCSemanticValue* _tmp12_;
			GcpSemanticValueReferenceType _tmp13_;
			GcpSemanticValueReferenceType _tmp14_;
			_tmp5_ = _v_index;
			_v_index = _tmp5_ + 1;
			_tmp6_ = _v_index;
			_tmp7_ = _v_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _v_list;
			_tmp9_ = _v_index;
			_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_);
			_tmp11_ = _g_object_ref0 (_tmp10_);
			v = _tmp11_;
			_tmp12_ = v;
			_tmp13_ = gcp_semantic_value_get_reference_type ((GcpSemanticValue*) _tmp12_);
			_tmp14_ = _tmp13_;
			if ((_tmp14_ & GCP_SEMANTIC_VALUE_REFERENCE_TYPE_DECLARATION) != 0) {
				result = (GcpSemanticValue*) v;
				_g_object_unref0 (_v_list);
				return result;
			}
			_g_object_unref0 (v);
		}
		_g_object_unref0 (_v_list);
	}
	result = NULL;
	return result;
}


static GcpSemanticValue* gcp_c_semantic_value_real_get_next (GcpSemanticValue* base) {
	GcpSemanticValue* result;
	GcpCSemanticValue* self;
	GcpSemanticValue* _tmp0_;
	self = (GcpCSemanticValue*) base;
	_tmp0_ = self->priv->d_next;
	result = _tmp0_;
	return result;
}


static GcpSemanticValue* gcp_c_semantic_value_real_get_previous (GcpSemanticValue* base) {
	GcpSemanticValue* result;
	GcpCSemanticValue* self;
	GcpSemanticValue* _tmp0_;
	self = (GcpCSemanticValue*) base;
	_tmp0_ = self->priv->d_previous;
	result = _tmp0_;
	return result;
}


static GcpSemanticValue* gcp_c_semantic_value_real_get_up (GcpSemanticValue* base) {
	GcpSemanticValue* result;
	GcpCSemanticValue* self;
	GcpSemanticValue* _tmp0_;
	self = (GcpCSemanticValue*) base;
	_tmp0_ = self->priv->d_up;
	result = _tmp0_;
	return result;
}


static GcpSemanticValue* gcp_c_semantic_value_real_get_down (GcpSemanticValue* base) {
	GcpSemanticValue* result;
	GcpCSemanticValue* self;
	GcpSemanticValue* _tmp0_;
	self = (GcpCSemanticValue*) base;
	_tmp0_ = self->priv->d_down;
	result = _tmp0_;
	return result;
}


static gint gcp_c_semantic_value_real_get_num_references (GcpSemanticValue* base) {
	gint result;
	GcpCSemanticValue* self;
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	self = (GcpCSemanticValue*) base;
	_tmp0_ = self->priv->d_references;
	_tmp1_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}


static GcpCSemanticValueTranslator* gcp_c_semantic_value_translator_construct (GType object_type, GcpCSemanticValueCursorMappedFunc mapped, void* mapped_target, GDestroyNotify mapped_target_destroy_notify, GFile* source) {
	GcpCSemanticValueTranslator* self = NULL;
	GcpCSemanticValueCursorMappedFunc _tmp0_;
	void* _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	GFile* _tmp1_;
	GFile* _tmp2_;
	self = (GcpCSemanticValueTranslator*) g_type_create_instance (object_type);
	_tmp0_ = mapped;
	_tmp0__target = mapped_target;
	_tmp0__target_destroy_notify = mapped_target_destroy_notify;
	mapped_target_destroy_notify = NULL;
	(self->priv->d_mapped_target_destroy_notify == NULL) ? NULL : (self->priv->d_mapped_target_destroy_notify (self->priv->d_mapped_target), NULL);
	self->priv->d_mapped = NULL;
	self->priv->d_mapped_target = NULL;
	self->priv->d_mapped_target_destroy_notify = NULL;
	self->priv->d_mapped = _tmp0_;
	self->priv->d_mapped_target = _tmp0__target;
	self->priv->d_mapped_target_destroy_notify = _tmp0__target_destroy_notify;
	_tmp1_ = source;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (self->priv->d_source);
	self->priv->d_source = _tmp2_;
	(mapped_target_destroy_notify == NULL) ? NULL : (mapped_target_destroy_notify (mapped_target), NULL);
	mapped = NULL;
	mapped_target = NULL;
	mapped_target_destroy_notify = NULL;
	return self;
}


static GcpCSemanticValueTranslator* gcp_c_semantic_value_translator_new (GcpCSemanticValueCursorMappedFunc mapped, void* mapped_target, GDestroyNotify mapped_target_destroy_notify, GFile* source) {
	return gcp_c_semantic_value_translator_construct (GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR, mapped, mapped_target, mapped_target_destroy_notify, source);
}


static enum CXChildVisitResult _gcp_c_semantic_value_translator_visit_children_cx_children_visitor_callback (CXCursor cursor, CXCursor parent, gpointer self) {
	enum CXChildVisitResult result;
	result = gcp_c_semantic_value_translator_visit_children (self, cursor, parent);
	return result;
}


static void gcp_c_semantic_value_translator_translate (GcpCSemanticValueTranslator* self, GcpCSemanticValue* parent) {
	GcpCSemanticValue* _tmp0_;
	GcpCSemanticValue* _tmp1_;
	GcpCSemanticValue* _tmp2_;
	CXCursor _tmp3_ = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (parent != NULL);
	_tmp0_ = parent;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->d_parent);
	self->priv->d_parent = _tmp1_;
	_g_object_unref0 (self->priv->d_current);
	self->priv->d_current = NULL;
	_tmp2_ = parent;
	_tmp3_ = gcp_c_semantic_value_get_cursor (_tmp2_);
	clang_visitChildren (_tmp3_, _gcp_c_semantic_value_translator_visit_children_cx_children_visitor_callback, self);
}


static enum CXChildVisitResult gcp_c_semantic_value_translator_visit_children (GcpCSemanticValueTranslator* self, CXCursor child, CXCursor parent) {
	enum CXChildVisitResult result = 0;
	CXSourceLocation _tmp0_ = {0};
	GcpSourceLocation* _tmp1_ = NULL;
	GcpSourceLocation* loc;
	gboolean _tmp2_ = FALSE;
	GFile* _tmp3_;
	gboolean _tmp14_;
	CXCursor _tmp15_;
	GcpCSemanticValue* _tmp16_;
	GcpCSemanticValue* val;
	GcpCSemanticValue* _tmp17_;
	GcpCSemanticValue* _tmp18_;
	GcpCSemanticValue* _tmp19_;
	GcpCSemanticValue* _tmp20_;
	GcpCSemanticValue* _tmp21_;
	GcpCSemanticValueCursorMappedFunc _tmp26_;
	void* _tmp26__target;
	CXCursor _tmp27_;
	GcpCSemanticValue* _tmp28_;
	GcpCSemanticValue* _tmp29_;
	GcpCSemanticValue* _tmp30_;
	GcpCSemanticValue* curparent;
	GcpCSemanticValue* _tmp31_;
	GcpCSemanticValue* _tmp32_;
	GcpCSemanticValue* _tmp33_;
	GcpCSemanticValue* _tmp34_;
	GcpCSemanticValue* _tmp35_;
	GcpCSemanticValue* _tmp36_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = clang_getCursorLocation (child);
	_tmp1_ = gcp_c_translator_source_location (_tmp0_);
	loc = _tmp1_;
	_tmp3_ = self->priv->d_source;
	if (_tmp3_ != NULL) {
		gboolean _tmp4_ = FALSE;
		GcpSourceLocation* _tmp5_;
		GFile* _tmp6_;
		GFile* _tmp7_;
		gboolean _tmp13_;
		_tmp5_ = loc;
		_tmp6_ = gcp_source_location_get_file (_tmp5_);
		_tmp7_ = _tmp6_;
		if (_tmp7_ == NULL) {
			_tmp4_ = TRUE;
		} else {
			GFile* _tmp8_;
			GcpSourceLocation* _tmp9_;
			GFile* _tmp10_;
			GFile* _tmp11_;
			gboolean _tmp12_ = FALSE;
			_tmp8_ = self->priv->d_source;
			_tmp9_ = loc;
			_tmp10_ = gcp_source_location_get_file (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = g_file_equal (_tmp8_, _tmp11_);
			_tmp4_ = !_tmp12_;
		}
		_tmp13_ = _tmp4_;
		_tmp2_ = _tmp13_;
	} else {
		_tmp2_ = FALSE;
	}
	_tmp14_ = _tmp2_;
	if (_tmp14_) {
		result = CXChildVisit_Recurse;
		_g_object_unref0 (loc);
		return result;
	}
	_tmp15_ = child;
	_tmp16_ = gcp_c_semantic_value_new (_tmp15_);
	val = _tmp16_;
	_tmp17_ = val;
	_tmp18_ = self->priv->d_parent;
	gcp_c_semantic_value_set_up (_tmp17_, _tmp18_);
	_tmp19_ = val;
	_tmp20_ = self->priv->d_current;
	gcp_c_semantic_value_set_previous (_tmp19_, _tmp20_);
	_tmp21_ = self->priv->d_current;
	if (_tmp21_ != NULL) {
		GcpCSemanticValue* _tmp22_;
		GcpCSemanticValue* _tmp23_;
		_tmp22_ = self->priv->d_current;
		_tmp23_ = val;
		gcp_c_semantic_value_set_next (_tmp22_, _tmp23_);
	} else {
		GcpCSemanticValue* _tmp24_;
		GcpCSemanticValue* _tmp25_;
		_tmp24_ = self->priv->d_parent;
		_tmp25_ = val;
		gcp_c_semantic_value_set_down (_tmp24_, _tmp25_);
	}
	_tmp26_ = self->priv->d_mapped;
	_tmp26__target = self->priv->d_mapped_target;
	_tmp27_ = child;
	_tmp28_ = val;
	_tmp26_ (_tmp27_, _tmp28_, _tmp26__target);
	_tmp29_ = self->priv->d_parent;
	_tmp30_ = _g_object_ref0 (_tmp29_);
	curparent = _tmp30_;
	_tmp31_ = val;
	_tmp32_ = _g_object_ref0 (_tmp31_);
	_g_object_unref0 (self->priv->d_parent);
	self->priv->d_parent = _tmp32_;
	_g_object_unref0 (self->priv->d_current);
	self->priv->d_current = NULL;
	clang_visitChildren (child, _gcp_c_semantic_value_translator_visit_children_cx_children_visitor_callback, self);
	_tmp33_ = curparent;
	_tmp34_ = _g_object_ref0 (_tmp33_);
	_g_object_unref0 (self->priv->d_parent);
	self->priv->d_parent = _tmp34_;
	_tmp35_ = val;
	_tmp36_ = _g_object_ref0 (_tmp35_);
	_g_object_unref0 (self->priv->d_current);
	self->priv->d_current = _tmp36_;
	result = CXChildVisit_Continue;
	_g_object_unref0 (curparent);
	_g_object_unref0 (val);
	_g_object_unref0 (loc);
	return result;
}


static void gcp_c_semantic_value_value_translator_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void gcp_c_semantic_value_value_translator_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		gcp_c_semantic_value_translator_unref (value->data[0].v_pointer);
	}
}


static void gcp_c_semantic_value_value_translator_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = gcp_c_semantic_value_translator_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer gcp_c_semantic_value_value_translator_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* gcp_c_semantic_value_value_translator_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		GcpCSemanticValueTranslator* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = gcp_c_semantic_value_translator_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* gcp_c_semantic_value_value_translator_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	GcpCSemanticValueTranslator** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = gcp_c_semantic_value_translator_ref (value->data[0].v_pointer);
	}
	return NULL;
}


static GParamSpec* gcp_c_semantic_value_param_spec_translator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	GcpCSemanticValueParamSpecTranslator* spec;
	g_return_val_if_fail (g_type_is_a (object_type, GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


static gpointer gcp_c_semantic_value_value_get_translator (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR), NULL);
	return value->data[0].v_pointer;
}


static void gcp_c_semantic_value_value_set_translator (GValue* value, gpointer v_object) {
	GcpCSemanticValueTranslator* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		gcp_c_semantic_value_translator_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		gcp_c_semantic_value_translator_unref (old);
	}
}


static void gcp_c_semantic_value_value_take_translator (GValue* value, gpointer v_object) {
	GcpCSemanticValueTranslator* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		gcp_c_semantic_value_translator_unref (old);
	}
}


static void gcp_c_semantic_value_translator_class_init (GcpCSemanticValueTranslatorClass * klass) {
	gcp_c_semantic_value_translator_parent_class = g_type_class_peek_parent (klass);
	GCP_C_SEMANTIC_VALUE_TRANSLATOR_CLASS (klass)->finalize = gcp_c_semantic_value_translator_finalize;
	g_type_class_add_private (klass, sizeof (GcpCSemanticValueTranslatorPrivate));
}


static void gcp_c_semantic_value_translator_instance_init (GcpCSemanticValueTranslator * self) {
	self->priv = GCP_C_SEMANTIC_VALUE_TRANSLATOR_GET_PRIVATE (self);
	self->ref_count = 1;
}


static void gcp_c_semantic_value_translator_finalize (GcpCSemanticValueTranslator* obj) {
	GcpCSemanticValueTranslator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCP_C_SEMANTIC_VALUE_TYPE_TRANSLATOR, GcpCSemanticValueTranslator);
	(self->priv->d_mapped_target_destroy_notify == NULL) ? NULL : (self->priv->d_mapped_target_destroy_notify (self->priv->d_mapped_target), NULL);
	self->priv->d_mapped = NULL;
	self->priv->d_mapped_target = NULL;
	self->priv->d_mapped_target_destroy_notify = NULL;
	_g_object_unref0 (self->priv->d_parent);
	_g_object_unref0 (self->priv->d_current);
	_g_object_unref0 (self->priv->d_source);
}


GType gcp_c_semantic_value_translator_get_type (void) {
	return gcp_c_semantic_value_translator_type_id;
}


GType gcp_c_semantic_value_translator_register_type (GTypeModule * module) {
	static const GTypeValueTable g_define_type_value_table = { gcp_c_semantic_value_value_translator_init, gcp_c_semantic_value_value_translator_free_value, gcp_c_semantic_value_value_translator_copy_value, gcp_c_semantic_value_value_translator_peek_pointer, "p", gcp_c_semantic_value_value_translator_collect_value, "p", gcp_c_semantic_value_value_translator_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (GcpCSemanticValueTranslatorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gcp_c_semantic_value_translator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcpCSemanticValueTranslator), 0, (GInstanceInitFunc) gcp_c_semantic_value_translator_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	gcp_c_semantic_value_translator_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GcpCSemanticValueTranslator", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return gcp_c_semantic_value_translator_type_id;
}


static gpointer gcp_c_semantic_value_translator_ref (gpointer instance) {
	GcpCSemanticValueTranslator* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


static void gcp_c_semantic_value_translator_unref (gpointer instance) {
	GcpCSemanticValueTranslator* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		GCP_C_SEMANTIC_VALUE_TRANSLATOR_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


static void gcp_c_semantic_value_class_init (GcpCSemanticValueClass * klass) {
	gcp_c_semantic_value_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GcpCSemanticValuePrivate));
	GCP_SEMANTIC_VALUE_CLASS (klass)->reference = gcp_c_semantic_value_real_reference;
	GCP_SEMANTIC_VALUE_CLASS (klass)->get_definition = gcp_c_semantic_value_real_get_definition;
	GCP_SEMANTIC_VALUE_CLASS (klass)->get_declaration = gcp_c_semantic_value_real_get_declaration;
	GCP_SEMANTIC_VALUE_CLASS (klass)->get_next = gcp_c_semantic_value_real_get_next;
	GCP_SEMANTIC_VALUE_CLASS (klass)->get_previous = gcp_c_semantic_value_real_get_previous;
	GCP_SEMANTIC_VALUE_CLASS (klass)->get_up = gcp_c_semantic_value_real_get_up;
	GCP_SEMANTIC_VALUE_CLASS (klass)->get_down = gcp_c_semantic_value_real_get_down;
	GCP_SEMANTIC_VALUE_CLASS (klass)->get_num_references = gcp_c_semantic_value_real_get_num_references;
	G_OBJECT_CLASS (klass)->get_property = _vala_gcp_c_semantic_value_get_property;
	G_OBJECT_CLASS (klass)->finalize = gcp_c_semantic_value_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCP_C_SEMANTIC_VALUE_DEFINITION, g_param_spec_object ("definition", "definition", "definition", GCP_TYPE_SEMANTIC_VALUE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCP_C_SEMANTIC_VALUE_DECLARATION, g_param_spec_object ("declaration", "declaration", "declaration", GCP_TYPE_SEMANTIC_VALUE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCP_C_SEMANTIC_VALUE_NEXT, g_param_spec_object ("next", "next", "next", GCP_TYPE_SEMANTIC_VALUE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCP_C_SEMANTIC_VALUE_PREVIOUS, g_param_spec_object ("previous", "previous", "previous", GCP_TYPE_SEMANTIC_VALUE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCP_C_SEMANTIC_VALUE_UP, g_param_spec_object ("up", "up", "up", GCP_TYPE_SEMANTIC_VALUE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCP_C_SEMANTIC_VALUE_DOWN, g_param_spec_object ("down", "down", "down", GCP_TYPE_SEMANTIC_VALUE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCP_C_SEMANTIC_VALUE_NUM_REFERENCES, g_param_spec_int ("num-references", "num-references", "num-references", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void gcp_c_semantic_value_instance_init (GcpCSemanticValue * self) {
	self->priv = GCP_C_SEMANTIC_VALUE_GET_PRIVATE (self);
}


static void gcp_c_semantic_value_finalize (GObject* obj) {
	GcpCSemanticValue * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCP_C_TYPE_SEMANTIC_VALUE, GcpCSemanticValue);
	_g_object_unref0 (self->priv->d_next);
	_g_object_unref0 (self->priv->d_down);
	_g_object_unref0 (self->priv->d_references);
	G_OBJECT_CLASS (gcp_c_semantic_value_parent_class)->finalize (obj);
}


GType gcp_c_semantic_value_get_type (void) {
	return gcp_c_semantic_value_type_id;
}


GType gcp_c_semantic_value_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (GcpCSemanticValueClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gcp_c_semantic_value_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcpCSemanticValue), 0, (GInstanceInitFunc) gcp_c_semantic_value_instance_init, NULL };
	gcp_c_semantic_value_type_id = g_type_module_register_type (module, GCP_TYPE_SEMANTIC_VALUE, "GcpCSemanticValue", &g_define_type_info, 0);
	return gcp_c_semantic_value_type_id;
}


static void _vala_gcp_c_semantic_value_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GcpCSemanticValue * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCP_C_TYPE_SEMANTIC_VALUE, GcpCSemanticValue);
	switch (property_id) {
		case GCP_C_SEMANTIC_VALUE_DEFINITION:
		g_value_take_object (value, gcp_semantic_value_get_definition ((GcpSemanticValue*) self));
		break;
		case GCP_C_SEMANTIC_VALUE_DECLARATION:
		g_value_take_object (value, gcp_semantic_value_get_declaration ((GcpSemanticValue*) self));
		break;
		case GCP_C_SEMANTIC_VALUE_NEXT:
		g_value_set_object (value, gcp_semantic_value_get_next ((GcpSemanticValue*) self));
		break;
		case GCP_C_SEMANTIC_VALUE_PREVIOUS:
		g_value_set_object (value, gcp_semantic_value_get_previous ((GcpSemanticValue*) self));
		break;
		case GCP_C_SEMANTIC_VALUE_UP:
		g_value_set_object (value, gcp_semantic_value_get_up ((GcpSemanticValue*) self));
		break;
		case GCP_C_SEMANTIC_VALUE_DOWN:
		g_value_set_object (value, gcp_semantic_value_get_down ((GcpSemanticValue*) self));
		break;
		case GCP_C_SEMANTIC_VALUE_NUM_REFERENCES:
		g_value_set_int (value, gcp_semantic_value_get_num_references ((GcpSemanticValue*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



