Gyoji Compiler
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Gyoji::mir::TypeMember Class Reference

This represents a typed member variable of a class. More...

#include <types.hpp>

Public Member Functions

 TypeMember (std::string _member_name, size_t _index, const Type *_member_type, const Gyoji::context::SourceReference &_source_ref)
 
 TypeMember (const TypeMember &other)
 
 ~TypeMember ()
 Move along, nothing to see here.
 
const std::stringget_name () const
 
size_t get_index () const
 
const Typeget_type () const
 
const Gyoji::context::SourceReferenceget_source_ref () const
 

Detailed Description

This represents a typed member variable of a class.

A member variable for a class consists of a name and a type. The name is the alias that is used when referring to this memory and the type is the type of that data. This also contains a source reference so that errors can be correctly attributed to their origin.

Constructor & Destructor Documentation

◆ TypeMember() [1/2]

TypeMember::TypeMember ( std::string  _member_name,
size_t  _index,
const Type _member_type,
const Gyoji::context::SourceReference _source_ref 
)

This is a named member of a class or structure. It is created with a name, the type of that member which may be another type, and a reference to the source location where it was declared.

◆ TypeMember() [2/2]

TypeMember::TypeMember ( const TypeMember other)

This makes a copy of the member. It is provided so that the type class may use a map or array to store the members rather than storing them by pointer, so a copy and assignment is required.

◆ ~TypeMember()

TypeMember::~TypeMember ( )

Move along, nothing to see here.

Move along, nothing to see here.

Member Function Documentation

◆ get_index()

size_t TypeMember::get_index ( ) const

Returns the index into the underlying structure representing the composite type. Indices start at 0 and run through the number of elements in the composite data type. This is technically redundant with the name, but it is convenient in the code-generation layer to have direct access to the index at a small cost of storing one index per memeber.

Specifically for LLVM, this makes it easy to use 'CreateGEP' and pass the correct index.

◆ get_name()

const std::string & TypeMember::get_name ( ) const

Returns the name of the member.

◆ get_source_ref()

const Gyoji::context::SourceReference & TypeMember::get_source_ref ( ) const

Returns a reference to the source location where the member was declared.

◆ get_type()

const Type * TypeMember::get_type ( ) const

Returns the type fo the member.


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