aboutsummaryrefslogtreecommitdiff
path: root/utils/FileCheck
AgeCommit message (Collapse)Author
2013-04-25Remove SMLoc paired with CHECK-NOT patterns. Not functionality change.Michael Liao
Pattern has source location by itself. After adding a trivial method to retrieve it, it's unnecessary to pair a source location for CHECK-NOT patterns. One thing revised after this is the diagnostic info is more accurate by pointing to the start of the CHECK-NOT pattern instead of the end of the CHECK-NOT pattern. E.g. diagnostic message previously looks like <stdin>:1:1: error: CHECK-NOT: string occurred! test ^ test.txt:1:16: note: CHECK-NOT: pattern specified here CHECK-NOT: test ^ is changed to <stdin>:1:1: error: CHECK-NOT: string occurred! test ^ test.txt:1:12: note: CHECK-NOT: pattern specified here CHECK-NOT: test ^ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180578 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-25Remove tailing whitespacesMichael Liao
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180564 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-23Plug a memory leak in FileCheck when the input file is empty.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177822 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12Add static cast to unsigned char whenever a character classification ↵Guy Benyei
function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175006 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06Canonicalize line endings to Linux style also when the --strict-whitespace ↵Guy Benyei
flag is in use. This flag is supposed to affect horizontal whitespaces only. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174541 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04Sort the #include lines for utils/...Chandler Carruth
I've tried to find main moudle headers where possible, but the TableGen stuff may warrant someone else looking at it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169251 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-02Fix a bug in FileCheck that wouldn't let define variables as follows:Eli Bendersky
; CHECK: [[VAR:[a-z]]] The problem was that to find the end of the regex var definition, it was simplistically looking for the next ]] and finding the incorrect one. A better approach is to count nesting of brackets (taking escaping into account). This way the brackets that are part of the regex can be discovered and skipped properly, and the ]] ending is detected in the right place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169109 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01Support referencing variables defined on the same line.Eli Bendersky
See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121126/157198.html and related discussions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169101 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30Clean up whitespace and add commentsEli Bendersky
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169002 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30Make FileCheck return 2 in case of an error as documented,Eli Bendersky
instead of 1 or true (?!) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169001 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15FileCheck: remove useless 'continue' at the end of a 'while(){}' loop.Dmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168048 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14Support for [[@LINE]], [[@LINE+<offset>]], [[@LINE-<offset>]] expressions inAlexander Kornienko
FileCheck. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167978 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-21Clarify comment.Dmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164371 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-18FileCheck: Fix off-by-one bug that made CHECK-NOT: ignore the next character ↵Benjamin Kramer
after the colon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164165 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-08Revert "Add -exact-match option to FileCheck to allow clients to do exact ↵Ted Kremenek
matches without using regular expressions." Turns out I did not need it after all. If we find a use for it in the future, we can resurrect it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163457 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-07Add -exact-match option to FileCheck to allow clients to do exact matches ↵Ted Kremenek
without using regular expressions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163371 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-16Make SMDiagnostic a little more sane. Instead of passing around ↵Chris Lattner
note/warning/error as a string, pass it around as an enum. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142107 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-16Enhance llvm::SourceMgr to support diagnostic ranges, the same way clang ↵Chris Lattner
does. Enhance the X86 asmparser to produce ranges in the one case that was annoying me, for example: test.s:10:15: error: invalid operand for instruction movl 0(%rax), 0(%edx) ^~~~~~~ It should be straight-forward to enhance filecheck, tblgen, and/or the .ll parser to use ranges where appropriate if someone is interested. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142106 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09fix PR9629 - We were lowering regexes like a{{b|c}}d into ab|cd, whichChris Lattner
is substantially different than a(b|c)d. Form the latter regex instead. This found a few problems in the testsuite, which serves as its test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129196 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09various cleanups, no functionality change.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129192 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-20Put targets on folders, if the IDE supports the feature.Oscar Fuentes
Requires CMake 2.8.3 or newer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126092 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09emit a specific error when the input file is empty. This fixes Chris Lattner
an annoyance of mine when working on tests: if the input .ll file is broken, opt outputs an error and generates an empty file. FileCheck then emits its "ooh I couldn't find the first CHECK line, scanning from ..." which obfuscates the actual problem. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125193 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> ↵Michael J. Spencer
via an out parm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121958 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with ↵Michael J. Spencer
error_code &ec. And fix clients. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121379 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29Merge System into Support.Michael J. Spencer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-14FileCheck: Eliminate DOSish \r from input file.NAKAMURA Takumi
It can pass two tests below on Win32. - Clang :: CodeGenCXX/dyncast.cpp - LLVM :: CodeGen/ARM/globals.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119023 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-15Teach FileCheck to handle trailing CHECK-NOT patterns.Jakob Stoklund Olesen
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116592 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20Trailing whitespace.Mikhail Glushenkov
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111656 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-05stringref-ize the MemoryBuffer::get apis. This requiresChris Lattner
a co-committed clang patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100485 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19FileCheck: Don't print "possibly intended match" line if it would match theDaniel Dunbar
"scanning from here" one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98971 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30FileCheck: When looking for "possible matches", only compare against the prefixDaniel Dunbar
line. Turns out edit_distance can be slow if the string we are scanning for happens to be quite large. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29Minor code cleanup.Dan Gohman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94848 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29Skip whitespace when looking for a potential intended match.Dan Gohman
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 ^ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94847 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29Fix the position of the caret in the FileCheck error message.Dan Gohman
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 ^ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94846 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29FileCheck: Switch "possible match" calculation to use StringRef::edit_distance.Daniel Dunbar
- Thanks Doug, who is obviously less lazy than me! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94795 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29Fix FileCheck crash when fuzzy scanning starting at the end of the file.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90065 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22FileCheck, PR5239: Try to find the intended match on failures, but looking for aDaniel Dunbar
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89631 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22FileCheck: When a string using variable references fails to match, printDaniel Dunbar
additional information about the current definitions of the variables used in the string. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89628 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22Allow '_' in FileCheck variable names, it is nice to have at least oneDaniel Dunbar
separate character. - Chris, OK? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89626 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27implement and document support for filecheck variables. ThisChris Lattner
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82891 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26remove support for "NoSub" from regex. It seems like a minor optimizationChris Lattner
and makes the API more annoying. Add a Regex::getNumMatches() method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82877 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25reject attempts to use ()'s in patterns, these are reserved for filecheck.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82780 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25reimplement the regex matching strategy by building a singleChris Lattner
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". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82779 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25special case Patterns that are a single fixed string. This is a microscopicChris Lattner
perf win and is needed for future changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82777 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25filecheck should not match a \n with a .Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82758 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25turn a std::pair into a real class.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82754 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24add and document regex support for FileCheck. You can now do stuff like:Chris Lattner
; 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
2009-09-24Use CanonicalizeInputFile to canonicalize the entire buffer containing theChris Lattner
CHECK strings, instead of canonicalizing the patterns directly. This allows Pattern to just contain a StringRef instead of std::string. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82713 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24change 'not' matching to use Pattern, move pattern parsing logic intoChris Lattner
the Pattern class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82712 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24refactor out the match string into its own Pattern class.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82711 91177308-0d34-0410-b5e6-96231b3b80d8