llvm-project/llvm/test/FileCheck/line-count.txt

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

83 lines
3.4 KiB
Plaintext
Raw Normal View History

; RUN: FileCheck -input-file %s %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD1 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR1 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD2 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR2 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD3 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR3 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD4 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR4 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD5 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR5 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD6 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR6 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD7 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR7 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD8 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR8 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD9 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR9 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD10 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR10 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD11 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR11 %s
13
14 aaa
15 bbb
16 ccc
17 CHECK: [[@LINE-3]] {{a}}aa
18 CHECK: [[@LINE-3]] {{b}}bb
19 CHECK: [[@LINE-3]] {{c}}cc
20 foobar
21 CHECK: [[@LINE-1]] {{foo}}bar
22
23 arst CHECK: [[@LINE]] {{a}}rst
24
25 BAD1: [[@LINE:cant-have-regex]]
FileCheck: Improve FileCheck variable terminology Summary: Terminology introduced by [[#]] blocks is confusing and does not integrate well with existing terminology. First, variables referred by [[]] blocks are called "pattern variables" while the text a CHECK directive needs to match is called a "CHECK pattern". This is inconsistent with variables in [[#]] blocks since [[#]] blocks are also found in CHECK pattern yet those variables are called "numeric variable". Second, the replacing of both [[]] and [[#]] blocks by the value of the variable or expression they contain is represented by a FileCheckPatternSubstitution class. The naming refers to being a substitution in a CHECK pattern but could be wrongly understood as being a substitution of a pattern variable. Third and lastly, comments use "numeric expression" to refer both to the [[#]] blocks as well as to the numeric expressions these blocks contain which get evaluated at match time. This patch solves these confusions by - calling variables in [[]] and [[#]] blocks as string and numeric variables respectively; - referring to [[]] and [[#]] as substitution *blocks*, with the former being a string substitution block and the latter a numeric substitution block; - calling [[]] and [[#]] blocks to be replaced by the value of a variable or expression they contain a substitution (as opposed to definition when these blocks are used to defined a variable), with the former being a string substitution and the latter a numeric substitution; - renaming the FileCheckPatternSubstitution as a FileCheckSubstitution class with FileCheckStringSubstitution and FileCheckNumericSubstitution subclasses; - restricting the use of "numeric expression" to refer to the expression that is evaluated in a numeric substitution. While numeric substitution blocks only support numeric substitutions of numeric expressions at the moment there are plans to augment numeric substitution blocks to support numeric definitions as well as both a numeric definition and numeric substitution in the same numeric substitution block. Reviewers: jhenderson, jdenny, probinson, arichardson Subscribers: hiraditya, arichardson, probinson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62146 llvm-svn: 361445
2019-05-23 08:10:14 +08:00
26 ERR1: line-count.txt:[[#@LINE-1]]:12: error: invalid name in string variable definition
27
28 BAD2: [[ @LINE]]
29 ERR2: line-count.txt:[[#@LINE-1]]:12: error: unexpected whitespace
30
31 BAD3: [[@LINE ]]
32 ERR3: line-count.txt:[[#@LINE-1]]:17: error: unexpected whitespace
33
34 BAD4: [[ @LINE-1]]
35 ERR4: line-count.txt:[[#@LINE-1]]:12: error: unexpected whitespace
36
37 BAD5: [[@LINE -1]]
38 ERR5: line-count.txt:[[#@LINE-1]]:17: error: unexpected whitespace
39
40 BAD6: [[@LINE- 1]]
41 ERR6: line-count.txt:[[#@LINE-1]]:18: error: unexpected whitespace
42
43 BAD7: [[@LINE-1 ]]
44 ERR7: line-count.txt:[[#@LINE-1]]:19: error: unexpected whitespace
45
46 BAD8: [[@LIN]]
47 ERR8: line-count.txt:[[#@LINE-1]]:12: error: invalid pseudo numeric variable '@LIN'
48
49 BAD9: [[@LINE*2]]
50 ERR9: line-count.txt:[[#@LINE-1]]:17: error: unsupported operation '*'
51
52 BAD10: [[@LINE-x]]
53 ERR10: line-count.txt:[[#@LINE-1]]:19: error: invalid operand format
54 ERR10-NEXT: 52 {{B}}AD10: {{\[\[@LINE-x\]\]}}
55 ERR10-NEXT: {{^}} ^{{$}}
56
57 BAD11: [[@LINE-1x]]
58 ERR11: line-count.txt:[[#@LINE-1]]:20: error: unexpected characters at end of expression 'x'
59
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -check-prefix BAD12 -input-file %s %s 2>&1 \
; RUN: | FileCheck -check-prefix ERR12 %s
63
64 BAD12: [[#@LINE-1]] NOT HERE
65 ERR12: note: with "@LINE-1" equal to "63"
66
FileCheck [9/12]: Add support for matching formats Summary: This patch is part of a patch series to add support for FileCheck numeric expressions. This specific patch adds support for selecting a matching format to match a numeric value against (ie. decimal, hex lower case letters or hex upper case letters). This commit allows to select what format a numeric value should be matched against. The following formats are supported: decimal value, lower case hex value and upper case hex value. Matching formats impact both the format of numeric value to be matched as well as the format of accepted numbers in a definition with empty numeric expression constraint. Default for absence of format is decimal value unless the numeric expression constraint is non null and use a variable in which case the format is the one used to define that variable. Conclict of format in case of several variable being used is diagnosed and forces the user to select a matching format explicitely. This commit also enables immediates in numeric expressions to be in any radix known to StringRef's GetAsInteger method, except for legacy numeric expressions (ie [[@LINE+<offset>]] which only support decimal immediates. Copyright: - Linaro (changes up to diff 183612 of revision D55940) - GraphCore (changes in later versions of revision D55940 and in new revision created off D55940) Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson Reviewed By: jhenderson, arichardson Subscribers: daltenty, MaskRay, hiraditya, llvm-commits, probinson, dblaikie, grimar, arichardson, kristina, hfinkel, rogfer01, JonChesterfield Tags: #llvm Differential Revision: https://reviews.llvm.org/D60389
2019-03-06 07:20:29 +08:00
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck --check-prefix BAD13 --input-file %s %s 2>&1 \
; RUN: | FileCheck --check-prefix ERR13 %s
70
71 BAD13: [[@LINE-0xA]]
72 ERR13: line-count.txt:[[#@LINE-1]]:20: error: unexpected characters at end of expression 'xA'
73
74 CHECK: [[#@LINE]] CHECK
75 CHECK: [[# @LINE]] CHECK
76 CHECK: [[# @LINE ]] CHECK
77
78 CHECK: [[#@LINE-1]]
79 CHECK: [[# @LINE-1]] CHECK
80 CHECK: [[# @LINE -1]] CHECK
81 CHECK: [[# @LINE - 1]] CHECK
82 CHECK: [[# @LINE - 1 ]] CHECK