diff options
Diffstat (limited to 'llvm/lib/Support/FileCheck.cpp')
-rw-r--r-- | llvm/lib/Support/FileCheck.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/Support/FileCheck.cpp b/llvm/lib/Support/FileCheck.cpp index 93a3f0513fc..5ec126f934e 100644 --- a/llvm/lib/Support/FileCheck.cpp +++ b/llvm/lib/Support/FileCheck.cpp @@ -24,18 +24,15 @@ using namespace llvm; -bool FileCheckNumericVariable::setValue(uint64_t NewValue) { - if (Value) - return true; +void FileCheckNumericVariable::setValue(uint64_t NewValue) { + assert(!Value && "Overwriting numeric variable's value is not allowed"); Value = NewValue; - return false; } -bool FileCheckNumericVariable::clearValue() { +void FileCheckNumericVariable::clearValue() { if (!Value) - return true; + return; Value = None; - return false; } Expected<uint64_t> FileCheckExpression::eval() const { @@ -625,8 +622,7 @@ 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"); - if (DefinedNumericVariable->setValue(Val)) - llvm_unreachable("Numeric variable redefined"); + DefinedNumericVariable->setValue(Val); } // Like CHECK-NEXT, CHECK-EMPTY's match range is considered to start after |