LLVM 20.0.0git
Public Member Functions | List of all members
llvm::NumericVariable Class Reference

Class representing a numeric variable and its associated current value. More...

#include "FileCheck/FileCheckImpl.h"

Public Member Functions

 NumericVariable (StringRef Name, ExpressionFormat ImplicitFormat, std::optional< size_t > DefLineNumber=std::nullopt)
 Constructor for a variable Name with implicit format ImplicitFormat defined at line DefLineNumber or defined before input is parsed if DefLineNumber is std::nullopt.
 
StringRef getName () const
 
ExpressionFormat getImplicitFormat () const
 
std::optional< APIntgetValue () const
 
std::optional< StringRefgetStringValue () const
 
void setValue (APInt NewValue, std::optional< StringRef > NewStrValue=std::nullopt)
 Sets value of this numeric variable to NewValue, and sets the input buffer string from which it was parsed to NewStrValue.
 
void clearValue ()
 Clears value of this numeric variable, regardless of whether it is currently defined or not.
 
std::optional< size_t > getDefLineNumber () const
 

Detailed Description

Class representing a numeric variable and its associated current value.

Definition at line 211 of file FileCheckImpl.h.

Constructor & Destructor Documentation

◆ NumericVariable()

llvm::NumericVariable::NumericVariable ( StringRef  Name,
ExpressionFormat  ImplicitFormat,
std::optional< size_t >  DefLineNumber = std::nullopt 
)
inlineexplicit

Constructor for a variable Name with implicit format ImplicitFormat defined at line DefLineNumber or defined before input is parsed if DefLineNumber is std::nullopt.

Definition at line 236 of file FileCheckImpl.h.

Member Function Documentation

◆ clearValue()

void llvm::NumericVariable::clearValue ( )
inline

Clears value of this numeric variable, regardless of whether it is currently defined or not.

Definition at line 268 of file FileCheckImpl.h.

◆ getDefLineNumber()

std::optional< size_t > llvm::NumericVariable::getDefLineNumber ( ) const
inline
Returns
the line number where this variable is defined, if any, or std::nullopt if defined before input is parsed.

Definition at line 275 of file FileCheckImpl.h.

◆ getImplicitFormat()

ExpressionFormat llvm::NumericVariable::getImplicitFormat ( ) const
inline
Returns
implicit format of this numeric variable.

Definition at line 245 of file FileCheckImpl.h.

Referenced by llvm::NumericVariableUse::getImplicitFormat(), and llvm::Pattern::match().

◆ getName()

StringRef llvm::NumericVariable::getName ( ) const
inline
Returns
name of this numeric variable.

Definition at line 242 of file FileCheckImpl.h.

◆ getStringValue()

std::optional< StringRef > llvm::NumericVariable::getStringValue ( ) const
inline
Returns
the input buffer's string from which this variable's value was parsed, or std::nullopt if the value is not yet defined or was not parsed from the input buffer. For example, the value of @LINE is not parsed from the input buffer, and some numeric variables are parsed from the command line instead.

Definition at line 255 of file FileCheckImpl.h.

◆ getValue()

std::optional< APInt > llvm::NumericVariable::getValue ( ) const
inline
Returns
this variable's value.

Definition at line 248 of file FileCheckImpl.h.

Referenced by llvm::NumericVariableUse::eval().

◆ setValue()

void llvm::NumericVariable::setValue ( APInt  NewValue,
std::optional< StringRef NewStrValue = std::nullopt 
)
inline

Sets value of this numeric variable to NewValue, and sets the input buffer string from which it was parsed to NewStrValue.

See comments on getStringValue for a discussion of when the latter can be std::nullopt.

Definition at line 260 of file FileCheckImpl.h.

Referenced by llvm::Pattern::match().


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