LLVM  10.0.0svn
Functions | Variables
FileCheck.cpp File Reference
#include "llvm/Support/FileCheck.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/FormatVariadic.h"
#include <cstdint>
#include <list>
#include <tuple>
#include <utility>
Include dependency graph for FileCheck.cpp:

Go to the source code of this file.

Functions

static char popFront (StringRef &S)
 
static uint64_t add (uint64_t LeftOp, uint64_t RightOp)
 
static uint64_t sub (uint64_t LeftOp, uint64_t RightOp)
 
static SMRange ProcessMatchResult (FileCheckDiag::MatchType MatchTy, const SourceMgr &SM, SMLoc Loc, Check::FileCheckType CheckTy, StringRef Buffer, size_t Pos, size_t Len, std::vector< FileCheckDiag > *Diags, bool AdjustPrevDiag=false)
 
static bool IsPartOfWord (char c)
 
static std::pair< Check::FileCheckType, StringRefFindCheckType (StringRef Buffer, StringRef Prefix)
 
static size_t SkipWord (StringRef Str, size_t Loc)
 
static std::pair< StringRef, StringRefFindFirstMatchingPrefix (Regex &PrefixRE, StringRef &Buffer, unsigned &LineNumber, Check::FileCheckType &CheckTy)
 Searches the buffer for the first prefix in the prefix regular expression. More...
 
static void PrintMatch (bool ExpectedMatch, const SourceMgr &SM, StringRef Prefix, SMLoc Loc, const FileCheckPattern &Pat, int MatchedCount, StringRef Buffer, size_t MatchPos, size_t MatchLen, const FileCheckRequest &Req, std::vector< FileCheckDiag > *Diags)
 
static void PrintMatch (bool ExpectedMatch, const SourceMgr &SM, const FileCheckString &CheckStr, int MatchedCount, StringRef Buffer, size_t MatchPos, size_t MatchLen, FileCheckRequest &Req, std::vector< FileCheckDiag > *Diags)
 
static void PrintNoMatch (bool ExpectedMatch, const SourceMgr &SM, StringRef Prefix, SMLoc Loc, const FileCheckPattern &Pat, int MatchedCount, StringRef Buffer, bool VerboseVerbose, std::vector< FileCheckDiag > *Diags, Error MatchErrors)
 
static void PrintNoMatch (bool ExpectedMatch, const SourceMgr &SM, const FileCheckString &CheckStr, int MatchedCount, StringRef Buffer, bool VerboseVerbose, std::vector< FileCheckDiag > *Diags, Error MatchErrors)
 
static unsigned CountNumNewlinesBetween (StringRef Range, const char *&FirstNewLine)
 Counts the number of newlines in the specified range. More...
 
static bool ValidateCheckPrefix (StringRef CheckPrefix)
 

Variables

StringRef SpaceChars = " \t"
 

Function Documentation

◆ add()

static uint64_t add ( uint64_t  LeftOp,
uint64_t  RightOp 
)
static

Definition at line 243 of file FileCheck.cpp.

