libabigail
Classes | Public Member Functions | Static Public Member Functions | List of all members
array_type_def::subrange_type Class Reference

Abstraction for an array range type, like in Ada, or just for an array dimension like in C or C++. More...

#include <abg-ir.h>

Inheritance diagram for array_type_def::subrange_type:
[legend]

Classes

class  bound_value
 This class is to hold the value of the bound of a subrange. The value can be either signed or unsigned, at least when it comes from DWARF. The class keeps the sign information, but allows users to access the value as signed or unsigned as they see fit. More...
 

Public Member Functions

 subrange_type (const environment &env, const string &name, bound_value lower_bound, bound_value upper_bound, const location &loc, translation_unit::language l=translation_unit::LANG_C11)
 Constructor of the array_type_def::subrange_type type. More...
 
 subrange_type (const environment &env, const string &name, bound_value lower_bound, bound_value upper_bound, const type_base_sptr &underlying_type, const location &loc, translation_unit::language l=translation_unit::LANG_C11)
 Constructor of an array_type_def::subrange_type type. More...
 
 subrange_type (const environment &env, const string &name, bound_value upper_bound, const location &loc, translation_unit::language l=translation_unit::LANG_C11)
 Constructor of the array_type_def::subrange_type type. More...
 
string as_string () const
 Return a string representation of the sub range. More...
 
translation_unit::language get_language () const
 Getter of the language that generated this type. More...
 
uint64_t get_length () const
 Getter of the length of the subrange type. More...
 
int64_t get_lower_bound () const
 Getter of the lower bound of the subrange type. More...
 
virtual string get_pretty_representation (bool internal=false, bool qualified_name=true) const
 Build a pretty representation for an array_type_def::subrange_type. More...
 
type_base_sptr get_underlying_type () const
 Getter of the underlying type of the subrange, that is, the type that defines the range. More...
 
int64_t get_upper_bound () const
 Getter of the upper bound of the subrange type. More...
 
bool is_non_finite () const
 Test if the length of the subrange type is infinite. More...
 
void is_non_finite (bool)
 Set the infinite-ness status of the subrange type. More...
 
bool operator!= (const decl_base &o) const
 Equality operator. More...
 
bool operator!= (const subrange_type &o) const
 Inequality operator. More...
 
bool operator!= (const type_base &o) const
 Equality operator. More...
 
virtual bool operator== (const decl_base &) const
 Equality operator. More...
 
bool operator== (const subrange_type &o) const
 Equality operator. More...
 
virtual bool operator== (const type_base &) const
 Equality operator. More...
 
void set_lower_bound (int64_t lb)
 Setter of the lower bound. More...
 
void set_underlying_type (const type_base_sptr &)
 Setter of the underlying type of the subrange, that is, the type that defines the range. More...
 
void set_upper_bound (int64_t ub)
 Setter of the upper bound of the subrange type. More...
 
virtual bool traverse (ir_node_visitor &)
 This implements the ir_traversable_base::traverse pure virtual function. More...
 
- Public Member Functions inherited from type_base
 type_base (const environment &e, size_t s, size_t a)
 The constructor of type_base. More...
 
virtual size_t get_alignment_in_bits () const
 Getter for the alignment of the type. More...
 
const interned_stringget_cached_pretty_representation (bool internal=false) const
 Get the pretty representation of the current type. More...
 
type_base_sptr get_canonical_type () const
 Getter of the canonical type of the current instance of type_base. More...
 
type_baseget_naked_canonical_type () const
 Getter of the canonical type pointer. More...
 
virtual size_t get_size_in_bits () const
 Getter for the size of the type. More...
 
virtual void set_alignment_in_bits (size_t)
 Setter for the alignment of the type. More...
 
virtual void set_size_in_bits (size_t)
 Setter for the size of the type. More...
 
- Public Member Functions inherited from type_or_decl_base
 type_or_decl_base (const environment &, enum type_or_decl_kind k=ABSTRACT_TYPE_OR_DECL)
 Constructor of type_or_decl_base. More...
 
virtual ~type_or_decl_base ()
 The destructor of the type_or_decl_base type. More...
 
