1 //===-- lib/Common/default-kinds.cpp --------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "flang/Common/default-kinds.h"
10 #include "flang/Common/idioms.h"
12 namespace Fortran::common
{
14 IntrinsicTypeDefaultKinds::IntrinsicTypeDefaultKinds() {
16 quadPrecisionKind_
= 10;
20 IntrinsicTypeDefaultKinds
&IntrinsicTypeDefaultKinds::set_defaultIntegerKind(
22 defaultIntegerKind_
= k
;
26 IntrinsicTypeDefaultKinds
&IntrinsicTypeDefaultKinds::set_subscriptIntegerKind(
28 subscriptIntegerKind_
= k
;
32 IntrinsicTypeDefaultKinds
&IntrinsicTypeDefaultKinds::set_sizeIntegerKind(
38 IntrinsicTypeDefaultKinds
&IntrinsicTypeDefaultKinds::set_defaultRealKind(
44 IntrinsicTypeDefaultKinds
&IntrinsicTypeDefaultKinds::set_doublePrecisionKind(
46 doublePrecisionKind_
= k
;
50 IntrinsicTypeDefaultKinds
&IntrinsicTypeDefaultKinds::set_quadPrecisionKind(
52 quadPrecisionKind_
= k
;
56 IntrinsicTypeDefaultKinds
&IntrinsicTypeDefaultKinds::set_defaultCharacterKind(
58 defaultCharacterKind_
= k
;
62 IntrinsicTypeDefaultKinds
&IntrinsicTypeDefaultKinds::set_defaultLogicalKind(
64 defaultLogicalKind_
= k
;
68 int IntrinsicTypeDefaultKinds::GetDefaultKind(TypeCategory category
) const {
70 case TypeCategory::Integer
:
71 return defaultIntegerKind_
;
72 case TypeCategory::Real
:
73 case TypeCategory::Complex
:
74 return defaultRealKind_
;
75 case TypeCategory::Character
:
76 return defaultCharacterKind_
;
77 case TypeCategory::Logical
:
78 return defaultLogicalKind_
;
84 } // namespace Fortran::common