LLVM: llvm::Pattern Class Reference (original) (raw)
#include "[FileCheck/FileCheckImpl.h](FileCheckImpl%5F8h%5Fsource.html)"
| Static Public Member Functions | |
|---|---|
| static LLVM_ABI_FOR_TEST bool | isValidVarNameStart (char C) |
| static LLVM_ABI_FOR_TEST Expected< VariableProperties > | parseVariable (StringRef &Str, const SourceMgr &SM) |
| Parses the string at the start of Str for a variable name. | |
| static LLVM_ABI_FOR_TEST Expected< std::unique_ptr< Expression > > | parseNumericSubstitutionBlock (StringRef Expr, std::optional< NumericVariable * > &DefinedNumericVariable, bool IsLegacyLineExpr, std::optional< size_t > LineNumber, FileCheckPatternContext *Context, const SourceMgr &SM) |
| Parses Expr for a numeric substitution block at line LineNumber, or before input is parsed if LineNumber is None. |
Definition at line 587 of file FileCheckImpl.h.
◆ getCheckTy()
◆ getContext()
◆ getCount()
| int llvm::Pattern::getCount ( ) const | inline |
|---|
◆ getLoc()
| SMLoc llvm::Pattern::getLoc ( ) const | inline |
|---|
◆ hasVariable()
| bool llvm::Pattern::hasVariable ( ) const | inline |
|---|
◆ isValidVarNameStart()
| bool Pattern::isValidVarNameStart ( char C) | static |
|---|
◆ match()
Matches the pattern string against the input buffer Buffer.
Returns
either (1) an error resulting in no match or (2) a match possibly with an error encountered while processing the match.
The GlobalVariableTable [StringMap](classllvm%5F1%5F1StringMap.html "StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...") in the FileCheckPatternContext class instance provides the current values of FileCheck string variables and is updated if this match defines new values. Likewise, the GlobalNumericVariableTable [StringMap](classllvm%5F1%5F1StringMap.html "StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...") in the same class provides the current values of FileCheck numeric variables and is updated if this match defines new numeric values.
Definition at line 1116 of file FileCheck.cpp.
References assert(), llvm::Check::CheckEmpty, llvm::Check::CheckEOF, llvm::StringRef::data(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::StringRef::find(), llvm::StringRef::find_insensitive(), llvm::Format, llvm::NumericVariable::getImplicitFormat(), llvm::Substitution::getIndex(), llvm::Substitution::getResultRegex(), llvm::handleErrors(), llvm::Regex::IgnoreCase, llvm::joinErrors(), llvm::Pattern::Match::Len, llvm::make_error(), match(), llvm::Regex::Newline, llvm::StringRef::npos, llvm::Pattern::Match::Pos, llvm::NumericVariable::setValue(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::StringRef::size(), and llvm::Error::success().
Referenced by llvm::ifs::filterIFSSyms(), and match().
◆ parseNumericSubstitutionBlock()
Parses Expr for a numeric substitution block at line LineNumber, or before input is parsed if LineNumber is None.
Parameter IsLegacyLineExpr indicates whether Expr should be a legacy @LINE expression and Context points to the class instance holding the live string and numeric variables.
Returns
a pointer to the class instance representing the expression whose value must be substitued, or an error holding a diagnostic against SM if parsing fails. If substitution was successful, sets DefinedNumericVariable to point to the class representing the numeric variable defined in this numeric substitution block, or std::nullopt if this block does not define any variable.
Definition at line 654 of file FileCheck.cpp.
References llvm::StringRef::consume_front(), llvm::StringRef::consumeInteger(), llvm::StringRef::data(), llvm::StringRef::drop_front(), llvm::StringRef::empty(), llvm::StringRef::find(), llvm::Format, llvm::ErrorDiagnostic::get(), llvm::SMLoc::getFromPointer(), llvm::ExpressionFormat::HexLower, llvm::ExpressionFormat::HexUpper, llvm::StringRef::ltrim(), llvm::StringRef::npos, popFront(), llvm::StringRef::rtrim(), llvm::ExpressionFormat::Signed, SpaceChars, llvm::StringRef::substr(), llvm::StringRef::take_front(), llvm::Expected< T >::takeError(), llvm::StringRef::trim(), and llvm::ExpressionFormat::Unsigned.
Referenced by llvm::FileCheckPatternContext::defineCmdlineVariables(), and parsePattern().
◆ parsePattern()
Parses the pattern in PatternStr and initializes this Pattern instance accordingly.
Prefix provides which prefix is being matched, Req describes the global options that influence the parsing such as whitespace canonicalization, SM provides the SourceMgr used for error reports.
Returns
true in case of an error, false otherwise.
Definition at line 801 of file FileCheck.cpp.
References llvm::cantFail(), llvm::Check::CheckEmpty, llvm::Check::CheckNot, llvm::StringRef::consume_front(), llvm::StringRef::contains(), llvm::StringRef::data(), llvm::SourceMgr::DK_Error, llvm::StringRef::empty(), llvm::errs(), llvm::Regex::escape(), llvm::StringRef::find(), llvm::StringRef::find_first_of(), llvm::Format, llvm::SMLoc::getFromPointer(), llvm::FileCheckRequest::IgnoreCase, llvm::logAllUnhandledErrors(), llvm::FileCheckRequest::MatchFullLines, llvm::FileCheckRequest::NoCanonicalizeWhiteSpace, llvm::StringRef::npos, parseNumericSubstitutionBlock(), parseVariable(), llvm::SourceMgr::PrintMessage(), llvm::StringRef::rtrim(), llvm::StringRef::size(), llvm::StringRef::starts_with(), llvm::StringRef::substr(), and llvm::Expected< T >::takeError().
◆ parseVariable()
◆ printFuzzyMatch()
◆ printSubstitutions()
Prints the value of successful substitutions.
Definition at line 1252 of file FileCheck.cpp.
References llvm::consumeError(), llvm::SourceMgr::DK_Note, llvm::Substitution::getFromString(), getLoc(), llvm::Substitution::getResultForDiagnostics(), llvm::SourceMgr::PrintMessage(), Range, llvm::raw_svector_ostream::str(), llvm::Expected< T >::takeError(), and llvm::raw_ostream::write_escaped().
Referenced by printMatch(), and printNoMatch().
◆ printVariableDefs()
Definition at line 1287 of file FileCheck.cpp.
References A(), assert(), B(), llvm::SourceMgr::DK_Note, llvm::SMLoc::getFromPointer(), getLoc(), llvm::SourceMgr::PrintMessage(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), Range, llvm::sort(), and llvm::raw_svector_ostream::str().
Referenced by printMatch().
The documentation for this class was generated from the following files:
- lib/FileCheck/FileCheckImpl.h
- lib/FileCheck/FileCheck.cpp