A QualifiedType modifies a "delegate" type with a TypeQualifier (const or volatile).
More...
#include "type.h"
A QualifiedType modifies a "delegate" type with a TypeQualifier (const or volatile).
Most of the member functions a just passed on to the delegate.
◆ add_member()
| void QualifiedType::add_member |
( |
const Member & |
member | ) |
|
|
virtual |
Add a member.
This should only be called if the type type is a StructType or FunctionType.
- Parameters
-
| member | the member (field or parameter) to add |
Reimplemented from Type.
◆ as_str()
| std::string QualifiedType::as_str |
( |
| ) |
const |
|
virtual |
Convert to a readable string representation of this type.
- Returns
- a string containing a description of the type
Implements Type.
◆ find_member()
| const Member * Type::find_member |
( |
const std::string & |
name | ) |
const |
|
inherited |
Find named member.
- Parameters
-
| name | name of the member to return |
- Returns
- pointer to a named
Member (or a null pointer if the named member doesn't exist)
◆ get_alignment()
| unsigned QualifiedType::get_alignment |
( |
| ) |
const |
|
virtual |
Get the storage alignment multiple in bytes for an instance of this type.
I.e., the start address of an instance of this type in memory must be aligned on a multiple of the returned value. Throws an exception if called on a FunctionType.
- Returns
- the storage alignment multiple in bytes for an instance of this type
Implements Type.
◆ get_array_size()
| unsigned QualifiedType::get_array_size |
( |
| ) |
const |
|
virtual |
Get the array size (number of elements).
Throws an exception if the type isn't an ArrayType.
- Returns
- the array size (number of elements)
Reimplemented from Type.
◆ get_base_type()
| std::shared_ptr< Type > HasBaseType::get_base_type |
( |
| ) |
const |
|
virtualinherited |
Get the base type.
For a FunctionType, the base type is the return type. For a PointerType, the base type is the pointed-to type. For an ArrayType, the base type is the element type.
- Returns
- the base type
Reimplemented from Type.
◆ get_basic_type_kind()
| BasicTypeKind QualifiedType::get_basic_type_kind |
( |
| ) |
const |
|
virtual |
Get the BasicTypeKind of a BasicType.
- Returns
- the BasicTypeKind of this basic type (throws an exception if this type is not a basic type)
Reimplemented from Type.
◆ get_field_offset()
| unsigned Type::get_field_offset |
( |
const std::string & |
name | ) |
const |
|
virtualinherited |
Get the offset of the named field.
Throws an exception if the type is not a StructType.
- Parameters
-
- Returns
- the offset of the field in bytes
Reimplemented in StructType.
◆ get_member()
| const Member & QualifiedType::get_member |
( |
unsigned |
index | ) |
const |
|
virtual |
Get the Member with the position indicated by the given index.
The index should be between 0 (inclusive) and the number of members (exclusive.)
- Parameters
-
- Returns
- reference to the member at the given index
Reimplemented from Type.
◆ get_num_members()
| unsigned QualifiedType::get_num_members |
( |
| ) |
const |
|
virtual |
Get the number of members (fields or parameters).
Throws an exception if this type isn't a StructType or FunctionType.
- Returns
- the number of members
Reimplemented from Type.
◆ get_storage_size()
| unsigned QualifiedType::get_storage_size |
( |
| ) |
const |
|
virtual |
Get the number of bytes required to store an instance of this type.
Throws an exception if called on a FunctionType.
- Returns
- the number of bytes required to store an instance of this type
Implements Type.
◆ get_unqualified_type()
| const Type * QualifiedType::get_unqualified_type |
( |
| ) |
const |
|
virtual |
Get unqualified type (strip off type qualifiers, if any).
- Returns
- The unqualified type
Reimplemented from Type.
◆ is_array()
| bool QualifiedType::is_array |
( |
| ) |
const |
|
virtual |
Check whether the type is an ArrayType.
- Returns
- true if this an ArrayType, false otherwise
Reimplemented from Type.
◆ is_basic()
| bool QualifiedType::is_basic |
( |
| ) |
const |
|
virtual |
Check whether the type is a BasicType.
- Returns
- true if this type represents a basic type (
int, char, etc., including qualified variants like const char), false otherwise
Reimplemented from Type.
◆ is_const()
| bool QualifiedType::is_const |
( |
| ) |
const |
|
virtual |
Check whether the type is qualified as const.
- Returns
- true if this is a const-qualified type, false otherwise
Reimplemented from Type.
◆ is_function()
| bool QualifiedType::is_function |
( |
| ) |
const |
|
virtual |
◆ is_pointer()
| bool QualifiedType::is_pointer |
( |
| ) |
const |
|
virtual |
◆ is_same()
| bool QualifiedType::is_same |
( |
const Type * |
other | ) |
const |
|
virtual |
Equality comparison.
- Returns
- true IFF the other type represents exactly the same type as this one
Implements Type.
◆ is_signed()
| bool QualifiedType::is_signed |
( |
| ) |
const |
|
virtual |
Check whether the BasicType is a signed type.
- Returns
- true if this basic type is signed, false if it's unsigned (throws an exception if this is not a basic type)
Reimplemented from Type.
◆ is_struct()
| bool QualifiedType::is_struct |
( |
| ) |
const |
|
virtual |
◆ is_void()
| bool QualifiedType::is_void |
( |
| ) |
const |
|
virtual |
Check whether the type represents void.
- Returns
- true if this type represents
void, false otherwise
Reimplemented from Type.
◆ is_volatile()
| bool QualifiedType::is_volatile |
( |
| ) |
const |
|
virtual |
Check whether the type is qualified as volatile.
- Returns
- true if this is a volatile-qualified type, false otherwise
Reimplemented from Type.
The documentation for this class was generated from the following files: