mirror of
https://github.com/RPCS3/llvm.git
synced 2026-08-25 11:51:41 -04:00
4a42ca4771
Summary:
This patch is part of a patch series to add support for FileCheck
numeric expressions. This specific patch gives earlier and better
diagnostics for the -D option.
Prior to this change, parsing of -D option was very loose: it assumed
that there is an equal sign (which to be fair is now checked by the
FileCheck executable) and that the part on the left of the equal sign
was a valid variable name. This commit adds logic to ensure that this
is the case and gives diagnostic when it is not, making it clear that
the issue came from a command-line option error. This is achieved by
sharing the variable parsing code into a new function ParseVariable.
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, rnk
Subscribers: hiraditya, llvm-commits, probinson, dblaikie, grimar, arichardson, tra, rnk, kristina, hfinkel, rogfer01, JonChesterfield
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60382
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359447 91177308-0d34-0410-b5e6-96231b3b80d8
49 lines
2.5 KiB
Plaintext
49 lines
2.5 KiB
Plaintext
; RUN: FileCheck -DVALUE=10 -input-file %s %s
|
|
; RUN: not FileCheck -DVALUE=20 -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRMSG
|
|
; RUN: not FileCheck -DVALUE=10 -check-prefix NOT -input-file %s %s 2>&1 | FileCheck %s -check-prefix NOT-ERRMSG
|
|
; RUN: FileCheck -DVALUE=20 -check-prefix NOT -input-file %s %s
|
|
; RUN: not FileCheck -DVALUE10 -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRCLIEQ1
|
|
; RUN: not FileCheck -D -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRCLIEQ2
|
|
; RUN: not FileCheck -D=10 -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRCLIVAR1
|
|
; RUN: not FileCheck -D= -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRCLIVAR2
|
|
; RUN: FileCheck -DVALUE= -check-prefix EMPTY -input-file %s %s 2>&1
|
|
|
|
; RUN: not FileCheck -D10VALUE=10 -input-file %s %s 2>&1 | FileCheck %s --strict-whitespace -check-prefix ERRCLIFMT
|
|
; RUN: not FileCheck -D@VALUE=10 -input-file %s %s 2>&1 | FileCheck %s --strict-whitespace -check-prefix ERRCLIPSEUDO
|
|
; RUN: not FileCheck -D'VALUE + 2=10' -input-file %s %s 2>&1 | FileCheck %s --strict-whitespace -check-prefix ERRCLITRAIL
|
|
Value = 10
|
|
; CHECK: Value = [[VALUE]]
|
|
; NOT-NOT: Value = [[VALUE]]
|
|
|
|
; ERRMSG: defines.txt:[[@LINE-3]]:10: error: CHECK: expected string not found in input
|
|
; ERRMSG: defines.txt:1:1: note: scanning from here
|
|
; ERRMSG: defines.txt:1:1: note: with variable "VALUE" equal to "20"
|
|
; ERRMSG: defines.txt:[[@LINE-7]]:1: note: possible intended match here
|
|
|
|
; NOT-ERRMSG: defines.txt:[[@LINE-7]]:12: error: {{NOT}}-NOT: excluded string found in input
|
|
; NOT-ERRMSG: defines.txt:[[@LINE-10]]:1: note: found here
|
|
; NOT-ERRMSG: defines.txt:[[@LINE-11]]:1: note: with variable "VALUE" equal to "10"
|
|
|
|
; ERRCLIEQ1: Missing equal sign in command-line definition '-DVALUE10'
|
|
|
|
; ERRCLIEQ2: {{F|f}}ile{{C|c}}heck{{[^:]*}}: for the -D option: requires a value!
|
|
|
|
; ERRCLIVAR1: Missing pattern variable name in command-line definition '-D=10'
|
|
|
|
; ERRCLIVAR2: Missing pattern variable name in command-line definition '-D='
|
|
|
|
Empty value = @@
|
|
; EMPTY: Empty value = @[[VALUE]]@
|
|
|
|
; ERRCLIFMT: Global defines:1:19: error: invalid name for variable definition '10VALUE'
|
|
; ERRCLIFMT-NEXT: Global define #1: 10VALUE=10
|
|
; ERRCLIFMT-NEXT: {{^ \^$}}
|
|
|
|
; ERRCLIPSEUDO: Global defines:1:19: error: invalid name for variable definition '@VALUE'
|
|
; ERRCLIPSEUDO-NEXT: Global define #1: @VALUE=10
|
|
; ERRCLIPSEUDO-NEXT: {{^ \^$}}
|
|
|
|
; ERRCLITRAIL: Global defines:1:19: error: invalid name for variable definition 'VALUE + 2'
|
|
; ERRCLITRAIL-NEXT: Global define #1: VALUE + 2=10
|
|
; ERRCLITRAIL-NEXT: {{^ \^$}}
|