LLVM 22.0.0git
llvm::Substitution Class Referenceabstract

Class representing a substitution to perform in the RegExStr string. More...

#include "FileCheck/FileCheckImpl.h"

Inheritance diagram for llvm::Substitution:
[legend]

Public Member Functions

 Substitution (FileCheckPatternContext *Context, StringRef VarName, size_t InsertIdx)
virtual ~Substitution ()=default
StringRef getFromString () const
size_t getIndex () const
virtual Expected< std::string > getResultRegex () const =0
virtual Expected< std::string > getResultForDiagnostics () const =0

Protected Attributes

FileCheckPatternContextContext
 Pointer to a class instance holding, among other things, the table with the values of live string variables at the start of any given CHECK line.
StringRef FromStr
 The string that needs to be substituted for something else.
size_t InsertIdx

Detailed Description

Class representing a substitution to perform in the RegExStr string.

Definition at line 345 of file FileCheckImpl.h.

Constructor & Destructor Documentation

◆ Substitution()

llvm::Substitution::Substitution ( FileCheckPatternContext * Context,
StringRef VarName,
size_t InsertIdx )
inline

◆ ~Substitution()

virtual llvm::Substitution::~Substitution ( )
virtualdefault

Member Function Documentation

◆ getFromString()

StringRef llvm::Substitution::getFromString ( ) const
inline
Returns
the string to be substituted for something else.

Definition at line 370 of file FileCheckImpl.h.

References FromStr.

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

◆ getIndex()

size_t llvm::Substitution::getIndex ( ) const
inline
Returns
the index where the substitution is to be performed in RegExStr.

Definition at line 373 of file FileCheckImpl.h.

References InsertIdx.

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

◆ getResultForDiagnostics()

virtual Expected< std::string > llvm::Substitution::getResultForDiagnostics ( ) const
pure virtual
Returns
a string containing the result of the substitution represented by this class instance in a form suitable for diagnostics, or an error if substitution failed.

Implemented in llvm::NumericSubstitution, and llvm::StringSubstitution.

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

◆ getResultRegex()

virtual Expected< std::string > llvm::Substitution::getResultRegex ( ) const
pure virtual
Returns
a regular expression string that matches the result of the substitution represented by this class instance or an error if substitution failed.

Implemented in llvm::NumericSubstitution, and llvm::StringSubstitution.

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

Member Data Documentation

◆ Context

FileCheckPatternContext* llvm::Substitution::Context
protected

Pointer to a class instance holding, among other things, the table with the values of live string variables at the start of any given CHECK line.

Used for substituting string variables with the text they were defined as. Expressions are linked to the numeric variables they use at parse time and directly access the value of the numeric variable to evaluate their value.

Definition at line 353 of file FileCheckImpl.h.

Referenced by llvm::StringSubstitution::getResultForDiagnostics(), llvm::StringSubstitution::getResultRegex(), llvm::NumericSubstitution::NumericSubstitution(), llvm::StringSubstitution::StringSubstitution(), and Substitution().

◆ FromStr

StringRef llvm::Substitution::FromStr
protected

The string that needs to be substituted for something else.

For a string variable this is its name, otherwise this is the whole expression.

Definition at line 357 of file FileCheckImpl.h.

Referenced by getFromString(), llvm::StringSubstitution::getResultForDiagnostics(), llvm::StringSubstitution::getResultRegex(), and Substitution().

◆ InsertIdx

size_t llvm::Substitution::InsertIdx
protected

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