| 1 | //===--- DirectX.cpp - Implement DirectX target feature support -----------===// |
|---|---|
| 2 | // |
| 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 |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file implements DirectX TargetInfo objects. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #include "DirectX.h" |
| 14 | #include "Targets.h" |
| 15 | #include "clang/Basic/TargetBuiltins.h" |
| 16 | |
| 17 | using namespace clang; |
| 18 | using namespace clang::targets; |
| 19 | |
| 20 | static constexpr int NumBuiltins = |
| 21 | clang::DirectX::LastTSBuiltin - Builtin::FirstTSBuiltin; |
| 22 | |
| 23 | #define GET_BUILTIN_STR_TABLE |
| 24 | #include "clang/Basic/BuiltinsDirectX.inc" |
| 25 | #undef GET_BUILTIN_STR_TABLE |
| 26 | |
| 27 | static constexpr Builtin::Info BuiltinInfos[] = { |
| 28 | #define GET_BUILTIN_INFOS |
| 29 | #include "clang/Basic/BuiltinsDirectX.inc" |
| 30 | #undef GET_BUILTIN_INFOS |
| 31 | }; |
| 32 | static_assert(std::size(BuiltinInfos) == NumBuiltins); |
| 33 | |
| 34 | void DirectXTargetInfo::getTargetDefines(const LangOptions &Opts, |
| 35 | MacroBuilder &Builder) const { |
| 36 | DefineStd(Builder, MacroName: "DIRECTX", Opts); |
| 37 | } |
| 38 | |
| 39 | llvm::SmallVector<Builtin::InfosShard> |
| 40 | DirectXTargetInfo::getTargetBuiltins() const { |
| 41 | return {{.Strings: &BuiltinStrings, .Infos: BuiltinInfos}}; |
| 42 | } |
| 43 |