[lldb] Add ability to hide the root name of a value
[llvm-project.git] / flang / lib / Common / default-kinds.cpp
blob0c708fcd6050941589beaad58f1770dc374bf658
1 //===-- lib/Common/default-kinds.cpp --------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "flang/Common/default-kinds.h"
10 #include "flang/Common/idioms.h"
12 namespace Fortran::common {
14 IntrinsicTypeDefaultKinds::IntrinsicTypeDefaultKinds() {
15 #if __x86_64__
16 quadPrecisionKind_ = 10;
17 #endif
20 IntrinsicTypeDefaultKinds &IntrinsicTypeDefaultKinds::set_defaultIntegerKind(
21 int k) {
22 defaultIntegerKind_ = k;
23 return *this;
26 IntrinsicTypeDefaultKinds &IntrinsicTypeDefaultKinds::set_subscriptIntegerKind(
27 int k) {
28 subscriptIntegerKind_ = k;
29 return *this;
32 IntrinsicTypeDefaultKinds &IntrinsicTypeDefaultKinds::set_sizeIntegerKind(
33 int k) {
34 sizeIntegerKind_ = k;
35 return *this;
38 IntrinsicTypeDefaultKinds &IntrinsicTypeDefaultKinds::set_defaultRealKind(
39 int k) {
40 defaultRealKind_ = k;
41 return *this;
44 IntrinsicTypeDefaultKinds &IntrinsicTypeDefaultKinds::set_doublePrecisionKind(
45 int k) {
46 doublePrecisionKind_ = k;
47 return *this;
50 IntrinsicTypeDefaultKinds &IntrinsicTypeDefaultKinds::set_quadPrecisionKind(
51 int k) {
52 quadPrecisionKind_ = k;
53 return *this;
56 IntrinsicTypeDefaultKinds &IntrinsicTypeDefaultKinds::set_defaultCharacterKind(
57 int k) {
58 defaultCharacterKind_ = k;
59 return *this;
62 IntrinsicTypeDefaultKinds &IntrinsicTypeDefaultKinds::set_defaultLogicalKind(
63 int k) {
64 defaultLogicalKind_ = k;
65 return *this;
68 int IntrinsicTypeDefaultKinds::GetDefaultKind(TypeCategory category) const {
69 switch (category) {
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_;
79 default:
80 CRASH_NO_CASE;
81 return 0;
84 } // namespace Fortran::common