summaryrefslogtreecommitdiff
path: root/lib/Support/Path.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Path.cpp')
-rw-r--r--lib/Support/Path.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp
index 1bd94a76fa..6fdad22158 100644
--- a/lib/Support/Path.cpp
+++ b/lib/Support/Path.cpp
@@ -307,21 +307,18 @@ const_iterator &const_iterator::operator++() {
}
const_iterator &const_iterator::operator--() {
- // If we're at the end and the previous char was a '/', return '.'.
+ // If we're at the end and the previous char was a '/', return '.' unless
+ // we are the root path.
+ size_t root_dir_pos = root_dir_start(Path);
if (Position == Path.size() &&
- Path.size() > 1 &&
- is_separator(Path[Position - 1])
-#ifdef LLVM_ON_WIN32
- && Path[Position - 2] != ':'
-#endif
- ) {
+ Path.size() > root_dir_pos + 1 &&
+ is_separator(Path[Position - 1])) {
--Position;
Component = ".";
return *this;
}
// Skip separators unless it's the root directory.
- size_t root_dir_pos = root_dir_start(Path);
size_t end_pos = Position;
while(end_pos > 0 &&