From aed5712522031074281835fb100a7a6508ae45ed Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 10 Mar 2020 13:07:46 -0700 Subject: [PATCH] [RuntimeDyld] Allow multi-line rtdyld-check and jitlink-check expressions. This patch allows rtdyld-check / jitlink-check expressions to be extended over multiple lines by terminating each line with a '\'. E.g. # llvm-rtdyld: *{8}X = \ # llvm-rtdyld: Y X: .quad Y This will be used to break up some long lines in upcoming test cases. --- .../ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp index 2ac0586..9ba6758 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp @@ -704,6 +704,7 @@ bool RuntimeDyldCheckerImpl::checkAllRulesInBuffer(StringRef RulePrefix, bool DidAllTestsPass = true; unsigned NumRules = 0; + std::string CheckExpr; const char *LineStart = MemBuf->getBufferStart(); // Eat whitespace. @@ -717,9 +718,18 @@ bool RuntimeDyldCheckerImpl::checkAllRulesInBuffer(StringRef RulePrefix, ++LineEnd; StringRef Line(LineStart, LineEnd - LineStart); - if (Line.startswith(RulePrefix)) { - DidAllTestsPass &= check(Line.substr(RulePrefix.size())); - ++NumRules; + if (Line.startswith(RulePrefix)) + CheckExpr += Line.substr(RulePrefix.size()).str(); + + // If there's a check expr string... + if (!CheckExpr.empty()) { + // ... and it's complete then run it, otherwise remove the trailer '\'. + if (CheckExpr.back() != '\\') { + DidAllTestsPass &= check(CheckExpr); + CheckExpr.clear(); + ++NumRules; + } else + CheckExpr.pop_back(); } // Eat whitespace. -- 2.7.4