From: Daniel Dunbar Date: Sun, 29 Nov 2009 08:30:24 +0000 (+0000) Subject: Fix FileCheck crash when fuzzy scanning starting at the end of the file. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=a76a7883b557c315f29dbf95155dd5ae0352fecf;p=oota-llvm.git Fix FileCheck crash when fuzzy scanning starting at the end of the file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90065 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/FileCheck/FileCheck.cpp b/utils/FileCheck/FileCheck.cpp index 101ff248808..078028a115c 100644 --- a/utils/FileCheck/FileCheck.cpp +++ b/utils/FileCheck/FileCheck.cpp @@ -398,7 +398,7 @@ void Pattern::PrintFailureInfo(const SourceMgr &SM, StringRef Buffer, } } - if (BestQuality < 50) { + if (Best != StringRef::npos && BestQuality < 50) { // Print the "possible intended match here" line if we found something // reasonable. SM.PrintMessage(SMLoc::getFromPointer(Buffer.data() + Best),