Skip to content

Commit 9e9edb5

Browse files
[CAS] Fix build for older macOS SDK (before 13.0) (#159133)
Fix a build failure and back-deployment problem for macOS before 13.0.
1 parent 0648c51 commit 9e9edb5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

llvm/lib/CAS/OnDiskCommon.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ Expected<size_t> cas::ondisk::preallocateFileTail(int FD, size_t CurrentSize,
105105
return NewSize;
106106
#elif defined(__APPLE__)
107107
fstore_t FAlloc;
108-
FAlloc.fst_flags = F_ALLOCATEALL | F_ALLOCATEPERSIST;
108+
FAlloc.fst_flags = F_ALLOCATEALL;
109+
#if defined(F_ALLOCATEPERSIST) && \
110+
defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
111+
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 130000
112+
// F_ALLOCATEPERSIST is introduced in macOS 13.
113+
FAlloc.fst_flags |= F_ALLOCATEPERSIST;
114+
#endif
109115
FAlloc.fst_posmode = F_PEOFPOSMODE;
110116
FAlloc.fst_offset = 0;
111117
FAlloc.fst_length = NewSize - CurrentSize;

0 commit comments

Comments
 (0)