summaryrefslogtreecommitdiff
path: root/src/format/mangling/itanium_gram.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/mangling/itanium_gram.y')
-rw-r--r--src/format/mangling/itanium_gram.y64
1 files changed, 33 insertions, 31 deletions
diff --git a/src/format/mangling/itanium_gram.y b/src/format/mangling/itanium_gram.y
index ab59ac7..0fd3b2b 100644
--- a/src/format/mangling/itanium_gram.y
+++ b/src/format/mangling/itanium_gram.y
@@ -10,6 +10,8 @@
#include "context-int.h"
#include "itanium.h"
#include "../../common/extstr.h"
+#include "../../analysis/types/cse.h"
+#include "../../analysis/types/template.h"
@@ -87,10 +89,10 @@ static GBinRoutine *g_itanium_dcontext_push_routine(GItaniumDContext *, GBinRout
static GBinRoutine *g_itanium_dcontext_pop_routine(GItaniumDContext *);
/* Ajoute un élément dans une liste de substitutions. */
-static void g_itanium_dcontext_add_item(GItaniumDContext *, GOpenidaType *);
+static void g_itanium_dcontext_add_item(GItaniumDContext *, GDataType *);
/* Fournit le nième élément d'une liste de substitutions. */
-static GOpenidaType *g_itanium_dcontext_get_item(GItaniumDContext *, guint);
+static GDataType *g_itanium_dcontext_get_item(GItaniumDContext *, guint);
/* Autorise ou non le dépilement des opérateurs. */
static void g_itanium_dcontext_update(GItaniumDContext *);
@@ -104,7 +106,7 @@ static void g_itanium_dcontext_update(GItaniumDContext *);
static void compute_routine_itanium_ret_type(GBinRoutine *);
/* Recherche et fait sauter les premiers arguments rencontrés. */
-static void update_itanium_ret_type(GOpenidaType *);
+static void update_itanium_ret_type(GDataType *);
@@ -164,7 +166,7 @@ char *strmerge(char *str1, const char *sep, char *str2);
union
{
char *str;
- void/*GOpenidaType*/ *type;
+ void/*GDataType*/ *type;
};
int/*bool*/ is_string;
@@ -175,7 +177,7 @@ char *strmerge(char *str1, const char *sep, char *str2);
unsigned int val;
short/*s16_t*/ s16_val;
- void /*GOpenidaType*/ *type;
+ void /*GDataType*/ *type;
void /*GTemplateType*/ *templtype;
void/*simple_variable*/ *simple;
@@ -339,7 +341,7 @@ name:
{
char *tmp;
- tmp = g_openida_type_to_string($1);
+ tmp = g_data_type_to_string($1);
$$.type = g_template_type_new(tmp, $2);
$$.is_string = false;
@@ -350,7 +352,7 @@ name:
}
//g_template_type_add_params($1, $2);
- printf(" [name tmp:: %s]\n", g_openida_type_to_string($$.type));
+ printf(" [name tmp:: %s]\n", g_data_type_to_string($$.type));
}
;
@@ -374,8 +376,8 @@ nested_name:
$$ = ($4 != NULL ? strmerge($3, "::", $4) : $3); printf("passage nested p+uq = '%s'\n", $$);
$$ = g_class_enum_type_new(CET_UNKNOWN, $$); g_itanium_dcontext_add_item(context, $$);
}
- | NN registered_template_prefix template_args EE { $$ = $2; g_template_type_add_params($2, $3); printf(" [nested tmp:: %s]\n", g_openida_type_to_string($$)); }
- | NN qualifiers registered_template_prefix template_args EE { $$ = $3; g_template_type_add_params($3, $4); printf(" [nested tmp:: %s]\n", g_openida_type_to_string($$)); }
+ | NN registered_template_prefix template_args EE { $$ = $2; g_template_type_add_params($2, $3); printf(" [nested tmp:: %s]\n", g_data_type_to_string($$)); }
+ | NN qualifiers registered_template_prefix template_args EE { $$ = $3; g_template_type_add_params($3, $4); printf(" [nested tmp:: %s]\n", g_data_type_to_string($$)); }
;
@@ -386,19 +388,19 @@ registered_prefix:
else
{
g_itanium_dcontext_add_item(context, $1);
- $$ = g_openida_type_to_string($1);
+ $$ = g_data_type_to_string($1);
}
}
| substitution {
- $$ = g_openida_type_to_string($1);
- printf("prefix substi :: %s\n", g_openida_type_to_string($1));
+ $$ = g_data_type_to_string($1);
+ printf("prefix substi :: %s\n", g_data_type_to_string($1));
}
;
prefix:
/* vide */ { $$ = NULL; }
- | registered_prefix unqualified_name { $$ = ($2 != NULL ? g_class_enum_type_new(CET_CLASS, strmerge($1, "::", $2)) : $1); printf("passage p+uq = '%s'\n", g_openida_type_to_string($$)); }
- | registered_template_prefix template_args { $$ = $1; g_template_type_add_params($1, $2); printf("passage p_tmp = '%s'\n", g_openida_type_to_string($$)); }
+ | registered_prefix unqualified_name { $$ = ($2 != NULL ? g_class_enum_type_new(CET_CLASS, strmerge($1, "::", $2)) : $1); printf("passage p+uq = '%s'\n", g_data_type_to_string($$)); }
+ | registered_template_prefix template_args { $$ = $1; g_template_type_add_params($1, $2); printf("passage p_tmp = '%s'\n", g_data_type_to_string($$)); }
;
registered_template_prefix:
@@ -414,12 +416,12 @@ template_prefix:
g_itanium_dcontext_add_item(context, g_class_enum_type_new(CET_CLASS, $$));
}
| template_param {
- $$ = g_openida_type_to_string($1);
+ $$ = g_data_type_to_string($1);
printf("[[ tmp param %s ]]\n", $$);
g_object_unref(G_OBJECT($1));
}
| substitution {
- $$ = g_openida_type_to_string($1);
+ $$ = g_data_type_to_string($1);
printf("template_prefix substi :: %s\n", $$);
g_object_unref(G_OBJECT($1));
}
@@ -526,20 +528,20 @@ function_type:
type:
- builtin_type { $$ = $1; printf("builtin '%s'\n", g_openida_type_to_string($1)); }
+ builtin_type { $$ = $1; printf("builtin '%s'\n", g_data_type_to_string($1)); }
| class_enum_type { $$ = $1; printf("type :: %p\n", $1); fflush(NULL); g_itanium_dcontext_add_item(context, $1); }
| substitution { $$ = $1; }
| template_param { $$ = $1; }
| template_template_param template_args {
- $$ = g_template_type_new(g_openida_type_to_string($1), NULL);
+ $$ = g_template_type_new(g_data_type_to_string($1), NULL);
g_object_unref($1);
g_template_type_add_params($$, $2);
- printf(" [type tmp:: %s]\n", g_openida_type_to_string($$));
+ printf(" [type tmp:: %s]\n", g_data_type_to_string($$));
}
| function_type { $$ = $1; }
| qualifiers type {
- $$ = g_openida_type_dup($2);
- g_openida_type_add_qualifier($$, $1);
+ $$ = g_data_type_dup($2);
+ g_data_type_add_qualifier($$, $1);
g_itanium_dcontext_add_item(context, $$);
}
| TP type { $$ = g_encapsulated_type_new(ECT_POINTER, $2); g_itanium_dcontext_add_item(context, $$); }
@@ -604,14 +606,14 @@ class_enum_type:
template_param:
TPARAM_FIRST {
- const GOpenidaType *type = g_binary_routine_get_type_from_name(routine);
+ const GDataType *type = g_binary_routine_get_type_from_name(routine);
if (G_IS_TEMPLATE_TYPE(type))
$$ = g_template_type_get_param(G_TEMPLATE_TYPE(type), 0);
else $$ = NULL;
if ($$ == NULL) YYERROR; if (!G_IS_BASIC_TYPE($$)) g_itanium_dcontext_add_item(context, $$);
}
| TPARAM_N {
- const GOpenidaType *type = g_binary_routine_get_type_from_name(routine);
+ const GDataType *type = g_binary_routine_get_type_from_name(routine);
if (G_IS_TEMPLATE_TYPE(type))
$$ = g_template_type_get_param(G_TEMPLATE_TYPE(type), $1 + 1);
else $$ = NULL;
@@ -929,11 +931,11 @@ static GBinRoutine *g_itanium_dcontext_pop_routine(GItaniumDContext *context)
* *
******************************************************************************/
-static void g_itanium_dcontext_add_item(GItaniumDContext *context, GOpenidaType *type)
+static void g_itanium_dcontext_add_item(GItaniumDContext *context, GDataType *type)
{
g_object_ref(G_OBJECT(type));
- printf(" [[ %u ]] PUSH '%s' (%p)\n", g_slist_length(context->substitutions) - 1, g_openida_type_to_string(type), type);
+ printf(" [[ %u ]] PUSH '%s' (%p)\n", g_slist_length(context->substitutions) - 1, g_data_type_to_string(type), type);
context->substitutions = g_slist_append(context->substitutions, type);
@@ -953,11 +955,11 @@ static void g_itanium_dcontext_add_item(GItaniumDContext *context, GOpenidaType
* *
******************************************************************************/
-static GOpenidaType *g_itanium_dcontext_get_item(GItaniumDContext *context, guint n)
+static GDataType *g_itanium_dcontext_get_item(GItaniumDContext *context, guint n)
{
printf("get [%u] == %p\n", n, g_slist_nth_data(context->substitutions, n + 1));
- return G_OPENIDA_TYPE(g_slist_nth_data(context->substitutions, n + 1));
+ return G_DATA_TYPE(g_slist_nth_data(context->substitutions, n + 1));
}
@@ -1072,7 +1074,7 @@ bool demangle_itanium_routine(GItaniumDContext *context, const char *desc)
GBinRoutine *routine; /* Routine à construire */
YY_BUFFER_STATE buffer; /* Tampon pour bison */
int ret; /* Bilan de l'appel */
- GOpenidaType *name_type; /* Nom basé sur un type ? */
+ GDataType *name_type; /* Nom basé sur un type ? */
routine = g_demangling_context_get_decoded_routine(G_DEMANGLING_CONTEXT(context));
@@ -1113,7 +1115,7 @@ static void compute_routine_itanium_ret_type(GBinRoutine *routine)
size_t count; /* Nombre d'arguments présents */
size_t i; /* Boucle de parcours */
GBinVariable *arg; /* Argument de la routine */
- GOpenidaType *type; /* Type associé à l'argument */
+ GDataType *type; /* Type associé à l'argument */
/* Traitement récursif des arguments */
@@ -1173,12 +1175,12 @@ static void compute_routine_itanium_ret_type(GBinRoutine *routine)
* *
******************************************************************************/
-static void update_itanium_ret_type(GOpenidaType *type)
+static void update_itanium_ret_type(GDataType *type)
{
GTemplateType *template; /* Gabarit à analyser */
size_t max; /* Nombre d'itérations */
size_t i; /* Boucle de parcours */
- GOpenidaType *subtype; /* Type à traiter */
+ GDataType *subtype; /* Type à traiter */
GEncapsulatedType *encaps; /* Encapsulation quelconque */
GBinRoutine *routine; /* Routine à traiter */