|
LLVM
10.0.0
|
#include "Support/FileCheckImpl.h"
Classes | |
| struct | VariableProperties |
| Parsing information about a variable. More... | |
Public Member Functions | |
| Pattern (Check::FileCheckType Ty, FileCheckPatternContext *Context, Optional< size_t > Line=None) | |
| SMLoc | getLoc () const |
| FileCheckPatternContext * | getContext () const |
| bool | parsePattern (StringRef PatternStr, StringRef Prefix, SourceMgr &SM, const FileCheckRequest &Req) |
Parses the pattern in PatternStr and initializes this Pattern instance accordingly. More... | |
| Expected< size_t > | match (StringRef Buffer, size_t &MatchLen, const SourceMgr &SM) const |
Matches the pattern string against the input buffer Buffer. More... | |
| void | printSubstitutions (const SourceMgr &SM, StringRef Buffer, SMRange MatchRange=None) const |
| Prints the value of successful substitutions or the name of the undefined string or numeric variables preventing a successful substitution. More... | |
| void | printFuzzyMatch (const SourceMgr &SM, StringRef Buffer, std::vector< FileCheckDiag > *Diags) const |
| bool | hasVariable () const |
| Check::FileCheckType | getCheckTy () const |
| int | getCount () const |
Static Public Member Functions | |
| static bool | isValidVarNameStart (char C) |
| static Expected< VariableProperties > | parseVariable (StringRef &Str, const SourceMgr &SM) |
Parses the string at the start of Str for a variable name. More... | |
| static Expected< std::unique_ptr< ExpressionAST > > | parseNumericSubstitutionBlock (StringRef Expr, Optional< NumericVariable *> &DefinedNumericVariable, bool IsLegacyLineExpr, 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. More... | |
Definition at line 358 of file FileCheckImpl.h.
|
inline |
Definition at line 428 of file FileCheckImpl.h.
|
inline |
Definition at line 503 of file FileCheckImpl.h.
Referenced by llvm::FileCheck::checkInput(), PrintMatch(), and PrintNoMatch().
|
inline |
Definition at line 437 of file FileCheckImpl.h.
|
inline |
Definition at line 505 of file FileCheckImpl.h.
References llvm::Check::FileCheckType::getCount(), llvm::Literal, and Name.
Referenced by PrintMatch(), and PrintNoMatch().
|
inline |
Definition at line 433 of file FileCheckImpl.h.
|
inline |
Definition at line 499 of file FileCheckImpl.h.
C is a valid first character for a variable name. Definition at line 69 of file FileCheck.cpp.
| Expected< size_t > Pattern::match | ( | StringRef | Buffer, |
| size_t & | MatchLen, | ||
| const SourceMgr & | SM | ||
| ) | const |
Matches the pattern string against the input buffer Buffer.
MatchLen with the size of the matched string.The GlobalVariableTable StringMap 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 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 602 of file FileCheck.cpp.
References assert(), llvm::Check::CheckEmpty, llvm::Check::CheckEOF, llvm::StringRef::data(), llvm::StringRef::edit_distance(), llvm::SmallVectorBase::empty(), llvm::StringRef::empty(), llvm::StringRef::find(), llvm::StringRef::find_lower(), llvm::ErrorDiagnostic::get(), llvm::StringRef::getAsInteger(), llvm::Substitution::getIndex(), llvm::Substitution::getResult(), llvm::Regex::IgnoreCase, llvm::PatternMatch::match(), llvm::Regex::Newline, llvm::StringRef::npos, llvm::NumericVariable::setValue(), llvm::SmallVectorBase::size(), llvm::StringRef::size(), llvm::StringRef::split(), llvm::StringRef::substr(), and llvm::Expected< T >::takeError().
|
static |
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 expression and Context points to the class instance holding the live string and numeric variables.
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 None if this block does not define any variable. Definition at line 258 of file FileCheck.cpp.
References llvm::SystemZICMP::Any, llvm::StringRef::empty(), llvm::StringRef::find(), llvm::ErrorDiagnostic::get(), llvm::StringRef::ltrim(), llvm::None, llvm::StringRef::npos, SpaceChars, llvm::StringRef::substr(), and llvm::Expected< T >::takeError().
Referenced by llvm::FileCheckPatternContext::defineCmdlineVariables().
| bool Pattern::parsePattern | ( | StringRef | PatternStr, |
| StringRef | Prefix, | ||
| SourceMgr & | SM, | ||
| const FileCheckRequest & | Req | ||
| ) |
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.
Definition at line 309 of file FileCheck.cpp.
References llvm::StringRef::back(), llvm::Check::CheckEmpty, llvm::Check::CheckNot, llvm::StringRef::data(), llvm::SourceMgr::DK_Error, llvm::StringRef::empty(), llvm::StringRef::find(), llvm::SMLoc::getFromPointer(), llvm::FileCheckRequest::IgnoreCase, llvm::FileCheckRequest::MatchFullLines, llvm::FileCheckRequest::NoCanonicalizeWhiteSpace, llvm::StringRef::npos, llvm::SourceMgr::PrintMessage(), llvm::StringRef::size(), llvm::StringRef::startswith(), and llvm::StringRef::substr().
|
static |
Parses the string at the start of Str for a variable name.
SM if parsing fail. If parsing was successful, also strips Str from the variable name. Definition at line 72 of file FileCheck.cpp.
References E, llvm::StringRef::empty(), llvm::ErrorDiagnostic::get(), I, llvm::StringRef::size(), llvm::StringRef::substr(), and llvm::StringRef::take_front().
Referenced by llvm::FileCheckPatternContext::defineCmdlineVariables().
| void Pattern::printFuzzyMatch | ( | const SourceMgr & | SM, |
| StringRef | Buffer, | ||
| std::vector< FileCheckDiag > * | Diags | ||
| ) | const |
Definition at line 770 of file FileCheck.cpp.
References llvm::SourceMgr::DK_Note, llvm::numbers::e, llvm::FileCheckDiag::MatchFuzzy, llvm::StringRef::npos, llvm::SourceMgr::PrintMessage(), ProcessMatchResult(), llvm::StringRef::size(), llvm::SMRange::Start, and llvm::StringRef::substr().
Referenced by PrintNoMatch().
| void Pattern::printSubstitutions | ( | const SourceMgr & | SM, |
| StringRef | Buffer, | ||
| SMRange | MatchRange = None |
||
| ) | const |
Prints the value of successful substitutions or the name of the undefined string or numeric variables preventing a successful substitution.
Definition at line 711 of file FileCheck.cpp.
References llvm::StringRef::data(), llvm::SourceMgr::DK_Note, E, llvm::SMLoc::getFromPointer(), llvm::Substitution::getFromString(), llvm::Substitution::getResult(), llvm::handleAllErrors(), llvm::SMRange::isValid(), llvm::SourceMgr::PrintMessage(), llvm::SMRange::Start, llvm::raw_svector_ostream::str(), llvm::Expected< T >::takeError(), and llvm::raw_ostream::write_escaped().
Referenced by PrintMatch(), and PrintNoMatch().
1.8.13