X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fident%2Fmangle.c;h=c27798edb80fbd7dd618c914ec6de467db9e8b1d;hb=f8d7cadcac7404b56a67f0c6b6cd71a76cda9bd6;hp=175bd21a4367672428453ab22a18c0ee578800d1;hpb=32ea6ea0320f551448bb66e534e3351977464d42;p=libfirm diff --git a/ir/ident/mangle.c b/ir/ident/mangle.c index 175bd21a4..c27798edb 100644 --- a/ir/ident/mangle.c +++ b/ir/ident/mangle.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2010 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -25,9 +25,9 @@ */ #include "config.h" -# include +#include -#include "ident.h" +#include "ident_t.h" #include "obst.h" /* Make types visible to allow most efficient access */ @@ -39,13 +39,13 @@ static struct obstack mangle_obst; /** returned a mangled type name, currently no mangling */ -static inline ident *mangle_type(ir_type *tp) +static inline ident *mangle_type(const ir_type *tp) { assert(tp->kind == k_type); return tp->name; } -ident *id_mangle_entity(ir_entity *ent) +ident *id_mangle_entity(const ir_entity *ent) { ident *type_id; char *cp; @@ -55,11 +55,11 @@ ident *id_mangle_entity(ir_entity *ent) type_id = mangle_type(ent->owner); obstack_grow(&mangle_obst, get_id_str(type_id), get_id_strlen(type_id)); obstack_1grow(&mangle_obst,'_'); - obstack_grow(&mangle_obst,get_id_str(ent->name),get_id_strlen(ent->name)); - len = obstack_object_size (&mangle_obst); - cp = obstack_finish (&mangle_obst); + obstack_grow(&mangle_obst, get_id_str(ent->name), get_id_strlen(ent->name)); + len = obstack_object_size(&mangle_obst); + cp = obstack_finish(&mangle_obst); res = new_id_from_chars(cp, len); - obstack_free (&mangle_obst, cp); + obstack_free(&mangle_obst, cp); return res; } @@ -73,10 +73,10 @@ ident *id_mangle(ident *first, ident *scnd) obstack_grow(&mangle_obst, get_id_str(first), get_id_strlen(first)); obstack_grow(&mangle_obst, get_id_str(scnd), get_id_strlen(scnd)); - len = obstack_object_size (&mangle_obst); - cp = obstack_finish (&mangle_obst); - res = new_id_from_chars (cp, len); - obstack_free (&mangle_obst, cp); + len = obstack_object_size(&mangle_obst); + cp = obstack_finish(&mangle_obst); + res = new_id_from_chars(cp, len); + obstack_free(&mangle_obst, cp); return res; } @@ -90,15 +90,15 @@ ident *id_mangle3(const char *prefix, ident *scnd, const char *suffix) obstack_grow(&mangle_obst, prefix, strlen(prefix)); obstack_grow(&mangle_obst, get_id_str(scnd), get_id_strlen(scnd)); obstack_grow(&mangle_obst, suffix, strlen(suffix)); - len = obstack_object_size (&mangle_obst); - cp = obstack_finish (&mangle_obst); - res = new_id_from_chars (cp, len); - obstack_free (&mangle_obst, cp); + len = obstack_object_size(&mangle_obst); + cp = obstack_finish(&mangle_obst); + res = new_id_from_chars(cp, len); + obstack_free(&mangle_obst, cp); return res; } /** Returns a new ident that represents firstscnd. */ -static ident *id_mangle_3(ident *first, char c, ident* scnd) +static ident *id_mangle_3(ident *first, char c, ident *scnd) { char *cp; int len; @@ -107,10 +107,10 @@ static ident *id_mangle_3(ident *first, char c, ident* scnd) obstack_grow(&mangle_obst, get_id_str(first), get_id_strlen(first)); obstack_1grow(&mangle_obst, c); obstack_grow(&mangle_obst,get_id_str(scnd),get_id_strlen(scnd)); - len = obstack_object_size (&mangle_obst); - cp = obstack_finish (&mangle_obst); - res = new_id_from_chars (cp, len); - obstack_free (&mangle_obst, cp); + len = obstack_object_size(&mangle_obst); + cp = obstack_finish(&mangle_obst); + res = new_id_from_chars(cp, len); + obstack_free(&mangle_obst, cp); return res; } @@ -121,13 +121,13 @@ ident *id_mangle_u(ident *first, ident* scnd) } /* Returns a new ident that represents first.scnd. */ -ident *id_mangle_dot(ident *first, ident* scnd) +ident *id_mangle_dot(ident *first, ident *scnd) { return id_mangle_3(first, '.', scnd); } /* returns a mangled name for a Win32 function using it's calling convention */ -ident *id_decorate_win32_c_fkt(ir_entity *ent, ident *id) +ident *id_decorate_win32_c_fkt(const ir_entity *ent, ident *id) { ir_type *tp = get_entity_type(ent); unsigned cc_mask = get_method_calling_convention(tp);