LLVM 22.0.0git
|
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 |
StringRef | prefix () const |
StringRef | suffix () const |
StringRef | longest_substr () const |
Static Public Member Functions | |
static LLVM_ABI Expected< GlobPattern > | create (StringRef Pat, std::optional< size_t > MaxSubPatterns={}) |
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.
MaxSubPatterns
is empty then brace expansions are not supported and characters {,} are treated as literals.Some known edge cases are:
Examples:
Definition at line 52 of file GlobPattern.h.
|
static |
Pat | the pattern to match against |
MaxSubPatterns | if provided limit the number of allowed subpatterns created from expanding braces otherwise disable brace expansion |
Definition at line 179 of file GlobPattern.cpp.
References assert(), llvm::StringRef::find_first_of(), llvm::StringRef::find_last_of(), parseBraceExpansions(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::StringRef::size(), llvm::StringRef::substr(), and SuffixStart.
Referenced by llvm::objcopy::NameOrPattern::create(), and llvm::ifs::filterIFSSyms().
|
inline |
Definition at line 65 of file GlobPattern.h.
StringRef GlobPattern::longest_substr | ( | ) | const |
Definition at line 248 of file GlobPattern.cpp.
References maxPlainSubstring().
true
if S
matches this glob pattern Definition at line 253 of file GlobPattern.cpp.
References llvm::StringRef::consume_back(), llvm::StringRef::consume_front(), llvm::StringRef::empty(), prefix(), and suffix().
|
inline |
Definition at line 79 of file GlobPattern.h.
References llvm::StringRef::take_front().
Referenced by match().
|
inline |
Definition at line 81 of file GlobPattern.h.
References llvm::StringRef::take_back().
Referenced by match().