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 *parent)
 Construct a data-type that resolves to itself. More...
 
 ResolvedUnion (Datatype *parent, int4 fldNum, TypeFactory &typegrp)
 Construct a reference to a field. More...
 
DatatypegetDatatype (void) const
 Get the resolved data-type.
 
DatatypegetBase (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
 Is this locked against overrides.
 
void setLock (bool val)
 Set whether this resolution is locked against overrides.
 

Private Attributes

Datatyperesolve
 The resolved data-type.
 
DatatypebaseType
 Union or Structure being resolved.
 
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 parent)

Construct a data-type that resolves to itself.

The original parent 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
parentis the original parent data-type

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

◆ ResolvedUnion() [2/2]

ghidra::ResolvedUnion::ResolvedUnion ( Datatype parent,
int4  fldNum,
TypeFactory typegrp 
)

Construct a reference to a field.

The original parent must be a union or structure.

Parameters
parentis the original parent
fldNumis the index of the particular field to resolve to (or -1 to resolve to parent)
typegrpis a TypeFactory used to construct the resolved data-type of the field

References baseType, fieldNum, ghidra::Datatype::getDepend(), ghidra::Datatype::getMetatype(), ghidra::TypePointer::getPtrTo(), ghidra::Datatype::getSize(), ghidra::TypeFactory::getTypePointer(), ghidra::TypePointer::getWordSize(), lock, resolve, ghidra::TYPE_PARTIALUNION, and ghidra::TYPE_PTR.


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