Go to file
Pavel Labath d20289b31a [Support/Path] Make handling of paths like "///" consistent
Summary:
Various path functions were not treating paths consisting of slashes
alone consistently. For example, the iterator-based accessors decomposed the
path "///" into two elements: "/" and ".". This is not too bad, but it
is different from the behavior specified by posix:
```
A pathname that contains ***at least one non-slash character*** and that
ends with one or more trailing slashes shall be resolved as if a single
dot character ( '.' ) were appended to the pathname.
```
More importantly, this was different from how we treated the same path
in the filename+parent_path functions, which decomposed this path into
"." and "". This was completely wrong as it lost the information that
this was an absolute path which referred to the root directory.

This patch fixes this behavior by making sure all functions treat paths
consisting of (back)slashes alone the same way as "/". I.e., the
iterator-based functions will just report one component ("/"), and the
filename+parent_path will decompose them into "/" and "".

A slightly controversial topic here may be the treatment of "//". Posix
says that paths beginning with "//" may have special meaning and indeed
we have code which parses paths like "//net/foo/bar" specially. However,
as we were already not being consistent in parsing the "//" string
alone, and any special parsing for it would complicate the code further,
I chose to treat it the same way as longer sequences of slashes (which
are guaranteed to be the same as "/").

Another slight change of behavior is in the parsing of paths like
"//net//". Previously the last component of this path was ".". However,
as in our parsing the "//net" part in this path was the same as the
"drive" part in "c:\" and the next slash was the "root directory", it
made sense to treat "//net//" the same way as "//net/" (i.e., not to add
the extra "." component at the end).

Reviewers: zturner, rnk, dblaikie, Bigcheese

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D45942

llvm-svn: 331876
2018-05-09 13:21:16 +00:00
clang [OpenCL] Restrict various keywords in OpenCL C++ mode 2018-05-09 13:16:17 +00:00
clang-tools-extra Do not warn on unused parameters for functions with empty bodies. 2018-05-09 13:20:03 +00:00
compiler-rt [sanitizer] Remove unneeded blank lines 2018-05-09 00:44:26 +00:00
debuginfo-tests [Darwin] Specify DWARF 2/4 when running apple accelerator tests. 2018-02-26 20:56:45 +00:00
libclc remquo: Flush denormals if not supported 2018-05-03 05:44:28 +00:00
libcxx Revert "Emit an error when mixing <stdatomic.h> and <atomic>" 2018-05-08 22:50:35 +00:00
libcxxabi Fix test failure for missing _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS 2018-05-03 12:44:27 +00:00
libunwind [cmake] Remove duplicate command line options from build 2018-04-05 20:27:50 +00:00
lld [wasm] Update test for variables->retainedNodes rename. 2018-05-09 10:09:23 +00:00
lldb [DWARF] Align non-accelerated function fullname searching with the apple-tables path 2018-05-09 08:21:25 +00:00
llgo
llvm [Support/Path] Make handling of paths like "///" consistent 2018-05-09 13:21:16 +00:00
openmp [OMPT] Fix thread_num for implicit_task_end callbacks in nested parallel regions 2018-05-07 12:42:21 +00:00
parallel-libs
polly [test] Replace undef with true/false to make test case less fragile 2018-05-08 07:24:05 +00:00
README.md Add an svn project to contain the files that appear at the root of the 2017-10-19 21:09:49 +00:00

README.md

Low Level Virtual Machine (LLVM)

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.