summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Path.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-03-05 19:56:30 +0000
committerBen Langmuir <blangmuir@apple.com>2014-03-05 19:56:30 +0000
commit8d1163961293ae0d3bceb9d39693548824b59f18 (patch)
treed2a2ad200bb2c513c5a842ce7d5f32bc340eb1a5 /llvm/lib/Support/Path.cpp
parentd6ad741e5e78afb93b61abe9fb7c021702dab3d7 (diff)
downloadbcm5719-llvm-8d1163961293ae0d3bceb9d39693548824b59f18.tar.gz
bcm5719-llvm-8d1163961293ae0d3bceb9d39693548824b59f18.zip
Fix an inconsistency in treatment of trailing / in path::const_iterator
When using a //net/ path, we were transforming the trailing / into a '.' when the path was just the root path and we were iterating backwards. Forwards iteration and other kinds of root path (C:\, /) were already correct. llvm-svn: 202999
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r--llvm/lib/Support/Path.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index 1bd94a76faf..6fdad22158d 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/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 &&
OpenPOWER on IntegriCloud