From d8a5541a513695039d1eb83eeced05d51ce9f567 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 29 Jan 2010 21:55:16 +0000 Subject: [PATCH] Skip whitespace when looking for a potential intended match. Before: :94:1: note: possible intended match here movsd 4096(%rsi), %xmm0 ^ After: :94:2: note: possible intended match here movsd 4096(%rsi), %xmm0 ^ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94847 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/FileCheck/FileCheck.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/FileCheck/FileCheck.cpp b/utils/FileCheck/FileCheck.cpp index 5b158fed8d3..ddc8dc2661c 100644 --- a/utils/FileCheck/FileCheck.cpp +++ b/utils/FileCheck/FileCheck.cpp @@ -382,6 +382,11 @@ void Pattern::PrintFailureInfo(const SourceMgr &SM, StringRef Buffer, if (Buffer[i] == '\n') ++NumLinesForward; + // Patterns have leading whitespace stripped, so skip whitespace when + // looking for something which looks like a pattern. + if (Buffer[i] == ' ' || Buffer[i] == '\t') + continue; + // Compute the "quality" of this match as an arbitrary combination of the // match distance and the number of lines skipped to get to this match. unsigned Distance = ComputeMatchDistance(Buffer.substr(i), VariableTable); -- 2.34.1