mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-04 23:32:00 +00:00
FileCheck: When looking for "possible matches", only compare against the prefix
line. Turns out edit_distance can be slow if the string we are scanning for happens to be quite large. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94860 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ec2b1f1beb
commit
0806f9ff58
@ -340,7 +340,10 @@ unsigned Pattern::ComputeMatchDistance(StringRef Buffer,
|
||||
if (ExampleString.empty())
|
||||
ExampleString = RegExStr;
|
||||
|
||||
return Buffer.substr(0, ExampleString.size()).edit_distance(ExampleString);
|
||||
// Only compare up to the first line in the buffer, or the string size.
|
||||
StringRef BufferPrefix = Buffer.substr(0, ExampleString.size());
|
||||
BufferPrefix = BufferPrefix.split('\n').first;
|
||||
return BufferPrefix.edit_distance(ExampleString);
|
||||
}
|
||||
|
||||
void Pattern::PrintFailureInfo(const SourceMgr &SM, StringRef Buffer,
|
||||
|
Loading…
x
Reference in New Issue
Block a user