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

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 28 08:41:04 PDT 2016


labath created this revision.
labath added reviewers: clayborg, zturner.
labath added a subscriber: lldb-commits.

.. handling for windows path was completely broken because the function was
expecting \ as path separators, but we were passing it normalized file paths,
where these have been replaced by forward slashes. Apart from this, the function
was incorrect for posix paths as well in some corner cases, as well as being
generally hard to follow.

The corner cases were:

- /../bar -> should be same as /bar
- /bar/.. -> should be same as / (slightly dodgy as the former depends on /bar actually existing, but since we're doing it in an abstract way, I think the transformation is reasonable)

I rewrite the function to fix these corner cases and handle windows paths more
correctly. The function should now handle the posix paths (modulo symlinks, but
we cannot really do anything about that without a real filesystem). For windows
paths, there are a couple of corner cases left, mostly to do with drive letter
handling, which cannot be fixed until the rest of the class understands drive
letters better.


https://reviews.llvm.org/D26081

Files:
  include/lldb/Host/FileSpec.h
  source/Host/common/FileSpec.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  unittests/Host/FileSpecTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26081.76201.patch
Type: text/x-patch
Size: 10834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20161028/9678ffcc/attachment-0001.bin>


More information about the lldb-commits mailing list