locationget_artificial_location () const
 Getter of the artificial location of the artifact. More...
 
corpusget_corpus ()
 Get the corpus this ABI artifact belongs to. More...
 
const corpusget_corpus () const
 Get the corpus this ABI artifact belongs to. More...
 
const environmentget_environment () const
 Getter of the environment of the current ABI artifact. More...
 
bool get_is_artificial () const
 Getter of the flag that says if the artefact is artificial. More...
 
translation_unitget_translation_unit ()
 Get the translation_unit this ABI artifact belongs to. More...
 
const translation_unitget_translation_unit () const
 Get the translation_unit this ABI artifact belongs to. More...
 
bool has_artificial_location () const
 Test if the current ABI artifact carries an artificial location. More...
 
void set_artificial_location (const location &)
 Setter of the artificial location of the artificat. More...
 
void set_is_artificial (bool)
 Setter of the flag that says if the artefact is artificial. More...
 
void set_translation_unit (translation_unit *)
 Set the translation_unit this ABI artifact belongs to. More...
 
- Public Member Functions inherited from traversable_base
virtual ~traversable_base ()
 Destructor of the traversable_base type. More...
 
- Public Member Functions inherited from decl_base
 decl_base (const environment &, const location &)
 Constructor for the decl_base type. More...
 
 decl_base (const environment &e, const interned_string &name, const location &locus, const interned_string &mangled_name=interned_string(), visibility vis=VISIBILITY_DEFAULT)
 Constructor. More...
 
 decl_base (const environment &e, const string &name, const location &locus, const string &mangled_name="", visibility vis=VISIBILITY_DEFAULT)
 Constructor for the decl_base type. More...
 
virtual ~decl_base ()
 Destructor of the decl_base type. More...
 
const decl_base_sptr get_definition_of_declaration () const
 If this decl_base is declaration-only, get its definition, if any. More...
 
const decl_base_sptr get_earlier_declaration () const
 If this decl_base is a definition, get its earlier declaration. More...
 
bool get_has_anonymous_parent () const
 Get the "has_anonymous_parent" flag of the current declaration. More...
 
virtual size_t get_hash () const
 Get the hash of a decl. If the hash hasn't been computed yet, compute it ans store its value; otherwise, just return the hash. More...
 
bool get_is_anonymous () const
 Test if the current declaration is anonymous. More...
 
bool get_is_anonymous_or_has_anonymous_parent () const
 
bool get_is_declaration_only () const
 Test if a decl_base is a declaration-only decl. More...
 
bool get_is_in_public_symbol_table () const
 Test if the decl is defined in a ELF symbol table as a public symbol. More...
 
const interned_stringget_linkage_name () const
 Getter for the mangled name. More...
 
const locationget_location () const
 Get the location of a given declaration. More...
 
const decl_baseget_naked_definition_of_declaration () const
 If this decl_base is declaration-only, get its definition, if any. More...
 
const interned_stringget_name () const
 Getter for the name of the current decl. More...
 
typedef_decl_sptr get_naming_typedef () const
 Getter for the naming typedef of the current decl. More...
 
virtual const interned_stringget_qualified_name (bool internal=false) const
 Return the qualified name of the decl. More...
 
virtual void get_qualified_name (interned_string &qualified_name, bool internal=false) const
 Compute the qualified name of the decl. More...
 
const interned_stringget_qualified_parent_name () const
 Return a copy of the qualified name of the parent of the current decl. More...
 
scope_declget_scope () const
 Return the type containing the current decl, if any. More...
 
virtual const interned_stringget_scoped_name () const
 Return the scoped name of the decl. More...
 
visibility get_visibility () const
 Getter for the visibility of the decl. More...
 
void set_definition_of_declaration (const decl_base_sptr &)
 Set the definition of this declaration-only decl_base. More...
 
void set_earlier_declaration (const decl_base_sptr &)
 set the earlier declaration of this decl_base definition. More...
 
void set_is_anonymous (bool)
 Set the "is_anonymous" flag of the current declaration. More...
 
void set_is_declaration_only (bool f)
 Set a flag saying if the enum_type_decl is a declaration-only enum_type_decl. More...
 
