CIRCT  19.0.0git
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
circt::moore::EnumType Class Reference

An enum type. More...

#include <MooreTypes.h>

Inheritance diagram for circt::moore::EnumType:
Inheritance graph
[legend]
Collaboration diagram for circt::moore::EnumType:
Collaboration graph
[legend]

Public Member Functions

PackedType getBase () const
 Get the base type of the enumeration. More...
 
bool isBaseExplicit () const
 Returns whether the base type was explicitly specified by the user. More...
 
StringAttr getName () const
 Get the name of the surrounding typedef, if this enum is embedded in a typedef. More...
 
Location getLoc () const
 Get the location in the source text where the enum was declared. More...
 
void format (llvm::raw_ostream &os) const
 Format this enum in SystemVerilog syntax. More...
 

Static Public Member Functions

static EnumType get (StringAttr name, Location loc, PackedType base={})
 

Static Public Attributes

static constexpr StringLiteral name = "moore.enum"
 

Detailed Description

An enum type.

Definition at line 1054 of file MooreTypes.h.

Member Function Documentation

◆ format()

void EnumType::format ( llvm::raw_ostream &  os) const

Format this enum in SystemVerilog syntax.

Useful to present the enum back to the user in diagnostics.

Definition at line 1001 of file MooreTypes.cpp.

References getBase(), getName(), isBaseExplicit(), and name.

◆ get()

EnumType EnumType::get ( StringAttr  name,
Location  loc,
PackedType  base = {} 
)
static

◆ getBase()

PackedType EnumType::getBase ( ) const

Get the base type of the enumeration.

Definition at line 993 of file MooreTypes.cpp.

Referenced by format().

◆ getLoc()

Location EnumType::getLoc ( ) const

Get the location in the source text where the enum was declared.

This shall be the location of the enum keyword or, if the enum is embedded in a typedef, the location of the typedef name.

Definition at line 999 of file MooreTypes.cpp.

◆ getName()

StringAttr EnumType::getName ( ) const

Get the name of the surrounding typedef, if this enum is embedded in a typedef.

Otherwise this returns a null attribute.

Definition at line 997 of file MooreTypes.cpp.

Referenced by format().

◆ isBaseExplicit()

bool EnumType::isBaseExplicit ( ) const

Returns whether the base type was explicitly specified by the user.

This allows us to distinguish enum from enum int.

Definition at line 995 of file MooreTypes.cpp.

Referenced by format().

Member Data Documentation

◆ name

constexpr StringLiteral circt::moore::EnumType::name = "moore.enum"
staticconstexpr

Definition at line 1076 of file MooreTypes.h.

Referenced by format(), and get().


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