[Lldb-commits] [PATCH] D26081: Improve ".." handling in FileSpec normalization

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 31 09:27:03 PDT 2016


labath added inline comments.


================
Comment at: source/Host/common/FileSpec.cpp:550
+      (m_filename.GetStringRef() != ".." && m_filename.GetStringRef() != "."))
+    return *this;
 
----------------
amccarth wrote:
> Do we have to worry about an unnecessary single dot in the directory, like `/foo/./bar/`?  Are those handled when the FileSpec is constructed?
Good catch. The fast path was too optimistic. I've replaced it with a much more conservative one. It can be beefed up, if we find that this is actually a performance problem.


================
Comment at: unittests/Host/FileSpecTest.cpp:144
       {R"(C:\bar)", R"(C:\foo\..\bar)"},
   };
 
----------------
amccarth wrote:
> How about a test to make sure `C:/foo/./bar` is the same as `C:/foo/bar`?
I added a bunch more tests with single dots in various places. If you see more interesting corner cases, let me know.


https://reviews.llvm.org/D26081





More information about the lldb-commits mailing list