void set_is_in_public_symbol_table (bool)
 Set the flag saying if this decl is from a symbol that is in a public symbols table, defined as public (global or weak). More...
 
virtual void set_linkage_name (const string &m)
 Setter for the linkage name. More...
 
void set_location (const location &l)
 Set the location for a given declaration. More...
 
void set_name (const string &n)
 Setter for the name of the decl. More...
 
void set_naming_typedef (const typedef_decl_sptr &)
 Set the naming typedef of the current instance of decl_base. More...
 
virtual void set_scope (scope_decl *)
 Setter of the scope of the current decl. More...
 
void set_visibility (visibility v)
 Setter for the visibility of the decl. More...
 

Static Public Member Functions

static string vector_as_string (const vector< subrange_sptr > &)
 Return a string representation of a vector of subranges. More...
 

Additional Inherited Members

- Public Types inherited from decl_base
enum  binding { BINDING_NONE , BINDING_LOCAL , BINDING_GLOBAL , BINDING_WEAK }
 ELF binding. More...
 
enum  visibility {
  VISIBILITY_NONE , VISIBILITY_DEFAULT , VISIBILITY_PROTECTED , VISIBILITY_HIDDEN ,
  VISIBILITY_INTERNAL
}
 ELF visibility. More...
 
- Public Attributes inherited from type_base
privpriv_
 
- Public Attributes inherited from decl_base
priv * priv_
 
- Protected Types inherited from type_or_decl_base
enum  type_or_decl_kind {
  ABSTRACT_TYPE_OR_DECL , ABSTRACT_DECL_BASE , ABSTRACT_SCOPE_DECL , GLOBAL_SCOPE_DECL ,
  NAMESPACE_DECL , VAR_DECL , FUNCTION_DECL , FUNCTION_PARAMETER_DECL ,
  METHOD_DECL , TEMPLATE_DECL , ABSTRACT_TYPE_BASE , ABSTRACT_SCOPE_TYPE_DECL ,
  BASIC_TYPE , SUBRANGE_TYPE , QUALIFIED_TYPE , POINTER_TYPE ,
  REFERENCE_TYPE , POINTER_TO_MEMBER_TYPE , ARRAY_TYPE , ENUM_TYPE ,
  TYPEDEF_TYPE , CLASS_TYPE , UNION_TYPE , FUNCTION_TYPE ,
  METHOD_TYPE
}
 This is a bitmap type which instance is meant to contain the runtime type of a given ABI artifact. Bits of the identifiers of the type of a given artifact as well as the types it inherits from are to be set to 1. More...
 
- Protected Member Functions inherited from type_base
virtual void on_canonical_type_set ()
 This method is invoked automatically right after the current instance of class_decl has been canonicalized. More...
 
- Protected Member Functions inherited from type_or_decl_base
bool hashing_started () const
 Getter for the 'hashing_started' property. More...
 
void hashing_started (bool) const
 Setter for the 'hashing_started' property. More...
 
enum type_or_decl_kind kind () const
 Getter for the "kind" property of type_or_decl_base type. More...
 
void kind (enum type_or_decl_kind)
 Setter for the "kind" property of type_or_decl_base type. More...
 
type_or_decl_baseoperator= (const type_or_decl_base &)
 
void * runtime_type_instance ()
 Getter of the pointer to the runtime type sub-object of the current instance. More...
 
const void * runtime_type_instance () const
 Getter of the pointer to the runtime type sub-object of the current instance. More...
 
void runtime_type_instance (void *)
 Setter of the pointer to the runtime type sub-object of the current instance. More...
 
void * type_or_decl_base_pointer ()
 Getter of the pointer to either the type_base sub-object of the current instance if it's a type, or to the decl_base sub-object of the current instance if it's a decl. More...
 
const void * type_or_decl_base_pointer () const
 Getter of the pointer to either the type_base sub-object of the current instance if it's a type, or to the decl_base sub-object of the current instance if it's a decl. More...
 
- Protected Member Functions inherited from traversable_base
 traversable_base ()
 Default constructor of the traversable_base type. More...
 
