forked from OSchip/llvm-project
[lldb] refactor FileSpec::Equal
The logic of this function was quite hard to follow. Replace it with a much simpler, equivalent, implementation.
This commit is contained in:
parent
bf716eb807
commit
b18e190b7c
|
@ -302,20 +302,10 @@ int FileSpec::Compare(const FileSpec &a, const FileSpec &b, bool full) {
|
|||
}
|
||||
|
||||
bool FileSpec::Equal(const FileSpec &a, const FileSpec &b, bool full) {
|
||||
// case sensitivity of equality test
|
||||
const bool case_sensitive = a.IsCaseSensitive() || b.IsCaseSensitive();
|
||||
if (full || (a.GetDirectory() && b.GetDirectory()))
|
||||
return a == b;
|
||||
|
||||
const bool filenames_equal = ConstString::Equals(a.m_filename,
|
||||
b.m_filename,
|
||||
case_sensitive);
|
||||
|
||||
if (!filenames_equal)
|
||||
return false;
|
||||
|
||||
if (!full && (a.GetDirectory().IsEmpty() || b.GetDirectory().IsEmpty()))
|
||||
return filenames_equal;
|
||||
|
||||
return a == b;
|
||||
return a.FileEquals(b);
|
||||
}
|
||||
|
||||
llvm::Optional<FileSpec::Style> FileSpec::GuessPathStyle(llvm::StringRef absolute_path) {
|
||||
|
|
Loading…
Reference in New Issue