|
| 1 | +/* |
| 2 | + * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +#include "TypeGraph.h" |
| 17 | + |
| 18 | +namespace type_graph { |
| 19 | + |
| 20 | +template <> |
| 21 | +Primitive* TypeGraph::make_type<Primitive>(Primitive::Kind kind) { |
| 22 | + switch (kind) { |
| 23 | + case Primitive::Kind::Int8: |
| 24 | + static Primitive pInt8{kind}; |
| 25 | + return &pInt8; |
| 26 | + case Primitive::Kind::Int16: |
| 27 | + static Primitive pInt16{kind}; |
| 28 | + return &pInt16; |
| 29 | + case Primitive::Kind::Int32: |
| 30 | + static Primitive pInt32{kind}; |
| 31 | + return &pInt32; |
| 32 | + case Primitive::Kind::Int64: |
| 33 | + static Primitive pInt64{kind}; |
| 34 | + return &pInt64; |
| 35 | + case Primitive::Kind::UInt8: |
| 36 | + static Primitive pUInt8{kind}; |
| 37 | + return &pUInt8; |
| 38 | + case Primitive::Kind::UInt16: |
| 39 | + static Primitive pUInt16{kind}; |
| 40 | + return &pUInt16; |
| 41 | + case Primitive::Kind::UInt32: |
| 42 | + static Primitive pUInt32{kind}; |
| 43 | + return &pUInt32; |
| 44 | + case Primitive::Kind::UInt64: |
| 45 | + static Primitive pUInt64{kind}; |
| 46 | + return &pUInt64; |
| 47 | + case Primitive::Kind::Float32: |
| 48 | + static Primitive pFloat32{kind}; |
| 49 | + return &pFloat32; |
| 50 | + case Primitive::Kind::Float64: |
| 51 | + static Primitive pFloat64{kind}; |
| 52 | + return &pFloat64; |
| 53 | + case Primitive::Kind::Float80: |
| 54 | + static Primitive pFloat80{kind}; |
| 55 | + return &pFloat80; |
| 56 | + case Primitive::Kind::Float128: |
| 57 | + static Primitive pFloat128{kind}; |
| 58 | + return &pFloat128; |
| 59 | + case Primitive::Kind::Bool: |
| 60 | + static Primitive pBool{kind}; |
| 61 | + return &pBool; |
| 62 | + case Primitive::Kind::UIntPtr: |
| 63 | + static Primitive pUIntPtr{kind}; |
| 64 | + return &pUIntPtr; |
| 65 | + case Primitive::Kind::Void: |
| 66 | + static Primitive pVoid{kind}; |
| 67 | + return &pVoid; |
| 68 | + } |
| 69 | +} |
| 70 | + |
| 71 | +} // namespace type_graph |
0 commit comments