[all-commits] [llvm/llvm-project] 73c12a: [libcxx] Migrate posix_compat.h layer to not use C...

James Y Knight via All-commits all-commits at lists.llvm.org
Wed Jul 5 10:28:00 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 73c12a8ffc553eb0c40ecbb522c289314783344e
  Author: James Y Knight <jyknight at google.com>
  Date:   2023-07-05 (Wed, 05 Jul 2023)

  Changed paths:
    M libcxx/src/filesystem/file_descriptor.h
    M libcxx/src/filesystem/posix_compat.h

  Log Message:
  [libcxx] Migrate posix_compat.h layer to not use CRT filesystem functions.

Right now, the filesystem APIs _mostly_ use Win32 API calls, but a
small number of functions use CRT APIs instead. The semantics are
effectively the same, except for which sorts of error codes are
returned. We want to be consistent about returning only native Win32
error codes, as a prerequisite for https://reviews.llvm.org/D151493.

This change switches getcwd, chdir, and mkdir. It does _not_ switch
open/close, because there are difficulties around the use of C-runtime
file descriptor numbers. Instead, those two APIs are removed from
posix_compat.h, and the win32-specific code inlined into the
operations.cpp FileDescriptor class (with a TODO comment).

Reviewed By: #libc, mstorsjo, Mordante

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

More information about the All-commits mailing list