LLVM  8.0.1
Public Member Functions | List of all members
llvm::FileCheckPattern Class Reference

#include "llvm/Support/FileCheck.h"

Public Member Functions

 FileCheckPattern (Check::FileCheckType Ty)
 
SMLoc getLoc () const
 Returns the location in source code. More...
 
bool ParsePattern (StringRef PatternStr, StringRef Prefix, SourceMgr &SM, unsigned LineNumber, const FileCheckRequest &Req)
 Parses the given string into the Pattern. More...
 
size_t Match (StringRef Buffer, size_t &MatchLen, StringMap< StringRef > &VariableTable) const
 Matches the pattern string against the input buffer Buffer. More...
 
void PrintVariableUses (const SourceMgr &SM, StringRef Buffer, const StringMap< StringRef > &VariableTable, SMRange MatchRange=None) const
 
void PrintFuzzyMatch (const SourceMgr &SM, StringRef Buffer, const StringMap< StringRef > &VariableTable, std::vector< FileCheckDiag > *Diags) const
 
bool hasVariable () const
 
Check::FileCheckType getCheckTy () const
 
int getCount () const
 

Detailed Description

Definition at line 87 of file FileCheck.h.

Constructor & Destructor Documentation

◆ FileCheckPattern()

llvm::FileCheckPattern::FileCheckPattern ( Check::FileCheckType  Ty)
inlineexplicit

Definition at line 116 of file FileCheck.h.

Member Function Documentation

◆ getCheckTy()

Check::FileCheckType llvm::FileCheckPattern::getCheckTy ( ) const
inline

◆ getCount()

int llvm::FileCheckPattern::getCount ( ) const
inline

Definition at line 139 of file FileCheck.h.

References EvaluateExpression(), and llvm::Check::FileCheckType::getCount().

Referenced by PrintMatch(), and PrintNoMatch().

◆ getLoc()

SMLoc llvm::FileCheckPattern::getLoc ( ) const
inline

Returns the location in source code.

Definition at line 120 of file FileCheck.h.

References llvm::Match, llvm::None, and llvm::cl::Prefix.

Referenced by PrintFuzzyMatch().

◆ hasVariable()

bool llvm::FileCheckPattern::hasVariable ( ) const
inline

Definition at line 133 of file FileCheck.h.

◆ Match()

size_t FileCheckPattern::Match ( StringRef  Buffer,
size_t &  MatchLen,
StringMap< StringRef > &  VariableTable 
) const

Matches the pattern string against the input buffer Buffer.

This returns the position that is matched or npos if there is no match. If there is a match, the size of the matched string is returned in MatchLen.

The VariableTable StringMap provides the current values of filecheck variables and is updated if this match defines new values.

Definition at line 275 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::StringMap< ValueTy, AllocatorTy >::end(), llvm::Regex::escape(), llvm::StringRef::find(), llvm::StringMap< ValueTy, AllocatorTy >::find(), llvm::PatternMatch::match(), llvm::Regex::Newline, llvm::StringRef::npos, llvm::SmallVectorBase::size(), llvm::StringRef::size(), llvm::StringRef::split(), and llvm::StringRef::substr().

◆ ParsePattern()

bool FileCheckPattern::ParsePattern ( StringRef  PatternStr,
StringRef  Prefix,
SourceMgr SM,
unsigned  LineNumber,
const FileCheckRequest Req 
)

Parses the given string into the Pattern.

Prefix provides which prefix is being matched, SM provides the SourceMgr used for error reports, and LineNumber is the line number in the input file from which the pattern string was read. Returns true in case of an error, false otherwise.

Definition at line 34 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::MatchFullLines, llvm::FileCheckRequest::NoCanonicalizeWhiteSpace, llvm::StringRef::npos, llvm::SourceMgr::PrintMessage(), llvm::StringRef::size(), llvm::StringRef::startswith(), and llvm::StringRef::substr().

◆ PrintFuzzyMatch()

void FileCheckPattern::PrintFuzzyMatch ( const SourceMgr SM,
StringRef  Buffer,
const StringMap< StringRef > &  VariableTable,
std::vector< FileCheckDiag > *  Diags 
) const

◆ PrintVariableUses()

void FileCheckPattern::PrintVariableUses ( const SourceMgr SM,
StringRef  Buffer,
const StringMap< StringRef > &  VariableTable,
SMRange  MatchRange = None 
) const

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