decompiler 1.0.0
Public Member Functions | Private Attributes | Friends | List of all members
ghidra::ResolvedUnion Class Reference

A data-type resolved from an associated TypeUnion or TypeStruct. More...

#include <unionresolve.hh>

Public Member Functions

 ResolvedUnion (Datatype *unresType)
 Construct a data-type that resolves to itself. More...
 
 ResolvedUnion (Datatype *unresType, int4 fldNum, TypeFactory &typegrp)
 Construct a resolution with a specific field number. More...
 
 ResolvedUnion (const ResolvedUnion &op, Datatype *res)
 Copy constructor with updated resolve data-type.
 
Datatype * getDatatype (void) const
 Get the resolved data-type.
 
Datatype * getBase (void) const
 Get the union or structure being referenced.
 
int4 getFieldNum (void) const
 Get the index of the resolved field or -1.
 
bool isLocked (void) const
 Return true if the field resolution is locked.
 
bool update (const ResolvedUnion &op)
 Update a resolution with a new data-type. More...
 
void setResolve (Datatype *res)
 Update the resolution data-type (without changing field resolution)
 
void setLock (bool val)
 Set whether this resolution is locked against overrides.
 

Private Attributes

Datatype * resolve
 The resolved data-type.
 
Datatype * baseType
 Union or Structure being resolved (pointers and partials stripped)
 
int4 fieldNum
 Index of field referenced by resolve.
 
bool lock
 If true, resolution cannot be overridden.
 

Friends

class ScoreUnionFields
 

Detailed Description

A data-type resolved from an associated TypeUnion or TypeStruct.

A parent refers to either: 1) A union 2) A structure that is an effective union (1 field filling the entire structure) OR 3) A pointer to a union/structure

This object represents a data-type that is resolved via analysis from the parent data-type. The resolved data-type can be either: 1) A specific field of the parent (if the parent is not a pointer) 2) A pointer to a specific field of the underlying union/structure (if the parent is a pointer) 3) The parent data-type itself (either a pointer or not) The fieldNum (if non-negative) selects a particular field of the underlying union/structure. If the parent is a pointer, the resolution is a pointer to the field. If the parent is not a pointer, the resolution is the field itself. A fieldNum of -1 indicates that the parent data-type itself is the resolution.

Constructor & Destructor Documentation

◆ ResolvedUnion() [1/2]

ghidra::ResolvedUnion::ResolvedUnion ( Datatype *  unresType)

Construct a data-type that resolves to itself.

The original data-type must either be a union, a partial union, a structure with a single field, an array with a single element, or a pointer to one of these data-types. The object is set up initially to resolve to the parent.

Parameters
unresTypeis the original unresolved data-type

References baseType, fieldNum, ghidra::Datatype::getMetatype(), lock, resolve, ghidra::TYPE_PARTIALUNION, and ghidra::TYPE_PTR.

◆ ResolvedUnion() [2/2]

ghidra::ResolvedUnion::ResolvedUnion ( Datatype *  unresType,
int4  fldNum,
TypeFactory &  typegrp 
)

Member Function Documentation

◆ update()

bool ghidra::ResolvedUnion::update ( const ResolvedUnion &  op)

Update a resolution with a new data-type.

Parameters
opis the new resolution
Returns
true if any change is made

References fieldNum, lock, and resolve.


The documentation for this class was generated from the following files: