Don't treat .foo as two path components in path::iterators

We were treating '/.foo' as ['/', '.', 'foo'] instead of ['/', '.foo'],
which lead to insanity.  Same for '..'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231727 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ben Langmuir
2015-03-10 00:04:29 +00:00
parent 8829ba195c
commit 5cb5adbe01
2 changed files with 43 additions and 7 deletions

View File

@ -49,7 +49,6 @@ namespace {
// * empty (in this case we return an empty string)
// * either C: or {//,\\}net.
// * {/,\}
// * {.,..}
// * {file,directory}name
if (path.empty())
@ -76,12 +75,6 @@ namespace {
if (is_separator(path[0]))
return path.substr(0, 1);
if (path.startswith(".."))
return path.substr(0, 2);
if (path[0] == '.')
return path.substr(0, 1);
// * {file,directory}name
size_t end = path.find_first_of(separators);
return path.substr(0, end);