]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/Basic/AlignedAllocation.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / Basic / AlignedAllocation.h
1 //===--- AlignedAllocation.h - Aligned Allocation ---------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// Defines a function that returns the minimum OS versions supporting
12 /// C++17's aligned allocation functions.
13 ///
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_CLANG_BASIC_ALIGNED_ALLOCATION_H
17 #define LLVM_CLANG_BASIC_ALIGNED_ALLOCATION_H
18
19 #include "llvm/ADT/Triple.h"
20 #include "llvm/Support/ErrorHandling.h"
21 #include "llvm/Support/VersionTuple.h"
22
23 namespace clang {
24
25 inline llvm::VersionTuple alignedAllocMinVersion(llvm::Triple::OSType OS) {
26   switch (OS) {
27   default:
28     break;
29   case llvm::Triple::Darwin:
30   case llvm::Triple::MacOSX: // Earliest supporting version is 10.14.
31     return llvm::VersionTuple(10U, 14U);
32   case llvm::Triple::IOS:
33   case llvm::Triple::TvOS: // Earliest supporting version is 11.0.0.
34     return llvm::VersionTuple(11U);
35   case llvm::Triple::WatchOS: // Earliest supporting version is 4.0.0.
36     return llvm::VersionTuple(4U);
37   }
38
39   llvm_unreachable("Unexpected OS");
40 }
41
42 } // end namespace clang
43
44 #endif // LLVM_CLANG_BASIC_ALIGNED_ALLOCATION_H