summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Path.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-02-11 21:16:35 +0000
committerZachary Turner <zturner@google.com>2015-02-11 21:16:35 +0000
commit3e76643a957a2ff569b19c96a61587b1895edc84 (patch)
tree61a8c82243e65622d1a9653af37dc8d8c2bbf037 /llvm/lib/Support/Path.cpp
parentd96652237741a9c010712772f1990d5b46d28f63 (diff)
downloadbcm5719-llvm-3e76643a957a2ff569b19c96a61587b1895edc84.tar.gz
bcm5719-llvm-3e76643a957a2ff569b19c96a61587b1895edc84.zip
Change Path::filename_pos() to skip the drive letter.
For Windows, filename_pos() tries to find the filename by searching for separators after the last :. Instead, it should really check for the only location that a : is valid, which is in the second character, and search for separators after that. llvm-svn: 228874
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r--llvm/lib/Support/Path.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index abec7b9dd22..3e0a4f5aab9 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -98,8 +98,11 @@ namespace {
size_t pos = str.find_last_of(separators, str.size() - 1);
#ifdef LLVM_ON_WIN32
- if (pos == StringRef::npos)
- pos = str.find_last_of(':', str.size() - 2);
+ if (pos == StringRef::npos) {
+ // Skip the drive letter, if one exists.
+ if (str.size() >= 2 && str[1] == ':')
+ pos = 2;
+ }
#endif
if (pos == StringRef::npos ||
OpenPOWER on IntegriCloud