From b18e190b7ca90c09566382a039887f6eafe63d0d Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Thu, 28 Nov 2019 13:48:05 +0100 Subject: [PATCH] [lldb] refactor FileSpec::Equal The logic of this function was quite hard to follow. Replace it with a much simpler, equivalent, implementation. --- lldb/source/Utility/FileSpec.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp index 8896684..7fb6e9d 100644 --- a/lldb/source/Utility/FileSpec.cpp +++ b/lldb/source/Utility/FileSpec.cpp @@ -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(); - - 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; + if (full || (a.GetDirectory() && b.GetDirectory())) + return a == b; - return a == b; + return a.FileEquals(b); } llvm::Optional FileSpec::GuessPathStyle(llvm::StringRef absolute_path) { -- 2.7.4