LLVM 22.0.0git
Classes | Public Member Functions | Static Public Member Functions | List of all members
llvm::GlobPattern Class Reference

This class implements a glob pattern matcher similar to the one found in bash, but with some key differences. More...

#include "llvm/Support/GlobPattern.h"

Public Member Functions

LLVM_ABI bool match (StringRef S) const
 
bool isTrivialMatchAll () const
 

Static Public Member Functions

static LLVM_ABI Expected< GlobPatterncreate (StringRef Pat, std::optional< size_t > MaxSubPatterns={})
 

Detailed Description

This class implements a glob pattern matcher similar to the one found in bash, but with some key differences.

Namely, that * matches all characters and does not exclude path separators.

Some known edge cases are:

Examples:

Definition at line 52 of file GlobPattern.h.

Member Function Documentation

◆ create()

Expected< GlobPattern > GlobPattern::create ( StringRef  Pat,
std::optional< size_t >  MaxSubPatterns = {} 
)
static
Parameters
Patthe pattern to match against
MaxSubPatternsif provided limit the number of allowed subpatterns created from expanding braces otherwise disable brace expansion

Definition at line 136 of file GlobPattern.cpp.

References llvm::StringRef::find_first_of(), parseBraceExpansions(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::StringRef::substr().

Referenced by llvm::objcopy::NameOrPattern::create(), llvm::ifs::filterIFSSyms(), and llvm::SpecialCaseList::Matcher::insert().

◆ isTrivialMatchAll()

bool llvm::GlobPattern::isTrivialMatchAll ( ) const
inline

◆ match()

bool GlobPattern::match ( StringRef  S) const
Returns
true if S matches this glob pattern

Definition at line 193 of file GlobPattern.cpp.

References llvm::StringRef::consume_front(), llvm::SmallVectorBase< Size_T >::empty(), and llvm::StringRef::empty().

Referenced by llvm::SpecialCaseList::Matcher::match().


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