diff options
author | Thomas Preud'homme <thomasp@graphcore.ai> | 2019-07-05 16:25:46 +0000 |
---|---|---|
committer | Thomas Preud'homme <thomasp@graphcore.ai> | 2019-07-05 16:25:46 +0000 |
commit | 56f6308b2d8094fb8fa2a93f91f3ea90ee5d144b (patch) | |
tree | 81fac51c0b7394fd2ad4bf07cbba5b2a0373ba11 /llvm/unittests/Support/FileCheckTest.cpp | |
parent | fe7ac170a7977079a6ce49e836bb0ab60455c986 (diff) | |
download | llvm-56f6308b2d8094fb8fa2a93f91f3ea90ee5d144b.zip llvm-56f6308b2d8094fb8fa2a93f91f3ea90ee5d144b.tar.gz llvm-56f6308b2d8094fb8fa2a93f91f3ea90ee5d144b.tar.bz2 |
[FileCheck] Share variable instance among uses
Summary:
This patch changes expression support to use one instance of
FileCheckNumericVariable per numeric variable rather than one per
variable and per definition. The current system was only necessary for
the last patch of the numeric expression support patch series in order
to handle a line using a variable defined earlier on the same line from
the input text. However this can be dealt more efficiently.
Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk
Subscribers: JonChesterfield, rogfer01, hfinkel, kristina, rnk, tra, arichardson, grimar, dblaikie, probinson, llvm-commits, hiraditya
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64229
llvm-svn: 365220
Diffstat (limited to 'llvm/unittests/Support/FileCheckTest.cpp')
-rw-r--r-- | llvm/unittests/Support/FileCheckTest.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/unittests/Support/FileCheckTest.cpp b/llvm/unittests/Support/FileCheckTest.cpp index b9970ff..7fcd5bb 100644 --- a/llvm/unittests/Support/FileCheckTest.cpp +++ b/llvm/unittests/Support/FileCheckTest.cpp @@ -178,6 +178,7 @@ public: GlobalDefines.emplace_back(std::string("BAR=BAZ")); EXPECT_FALSE( errorToBool(Context.defineCmdlineVariables(GlobalDefines, SM))); + Context.createLineVariable(); // Call parsePattern to have @LINE defined. P.parsePattern("N/A", "CHECK", SM, Req); // parsePattern does not expect to be called twice for the same line and @@ -192,9 +193,9 @@ public: bool parseNumVarDefExpect(StringRef Expr) { StringRef ExprBufferRef = bufferize(SM, Expr); - StringRef Name; return errorToBool(FileCheckPattern::parseNumericVariableDefinition( - ExprBufferRef, Name, &Context, SM)); + ExprBufferRef, &Context, LineNumber, SM) + .takeError()); } bool parseSubstExpect(StringRef Expr) { |