[PATCH] D58784: [FileCheck]Remove assertions that prevent matching an empty string at file start before CHECK-NEXT/SAME

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 08:36:43 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL355928: [FileCheck]Remove assertions that prevent matching an empty string at fileā€¦ (authored by jhenderson, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D58784?vs=188733&id=190269#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58784/new/

https://reviews.llvm.org/D58784

Files:
  llvm/trunk/lib/Support/FileCheck.cpp
  llvm/trunk/test/FileCheck/empty-regex-match-at-start.txt


Index: llvm/trunk/test/FileCheck/empty-regex-match-at-start.txt
===================================================================
--- llvm/trunk/test/FileCheck/empty-regex-match-at-start.txt
+++ llvm/trunk/test/FileCheck/empty-regex-match-at-start.txt
@@ -0,0 +1,16 @@
+some text
+more text
+
+RUN: FileCheck %s --check-prefix=NEXT --input-file=%s
+NEXT:      {{^}}
+NEXT-NEXT: more text
+
+RUN: FileCheck %s --check-prefix=SAME --input-file=%s
+SAME:      {{^}}
+SAME-SAME: some text
+
+RUN: echo "" > %t
+RUN: echo "" >> %t
+RUN: FileCheck %s --check-prefix=EMPTY --input-file=%t
+EMPTY:       {{^}}
+EMPTY-EMPTY:
Index: llvm/trunk/lib/Support/FileCheck.cpp
===================================================================
--- llvm/trunk/lib/Support/FileCheck.cpp
+++ llvm/trunk/lib/Support/FileCheck.cpp
@@ -1114,12 +1114,6 @@
       Twine(Pat.getCheckTy() == Check::CheckEmpty ? "-EMPTY" : "-NEXT");
 
   // Count the number of newlines between the previous match and this one.
-  assert(Buffer.data() !=
-             SM.getMemoryBuffer(SM.FindBufferContainingLoc(
-                                    SMLoc::getFromPointer(Buffer.data())))
-                 ->getBufferStart() &&
-         "CHECK-NEXT and CHECK-EMPTY can't be the first check in a file");
-
   const char *FirstNewLine = nullptr;
   unsigned NumNewLines = CountNumNewlinesBetween(Buffer, FirstNewLine);
 
@@ -1155,12 +1149,6 @@
     return false;
 
   // Count the number of newlines between the previous match and this one.
-  assert(Buffer.data() !=
-             SM.getMemoryBuffer(SM.FindBufferContainingLoc(
-                                    SMLoc::getFromPointer(Buffer.data())))
-                 ->getBufferStart() &&
-         "CHECK-SAME can't be the first check in a file");
-
   const char *FirstNewLine = nullptr;
   unsigned NumNewLines = CountNumNewlinesBetween(Buffer, FirstNewLine);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58784.190269.patch
Type: text/x-patch
Size: 1883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190312/99b4be2b/attachment.bin>


More information about the llvm-commits mailing list