bool visiting () const
 This should returns false before and after the node has been visiting. During the visiting of the node (and of its children) this should return true. More...
 
void visiting (bool f)
 The traversing code should be responsible of calling this, not the user code. More...
 
- Protected Member Functions inherited from decl_base
 decl_base (const decl_base &)
 
void clear_qualified_name ()
 Clear the qualified name of this decl. More...
 
context_relget_context_rel ()
 Getter for the context relationship. More...
 
const context_relget_context_rel () const
 Getter for the context relationship. More...
 
const interned_stringpeek_qualified_name () const
 Getter for the qualified name. More...
 
const interned_stringpeek_temporary_qualified_name () const
 Getter of the temporary qualified name of the current declaration. More...
 
void set_context_rel (context_rel *c)
 
void set_qualified_name (const interned_string &) const
 Setter for the qualified name. More...
 
void set_temporary_qualified_name (const interned_string &) const
 Setter for the temporary qualified name of the current declaration. More...
 

Detailed Description

Abstraction for an array range type, like in Ada, or just for an array dimension like in C or C++.

Definition at line 2544 of file abg-ir.h.

Constructor & Destructor Documentation

◆ subrange_type() [1/3]

subrange_type ( const environment env,
const string &  name,
bound_value  lower_bound,
bound_value  upper_bound,
const type_base_sptr &  utype,
const location loc,
translation_unit::language  l = translation_unit::LANG_C11 
)

Constructor of an array_type_def::subrange_type type.

Parameters
envthe environment this type was created from.
namethe name of the subrange type.
lower_boundthe lower bound of the array. This is generally zero (at least for C and C++).
upper_boundthe upper bound of the array.
underlying_typethe underlying type of the subrange type.
locthe source location where the type is defined.

Definition at line 18855 of file abg-ir.cc.

◆ subrange_type() [2/3]

subrange_type ( const environment env,
const string &  name,
bound_value  lower_bound,
bound_value  upper_bound,
const location loc,
translation_unit::language  l = translation_unit::LANG_C11 
)

Constructor of the array_type_def::subrange_type type.

Parameters
envthe environment this type is being created in.
namethe name of the subrange type.
lower_boundthe lower bound of the array. This is generally zero (at least for C and C++).
upper_boundthe upper bound of the array.
locthe source location where the type is defined.
lthe language that generated this subrange.

Definition at line 18887 of file abg-ir.cc.

◆ subrange_type() [3/3]

subrange_type ( const environment env,
const string &  name,
bound_value  upper_bound,
const location loc,
translation_unit::language  l = translation_unit::LANG_C11 
)

Constructor of the array_type_def::subrange_type type.

Parameters
envthe environment this type is being created from.
nameof the name of type.
upper_boundthe upper bound of the array. The lower bound is considered to be zero.
locthe source location of the type.
thelanguage that generated this type.

Definition at line 18915 of file abg-ir.cc.

Member Function Documentation

◆ as_string()

string as_string ( ) const

Return a string representation of the sub range.

Returns
the string representation of the sub range.

Definition at line 19021 of file abg-ir.cc.

◆ get_language()

translation_unit::language get_language ( ) const

Getter of the language that generated this type.

Returns
the language of this type.

Definition at line 19014 of file abg-ir.cc.

◆ get_length()

uint64_t get_length ( ) const

Getter of the length of the subrange type.

Note that a length of zero means the array has an infinite (or rather a non-known) size.

Returns
the length of the subrange type.

Definition at line 18982 of file abg-ir.cc.

◆ get_lower_bound()

int64_t get_lower_bound ( ) const

Getter of the lower bound of the subrange type.

Returns
the lower bound of the subrange type.

Definition at line 18958 of file abg-ir.cc.

◆ get_pretty_representation()

string get_pretty_representation ( bool  internal = false,
bool  qualified_name = true 
) const
virtual

Build a pretty representation for an array_type_def::subrange_type.

Parameters
internalset to true if the call is intended to get a representation of the decl (or type) for the purpose of canonical type comparison. This is mainly used in the function type_base::get_canonical_type_for().

