summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Path.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r--llvm/lib/Support/Path.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index ff41dd47c42..dfe9f470bab 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -726,6 +726,10 @@ static SmallString<256> remove_dots(StringRef path, bool remove_dot_dot,
SmallString<256> buffer = path::root_path(path, style);
for (StringRef C : components)
path::append(buffer, style, C);
+ // If the buffer is empty, then return ".". Many other path utilities
+ // do this so it seems to be an expected result.
+ if (buffer.empty())
+ buffer.append(1, '.');
return buffer;
}
OpenPOWER on IntegriCloud