From b24957e22a965535d34f8f987c8b4b6ccfcd5f69 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Wed, 16 May 2018 18:25:51 +0000 Subject: Fix llvm::sys::path::remove_dots() to return "." instead of an empty path. Differential Revision: https://reviews.llvm.org/D46887 llvm-svn: 332508 --- llvm/lib/Support/Path.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/Support/Path.cpp') 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; } -- cgit v1.2.3