labath added a comment.

I was also thinking whether this behavior needs to be conditional. If nothing 
depends on this, then I'm all for changing the condition. However, my question 
is whether "." is the only path we should treat this way. I'm thinking it would 
be more consistent to give the root directory the same treatment too (so, 
`"/".RemoveLastComponent() == "/"`, `"//net".RemoveLastComponent()=="//net"`, 
etc). I guess you're unlikely to encounter an absolute path with less than two 
components in the path mappings, but it sounds like this is the behavior you 
would want there anyway.

Also, a test for the new behavior of the FileSpec function would be in order, 
as there are some interesting corner cases which I am not sure you get right 
(e.g, what is the value of `"foo".RemoveLastComponent()`?)



================
Comment at: source/Utility/FileSpec.cpp:796
   }
+  if (*this == FileSpec(".", false))
+    return;
----------------
This won't change the result of this particular comparison, but it's best to 
get in the habit of specifying the path syntax when constructing FileSpecs. 
"native" is not always the right choice.


https://reviews.llvm.org/D47495



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to