[Lldb-commits] [PATCH] D47495: Support relative paths with less than two components in DBGSourcePathRemapping

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 30 01:28:54 PDT 2018


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





More information about the lldb-commits mailing list