[PATCH] D46887: Fix llvm::sys::path::remove_dots() to return "." instead of an empty path.
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 15 09:27:03 PDT 2018
labath added a comment.
As I said on the lldb patch, I believe this behavior makes more sense for a function like this (i.e., it should never return an invalid path ("") if the input path is valid, even if it means leaving some dots around. (We already keep a leading `../` component for the `remove_dot_dot=true` case as it is not possible to preserve the path semantics without this.)
================
Comment at: unittests/Support/Path.cpp:1166
remove_dots("././/foolz/wat", false, path::Style::posix));
- EXPECT_EQ("", remove_dots("./////", false, path::Style::posix));
+ EXPECT_EQ(".", remove_dots("./////", false, path::Style::posix));
----------------
Another interesting test here would be to make sure this does return an empty path when the input is also empty.
Repository:
rL LLVM
https://reviews.llvm.org/D46887
More information about the llvm-commits
mailing list