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

Class holding the Pattern global state, shared by all patterns: tables holding values of variables and whether they are defined or not at any given time in the matching process. More...

#include "FileCheck/FileCheckImpl.h"

Public Member Functions

Expected< StringRefgetPatternVarValue (StringRef VarName)
 
Error defineCmdlineVariables (ArrayRef< StringRef > CmdlineDefines, SourceMgr &SM)
 Defines string and numeric variables from definitions given on the command line, passed as a vector of [#]VAR=VAL strings in CmdlineDefines.
 
void createLineVariable ()
 Create @LINE pseudo variable.
 
void clearLocalVars ()
 Undefines local variables (variables whose name does not start with a '$' sign), i.e.
 

Friends

class Pattern
 

Detailed Description

Class holding the Pattern global state, shared by all patterns: tables holding values of variables and whether they are defined or not at any given time in the matching process.

Definition at line 410 of file FileCheckImpl.h.

Member Function Documentation

◆ clearLocalVars()

void FileCheckPatternContext::clearLocalVars ( )

Undefines local variables (variables whose name does not start with a '$' sign), i.e.

removes them from GlobalVariableTable and from GlobalNumericVariableTable and also clears the value of numeric variables.

Definition at line 2651 of file FileCheck.cpp.

References llvm::SmallVectorTemplateBase< T, bool >::push_back().

◆ createLineVariable()

void FileCheckPatternContext::createLineVariable ( )

Create @LINE pseudo variable.

Value is set when pattern are being matched.

Definition at line 1760 of file FileCheck.cpp.

References assert(), and llvm::ExpressionFormat::Unsigned.

◆ defineCmdlineVariables()

Error FileCheckPatternContext::defineCmdlineVariables ( ArrayRef< StringRef CmdlineDefines,
SourceMgr SM 
)

Defines string and numeric variables from definitions given on the command line, passed as a vector of [#]VAR=VAL strings in CmdlineDefines.

Returns
an error list containing diagnostics against SM for all definition parsing failures, if any, or Success otherwise.

Definition at line 2513 of file FileCheck.cpp.

References llvm::SourceMgr::AddNewSourceBuffer(), assert(), llvm::ArrayRef< T >::empty(), llvm::StringRef::empty(), llvm::ExpressionAST::eval(), llvm::ErrorDiagnostic::get(), llvm::Expression::getAST(), llvm::MemoryBuffer::getMemBufferCopy(), I, llvm::joinErrors(), Name, llvm::StringRef::npos, llvm::Pattern::parseNumericSubstitutionBlock(), llvm::Pattern::parseVariable(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::StringRef::split(), llvm::StringRef::substr(), llvm::Error::success(), and llvm::Expected< T >::takeError().

◆ getPatternVarValue()

Expected< StringRef > FileCheckPatternContext::getPatternVarValue ( StringRef  VarName)
Returns
the value of string variable VarName or an error if no such variable has been defined.

Definition at line 1360 of file FileCheck.cpp.

Referenced by llvm::StringSubstitution::getResult().

Friends And Related Function Documentation

◆ Pattern

friend class Pattern
friend

Definition at line 411 of file FileCheckImpl.h.


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