[Lldb-commits] [PATCH] D46783: FileSpec objects that resolve to "." should have "." in m_filename and m_directory empty.

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue May 15 08:22:56 PDT 2018

labath added a comment.

In https://reviews.llvm.org/D46783#1099561, @clayborg wrote:

> So the function in llvm is called llvm::sys::path::remove_dots(...) and it is removing the dots. Not sure it is correct to be changing a function that says "remove_dots" to not remove dots and actually return something with a . in it... Seems like this should be taken care of in LLDB. Thoughts?

That's kinda true, but I think this is a corner case that the author simply didn't think of when writing that function. Even though it is not mentioned anywhere, I think that a part of the contract of that function is that it returns a *valid* path, which is *equivalent* to the input path. "" is neither valid nor equivalent to ".", so I think this should trump the desire to remove all dots. I don't think any user would want the current behavior.

In fact when you look at the function description, it speaks about removing "./" components. "." does not have a "./" component.

So yes, I still believe the place for this is in the `remove_dots` function. Feel free to add me to the llvm patch, and I'll help you argue the case. If it turns out that present behavior is actually desired/depended on by somebody, then we can do it on our side, but I expect this is just a bug/corner case that nobody cared for until now.


More information about the lldb-commits mailing list