LLVM 22.0.0git
llvm::RecordVal Class Reference

This class represents a field in a record, including its name, type, value, and source location. More...

#include "llvm/TableGen/Record.h"

Public Types

enum  FieldKind { FK_Normal , FK_NonconcreteOK , FK_TemplateArg }

Public Member Functions

 RecordVal (const Init *N, const RecTy *T, FieldKind K)
 RecordVal (const Init *N, SMLoc Loc, const RecTy *T, FieldKind K)
RecordKeepergetRecordKeeper () const
 Get the record keeper used to unique this value.
StringRef getName () const
 Get the name of the field as a StringRef.
const InitgetNameInit () const
 Get the name of the field as an Init.
std::string getNameInitAsString () const
 Get the name of the field as a std::string.
const SMLocgetLoc () const
 Get the source location of the point where the field was defined.
bool isNonconcreteOK () const
 Is this a field where nonconcrete values are okay?
bool isTemplateArg () const
 Is this a template argument?
const RecTygetType () const
 Get the type of the field value as a RecTy.
std::string getPrintType () const
 Get the type of the field for printing purposes.
const InitgetValue () const
 Get the value of the field as an Init.
bool setValue (const Init *V)
 Set the value of the field from an Init.
bool setValue (const Init *V, SMLoc NewLoc)
 Set the value and source location of the field.
void addReferenceLoc (SMRange Loc)
 Add a reference to this record value.
ArrayRef< SMRangegetReferenceLocs () const
 Return the references of this record value.
void setUsed (bool Used)
 Whether this value is used.
bool isUsed () const
void dump () const
void print (raw_ostream &OS, bool PrintSem=true) const
 Print the value to an output stream, possibly with a semicolon.

Friends

class Record

Detailed Description

This class represents a field in a record, including its name, type, value, and source location.

Definition at line 1541 of file Record.h.

Member Enumeration Documentation

◆ FieldKind

Enumerator
FK_Normal 
FK_NonconcreteOK 
FK_TemplateArg 

Definition at line 1545 of file Record.h.

Constructor & Destructor Documentation

◆ RecordVal() [1/2]

RecordVal::RecordVal ( const Init * N,
const RecTy * T,
FieldKind K )

Definition at line 2855 of file Record.cpp.

References assert(), llvm::UnsetInit::get(), N, setValue(), and T.

◆ RecordVal() [2/2]

RecordVal::RecordVal ( const Init * N,
SMLoc Loc,
const RecTy * T,
FieldKind K )

Definition at line 2863 of file Record.cpp.

References assert(), llvm::UnsetInit::get(), N, setValue(), and T.

Member Function Documentation

◆ addReferenceLoc()

void llvm::RecordVal::addReferenceLoc ( SMRange Loc)
inline

Add a reference to this record value.

Definition at line 1608 of file Record.h.

Referenced by llvm::TGVarScope::getVar().

◆ dump()

LLVM_DUMP_METHOD void RecordVal::dump ( ) const

Definition at line 2920 of file Record.cpp.

References llvm::errs(), and LLVM_DUMP_METHOD.

◆ getLoc()

const SMLoc & llvm::RecordVal::getLoc ( ) const
inline

Get the source location of the point where the field was defined.

Definition at line 1580 of file Record.h.

Referenced by llvm::Record::checkUnusedTemplateArgs(), llvm::PrintError(), llvm::PrintFatalError(), and llvm::PrintFatalNote().

◆ getName()

StringRef RecordVal::getName ( ) const

Get the name of the field as a StringRef.

Definition at line 2869 of file Record.cpp.

References llvm::cast(), and getNameInit().

Referenced by llvm::Record::checkUnusedTemplateArgs().

◆ getNameInit()

const Init * llvm::RecordVal::getNameInit ( ) const
inline

Get the name of the field as an Init.

Definition at line 1572 of file Record.h.

Referenced by llvm::Record::addValue(), getName(), and getNameInitAsString().

◆ getNameInitAsString()

std::string llvm::RecordVal::getNameInitAsString ( ) const
inline

Get the name of the field as a std::string.

Definition at line 1575 of file Record.h.

References llvm::Init::getAsUnquotedString(), and getNameInit().

Referenced by print().

◆ getPrintType()

std::string RecordVal::getPrintType ( ) const

Get the type of the field for printing purposes.

Definition at line 2873 of file Record.cpp.

References llvm::dyn_cast(), llvm::StringRecTy::get(), getRecordKeeper(), and getType().

Referenced by print().

◆ getRecordKeeper()

RecordKeeper & llvm::RecordVal::getRecordKeeper ( ) const
inline

Get the record keeper used to unique this value.

Definition at line 1566 of file Record.h.

Referenced by getPrintType().

◆ getReferenceLocs()

ArrayRef< SMRange > llvm::RecordVal::getReferenceLocs ( ) const
inline

Return the references of this record value.

Definition at line 1611 of file Record.h.

◆ getType()

const RecTy * llvm::RecordVal::getType ( ) const
inline

Get the type of the field value as a RecTy.

Definition at line 1593 of file Record.h.

Referenced by getPrintType(), llvm::TGVarScope::getVar(), and setValue().

◆ getValue()

const Init * llvm::RecordVal::getValue ( ) const
inline

Get the value of the field as an Init.

Definition at line 1599 of file Record.h.

Referenced by checkBitsConcrete(), llvm::DefInit::getFieldType(), llvm::TGVarScope::getVar(), and print().

◆ isNonconcreteOK()

bool llvm::RecordVal::isNonconcreteOK ( ) const
inline

Is this a field where nonconcrete values are okay?

Definition at line 1583 of file Record.h.

References FK_NonconcreteOK.

Referenced by print().

◆ isTemplateArg()

bool llvm::RecordVal::isTemplateArg ( ) const
inline

Is this a template argument?

Definition at line 1588 of file Record.h.

References FK_TemplateArg.

◆ isUsed()

bool llvm::RecordVal::isUsed ( ) const
inline

Definition at line 1616 of file Record.h.

Referenced by llvm::Record::checkUnusedTemplateArgs().

◆ print()

void RecordVal::print ( raw_ostream & OS,
bool PrintSem = true ) const

Print the value to an output stream, possibly with a semicolon.

Definition at line 2923 of file Record.cpp.

References getNameInitAsString(), getPrintType(), getValue(), and isNonconcreteOK().

Referenced by llvm::operator<<(), and llvm::operator<<().

◆ setUsed()

void llvm::RecordVal::setUsed ( bool Used)
inline

Whether this value is used.

Useful for reporting warnings, for example when a template argument is unused.

Definition at line 1615 of file Record.h.

Referenced by llvm::TGVarScope::getVar().

◆ setValue() [1/2]

bool RecordVal::setValue ( const Init * V)

Set the value of the field from an Init.

Definition at line 2888 of file Record.cpp.

References assert(), llvm::cast(), llvm::dyn_cast(), llvm::BitsInit::get(), getType(), I, and llvm::isa().

Referenced by RecordVal(), RecordVal(), and setValue().

◆ setValue() [2/2]

bool RecordVal::setValue ( const Init * V,
SMLoc NewLoc )

Set the value and source location of the field.

Definition at line 2914 of file Record.cpp.

References setValue().

◆ Record

friend class Record
friend

Definition at line 1542 of file Record.h.

References Record.

Referenced by Record.


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