This is an archive of the discontinued LLVM Phabricator instance.

[libc][NFC] Move the Linux file implementation to a subdirectory
ClosedPublic

Authored by jhuber6 on May 23 2023, 10:12 AM.

Details

Summary

This patch simply moves the special handling for linux files to a
subdirectory. This is done to make it easier in the future to extend
this support to targets (like the GPU) that will have different
dependencies.

Diff Detail

Event Timeline

jhuber6 created this revision.May 23 2023, 10:12 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 23 2023, 10:12 AM
jhuber6 requested review of this revision.May 23 2023, 10:12 AM
jhuber6 updated this revision to Diff 524825.May 23 2023, 11:56 AM

Return if the directory doesn't exist

lntue added inline comments.May 24 2023, 5:27 AM
libc/src/__support/File/CMakeLists.txt
37

Since the targets are moved to separate sub-folders, shall we drop the prefix ${LIBC_TARGET_OS}_ from the target name?

jhuber6 added inline comments.May 25 2023, 12:15 PM
libc/src/__support/File/CMakeLists.txt
37

We could, I was mostly just copying the interface from how we handle OSUtil.

lntue added inline comments.May 29 2023, 7:39 PM
libc/src/__support/File/CMakeLists.txt
37

Can you change it so that it matches other folders' structure?

jhuber6 added inline comments.May 29 2023, 7:40 PM
libc/src/__support/File/CMakeLists.txt
37

I thought that's what we have now. For something like OSUtil we have a linux/ subdirectory which provides linux_unit.

lntue added inline comments.May 29 2023, 8:03 PM
libc/src/__support/File/CMakeLists.txt
37

So for example you can see that in OSUtil, each sub-target has io.h or syscall.h instead of target_io.h or target_syscall.h

jhuber6 added inline comments.May 29 2023, 8:10 PM
libc/src/__support/File/CMakeLists.txt
37

Well the files are called file.cpp and dir.cpp, it's just the CMake target name that's different, I guess in the off-chance that we'd ever build two of these at one time, like there's a generic version or something.

lntue accepted this revision.May 29 2023, 9:17 PM
This revision is now accepted and ready to land.May 29 2023, 9:17 PM