improve filecheck's "scanning from here" caret position.
[oota-llvm.git] / utils / FileCheck / FileCheck.cpp
index 8c46f4b4edd997b85d7c8833ea957eb3b119aa0d..372b1978439c267dbb41588a940c6aa04437214b 100644 (file)
@@ -232,6 +232,17 @@ int main(int argc, char **argv) {
     // 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;