1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-01 16:33:37 +01:00
Commit Graph

40 Commits

Author SHA1 Message Date
NAKAMURA Takumi
44e935f199 FileCheck: Eliminate DOSish \r from input file.
It can pass two tests below on Win32.
  - Clang :: CodeGenCXX/dyncast.cpp
  - LLVM :: CodeGen/ARM/globals.ll

llvm-svn: 119023
2010-11-14 03:28:22 +00:00
Jakob Stoklund Olesen
005aa1c020 Teach FileCheck to handle trailing CHECK-NOT patterns.
A CHECK-NOT pattern without a following CHECK pattern simply checks that the
pattern doesn't match before the end of the input file.

You can even have only CHECK-NOT patterns to check that strings appear nowhere
in the input file.

llvm-svn: 116592
2010-10-15 17:47:12 +00:00
Mikhail Glushenkov
034e27c664 Trailing whitespace.
llvm-svn: 111656
2010-08-20 17:38:38 +00:00
Chris Lattner
269737461d stringref-ize the MemoryBuffer::get apis. This requires
a co-committed clang patch.

llvm-svn: 100485
2010-04-05 22:42:30 +00:00
Daniel Dunbar
41e0c40cf4 FileCheck: Don't print "possibly intended match" line if it would match the
"scanning from here" one.

llvm-svn: 98971
2010-03-19 18:07:43 +00:00
Daniel Dunbar
08265d2e9b FileCheck: When looking for "possible matches", only compare against the prefix
line. Turns out edit_distance can be slow if the string we are scanning for
happens to be quite large.

llvm-svn: 94860
2010-01-30 00:24:06 +00:00
Dan Gohman
4ce1281b20 Minor code cleanup.
llvm-svn: 94848
2010-01-29 21:57:46 +00:00
Dan Gohman
b550d3a78e Skip whitespace when looking for a potential intended match.
Before:

<stdin>:94:1: note: possible intended match here
 movsd 4096(%rsi), %xmm0
^

After:
<stdin>:94:2: note: possible intended match here
 movsd 4096(%rsi), %xmm0
 ^

llvm-svn: 94847
2010-01-29 21:55:16 +00:00
Dan Gohman
ef102f1ed3 Fix the position of the caret in the FileCheck error message.
Before:

test/CodeGen/X86/lsr-reuse.ll:52:34: error: expected string not found in input
; CHECK: movsd -2048(%rsi), %xmm0
                                 ^

After:

test/CodeGen/X86/lsr-reuse.ll:52:10: error: expected string not found in input
; CHECK: movsd -2048(%rsi), %xmm0
         ^

llvm-svn: 94846
2010-01-29 21:53:18 +00:00
Daniel Dunbar
f65b05e7e1 FileCheck: Switch "possible match" calculation to use StringRef::edit_distance.
- Thanks Doug, who is obviously less lazy than me!

llvm-svn: 94795
2010-01-29 03:22:19 +00:00
Daniel Dunbar
f7eaf3980c Fix FileCheck crash when fuzzy scanning starting at the end of the file.
llvm-svn: 90065
2009-11-29 08:30:24 +00:00
Daniel Dunbar
da651bf31a FileCheck, PR5239: Try to find the intended match on failures, but looking for a
good nearby fuzzy match. Frequently the input is nearly correct, and just
showing the user the a nearby sensible match is enough to diagnose the problem.
 - The "fuzzyness" is pretty simple and arbitrary, but worked on my three test
   cases. If you encounter problems, or places you think FileCheck should have
   guessed but didn't, please add test cases to PR5239.

For example, previously FileCheck would report this:
--
t.cpp:21:55: error: expected string not found in input
// CHECK: define void @_Z2f25f2_s1([[i64_i64_ty]] %a0)
                                                      ^
<stdin>:19:30: note: scanning from here
define void @_Z2f15f1_s1(%1) nounwind {
                             ^
<stdin>:19:30: note: with variable "i64_i64_ty" equal to "%0"
--

and now it also reports this:
--
<stdin>:27:1: note: possible intended match here
define void @_Z2f25f2_s1(%0) nounwind {
^
--

which makes it clear that the CHECK just has an extra ' %a0' in it, without
having to check the input.

llvm-svn: 89631
2009-11-22 22:59:26 +00:00
Daniel Dunbar
acbdd9f541 FileCheck: When a string using variable references fails to match, print
additional information about the current definitions of the variables used in
the string.

llvm-svn: 89628
2009-11-22 22:08:06 +00:00
Daniel Dunbar
1b60708ac9 Allow '_' in FileCheck variable names, it is nice to have at least one
separate character.
 - Chris, OK?

llvm-svn: 89626
2009-11-22 22:07:50 +00:00
Chris Lattner
80d69b5973 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
b47463f436 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
7143d73e96 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
2b1f7c6a75 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
fed266aae9 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
2bf0d0ca42 filecheck should not match a \n with a .
llvm-svn: 82758
2009-09-25 06:47:09 +00:00
Chris Lattner
a6bcda7a8a turn a std::pair into a real class.
llvm-svn: 82754
2009-09-25 06:32:47 +00:00
Chris Lattner
af2ce37cb3 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
97cf81c3c6 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
5f3b698a06 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
756adfb5ca refactor out the match string into its own Pattern class.
llvm-svn: 82711
2009-09-24 20:25:55 +00:00
Chris Lattner
82a963788d 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
d5f420ca4d rewrite CountNumNewlinesBetween to be in terms of StringRef.
llvm-svn: 82410
2009-09-20 22:42:44 +00:00
Chris Lattner
63735b5e10 implement and document support for CHECK-NOT
llvm-svn: 82408
2009-09-20 22:35:26 +00:00
Chris Lattner
4552cc1387 rewrite FileCheck in terms of StringRef instead of manual pointer pairs.
llvm-svn: 82407
2009-09-20 22:11:44 +00:00
Chris Lattner
b2791c888d 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
d910c3a30e implement support for CHECK-NEXT: in filecheck.
llvm-svn: 79123
2009-08-15 18:32:21 +00:00
Chris Lattner
a2ab7de470 simplify some code.
llvm-svn: 79121
2009-08-15 18:00:42 +00:00
Chris Lattner
2942a8852f 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
b1de5e438a Instead of using an std::pair, use a custom struct.
llvm-svn: 79119
2009-08-15 17:41:04 +00:00
Daniel Dunbar
29c0894945 Fix an ENABLE_EXPENSIVE_CHECKS error.
llvm-svn: 77845
2009-08-02 01:21:22 +00:00
Daniel Dunbar
e905c7445d Tweak comment.
llvm-svn: 75391
2009-07-11 22:06:10 +00:00
Chris Lattner
abe5a919b8 improve filecheck's "scanning from here" caret position.
llvm-svn: 75371
2009-07-11 19:21:09 +00:00
Chris Lattner
3ddde921ee 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
9a419de980 stop on the first file mismatch.
llvm-svn: 75076
2009-07-09 00:19:21 +00:00
Chris Lattner
425ad95921 Add a new little "FileCheck" utility for regression testing.
llvm-svn: 75022
2009-07-08 18:44:05 +00:00