mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
d5ea9f022a
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
100 lines
5.0 KiB
Plaintext
100 lines
5.0 KiB
Plaintext
; Test functionality of -D# option: numeric variables are defined to the right
|
|
; value and CHECK directives using them match as expected given the value set.
|
|
|
|
; Tests with default format specifier.
|
|
RUN: FileCheck -D#NUMVAL1=8 -D#NUMVAL2='NUMVAL1 + 4' --check-prefixes CHECKNUM1,CHECKNUM2 --input-file %s %s
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -D#NUMVAL1=7 -D#NUMVAL2=12 --check-prefix CHECKNUM1 --input-file %s %s 2>&1 \
|
|
RUN: | FileCheck %s --strict-whitespace --check-prefix NUMERRMSG1
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -D#NUMVAL1=8 -D#NUMVAL2=8 --check-prefix CHECKNUM2 --input-file %s %s 2>&1 \
|
|
RUN: | FileCheck %s --strict-whitespace --check-prefix NUMERRMSG2
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -D#NUMVAL1=8 -D#NUMVAL2=8 --check-prefix NUMNOT1 --input-file %s %s 2>&1 \
|
|
RUN: | FileCheck %s --strict-whitespace --check-prefix NOT-NUMERRMSG1
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -D#NUMVAL1=7 -D#NUMVAL2=12 --check-prefix NUMNOT1 --input-file %s %s 2>&1 \
|
|
RUN: | FileCheck %s --strict-whitespace --check-prefix NOT-NUMERRMSG2
|
|
|
|
RUN: FileCheck -D#NUMVAL1=7 -D#NUMVAL2=8 --check-prefix NUMNOT1 --input-file %s %s
|
|
|
|
Numeric value #1 = 8
|
|
Numeric value #2 = 12
|
|
CHECKNUM1: Numeric value #1 = [[#NUMVAL1]]
|
|
CHECKNUM2: Numeric value #2 = [[#NUMVAL2]]
|
|
NUMNOT1-NOT: Numeric value #1 = [[#NUMVAL1]]
|
|
NUMNOT1-NOT: Numeric value #2 = [[#NUMVAL2]]
|
|
|
|
NUMERRMSG1: defines.txt:[[#@LINE-5]]:12: error: CHECKNUM1: expected string not found in input
|
|
NUMERRMSG1: defines.txt:1:1: note: scanning from here
|
|
NUMERRMSG1: defines.txt:1:1: note: with "NUMVAL1" equal to "7"
|
|
NUMERRMSG1: defines.txt:[[#@LINE-10]]:1: note: possible intended match here
|
|
|
|
NUMERRMSG2: defines.txt:[[#@LINE-9]]:12: error: CHECKNUM2: expected string not found in input
|
|
NUMERRMSG2: defines.txt:1:1: note: scanning from here
|
|
NUMERRMSG2: defines.txt:1:1: note: with "NUMVAL2" equal to "8"
|
|
NUMERRMSG2: defines.txt:[[#@LINE-14]]:1: note: possible intended match here
|
|
|
|
NOT-NUMERRMSG1: defines.txt:[[#@LINE-13]]:14: error: {{NUMNOT1}}-NOT: excluded string found in input
|
|
NOT-NUMERRMSG1: defines.txt:[[#@LINE-18]]:1: note: found here
|
|
NOT-NUMERRMSG1: defines.txt:[[#@LINE-19]]:1: note: with "NUMVAL1" equal to "8"
|
|
|
|
NOT-NUMERRMSG2: defines.txt:[[#@LINE-16]]:14: error: {{NUMNOT1}}-NOT: excluded string found in input
|
|
NOT-NUMERRMSG2: defines.txt:[[#@LINE-21]]:1: note: found here
|
|
NOT-NUMERRMSG2: defines.txt:[[#@LINE-22]]:1: note: with "NUMVAL2" equal to "12"
|
|
|
|
; Tests with explicit format specifiers.
|
|
RUN: FileCheck -D#%X,NUMVAL3=8 -D#%X,NUMVAL4='NUMVAL3 + 4' --check-prefixes CHECKNUM3,CHECKNUM4 --input-file %s %s
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -D#%X,NUMVAL3=7 -D#%X,NUMVAL4=12 --check-prefix CHECKNUM3 --input-file %s %s 2>&1 \
|
|
RUN: | FileCheck %s --strict-whitespace --check-prefix NUMERRMSG3
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -D#%X,NUMVAL3=8 -D#%X,NUMVAL4=8 --check-prefix CHECKNUM4 --input-file %s %s 2>&1 \
|
|
RUN: | FileCheck %s --strict-whitespace --check-prefix NUMERRMSG4
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -D#%X,NUMVAL3=8 -D#%X,NUMVAL4=8 --check-prefix NUMNOT2 --input-file %s %s 2>&1 \
|
|
RUN: | FileCheck %s --strict-whitespace --check-prefix NOT-NUMERRMSG3
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -D#%X,NUMVAL3=7 -D#%X,NUMVAL4=12 --check-prefix NUMNOT2 --input-file %s %s 2>&1 \
|
|
RUN: | FileCheck %s --strict-whitespace --check-prefix NOT-NUMERRMSG4
|
|
|
|
RUN: FileCheck -D#%X,NUMVAL3=7 -D#%X,NUMVAL4=8 --check-prefix NUMNOT2 --input-file %s %s
|
|
|
|
; Test with explicit and default format specifiers.
|
|
RUN: FileCheck -D#NUMVAL3=8 -D#%X,NUMVAL4='NUMVAL3 + 4' --check-prefixes CHECKNUM3,CHECKNUM4 --input-file %s %s
|
|
; Test with explicit and implicit format specifiers.
|
|
RUN: FileCheck -D#%X,NUMVAL3=8 -D#NUMVAL4='NUMVAL3 + 4' --check-prefixes CHECKNUM3,CHECKNUM4 --input-file %s %s
|
|
|
|
Numeric value #3 = 8
|
|
Numeric value #4 = C
|
|
CHECKNUM3: Numeric value #3 = [[#NUMVAL3]]
|
|
CHECKNUM4: Numeric value #4 = [[#NUMVAL4]]
|
|
NUMNOT2-NOT: Numeric value #3 = [[#NUMVAL3]]
|
|
NUMNOT2-NOT: Numeric value #4 = [[#NUMVAL4]]
|
|
|
|
NUMERRMSG3: defines.txt:[[#@LINE-5]]:12: error: CHECKNUM3: expected string not found in input
|
|
NUMERRMSG3: defines.txt:1:1: note: scanning from here
|
|
NUMERRMSG3: defines.txt:1:1: note: with "NUMVAL3" equal to "7"
|
|
NUMERRMSG3: defines.txt:[[#@LINE-10]]:1: note: possible intended match here
|
|
|
|
NUMERRMSG4: defines.txt:[[#@LINE-9]]:12: error: CHECKNUM4: expected string not found in input
|
|
NUMERRMSG4: defines.txt:1:1: note: scanning from here
|
|
NUMERRMSG4: defines.txt:1:1: note: with "NUMVAL4" equal to "8"
|
|
NUMERRMSG4: defines.txt:[[#@LINE-14]]:1: note: possible intended match here
|
|
|
|
NOT-NUMERRMSG3: defines.txt:[[#@LINE-13]]:14: error: {{NUMNOT2}}-NOT: excluded string found in input
|
|
NOT-NUMERRMSG3: defines.txt:[[#@LINE-18]]:1: note: found here
|
|
NOT-NUMERRMSG3: defines.txt:[[#@LINE-19]]:1: note: with "NUMVAL3" equal to "8"
|
|
|
|
NOT-NUMERRMSG4: defines.txt:[[#@LINE-16]]:14: error: {{NUMNOT2}}-NOT: excluded string found in input
|
|
NOT-NUMERRMSG4: defines.txt:[[#@LINE-21]]:1: note: found here
|
|
NOT-NUMERRMSG4: defines.txt:[[#@LINE-22]]:1: note: with "NUMVAL4" equal to "C"
|