Referenced by llvm::APInt::abs(), llvm::AliasSetTracker::add(), llvm::AliasSetTracker::addAllInstructionsInLoopUsingMSSA(), llvm::BlockFrequencyInfoImplBase::Distribution::addBackedge(), addExclusiveRegPair(), llvm::BlockFrequencyInfoImplBase::Distribution::addExit(), llvm::BlockFrequencyInfoImplBase::Distribution::addLocal(), llvm::ARMFrameLowering::adjustForSegmentedStacks(), areCandidatesToMergeOrPair(), llvm::HexagonFrameLowering::assignCalleeSavedSpillSlots(), buildMUBUFOffsetLoadStore(), combineKnownAdjacentMMOs(), llvm::FunctionComparator::compare(), ContainsReg(), llvm::SIInstrInfo::convertNonUniformIfRegion(), llvm::X86InstrInfo::convertToThreeAddress(), llvm::SIInstrInfo::convertToThreeAddress(), llvm::Thumb1InstrInfo::copyPhysReg(), createPHIsForSelects(), llvm::orc::CtorDtorRunner::CtorDtorRunner(), DecodeAddrModeImm12Operand(), DecodePostIdxReg(), DecodeT2LoadImm8(), llvm::ModuleSummaryIndex::dumpSCCs(), emitIndirectDst(), llvm::R600TargetLowering::EmitInstrWithCustomInserter(), llvm::ARMTargetLowering::EmitInstrWithCustomInserter(), llvm::SITargetLowering::EmitInstrWithCustomInserter(), emitPostLd(), emitPostSt(), llvm::ARMFrameLowering::emitPrologue(), emitThumbRegPlusImmInReg(), emitXBegin(), llvm::InstructionSelector::executeMatchTable(), llvm::HexagonInstrInfo::expandPostRAPseudo(), llvm::SIInstrInfo::expandPostRAPseudo(), llvm::HexagonInstrInfo::expandVGatherPseudo(), llvm::LegalizeRuleSet::fallback(), findPotentialBlockers(), findTemporariesForLR(), foldVGPRCopyIntoRegSequence(), for(), forceReg(), llvm::AArch64InstrInfo::genAlternativeCodeSequence(), getAdjustedCmp(), getCmpForPseudo(), getCompareSourceReg(), llvm::coverage::CounterExpressionBuilder::getExpressions(), getGeneralPermuteNode(), getINCDECFromLEA(), getLogicalBitOpcode(), getLSMultipleTransferSize(), getPostIndexedLoadStoreOpcode(), llvm::SCEVUnionPredicate::getPredicates(), llvm::detail::DoubleAPFloat::getSecond(), getUnconditionalBrDisp(), getV_CMPOpcode(), hasUsesOutsideLoop(), hoistAndMergeSGPRInits(), INITIALIZE_PASS(), InsertLDR_STR(), isAlwaysFoldable(), llvm::ARMBaseInstrInfo::isLoadFromStackSlotPostFE(), isMergeableLdStUpdate(), llvm::detail::IEEEFloat::needsCleanup(), llvm::PMDataManager::PMDataManager(), llvm::PPCInstrInfo::PredicateInstruction(), llvm::bfi_detail::BlockMass::print(), llvm::ARMTargetLowering::ReplaceNodeResults(), llvm::Thumb1FrameLowering::restoreCalleeSavedRegisters(), setM0ToIndexFromSGPR(), llvm::Thumb1FrameLowering::spillCalleeSavedRegisters(), sub(), tieOpsIfNeeded(), llvm::HexagonBlockRanges::RangeList::unionize(), VerifyLowRegs(), llvm::AliasSetTracker::~AliasSetTracker(), and llvm::LiveRangeUpdater::~LiveRangeUpdater().

◆ CountNumNewlinesBetween()

static unsigned CountNumNewlinesBetween ( StringRef  Range,
const char *&  FirstNewLine 
)
static

◆ FindCheckType()

static std::pair<Check::FileCheckType, StringRef> FindCheckType ( StringRef  Buffer,
StringRef  Prefix 
)
static

◆ FindFirstMatchingPrefix()

static std::pair<StringRef, StringRef> FindFirstMatchingPrefix ( Regex PrefixRE,
StringRef Buffer,
unsigned LineNumber,
Check::FileCheckType CheckTy 
)
static

Searches the buffer for the first prefix in the prefix regular expression.

This searches the buffer using the provided regular expression, however it enforces constraints beyond that: 1) The found prefix must not be a suffix of something that looks like a valid prefix. 2) The found prefix must be followed by a valid check type suffix using FindCheckType above.

Returns
a pair of StringRefs into the Buffer, which combines:
  • the first match of the regular expression to satisfy these two is returned, otherwise an empty StringRef is returned to indicate failure.
  • buffer rewound to the location right after parsed suffix, for parsing to continue from

