diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-11 19:21:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-11 19:21:09 +0000 |
commit | 0029c0e57a3a0c7a2e88264cad19237e3798b366 (patch) | |
tree | 123531cd9cc1fd2a50105e467632855a0b4bb004 /llvm/utils/FileCheck/FileCheck.cpp | |
parent | 2c3e5cdf3d5f091977a148eac28cf442e5f1f175 (diff) | |
download | bcm5719-llvm-0029c0e57a3a0c7a2e88264cad19237e3798b366.tar.gz bcm5719-llvm-0029c0e57a3a0c7a2e88264cad19237e3798b366.zip |
improve filecheck's "scanning from here" caret position.
llvm-svn: 75371
Diffstat (limited to 'llvm/utils/FileCheck/FileCheck.cpp')
-rw-r--r-- | llvm/utils/FileCheck/FileCheck.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp index 8c46f4b4edd..372b1978439 100644 --- a/llvm/utils/FileCheck/FileCheck.cpp +++ b/llvm/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; |