[llvm-commits] [llvm] r75371 - /llvm/trunk/utils/FileCheck/FileCheck.cpp

Chris Lattner sabre at nondot.org
Sat Jul 11 12:21:21 PDT 2009


Author: lattner
Date: Sat Jul 11 14:21:09 2009
New Revision: 75371

URL: http://llvm.org/viewvc/llvm-project?rev=75371&view=rev
Log:
improve filecheck's "scanning from here" caret position.

Modified:
    llvm/trunk/utils/FileCheck/FileCheck.cpp

Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=75371&r1=75370&r2=75371&view=diff

==============================================================================
--- llvm/trunk/utils/FileCheck/FileCheck.cpp (original)
+++ llvm/trunk/utils/FileCheck/FileCheck.cpp Sat Jul 11 14:21:09 2009
@@ -232,6 +232,17 @@
     // Otherwise, we have an error, emit an error message.
     SM.PrintMessage(CheckStr.second, "expected string not found in input",
                     "error");
+    
+    // Print the scanning from here line.  If the current position is at the end
+    // of a line, advance to the start of the next line.
+    const char *Scan = CurPtr;
+    while (Scan != BufferEnd &&
+           (*Scan == ' ' || *Scan == '\t'))
+      ++Scan;
+    if (*Scan == '\n' || *Scan == '\r')
+      CurPtr = Scan+1;
+    
+    
     SM.PrintMessage(SMLoc::getFromPointer(CurPtr), "scanning from here",
                     "note");
     return 1;





More information about the llvm-commits mailing list