[llvm] aed5712 - [RuntimeDyld] Allow multi-line rtdyld-check and jitlink-check expressions.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 16:16:00 PDT 2020


Author: Lang Hames
Date: 2020-03-10T16:08:40-07:00
New Revision: aed5712522031074281835fb100a7a6508ae45ed

URL: https://github.com/llvm/llvm-project/commit/aed5712522031074281835fb100a7a6508ae45ed
DIFF: https://github.com/llvm/llvm-project/commit/aed5712522031074281835fb100a7a6508ae45ed.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
index 2ac0586ff324..9ba67589e4b2 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.


        


More information about the llvm-commits mailing list