In other words if the argument for this parameter is true then the call is meant for internal use (for technical use inside the library itself), false otherwise. If you don't know what this is for, then set it to false.

Returns
a copy of the pretty representation of the current instance of typedef_decl.

Reimplemented from decl_base.

Definition at line 19188 of file abg-ir.cc.

◆ get_underlying_type()

type_base_sptr get_underlying_type ( ) const

Getter of the underlying type of the subrange, that is, the type that defines the range.

Returns
the underlying type.

Definition at line 18933 of file abg-ir.cc.

◆ get_upper_bound()

int64_t get_upper_bound ( ) const

Getter of the upper bound of the subrange type.

Returns
the upper bound of the subrange type.

Definition at line 18951 of file abg-ir.cc.

◆ is_non_finite() [1/2]

bool is_non_finite ( ) const

Test if the length of the subrange type is infinite.

Returns
true iff the length of the subrange type is infinite.

Definition at line 18999 of file abg-ir.cc.

◆ is_non_finite() [2/2]

void is_non_finite ( bool  f)

Set the infinite-ness status of the subrange type.

Parameters
ftrue iff the length of the subrange type should be set to being infinite.

Definition at line 19007 of file abg-ir.cc.

◆ operator!=() [1/3]

bool operator!= ( const decl_base o) const
virtual

Equality operator.

Parameters
othe other subrange to test against.
Returns
true iff o equals the current instance of array_type_def::subrange_type.

Reimplemented from decl_base.

Definition at line 19149 of file abg-ir.cc.

◆ operator!=() [2/3]

bool operator!= ( const subrange_type o) const

Inequality operator.

Parameters
othe other subrange to test against.
Returns
true iff o is different from the current instance of array_type_def::subrange_type.

Definition at line 19169 of file abg-ir.cc.

◆ operator!=() [3/3]

bool operator!= ( const type_base o) const
virtual

Equality operator.

Parameters
othe other subrange to test against.
Returns
true iff o equals the current instance of array_type_def::subrange_type.

Reimplemented from type_base.

Definition at line 19159 of file abg-ir.cc.

◆ operator==() [1/3]

bool operator== ( const decl_base o) const
virtual

Equality operator.

Parameters
othe other subrange to test against.
Returns
true iff o equals the current instance of array_type_def::subrange_type.

Reimplemented from decl_base.

Definition at line 19105 of file abg-ir.cc.

◆ operator==() [2/3]

bool operator== ( const subrange_type o) const

Equality operator.

Parameters
othe other subrange to test against.
Returns
true iff o equals the current instance of array_type_def::subrange_type.

Definition at line 19136 of file abg-ir.cc.

◆ operator==() [3/3]

bool operator== ( const type_base o) const
virtual

Equality operator.

Parameters
othe other subrange to test against.
Returns
true iff o equals the current instance of array_type_def::subrange_type.

Reimplemented from type_base.

Definition at line 19121 of file abg-ir.cc.

◆ set_lower_bound()

void set_lower_bound ( int64_t  lb)

Setter of the lower bound.

Parameters
lbthe new value of the lower bound.

Definition at line 18972 of file abg-ir.cc.

◆ set_underlying_type()

void set_underlying_type ( const type_base_sptr &  u)

Setter of the underlying type of the subrange, that is, the type that defines the range.

Parameters
uthe new underlying type.

Definition at line 18941 of file abg-ir.cc.

◆ set_upper_bound()

void set_upper_bound ( int64_t  ub)

Setter of the upper bound of the subrange type.

Parameters
ubthe new value of the upper bound.

Definition at line 18965 of file abg-ir.cc.

◆ traverse()

bool traverse ( ir_node_visitor v)
virtual

This implements the ir_traversable_base::traverse pure virtual function.

Parameters
vthe visitor used on the current instance.
Returns
true if the entire IR node tree got traversed, false otherwise.

Reimplemented from decl_base.

Definition at line 19210 of file abg-ir.cc.

◆ vector_as_string()

string vector_as_string ( const vector< subrange_sptr > &  v)
static

Return a string representation of a vector of subranges.

Returns
the string representation of a vector of sub ranges.

Definition at line 19044 of file abg-ir.cc.


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