aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/FileCheck.cpp
diff options
context:
space:
mode:
authorMichael Liao <michael.hliao@gmail.com>2019-07-05 22:23:27 +0000
committerMichael Liao <michael.hliao@gmail.com>2019-07-05 22:23:27 +0000
commit88b0d20edf673b8c195c2cb426838b4f46623858 (patch)
treee64388c44aefbf12e553a21c1dd170463c15f5ee /llvm/lib/Support/FileCheck.cpp
parentabd1561f15ee466c0fd9abeede2cdcde2ebb2cec (diff)
downloadllvm-88b0d20edf673b8c195c2cb426838b4f46623858.zip
llvm-88b0d20edf673b8c195c2cb426838b4f46623858.tar.gz
llvm-88b0d20edf673b8c195c2cb426838b4f46623858.tar.bz2
Revert "[FileCheck] Simplify numeric variable interface"
This reverts commit 096600a4b073dd94a366cc8e57bff93c34ff6966. llvm-svn: 365251
Diffstat (limited to 'llvm/lib/Support/FileCheck.cpp')
-rw-r--r--llvm/lib/Support/FileCheck.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/Support/FileCheck.cpp b/llvm/lib/Support/FileCheck.cpp
index 12431d9..03e892af 100644
--- a/llvm/lib/Support/FileCheck.cpp
+++ b/llvm/lib/Support/FileCheck.cpp
@@ -24,15 +24,18 @@
using namespace llvm;
-void FileCheckNumericVariable::setValue(uint64_t NewValue) {
- assert(!Value && "Overwriting numeric variable's value is not allowed");
+bool FileCheckNumericVariable::setValue(uint64_t NewValue) {
+ if (Value)
+ return true;
Value = NewValue;
+ return false;
}
-void FileCheckNumericVariable::clearValue() {
+bool FileCheckNumericVariable::clearValue() {
if (!Value)
- return;
+ return true;
Value = None;
+ return false;
}
Expected<uint64_t> FileCheckExpression::eval() const {
@@ -620,7 +623,8 @@ Expected<size_t> FileCheckPattern::match(StringRef Buffer, size_t &MatchLen,
if (MatchedValue.getAsInteger(10, Val))
return FileCheckErrorDiagnostic::get(SM, MatchedValue,
"Unable to represent numeric value");
- DefinedNumericVariable->setValue(Val);
+ if (DefinedNumericVariable->setValue(Val))
+ llvm_unreachable("Numeric variable redefined");
}
// Like CHECK-NEXT, CHECK-EMPTY's match range is considered to start after