[all-commits] [llvm/llvm-project] e83e0c: [libcxx] Make filesystem::path::value_type wchar_t...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Fri Dec 18 01:30:13 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e83e0cac041bc071301f8399bb5c32b2529fc83f
      https://github.com/llvm/llvm-project/commit/e83e0cac041bc071301f8399bb5c32b2529fc83f
  Author: Martin Storsjö <martin at martin.st>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M libcxx/include/filesystem
    M libcxx/src/filesystem/filesystem_common.h
    M libcxx/src/filesystem/operations.cpp

  Log Message:
  -----------
  [libcxx] Make filesystem::path::value_type wchar_t on windows

Also set the preferred separator to backslash.

libc++ doesn't compile successfully for windows prior to this change,
and this change on its own isn't enough to make it compile successfully
either, but is the first stepping stone towards making it work correctly.

Most of operations.cpp will need to be touched, both for calling
functions that take wchar paths, but also for using other windows
specific functions instead of the posix functions used so far; that is
handled in later commits.

Changing parts of operations.cpp to generalize the string type handling
in code that doesn't touch system functions.

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


  Commit: 48c6500b5bfa60dfe6ca5f407fcdbf5ddff0c289
      https://github.com/llvm/llvm-project/commit/48c6500b5bfa60dfe6ca5f407fcdbf5ddff0c289
  Author: Martin Storsjö <martin at martin.st>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M libcxx/include/filesystem

  Log Message:
  -----------
  [libcxx] Reorder the two u8path functions, to make the following diff more readable. NFC.

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


  Commit: de698ae73444b5160dd6b8d768b30d6764be004e
      https://github.com/llvm/llvm-project/commit/de698ae73444b5160dd6b8d768b30d6764be004e
  Author: Martin Storsjö <martin at martin.st>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M libcxx/include/filesystem
    M libcxx/src/filesystem/filesystem_common.h
    M libcxx/src/filesystem/operations.cpp

  Log Message:
  -----------
  [libcxx] Convert paths to/from the right narrow code page for narrow strings on windows

On windows, the narrow, char based paths normally don't use utf8, but
can use many different native code pages, and this is what system
functions that operate on files, taking such paths/file names, interpret
them as.

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


  Commit: 156180727d6c347eda3ba749730707acb8a48093
      https://github.com/llvm/llvm-project/commit/156180727d6c347eda3ba749730707acb8a48093
  Author: Martin Storsjö <martin at martin.st>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M libcxx/src/filesystem/directory_iterator.cpp
    M libcxx/src/filesystem/filesystem_common.h
    M libcxx/src/filesystem/operations.cpp

  Log Message:
  -----------
  [libcxx] Fix the preexisting directory_iterator code for windows

The directory_iterator.cpp file did contain an incomplete,
non-working implementation for windows.

Change it to use the wchar version of the APIs.

Don't set the windows specific errors from GetLastError() as code
in the generic category; remap the errors to the std::errc values.

Error out cleanly on empty paths.

Invoke FindFirstFile on <directoryname>/* to actually list the
entries of the directory.

If the first entry retured by FindFirstFile is to be skipped (e.g.
being "." or ".."), call advance() (which calls FindNextFile and loops)
which doesn't return until a valid entry is found (or the end is
reached).

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


Compare: https://github.com/llvm/llvm-project/compare/569676c05725...156180727d6c


More information about the All-commits mailing list