Commit Graph

126 Commits

Author SHA1 Message Date
Chris Lattner 8879e06d0a implement and document support for filecheck variables. This
allows matching and remembering a string and then matching and
verifying that the string occurs later in the file.

Change X86/xor.ll to use this in some cases where the test was
checking for an arbitrary register allocation decision.

llvm-svn: 82891
2009-09-27 07:56:52 +00:00
Chris Lattner 37d8015dc1 remove support for "NoSub" from regex. It seems like a minor optimization
and makes the API more annoying.  Add a Regex::getNumMatches() method.

llvm-svn: 82877
2009-09-26 21:27:04 +00:00
Chris Lattner 0a4c44bdf4 reject attempts to use ()'s in patterns, these are reserved for filecheck.
llvm-svn: 82780
2009-09-25 17:29:36 +00:00
Chris Lattner b16ab0c40a reimplement the regex matching strategy by building a single
regex and matching it instead of trying to match chunks at a time.
Matching chunks at a time broke with check lines like 
  CHECK: foo {{.*}}bar
because the .* would eat the entire rest of the line and bar would
never match.

Now we just escape the fixed strings for the user, so that something
like:
  CHECK: a() {{.*}}???
is matched as:
  CHECK: {{a\(\) .*\?\?\?}}
transparently "under the covers".

llvm-svn: 82779
2009-09-25 17:23:43 +00:00
Chris Lattner 221460e0be special case Patterns that are a single fixed string. This is a microscopic
perf win and is needed for future changes.

llvm-svn: 82777
2009-09-25 17:09:12 +00:00
Chris Lattner 712e8e03a5 filecheck should not match a \n with a .
llvm-svn: 82758
2009-09-25 06:47:09 +00:00
Chris Lattner b121a24f25 turn a std::pair into a real class.
llvm-svn: 82754
2009-09-25 06:32:47 +00:00
Chris Lattner f08d2db928 add and document regex support for FileCheck. You can now do stuff like:
; CHECK: movl {{%e[a-z][xi]}}, %eax

or whatever.

llvm-svn: 82717
2009-09-24 21:47:32 +00:00
Chris Lattner a2f8fc5a72 Use CanonicalizeInputFile to canonicalize the entire buffer containing the
CHECK strings, instead of canonicalizing the patterns directly.  This allows
Pattern to just contain a StringRef instead of std::string.

llvm-svn: 82713
2009-09-24 20:45:07 +00:00
Chris Lattner 74d50731c1 change 'not' matching to use Pattern, move pattern parsing logic into
the Pattern class.

llvm-svn: 82712
2009-09-24 20:39:13 +00:00
Chris Lattner 3b40b44528 refactor out the match string into its own Pattern class.
llvm-svn: 82711
2009-09-24 20:25:55 +00:00
Chris Lattner b9f2bf46f7 fix a FileCheck bug where:
; CHECK: foo
; CHECK-NOT: foo
; CHECK: bar

would always fail.

llvm-svn: 82424
2009-09-21 02:30:42 +00:00
Chris Lattner 3718358476 rewrite CountNumNewlinesBetween to be in terms of StringRef.
llvm-svn: 82410
2009-09-20 22:42:44 +00:00
Chris Lattner 236d2d5e7b implement and document support for CHECK-NOT
llvm-svn: 82408
2009-09-20 22:35:26 +00:00
Chris Lattner caa5fc0c9d rewrite FileCheck in terms of StringRef instead of manual pointer pairs.
llvm-svn: 82407
2009-09-20 22:11:44 +00:00
Chris Lattner 107c21eafc when emitting errors about CHECK-NEXT directives, show the line that the
CHECK-NEXT is on.

llvm-svn: 79164
2009-08-16 02:22:31 +00:00
Chris Lattner da108b4ed4 implement support for CHECK-NEXT: in filecheck.
llvm-svn: 79123
2009-08-15 18:32:21 +00:00
Chris Lattner 10f10ced3f simplify some code.
llvm-svn: 79121
2009-08-15 18:00:42 +00:00
Chris Lattner 6a7b917e32 rewrite FindStringInBuffer to use an explicit loop instead of
trying to wrap strstr which is just too inconvenient.  Make it
use a StringRef to avoid ".c_str()" calls.

llvm-svn: 79120
2009-08-15 17:53:12 +00:00
Chris Lattner 26cccfe1bc Instead of using an std::pair, use a custom struct.
llvm-svn: 79119
2009-08-15 17:41:04 +00:00
Daniel Dunbar 6eca7ab91c Fix an ENABLE_EXPENSIVE_CHECKS error.
llvm-svn: 77845
2009-08-02 01:21:22 +00:00
Daniel Dunbar 8bda49a827 Tweak comment.
llvm-svn: 75391
2009-07-11 22:06:10 +00:00
Chris Lattner 0029c0e57a improve filecheck's "scanning from here" caret position.
llvm-svn: 75371
2009-07-11 19:21:09 +00:00
Chris Lattner 2c3e5cdf3d make filecheck default to canonicalizing horizontal whitespace
away.  This way you can write a space and it matches arbitrary spaces and tabs.

llvm-svn: 75370
2009-07-11 18:58:15 +00:00
Chris Lattner aedd818577 stop on the first file mismatch.
llvm-svn: 75076
2009-07-09 00:19:21 +00:00
Chris Lattner ee3c74fba0 Add a new little "FileCheck" utility for regression testing.
llvm-svn: 75022
2009-07-08 18:44:05 +00:00