add and document regex support for FileCheck. You can now do stuff like:

; CHECK: movl {{%e[a-z][xi]}}, %eax

or whatever.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82717 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2009-09-24 21:47:32 +00:00
parent fe03dbeaa3
commit 528700863a
5 changed files with 162 additions and 16 deletions

View File

@@ -14,13 +14,14 @@
#include "llvm/Support/Regex.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/SmallVector.h"
#include "regex_impl.h"
#include <string>
using namespace llvm;
Regex::Regex(const StringRef &regex, unsigned Flags) {
unsigned flags = 0;
preg = new struct llvm_regex;
preg = new llvm_regex();
preg->re_endp = regex.end();
if (Flags & IgnoreCase)
flags |= REG_ICASE;
@@ -60,7 +61,7 @@ bool Regex::match(const StringRef &String, SmallVectorImpl<StringRef> *Matches){
}
// pmatch needs to have at least one element.
SmallVector<llvm_regmatch_t, 2> pm;
SmallVector<llvm_regmatch_t, 8> pm;
pm.resize(nmatch > 0 ? nmatch : 1);
pm[0].rm_so = 0;
pm[0].rm_eo = String.size();