If this routine returns a valid prefix, it will also shrink Buffer to start at the beginning of the returned prefix, increment LineNumber for each new line consumed from Buffer, and set CheckTy to the type of check found by examining the suffix.

If no valid prefix is found, the state of Buffer, LineNumber, and CheckTy is unspecified.

Definition at line 1096 of file FileCheck.cpp.

References assert(), llvm::StringRef::back(), llvm::Check::CheckNone, llvm::SmallVectorImpl< T >::clear(), llvm::StringRef::count(), llvm::StringRef::data(), llvm::StringRef::drop_front(), llvm::StringRef::empty(), FindCheckType(), IsPartOfWord(), llvm::Regex::match(), llvm::cl::Prefix, llvm::StringRef::size(), SkipWord(), and llvm::StringRef::substr().

Referenced by llvm::FileCheck::ReadCheckFile().

◆ IsPartOfWord()

static bool IsPartOfWord ( char  c)
static

Definition at line 968 of file FileCheck.cpp.

Referenced by FindFirstMatchingPrefix(), and SkipWord().

◆ popFront()

static char popFront ( StringRef S)
static

◆ PrintMatch() [1/2]

static void PrintMatch ( bool  ExpectedMatch,
const SourceMgr SM,
StringRef  Prefix,
SMLoc  Loc,
const FileCheckPattern Pat,
int  MatchedCount,
StringRef  Buffer,
size_t  MatchPos,
size_t  MatchLen,
const FileCheckRequest Req,
std::vector< FileCheckDiag > *  Diags 
)
static

◆ PrintMatch() [2/2]

static void PrintMatch ( bool  ExpectedMatch,
const SourceMgr SM,
const FileCheckString CheckStr,
int  MatchedCount,
StringRef  Buffer,
size_t  MatchPos,
size_t  MatchLen,
FileCheckRequest Req,
std::vector< FileCheckDiag > *  Diags 
)
static

◆ PrintNoMatch() [1/2]

static void PrintNoMatch ( bool  ExpectedMatch,
const SourceMgr SM,
StringRef  Prefix,
SMLoc  Loc,
const FileCheckPattern Pat,
int  MatchedCount,
StringRef  Buffer,
bool  VerboseVerbose,
std::vector< FileCheckDiag > *  Diags,
Error  MatchErrors 
)
static

◆ PrintNoMatch() [2/2]

static void PrintNoMatch ( bool  ExpectedMatch,
const SourceMgr SM,
const FileCheckString CheckStr,
int  MatchedCount,
StringRef  Buffer,
bool  VerboseVerbose,
std::vector< FileCheckDiag > *  Diags,
Error  MatchErrors 
)
static

◆ ProcessMatchResult()

static SMRange ProcessMatchResult ( FileCheckDiag::MatchType  MatchTy,
const SourceMgr SM,
SMLoc  Loc,
Check::FileCheckType  CheckTy,
StringRef  Buffer,
size_t  Pos,
size_t  Len,
std::vector< FileCheckDiag > *  Diags,
bool  AdjustPrevDiag = false 
)
static

◆ SkipWord()

static size_t SkipWord ( StringRef  Str,
size_t  Loc 
)
static

Definition at line 1066 of file FileCheck.cpp.

References IsPartOfWord(), and llvm::StringRef::size().

Referenced by FindFirstMatchingPrefix().

◆ sub()

static uint64_t sub ( uint64_t  LeftOp,
uint64_t  RightOp 
)
static

◆ ValidateCheckPrefix()

static bool ValidateCheckPrefix ( StringRef  CheckPrefix)
static

Definition at line 1744 of file FileCheck.cpp.

References llvm::Regex::match().

Referenced by llvm::FileCheck::ValidateCheckPrefixes().

Variable Documentation

◆ SpaceChars

StringRef SpaceChars = " \t"

Definition at line 128 of file FileCheck.cpp.