summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-11 19:21:09 +0000
committerChris Lattner <sabre@nondot.org>2009-07-11 19:21:09 +0000
commitd7073db1af89c0340eb81740beb78875d3c4a2f8 (patch)
tree725905a8d8285475db1da730f71a89c1194ba34a /utils
parent88a7e9ee8dd2f1d2f40cdb9c378f050e45161783 (diff)
downloadllvm-d7073db1af89c0340eb81740beb78875d3c4a2f8.tar.gz
llvm-d7073db1af89c0340eb81740beb78875d3c4a2f8.tar.bz2
llvm-d7073db1af89c0340eb81740beb78875d3c4a2f8.tar.xz
improve filecheck's "scanning from here" caret position.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75371 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/FileCheck/FileCheck.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/FileCheck/FileCheck.cpp b/utils/FileCheck/FileCheck.cpp
index 8c46f4b4ed..372b197843 100644
--- a/utils/FileCheck/FileCheck.cpp
+++ b/utils/FileCheck/FileCheck.cpp
@@ -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;