summaryrefslogtreecommitdiff
path: root/plugins/itanium
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-07-07 10:49:20 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-07-07 10:49:20 (GMT)
commita857e1e9db9d298b7aa91e8f618e6c0ea4db84ac (patch)
treee0dc140ee5bf5badbcee673e79c4b43f88a53322 /plugins/itanium
parent21d310503e29c61411491eef6be2fb83bb5ed61c (diff)
Extended the types API.
Diffstat (limited to 'plugins/itanium')
-rw-r--r--plugins/itanium/component.c77
1 files changed, 68 insertions, 9 deletions
diff --git a/plugins/itanium/component.c b/plugins/itanium/component.c
index b8aa9c5..c2bf78a 100644
--- a/plugins/itanium/component.c
+++ b/plugins/itanium/component.c
@@ -60,6 +60,9 @@ static void visit_comp(itanium_component *, visit_comp_fc);
/* Traduit les composants de contexte Itanium en décalage. */
static bool itd_translate_component_to_offset(const itanium_component *, call_offset_t *);
+/* Ajoute un espace de noms à un type déjà préparé. */
+static void itd_prepend_namespace_to_type(GDataType *, GDataType *);
+
/******************************************************************************
@@ -1279,6 +1282,39 @@ static bool itd_translate_component_to_offset(const itanium_component *comp, cal
/******************************************************************************
* *
+* Paramètres : type = type à traiter. *
+* ns = espace à intégrer. *
+* *
+* Description : Ajoute un espace de noms à un type déjà préparé. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void itd_prepend_namespace_to_type(GDataType *type, GDataType *ns)
+{
+ GDataType *existing; /* Espace en place ? */
+
+ existing = g_data_type_get_namespace(type);
+
+ if (existing == NULL)
+ g_data_type_set_namespace(type, ns, "::");
+
+ else
+ {
+ itd_prepend_namespace_to_type(existing, ns);
+
+ g_object_unref(G_OBJECT(existing));
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : comp = composant Itanium à traduire en type. *
* *
* Description : Traduit les composants de contexte Itanium en type. *
@@ -1294,6 +1330,7 @@ GDataType *itd_translate_component_to_type(const itanium_component *comp)
GDataType *result; /* Type à retourner */
char *name; /* Attribution finale */
GDataType *ns; /* Espace de noms d'un type */
+ GDataType *sub; /* Sous-titre à traiter */
call_offset_t off0; /* Décalage #0 */
call_offset_t off1; /* Décalage #1 */
itanium_component *iter; /* Boucle de parcours */
@@ -1316,7 +1353,7 @@ GDataType *itd_translate_component_to_type(const itanium_component *comp)
if (result != NULL)
{
ns = g_class_enum_type_new(CET_NAMESPACE, strdup("std"));
- g_data_type_set_namespace(result, ns, "::");
+ itd_prepend_namespace_to_type(result, ns);
}
break;
@@ -1348,7 +1385,7 @@ GDataType *itd_translate_component_to_type(const itanium_component *comp)
result = itd_translate_component_to_type(comp->binary.right);
if (result != NULL && ns != NULL)
- g_data_type_set_namespace(result, ns, "::");
+ itd_prepend_namespace_to_type(result, ns);
}
@@ -1360,8 +1397,30 @@ GDataType *itd_translate_component_to_type(const itanium_component *comp)
if (result != NULL)
{
- name = itd_translate_component(comp->binary.left, NULL);
+ sub = itd_translate_component_to_type(comp->binary.left);
+
+ if (sub == NULL)
+ {
+ name = itd_translate_component(comp->binary.left, NULL);
+ ns = NULL;
+ }
+
+ else
+ {
+ ns = g_data_type_get_namespace(sub);
+ g_data_type_set_namespace(sub, NULL, NULL);
+
+ name = g_data_type_to_string(sub, true);
+
+ g_object_unref(G_OBJECT(sub));
+
+ }
+
g_template_type_set_name(G_TEMPLATE_TYPE(result), name);
+
+ if (ns != NULL)
+ itd_prepend_namespace_to_type(result, ns);
+
}
break;
@@ -1389,7 +1448,7 @@ GDataType *itd_translate_component_to_type(const itanium_component *comp)
result = itd_translate_component_to_type(comp->binary.right);
if (result != NULL)
- g_data_type_set_namespace(result, ns, "::");
+ itd_prepend_namespace_to_type(result, ns);
}
@@ -1426,7 +1485,7 @@ GDataType *itd_translate_component_to_type(const itanium_component *comp)
if (result != NULL)
{
if (ns != NULL)
- g_data_type_set_namespace(result, ns, "::");
+ itd_prepend_namespace_to_type(result, ns);
}
else
{
@@ -1452,7 +1511,7 @@ GDataType *itd_translate_component_to_type(const itanium_component *comp)
else
{
result = g_class_enum_type_new(CET_VIRTUAL_TABLE, NULL);
- g_data_type_set_namespace(result, ns, "::");
+ itd_prepend_namespace_to_type(result, ns);
}
break;
@@ -1467,7 +1526,7 @@ GDataType *itd_translate_component_to_type(const itanium_component *comp)
else
{
result = g_class_enum_type_new(CET_VIRTUAL_STRUCT, NULL);
- g_data_type_set_namespace(result, ns, "::");
+ itd_prepend_namespace_to_type(result, ns);
}
break;
@@ -1635,7 +1694,7 @@ GDataType *itd_translate_component_to_type(const itanium_component *comp)
g_object_unref(G_OBJECT(ns));
else
- g_data_type_set_namespace(result, ns, "::");
+ itd_prepend_namespace_to_type(result, ns);
}
@@ -1773,7 +1832,7 @@ GBinRoutine *itd_translate_component_to_routine(const itanium_component *comp)
g_data_type_set_namespace(type, NULL, NULL);
if (G_IS_TEMPLATE_TYPE(type))
- g_binary_routine_set_name_from_type(result, type);
+ g_binary_routine_set_typed_name(result, type);
else
{