mscvpdb.h: Redefine property with bitfields.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
This commit is contained in:
Eric Pouech 2022-06-22 16:28:09 +02:00 committed by Alexandre Julliard
parent b7c231c78f
commit eb14fad72a
3 changed files with 52 additions and 33 deletions

View file

@ -1015,7 +1015,7 @@ static struct symt* codeview_add_type_enum(struct codeview_type_parse* ctp,
static struct symt* codeview_add_type_struct(struct codeview_type_parse* ctp,
struct symt* existing,
const char* name, int structlen,
enum UdtKind kind, unsigned property)
enum UdtKind kind, cv_property_t property)
{
struct symt_udt* symt;
@ -1045,7 +1045,7 @@ static struct symt* codeview_add_type_struct(struct codeview_type_parse* ctp,
{
if (!(symt = codeview_cast_symt(existing, SymTagUDT))) return NULL;
/* should also check that all fields are the same */
if (!(property & 0x80)) /* 0x80 = forward declaration */
if (!property.is_forward_defn)
{
if (!symt->size) /* likely prior forward declaration, set UDT size */
symt_set_udt_size(ctp->module, symt, structlen);
@ -1195,7 +1195,7 @@ static struct symt* codeview_parse_one_type(struct codeview_type_parse* ctp,
if (details)
{
codeview_add_type(curr_type, symt);
if (!(type->struct_v1.property & 0x80)) /* 0x80 = forward declaration */
if (!type->struct_v1.property.is_forward_defn)
codeview_add_type_struct_field_list(ctp, (struct symt_udt*)symt,
type->struct_v1.fieldlist);
}
@ -1211,7 +1211,7 @@ static struct symt* codeview_parse_one_type(struct codeview_type_parse* ctp,
if (details)
{
codeview_add_type(curr_type, symt);
if (!(type->struct_v2.property & 0x80)) /* 0x80 = forward declaration */
if (!type->struct_v2.property.is_forward_defn)
codeview_add_type_struct_field_list(ctp, (struct symt_udt*)symt,
type->struct_v2.fieldlist);
}
@ -1227,7 +1227,7 @@ static struct symt* codeview_parse_one_type(struct codeview_type_parse* ctp,
if (details)
{
codeview_add_type(curr_type, symt);
if (!(type->struct_v3.property & 0x80)) /* 0x80 = forward declaration */
if (!type->struct_v3.property.is_forward_defn)
codeview_add_type_struct_field_list(ctp, (struct symt_udt*)symt,
type->struct_v3.fieldlist);
}

View file

@ -112,6 +112,25 @@ typedef unsigned short cv_typ16_t;
typedef unsigned int cv_typ_t;
typedef cv_typ_t cv_itemid_t;
typedef struct cv_property_t
{
unsigned short is_packed : 1;
unsigned short has_ctor : 1;
unsigned short has_overloaded_operator : 1;
unsigned short is_nested : 1;
unsigned short has_nested : 1;
unsigned short has_overloaded_assign : 1;
unsigned short has_operator_cast : 1;
unsigned short is_forward_defn : 1;
unsigned short is_scoped : 1;
unsigned short has_decorated_name : 1; /* follows name field */
unsigned short is_sealed : 1; /* not usage as base class */
unsigned short hfa : 2;
unsigned short is_intrinsic : 1;
unsigned short mocom : 2;
}
cv_property_t;
/* ======================================== *
* Type information
* ======================================== */
@ -201,7 +220,7 @@ union codeview_type
unsigned short int id;
short int n_element;
cv_typ16_t fieldlist;
short int property;
cv_property_t property;
cv_typ16_t derived;
cv_typ16_t vshape;
unsigned short int structlen; /* numeric leaf */
@ -215,7 +234,7 @@ union codeview_type
unsigned short int len;
unsigned short int id;
short int n_element;
short int property;
cv_property_t property;
cv_typ_t fieldlist;
cv_typ_t derived;
cv_typ_t vshape;
@ -230,7 +249,7 @@ union codeview_type
unsigned short int len;
unsigned short int id;
short int n_element;
short int property;
cv_property_t property;
cv_typ_t fieldlist;
cv_typ_t derived;
cv_typ_t vshape;
@ -246,7 +265,7 @@ union codeview_type
unsigned short int id;
short int count;
cv_typ16_t fieldlist;
short int property;
cv_property_t property;
unsigned short int un_len; /* numeric leaf */
#if 0
struct p_string p_name;
@ -258,7 +277,7 @@ union codeview_type
unsigned short int len;
unsigned short int id;
short int count;
short int property;
cv_property_t property;
cv_typ_t fieldlist;
unsigned short int un_len; /* numeric leaf */
#if 0
@ -271,7 +290,7 @@ union codeview_type
unsigned short int len;
unsigned short int id;
short int count;
short int property;
cv_property_t property;
cv_typ_t fieldlist;
unsigned short int un_len; /* numeric leaf */
#if 0
@ -286,7 +305,7 @@ union codeview_type
short int count;
cv_typ16_t type;
cv_typ16_t fieldlist;
short int property;
cv_property_t property;
struct p_string p_name;
} enumeration_v1;
@ -295,7 +314,7 @@ union codeview_type
unsigned short int len;
unsigned short int id;
short int count;
short int property;
cv_property_t property;
cv_typ_t type;
cv_typ_t fieldlist;
struct p_string p_name;
@ -306,7 +325,7 @@ union codeview_type
unsigned short int len;
unsigned short int id;
short int count;
short int property;
cv_property_t property;
cv_typ_t type;
cv_typ_t fieldlist;
char name[1];

View file

@ -227,28 +227,28 @@ static const char* get_attr(unsigned attr)
return tmp;
}
static const char* get_property(unsigned prop)
static const char* get_property(cv_property_t prop)
{
static char tmp[1024];
unsigned pos = 0;
if (!prop) return "none";
#define X(s) {if (pos) tmp[pos++] = ';'; strcpy(tmp + pos, s); pos += strlen(s);}
if (prop & 0x0001) X("packed");
if (prop & 0x0002) X("w/{cd}tor");
if (prop & 0x0004) X("w/overloaded-ops");
if (prop & 0x0008) X("nested-class");
if (prop & 0x0010) X("has-nested-classes");
if (prop & 0x0020) X("w/overloaded-assign");
if (prop & 0x0040) X("w/casting-methods");
if (prop & 0x0080) X("forward");
if (prop & 0x0100) X("scoped");
if (prop & 0x0200) X("decorated-name");
if (prop & 0x0400) X("sealed-name");
if (prop & 0x1800) pos += sprintf(tmp, "hfa%x", (prop >> 11) & 3);
if (prop & 0x2000) X("intrinsic");
if (prop & 0xC000) pos += sprintf(tmp, "mocom%x", prop >> 14);
if (prop.is_packed) X("packed");
if (prop.has_ctor) X("w/{cd}tor");
if (prop.has_overloaded_operator) X("w/overloaded-ops");
if (prop.is_nested) X("nested-class");
if (prop.has_nested) X("has-nested-classes");
if (prop.has_overloaded_assign) X("w/overloaded-assign");
if (prop.has_operator_cast) X("w/casting-methods");
if (prop.is_forward_defn) X("forward");
if (prop.is_scoped) X("scoped");
if (prop.has_decorated_name) X("decorated-name");
if (prop.is_sealed) X("sealed");
if (prop.hfa) pos += sprintf(tmp, "hfa%x", prop.hfa);
if (prop.is_intrinsic) X("intrinsic");
if (prop.mocom) pos += sprintf(tmp, "mocom%x", prop.mocom);
#undef X
if (!pos) return "none";
tmp[pos] = '\0';
assert(pos < sizeof(tmp));
@ -902,7 +902,7 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type
str, type->struct_v3.n_element, get_property(type->struct_v3.property),
type->struct_v3.fieldlist, type->struct_v3.derived,
type->struct_v3.vshape, value);
if (type->union_v3.property & 0x200)
if (type->union_v3.property.has_decorated_name)
printf("\t\tDecorated name:%s\n", str + strlen(str) + 1);
break;
@ -929,7 +929,7 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type
curr_type, str, type->union_v3.count,
get_property(type->union_v3.property),
type->union_v3.fieldlist, value);
if (type->union_v3.property & 0x200)
if (type->union_v3.property.has_decorated_name)
printf("\t\tDecorated name:%s\n", str + strlen(str) + 1);
break;
@ -958,7 +958,7 @@ static void codeview_dump_one_type(unsigned curr_type, const union codeview_type
type->enumeration_v3.fieldlist,
type->enumeration_v3.count,
get_property(type->enumeration_v3.property));
if (type->union_v3.property & 0x200)
if (type->union_v3.property.has_decorated_name)
printf("\t\tDecorated name:%s\n", type->enumeration_v3.name + strlen(type->enumeration_v3.name) + 1);
break;