aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/FileCheck/FileCheck.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-08-26FileCheck: Minor cleanup of the class PatternSaleem Abdulrasool1-8/+6
1. Add the "explicit" specifier to the single-argument constructor of Pattern 2. Reorder the fields to remove excessive padding (8 bytes). Patch by Alexander Shaposhnikov! llvm-svn: 279832
2016-06-14[FileCheck] Add --check-prefixes as a shorthand for multiple --check-prefix ↵Daniel Sanders1-0/+5
options. Summary: This new alias takes a comma separated list of prefixes which allows '--check-prefix=A --check-prefix=B --check-prefix=C' to be written as '--check-prefixes=A,B,C'. Reviewers: probinson Subscribers: probinson, llvm-commits, dsanders Differential Revision: http://reviews.llvm.org/D21293 llvm-svn: 272670
2016-06-09Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith1-1/+1
looking for it along $PATH. This allows installs of LLVM tools outside of $PATH to find the symbolizer and produce pretty backtraces if they crash. llvm-svn: 272232
2016-05-27FileCheck: dump command line context with empty inputXinliang David Li1-0/+8
Differential Revision: http://reviews.llvm.org/D20716 llvm-svn: 271047
2016-02-29Reapply r262092: [FileCheck] Abort if -NOT is combined with another suffix.Paul Robinson1-1/+18
Combinations of suffixes that look useful are actually ignored; complaining about them will avoid mistakes. Differential Revision: http://reviews.llvm.org/D17587 llvm-svn: 262263
2016-02-26Revert r262092, caught LLD testsPaul Robinson1-18/+1
llvm-svn: 262093
2016-02-26[FileCheck] Abort if -NOT is combined with another suffix.Paul Robinson1-1/+18
Combinations of suffixes that look useful actually are ignored; complaining about them will avoid mistakes. Differential Revision: http://reviews.llvm.org/D17587 llvm-svn: 262092
2016-02-11Add -match-full-lines argument to FileCheck.James Y Knight1-17/+32
This is useful for some tests where more-exact matching is useful, such as clang's Preprocessor tests. llvm-svn: 260540
2015-11-17StringRef-ify some Option APIsDavid Blaikie1-1/+1
Patch by Eugene Kosov! Differential Revision: http://reviews.llvm.org/D14711 llvm-svn: 253360
2015-09-20Cleanup places that passed SMLoc by const reference to pass it by value ↵Craig Topper1-1/+1
instead. NFC llvm-svn: 248135
2015-09-10[FileCheck] Use range-based for loops. NFC.Benjamin Kramer1-26/+14
llvm-svn: 247272
2015-05-29Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer1-8/+4
If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. llvm-svn: 238602
2015-04-29[NFC] Updating FileCheck to reduce the std::vector interface used via cl::list.Chris Bieneman1-6/+8
llvm-svn: 236164
2015-03-12Fix FileCheck: substr() expect the length of the string as 2nd argMehdi Amini1-2/+1
The code assumed that substr() was taking start,end while it takes start,length. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 231988
2015-02-26FileCheck: Add CHECK-SAMEDuncan P. N. Exon Smith1-2/+47
Add `CHECK-SAME`, which requires that the pattern matches on the *same* line as the previous `CHECK`/`CHECK-NEXT` -- in other words, no newline is allowed in the skipped region. This is similar to `CHECK-NEXT`, which requires exactly 1 newline in the skipped region. My motivation is to simplify checking the long lines of LLVM assembly for the new debug info hierarchy. This allows CHECK sequences like the following: CHECK: ![[REF]] = !SomeMDNode( CHECK-SAME: file: ![[FILE:[0-9]+]] CHECK-SAME: otherField: 93{{[,)]}} which is equivalent to: CHECK: ![[REF]] = !SomeMDNode({{.*}}file: ![[FILE:[0-9]+]]{{.*}}otherField: 93{{[,)]}} While this example just has two fields, many nodes in debug info have more than that. `CHECK-SAME` will keep the logic easy to follow. Morever, it enables interleaving `CHECK-NOT`s without allowing newlines. Consider the following: CHECK: ![[REF]] = !SomeMDNode( CHECK-SAME: file: ![[FILE:[0-9]+]] CHECK-NOT: unexpectedField: CHECK-SAME: otherField: 93{{[,)]}} CHECK-NOT: otherUnexpectedField: CHECK-SAME: ) which doesn't seem to have an equivalent `CHECK` line. llvm-svn: 230612
2014-11-19Make StringSet::insert return pair<iterator, bool> like other ↵David Blaikie1-1/+1
self-associative containers StringSet is still a bit dodgy in that it exposes the raw iterator of the StringMap parent, which exposes the weird detail that StringSet actually has a 'value'... but anyway, this is useful for a handful of clients that want to reference the newly inserted/persistent string data in the StringSet/Map/Entry/thing. llvm-svn: 222302
2014-08-27Return a std::unique_ptr when creating a new MemoryBuffer.Rafael Espindola1-4/+5
llvm-svn: 216583
2014-08-21Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using ↵David Blaikie1-18/+19
std::unique_ptr llvm-svn: 216223
2014-08-07FileCheck: Add a flag to allow checking empty inputJustin Bogner1-1/+6
Currently FileCheck errors out on empty input. This is usually the right thing to do, but makes testing things like "this command does not emit some error message" hard to test. This usually leads to people using "command 2>&1 | count 0" instead, and then the bots that use guard malloc fail a few hours later. By adding a flag to FileCheck that allows empty inputs, we can make tests that consist entirely of "CHECK-NOT" lines feasible. llvm-svn: 215127
2014-08-01Remove some calls to std::move.Rafael Espindola1-1/+1
Instead of moving out the data in a ErrorOr<std::unique_ptr<Foo>>, get a reference to it. Thanks to David Blaikie for the suggestion. llvm-svn: 214516
2014-08-01Simplify the code a bit with std::unique_ptr.Rafael Espindola1-9/+5
llvm-svn: 214514
2014-07-29Fix FileCheck crash when empty prefix is passed.Eli Bendersky1-0/+4
llvm-svn: 214210
2014-07-11Add FileCheck -implicit-check-not option to allow stricter tests without ↵Alexander Kornienko1-1/+28
adding too many CHECK-NOTs manually. Summary: Add FileCheck -implicit-check-not option which allows specifying a pattern that should only occur in the input when explicitly matched by a positive check. This feature allows checking tool diagnostics in a way clang -verify does it for compiler diagnostics. The option has been tested on a number of clang-tidy checks, I'll post a link to the clang-tidy patch to this thread. Once there's an agreement on the general direction, I can add tests and documentation. Reviewers: djasper, bkramer Reviewed By: bkramer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D4462 llvm-svn: 212810
2014-07-06Update the MemoryBuffer API to use ErrorOr.Rafael Espindola1-10/+13
llvm-svn: 212405
2014-06-26Revert "Introduce a string_ostream string builder facilty"Alp Toker1-1/+2
Temporarily back out commits r211749, r211752 and r211754. llvm-svn: 211814
2014-06-26Introduce a string_ostream string builder faciltyAlp Toker1-2/+1
string_ostream is a safe and efficient string builder that combines opaque stack storage with a built-in ostream interface. small_string_ostream<bytes> additionally permits an explicit stack storage size other than the default 128 bytes to be provided. Beyond that, storage is transferred to the heap. This convenient class can be used in most places an std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair would previously have been used, in order to guarantee consistent access without byte truncation. The patch also converts much of LLVM to use the new facility. These changes include several probable bug fixes for truncated output, a programming error that's no longer possible with the new interface. llvm-svn: 211749
2014-06-13Remove the last uses of 'using std::error_code'Rafael Espindola1-5/+2
This finishes the transition to std::error_code. llvm-svn: 210877
2014-06-12Don't use 'using std::error_code' in include/llvm.Rafael Espindola1-0/+1
This should make sure that most new uses use the std prefix. llvm-svn: 210835
2014-06-12Remove system_error.h.Rafael Espindola1-1/+1
This is a minimal change to remove the header. I will remove the occurrences of "using std::error_code" in a followup patch. llvm-svn: 210803
2014-06-08[C++11] Use 'nullptr'.Craig Topper1-1/+1
llvm-svn: 210442
2014-04-07When a CHECK-NEXT fails because there was no match on the next line, includeRichard Smith1-2/+9
the non-matching next line in the diagnostic to make the problem more obvious. llvm-svn: 205725
2014-03-06Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles1-3/+2
This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
2014-03-05[C++11] Replace OwningPtr::take() with OwningPtr::release().Ahmed Charles1-2/+2
llvm-svn: 202957
2014-01-03FileCheck: Print a nice error message for missing closing ']' in regex vars.Adrian Prantl1-4/+9
llvm-svn: 198449
2013-12-12Expose FileCheck's AddFixedStringToRegEx as Regex::escapeHans Wennborg1-31/+3
Both FileCheck and clang's -verify need to escape strings for regexes, so let's expose this as a utility in the Regex class. llvm-svn: 197096
2013-11-20FileCheck: fix a bug with multiple --check-prefix options. Similar to r194565Daniel Sanders1-2/+3
Summary: Directives are being ignored, when they occur between a partial-word false match and any match on another prefix. For example, with FOO and BAR prefixes: _FOO FOO: foo BAR: bar FileCheck incorrectly matches: fog bar This happens because FOO falsely matched as a partial word at '_FOO' and was ignored while BAR matched at 'BAR:'. The match of BAR is incorrectly returned as the 'first match' causing the FOO directive to be discarded. Fixed this the same way as r194565 (D2166) did for a similar test case. The partial-word false match should be counted as a match for the purposes of finding the first match of a prefix, but should be returned as a false match using CheckTy::CheckNone so that it isn't treated as a directive. Fixes PR17995 Reviewers: samsonov, arsenm Reviewed By: samsonov CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2228 llvm-svn: 195248
2013-11-13FileCheck: fix matching of one check-prefix is a prefix of anotherAlexey Samsonov1-10/+11
Summary: Fix a case when "FileCheck --check-prefix=CHECK --check-prefix=CHECKER" would silently ignore check-lines of the form: CHECKER: foo Reviewers: dsanders Reviewed By: dsanders CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2168 llvm-svn: 194577
2013-11-13FileCheck: fix a bug with multiple --check-prefix options.Alexey Samsonov1-3/+3
Summary: This fixes a subtle bug in new FileCheck feature added in r194343. When we search for the first satisfying check-prefix, we should actually return the first encounter of some check-prefix as a substring, even if it's not a part of valid check-line. Otherwise "FileCheck --check-prefix=FOO --check-prefix=BAR" with check file: FOO not a vaild check-line FOO: foo BAR: bar incorrectly accepted file: fog bar as it skipped the first two encounters of FOO, matching only BAR: line. Reviewers: arsenm, dsanders Reviewed By: dsanders CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2166 llvm-svn: 194565
2013-11-10Allow multiple check prefixes in FileCheck.Matt Arsenault1-80/+237
This is useful if you want to run multiple variations of a single test, and the majority of check lines should be the same. llvm-svn: 194343
2013-10-12Add missing #include's to cctype when using isdigit/alpha/etc.Will Dietz1-0/+1
llvm-svn: 192519
2013-10-11Really fix CHECK-LABEL and CHECK-DAG interaction. This actually just ↵Stephen Lin1-9/+17
restores the initial implementation that was in r186162 but got lost in some subsequent refactoring. More explicit variable names and comments are present now to hopefully prevent repeat regression, as well as another test. llvm-svn: 192477
2013-10-11Fix handling of CHECK-DAG inside of CHECK-LABEL.Rafael Espindola1-6/+4
llvm-svn: 192463
2013-09-17Missed using check type enum in one placeMatt Arsenault1-6/+6
llvm-svn: 190897
2013-09-17Use function's argument instead of the global flag.Matt Arsenault1-3/+3
For now it happens the argument is always the same. llvm-svn: 190896
2013-09-17FileCheck refactor: use enum instead of bunch of boolsMatt Arsenault1-76/+88
llvm-svn: 190893
2013-08-16FileCheck: Fix stray quote in CHECK-LABEL error message.Stephen Lin1-1/+1
llvm-svn: 188564
2013-08-12[FileCheck] Fix a bug that cause FileCheck to misidentify check-prefixRui Ueyama1-2/+26
FileCheck should check to make sure the prefix was found, and not a word containing it (e.g -check-prefix=BASEREL shouldn't match NOBASEREL). Patch by Ron Ofir. llvm-svn: 188221
2013-08-02Fix handling of CHECK-DAG combined with CHECK-NOTTim Northover1-2/+1
Patch by Daniel Sanders. llvm-svn: 187651
2013-07-12Add new directive called CHECK-LABEL to FileCheck.Stephen Lin1-29/+94
CHECK-LABEL is meant to be used in place on CHECK on lines containing identifiers or other unique labels (they need not actually be labels in the source or output language, though.) This is used to break up the input stream into separate blocks delineated by CHECK-LABEL lines, each of which is checked independently. This greatly improves the accuracy of errors and fix-it hints in many cases, and allows for FileCheck to recover from errors in one block by continuing to subsequent blocks. Some tests will be converted to use this new directive in forthcoming patches. llvm-svn: 186162
2013-06-25keep only the StringRef version of getFileOrSTDIN.Rafael Espindola1-2/+2
llvm-svn: 184826