| chigraph master Systems programming language written for beginners in LLVM

Public Member Functions | Related Functions | List of all members
chi::DataType Struct Reference

A type of data Loose wrapper around llvm::Type*, except it knows which ChiModule it's in and it embeds debug types. More...

`#include <chi/DataType.hpp>`

## Public Member Functions
| DataType (ChiModule *chiMod=nullptr, std::string typeName={}, llvm::Type *llvmtype=nullptr, llvm::DIType *debugTy=nullptr)
| Constructor. More...
llvm::DIType * | debugType () const
| Get the debug type. More...
llvm::Type * | llvmType () const
| Get the underlying `llvm::Type`. More...
ChiModule & | module () const
| Get the module this is a part of. More...
std::string | qualifiedName () const
| Get the qualified name of the type (module().fullName() + ":" name()) More...
const std::string & | unqualifiedName () const
| Get the unqualified name of the type. More...
bool | valid () const
| Check if the DataType is valid (if it's actually bound to a type and module) More...

## Related Functions
(Note that these are not member functions.)
bool | operator!= (const DataType &lhs, const DataType &rhs)
| Inequality check. More...
bool | operator== (const DataType &lhs, const DataType &rhs)
| Equality check. More...

## Detailed Description

A type of data Loose wrapper around llvm::Type*, except it knows which ChiModule it's in and it embeds debug types.

Definition at line 17 of file DataType.hpp.

## Constructor & Destructor Documentation

## ◆ DataType()

chi::DataType::DataType | ( | ChiModule * | chiMod = `nullptr`,
|  | std::string | typeName = `{}`,
|  | llvm::Type * | llvmtype = `nullptr`,
|  | llvm::DIType * | debugTy = `nullptr`
| ) |  |
| inline

Constructor.

Parameters

  chiMod | The module
  typeName | The ID of the type in the module
  llvmtype | The underlying type
  debugTy | The debug type for the DataType

Definition at line 23 of file DataType.hpp.

## Member Function Documentation

## ◆ debugType()

llvm::DIType* chi::DataType::debugType | ( |  | ) | const
| inline

Get the debug type.

Returns
  The debug type

Definition at line 41 of file DataType.hpp.

## ◆ llvmType()

llvm::Type* chi::DataType::llvmType | ( |  | ) | const
| inline

Get the underlying `llvm::Type`.

Returns
  the `llvm::Type`

Definition at line 38 of file DataType.hpp.

## ◆ module()

ChiModule& chi::DataType::module | ( |  | ) | const
| inline

Get the module this is a part of.

Returns
  The module

Definition at line 29 of file DataType.hpp.

Referenced by operator==(), and qualifiedName().

Here is the caller graph for this function:

## ◆ qualifiedName()

std::string chi::DataType::qualifiedName | ( |  | ) | const

Get the qualified name of the type (module().fullName() + ":" name())

Returns
  The qualified name

Definition at line 8 of file DataType.cpp.

References chi::ChiModule::fullName(), module(), and unqualifiedName().

Referenced by chi::Context::createConverterNodeType(), chi::GraphFunction::retypeLocalVariable(), and unqualifiedName().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ unqualifiedName()

const std::string& chi::DataType::unqualifiedName | ( |  | ) | const
| inline

Get the unqualified name of the type.

Returns
  The unqualified name

Definition at line 32 of file DataType.hpp.

References qualifiedName().

Referenced by operator==(), and qualifiedName().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ valid()

bool chi::DataType::valid | ( |  | ) | const
| inline

Check if the DataType is valid (if it's actually bound to a type and module)

Returns
  `true` if valid, `false` otherwise

Definition at line 44 of file DataType.hpp.

Referenced by chi::GraphStruct::addType(), chi::FunctionCompiler::createSubroutineType(), chi::GraphStruct::dataType(), and chi::GraphStruct::modifyType().

Here is the caller graph for this function:

## Friends And Related Function Documentation

## ◆ operator!=()

bool operator!= | ( | const DataType & | lhs,
|  | const DataType & | rhs
| ) |  |
| related

Inequality check.

Parameters

  lhs | The first DataType
  rhs | The DataType to check equality against

Returns
  If they aren't equal

Definition at line 69 of file DataType.hpp.

## ◆ operator==()

bool operator== | ( | const DataType & | lhs,
|  | const DataType & | rhs
| ) |  |
| related

Equality check.

Parameters

  lhs | The first DataType
  rhs | The DataType to check equality against

Returns
  If they are equal

Definition at line 60 of file DataType.hpp.

References module(), and unqualifiedName().

Here is the call graph for this function:

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

- lib/core/include/chi/DataType.hpp
- lib/core/src/DataType.cpp