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
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;
{"/foo/./bar", "/foo/bar"},
{"/foo/..", "/"},
{"/foo/.", "/foo"},
+ {"/foo//bar", "/foo/bar"},
+ {"/foo//bar/baz", "/foo/bar/baz"},
+ {"/foo//bar/./baz", "/foo/bar/baz"},
{"/./foo", "/foo"},
{"/", "/"},
{"//", "//"},