1 //===--- AlignedAllocation.h - Aligned Allocation ---------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 /// Defines a function that returns the minimum OS versions supporting
11 /// C++17's aligned allocation functions.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_BASIC_ALIGNED_ALLOCATION_H
16 #define LLVM_CLANG_BASIC_ALIGNED_ALLOCATION_H
18 #include "llvm/ADT/Triple.h"
19 #include "llvm/Support/ErrorHandling.h"
20 #include "llvm/Support/VersionTuple.h"
24 inline llvm::VersionTuple alignedAllocMinVersion(llvm::Triple::OSType OS) {
28 case llvm::Triple::Darwin:
29 case llvm::Triple::MacOSX: // Earliest supporting version is 10.14.
30 return llvm::VersionTuple(10U, 14U);
31 case llvm::Triple::IOS:
32 case llvm::Triple::TvOS: // Earliest supporting version is 11.0.0.
33 return llvm::VersionTuple(11U);
34 case llvm::Triple::WatchOS: // Earliest supporting version is 4.0.0.
35 return llvm::VersionTuple(4U);
38 llvm_unreachable("Unexpected OS");
41 } // end namespace clang
43 #endif // LLVM_CLANG_BASIC_ALIGNED_ALLOCATION_H