summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility/FileSpec.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-11-28 13:48:05 +0100
committerPavel Labath <pavel@labath.sk>2019-11-28 14:33:25 +0100
commitb18e190b7ca90c09566382a039887f6eafe63d0d (patch)
treea3d6d534eaf02edd3e1261322633b3790aec9587 /lldb/source/Utility/FileSpec.cpp
parentbf716eb807409adf6490cb1cf595fb51efbd3fe6 (diff)
downloadbcm5719-llvm-b18e190b7ca90c09566382a039887f6eafe63d0d.tar.gz
bcm5719-llvm-b18e190b7ca90c09566382a039887f6eafe63d0d.zip
[lldb] refactor FileSpec::Equal
The logic of this function was quite hard to follow. Replace it with a much simpler, equivalent, implementation.
Diffstat (limited to 'lldb/source/Utility/FileSpec.cpp')
-rw-r--r--lldb/source/Utility/FileSpec.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp
index 88966843072..7fb6e9db72c 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::Style> FileSpec::GuessPathStyle(llvm::StringRef absolute_path) {
OpenPOWER on IntegriCloud