summaryrefslogtreecommitdiffstats
path: root/llvm/test/FileCheck/numeric-expression.txt
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/FileCheck/numeric-expression.txt')
-rw-r--r--llvm/test/FileCheck/numeric-expression.txt35
1 files changed, 32 insertions, 3 deletions
diff --git a/llvm/test/FileCheck/numeric-expression.txt b/llvm/test/FileCheck/numeric-expression.txt
index 29abc385650..3245adc85c3 100644
--- a/llvm/test/FileCheck/numeric-expression.txt
+++ b/llvm/test/FileCheck/numeric-expression.txt
@@ -82,6 +82,20 @@ CHECK-LABEL: USE MULTI VAR
CHECK-NEXT: [[#VAR2:]]
CHECK-NEXT: [[#VAR1+VAR2]]
+; Numeric expression using a variable defined from a numeric expression.
+DEF EXPR GOOD MATCH
+42
+41 43
+; CHECK-LABEL: DEF EXPR GOOD MATCH
+; CHECK-NEXT: [[# VAR42:VAR1+31]]
+; CHECK-NEXT: [[# VAR41: VAR42-1]] [[# VAR41 + 2]]
+
+; Empty numeric expression.
+EMPTY NUM EXPR
+foo 104 bar
+; CHECK-LABEL: EMPTY NUM EXPR
+; CHECK-NEXT: foo [[#]] bar
+
; Numeric expression using undefined variables.
RUN: not FileCheck --check-prefix UNDEF-USE --input-file %s %s 2>&1 \
RUN: | FileCheck --strict-whitespace --check-prefix UNDEF-USE-MSG %s
@@ -145,9 +159,9 @@ CLI-STR-CONFLICT-NEXT: {{^ \^$}}
INPUT-NUM-CONFLICT: numeric-expression.txt:[[#@LINE-7]]:22: error: string variable with name 'STRVAR' already exists
INPUT-NUM-CONFLICT-NEXT: CONFLICT4: redef2 {{\[\[#STRVAR:\]\]}}
INPUT-NUM-CONFLICT-NEXT: {{^ \^$}}
-CLI-NUM-CONFLICT: Global defines:2:20: error: string variable with name 'STRVAR' already exists
-CLI-NUM-CONFLICT-NEXT: Global define #2: #STRVAR=42
-CLI-NUM-CONFLICT-NEXT: {{^ \^$}}
+CLI-NUM-CONFLICT: Global defines:2:45: error: string variable with name 'STRVAR' already exists
+CLI-NUM-CONFLICT-NEXT: Global define #2: #STRVAR=42 (parsed as: {{\[\[#STRVAR:42\]\]}})
+CLI-NUM-CONFLICT-NEXT: {{^ \^$}}
; Numeric variable definition with too big value.
RUN: not FileCheck --check-prefix BIGVAL --input-file %s %s 2>&1 \
@@ -160,3 +174,18 @@ BIGVAL-NEXT: NUMVAR: [[#NUMVAR:]]
BIGVAL-MSG: numeric-expression.txt:[[#@LINE-3]]:9: error: Unable to represent numeric value
BIGVAL-MSG-NEXT: {{N}}UMVAR: 10000000000000000000000
BIGVAL-MSG-NEXT: {{^ \^$}}
+
+; Verify that when a variable is set to an expression the expression is still
+; checked.
+RUN: not FileCheck --check-prefix DEF-EXPR-FAIL --input-file %s %s 2>&1 \
+RUN: | FileCheck --strict-whitespace --check-prefix DEF-EXPR-FAIL-MSG %s
+
+DEF EXPR WRONG MATCH
+20
+43
+DEF-EXPR-FAIL-LABEL: DEF EXPR WRONG MATCH
+DEF-EXPR-FAIL-NEXT: [[# VAR20:]]
+DEF-EXPR-FAIL-NEXT: [[# VAR42: VAR20+22]]
+DEF-EXPR-FAIL-MSG: numeric-expression.txt:[[#@LINE-1]]:21: error: {{D}}EF-EXPR-FAIL-NEXT: is not on the line after the previous match
+DEF-EXPR-FAIL-MSG-NEXT: {{D}}EF-EXPR-FAIL-NEXT: {{\[\[# VAR42: VAR20\+22\]\]}}
+DEF-EXPR-FAIL-MSG-NEXT: {{^ \^$}}
OpenPOWER on IntegriCloud