aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Host/common/FileSpec.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-11-30 16:08:45 +0000
committerPavel Labath <labath@google.com>2016-11-30 16:08:45 +0000
commite6e7e6c348843be148c428834eb424c439e5e617 (patch)
treec1acbe2e6150edf3d7000cf5507e00587fcfac6c /lldb/source/Host/common/FileSpec.cpp
parent5d92bc5bd91021cd591876983b7cbfc50be85cc0 (diff)
downloadllvm-e6e7e6c348843be148c428834eb424c439e5e617.zip
llvm-e6e7e6c348843be148c428834eb424c439e5e617.tar.gz
llvm-e6e7e6c348843be148c428834eb424c439e5e617.tar.bz2
Fix handling of consecutive slashes in FileSpec::GetNormalizedPath()
The core of the function was actually handling them correctly. However, the early exit was being too optimistic and did not give the function a chance to fire if the path did not contain dots as well. Fix that and add a couple of unit tests. llvm-svn: 288247
Diffstat (limited to 'lldb/source/Host/common/FileSpec.cpp')
-rw-r--r--lldb/source/Host/common/FileSpec.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp
index d958d8c..9287336 100644
--- a/lldb/source/Host/common/FileSpec.cpp
+++ b/lldb/source/Host/common/FileSpec.cpp
@@ -544,7 +544,8 @@ bool FileSpec::Equal(const FileSpec &a, const FileSpec &b, bool full,
FileSpec FileSpec::GetNormalizedPath() const {
// Fast path. Do nothing if the path is not interesting.
if (!m_directory.GetStringRef().contains(".") &&
- (m_filename.GetStringRef() != ".." && m_filename.GetStringRef() != "."))
+ !m_directory.GetStringRef().contains("//") &&
+ m_filename.GetStringRef() != ".." && m_filename.GetStringRef() != ".")
return *this;
llvm::SmallString<64> path, result;