]> granicus.if.org Git - llvm/commit
[FileCheck] Fix numeric variable redefinition
authorThomas Preud'homme <thomasp@graphcore.ai>
Thu, 18 Jul 2019 13:39:04 +0000 (13:39 +0000)
committerThomas Preud'homme <thomasp@graphcore.ai>
Thu, 18 Jul 2019 13:39:04 +0000 (13:39 +0000)
commit1f688f6d4c38569f96308c94ac7f7fbc0998d01f
treea311d3c4e64448d530d1d40c458f0d70e66665f5
parent301cca3f354879fd2447fe0f37deea78e0498177
[FileCheck] Fix numeric variable redefinition

Summary:
Commit r365249 changed usage of FileCheckNumericVariable to have one
instance of that class per variable as opposed to one instance per
definition of a given variable as was done before. However, it retained
the safety check in setValue that it should only be called with the
variable unset, even after r365625.

However this causes assert failure when a non-pseudo variable is being
redefined. And while redefinition of @LINE at each CHECK line work in
the general case, it caused problem when a substitution failed (fixed in
r365624) and still causes problem when a CHECK line does not match since
@LINE's value is cleared after substitutions in match() happened but
printSubstitutions also attempts a substitution.

This commit solves the root of the problem by changing setValue to set a
new value regardless of whether a value was set or not, thus fixing all
the aforementioned issues.

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/D64882

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366434 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/FileCheck.h
lib/Support/FileCheck.cpp
test/FileCheck/line-count.txt
test/FileCheck/numeric-expression.txt
unittests/Support/FileCheckTest.cpp