class Pattern
Declaration
class Pattern { /* full declaration omitted */ };
Declared at: llvm/lib/Support/FileCheckImpl.h:358
Method Overview
- public Pattern(Check::FileCheckType Ty, llvm::FileCheckPatternContext * Context, Optional<size_t> Line = None)
- public Check::FileCheckType getCheckTy() const
- public llvm::FileCheckPatternContext * getContext() const
- public int getCount() const
- public llvm::SMLoc getLoc() const
- public bool hasVariable() const
- public static bool isValidVarNameStart(char C)
- public Expected<size_t> match(llvm::StringRef Buffer, size_t & MatchLen, const llvm::SourceMgr & SM) const
- public static Expected<std::unique_ptr<ExpressionAST>> parseNumericSubstitutionBlock(llvm::StringRef Expr, Optional<llvm::NumericVariable *> & DefinedNumericVariable, bool IsLegacyLineExpr, Optional<size_t> LineNumber, llvm::FileCheckPatternContext * Context, const llvm::SourceMgr & SM)
- public bool parsePattern(llvm::StringRef PatternStr, llvm::StringRef Prefix, llvm::SourceMgr & SM, const llvm::FileCheckRequest & Req)
- public static Expected<llvm::Pattern::VariableProperties> parseVariable(llvm::StringRef & Str, const llvm::SourceMgr & SM)
- public void printFuzzyMatch(const llvm::SourceMgr & SM, llvm::StringRef Buffer, std::vector<FileCheckDiag> * Diags) const
- public void printSubstitutions(const llvm::SourceMgr & SM, llvm::StringRef Buffer, llvm::SMRange MatchRange = None) const
Methods
¶Pattern(Check::FileCheckType Ty,
llvm::FileCheckPatternContext* Context,
Optional<size_t> Line = None)
Pattern(Check::FileCheckType Ty,
llvm::FileCheckPatternContext* Context,
Optional<size_t> Line = None)
Declared at: llvm/lib/Support/FileCheckImpl.h:428
Parameters
- Check::FileCheckType Ty
- llvm::FileCheckPatternContext* Context
- Optional<size_t> Line = None
¶Check::FileCheckType getCheckTy() const
Check::FileCheckType getCheckTy() const
Declared at: llvm/lib/Support/FileCheckImpl.h:503
¶llvm::FileCheckPatternContext* getContext() const
llvm::FileCheckPatternContext* getContext() const
Declared at: llvm/lib/Support/FileCheckImpl.h:437
Returns
the pointer to the global state for all patterns in this FileCheck instance.
¶int getCount() const
int getCount() const
Declared at: llvm/lib/Support/FileCheckImpl.h:505
¶llvm::SMLoc getLoc() const
llvm::SMLoc getLoc() const
Declared at: llvm/lib/Support/FileCheckImpl.h:433
Returns
the location in source code.
¶bool hasVariable() const
bool hasVariable() const
Declared at: llvm/lib/Support/FileCheckImpl.h:499
¶static bool isValidVarNameStart(char C)
static bool isValidVarNameStart(char C)
Declared at: llvm/lib/Support/FileCheckImpl.h:440
Parameters
- char C
Returns
whether \p C is a valid first character for a variable name.
¶Expected<size_t> match(
llvm::StringRef Buffer,
size_t& MatchLen,
const llvm::SourceMgr& SM) const
Expected<size_t> match(
llvm::StringRef Buffer,
size_t& MatchLen,
const llvm::SourceMgr& SM) const
Description
Matches the pattern string against the input buffer \p Buffer 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.
Declared at: llvm/lib/Support/FileCheckImpl.h:490
Parameters
- llvm::StringRef Buffer
- size_t& MatchLen
- const llvm::SourceMgr& SM
Returns
the position that is matched or an error indicating why matching failed. If there is a match, updates \p MatchLen with the size of the matched string.
¶static Expected<std::unique_ptr<ExpressionAST>>
parseNumericSubstitutionBlock(
llvm::StringRef Expr,
Optional<llvm::NumericVariable*>&
DefinedNumericVariable,
bool IsLegacyLineExpr,
Optional<size_t> LineNumber,
llvm::FileCheckPatternContext* Context,
const llvm::SourceMgr& SM)
static Expected<std::unique_ptr<ExpressionAST>>
parseNumericSubstitutionBlock(
llvm::StringRef Expr,
Optional<llvm::NumericVariable*>&
DefinedNumericVariable,
bool IsLegacyLineExpr,
Optional<size_t> LineNumber,
llvm::FileCheckPatternContext* Context,
const llvm::SourceMgr& SM)
Description
Parses \p Expr for a numeric substitution block at line \p LineNumber, or before input is parsed if \p LineNumber is None. Parameter\p IsLegacyLineExpr indicates whether \p Expr should be a legacy @LINEexpression and \p Context points to the class instance holding the live string and numeric variables.
Declared at: llvm/lib/Support/FileCheckImpl.h:465
Parameters
- llvm::StringRef Expr
- Optional<llvm::NumericVariable*>& DefinedNumericVariable
- bool IsLegacyLineExpr
- Optional<size_t> LineNumber
- llvm::FileCheckPatternContext* Context
- const llvm::SourceMgr& SM
Returns
a pointer to the class instance representing the AST of the expression whose value must be substitued, or an error holding a diagnostic against \p SM if parsing fails. If substitution was successful, sets \p 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.
¶bool parsePattern(
llvm::StringRef PatternStr,
llvm::StringRef Prefix,
llvm::SourceMgr& SM,
const llvm::FileCheckRequest& Req)
bool parsePattern(
llvm::StringRef PatternStr,
llvm::StringRef Prefix,
llvm::SourceMgr& SM,
const llvm::FileCheckRequest& Req)
Description
Parses the pattern in \p PatternStr and initializes this Pattern instance accordingly. \p Prefix provides which prefix is being matched, \p Req describes the global options that influence the parsing such as whitespace canonicalization, \p SM provides the SourceMgr used for error reports.
Declared at: llvm/lib/Support/FileCheckImpl.h:476
Parameters
- llvm::StringRef PatternStr
- llvm::StringRef Prefix
- llvm::SourceMgr& SM
- const llvm::FileCheckRequest& Req
Returns
true in case of an error, false otherwise.
¶static Expected<llvm::Pattern::VariableProperties>
parseVariable(llvm::StringRef& Str,
const llvm::SourceMgr& SM)
static Expected<llvm::Pattern::VariableProperties>
parseVariable(llvm::StringRef& Str,
const llvm::SourceMgr& SM)
Description
Parses the string at the start of \p Str for a variable name.
Declared at: llvm/lib/Support/FileCheckImpl.h:453
Parameters
- llvm::StringRef& Str
- const llvm::SourceMgr& SM
Returns
a VariableProperties structure holding the variable name and whether it is the name of a pseudo variable, or an error holding a diagnostic against \p SM if parsing fail. If parsing was successful, also strips\p Str from the variable name.
¶void printFuzzyMatch(
const llvm::SourceMgr& SM,
llvm::StringRef Buffer,
std::vector<FileCheckDiag>* Diags) const
void printFuzzyMatch(
const llvm::SourceMgr& SM,
llvm::StringRef Buffer,
std::vector<FileCheckDiag>* Diags) const
Declared at: llvm/lib/Support/FileCheckImpl.h:496
Parameters
- const llvm::SourceMgr& SM
- llvm::StringRef Buffer
- std::vector<FileCheckDiag>* Diags
¶void printSubstitutions(
const llvm::SourceMgr& SM,
llvm::StringRef Buffer,
llvm::SMRange MatchRange = None) const
void printSubstitutions(
const llvm::SourceMgr& SM,
llvm::StringRef Buffer,
llvm::SMRange MatchRange = None) const
Description
Prints the value of successful substitutions or the name of the undefined string or numeric variables preventing a successful substitution.
Declared at: llvm/lib/Support/FileCheckImpl.h:494
Parameters
- const llvm::SourceMgr& SM
- llvm::StringRef Buffer
- llvm::SMRange MatchRange = None