From fd941036bf2494cfbd2749f2f179733cbe9e2eb4 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Fri, 28 Aug 2020 11:30:01 +0100 Subject: Fix PR46880: Fail CHECK-NOT with undefined variable Currently a CHECK-NOT directive succeeds whenever the corresponding match fails. However match can fail due to an error rather than a lack of match, for instance if a variable is undefined. This commit makes match error a failure for CHECK-NOT. Reviewed By: jdenny Differential Revision: https://reviews.llvm.org/D86222 --- llvm/lib/FileCheck/FileCheckImpl.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'llvm/lib/FileCheck/FileCheckImpl.h') diff --git a/llvm/lib/FileCheck/FileCheckImpl.h b/llvm/lib/FileCheck/FileCheckImpl.h index d4d891f..29e721e 100644 --- a/llvm/lib/FileCheck/FileCheckImpl.h +++ b/llvm/lib/FileCheck/FileCheckImpl.h @@ -229,8 +229,7 @@ public: /// Print name of variable associated with this error. void log(raw_ostream &OS) const override { - OS << "\""; - OS.write_escaped(VarName) << "\""; + OS << "undefined variable: " << VarName; } }; @@ -756,8 +755,7 @@ public: /// current values of FileCheck numeric variables and is updated if this /// match defines new numeric values. MatchResult match(StringRef Buffer, const SourceMgr &SM) const; - /// Prints the value of successful substitutions or the name of the undefined - /// string or numeric variables preventing a successful substitution. + /// Prints the value of successful substitutions. void printSubstitutions(const SourceMgr &SM, StringRef Buffer, SMRange MatchRange, FileCheckDiag::MatchType MatchTy, std::vector *Diags) const; -- cgit v1.1