[llvm] r231988 - Fix FileCheck: substr() expect the length of the string as 2nd arg

Mehdi Amini mehdi.amini at apple.com
Wed Mar 11 17:07:29 PDT 2015


Author: mehdi_amini
Date: Wed Mar 11 19:07:29 2015
New Revision: 231988

URL: http://llvm.org/viewvc/llvm-project?rev=231988&view=rev
Log:
Fix FileCheck: substr() expect the length of the string as 2nd arg

The code assumed that substr() was taking start,end while it takes
start,length.

From: Mehdi Amini <mehdi.amini at apple.com>

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=231988&r1=231987&r2=231988&view=diff
==============================================================================
--- llvm/trunk/utils/FileCheck/FileCheck.cpp (original)
+++ llvm/trunk/utils/FileCheck/FileCheck.cpp Wed Mar 11 19:07:29 2015
@@ -1053,7 +1053,6 @@ size_t CheckString::Check(const SourceMg
     PrintCheckFailed(SM, *this, MatchBuffer, VariableTable);
     return StringRef::npos;
   }
-  MatchPos += LastPos;
 
   // Similar to the above, in "label-scan mode" we can't yet handle CHECK-NEXT
   // or CHECK-NOT
@@ -1076,7 +1075,7 @@ size_t CheckString::Check(const SourceMg
       return StringRef::npos;
   }
 
-  return MatchPos;
+  return LastPos + MatchPos;
 }
 
 bool CheckString::CheckNext(const SourceMgr &SM, StringRef Buffer) const {





More information about the llvm-commits mailing list