diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp index 9410252ba3319..c8de2c0625aa2 100644 --- a/llvm/lib/Support/Path.cpp +++ b/llvm/lib/Support/Path.cpp @@ -104,7 +104,7 @@ namespace { if (is_style_windows(style)) { if (pos == StringRef::npos) - pos = str.find_last_of(':', str.size() - 2); + pos = str.find_last_of(':', str.size() - 1); } if (pos == StringRef::npos || (pos == 1 && is_separator(str[0], style))) diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp index a7b7e6a0f5044..837ca03216f87 100644 --- a/llvm/unittests/Support/Path.cpp +++ b/llvm/unittests/Support/Path.cpp @@ -190,6 +190,7 @@ TEST(Support, Path) { paths.push_back("c:\\foo\\"); paths.push_back("c:\\foo/"); paths.push_back("c:/foo\\bar"); + paths.push_back(":"); for (SmallVector::const_iterator i = paths.begin(), e = paths.end();