LLVM 22.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

LLVM_ABI_FOR_TEST Expected< StringRefgetPatternVarValue (StringRef VarName)
 
LLVM_ABI_FOR_TEST 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.
 
LLVM_ABI_FOR_TEST void createLineVariable ()
 Create @LINE pseudo variable.
 
LLVM_ABI_FOR_TEST 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 432 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 2690 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 1804 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 2552 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 1406 of file FileCheck.cpp.

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

Friends And Related Function Documentation

◆ Pattern

friend class Pattern
friend

Definition at line 433 of file FileCheckImpl.h.


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