LibreOffice Module bridges (master) 1
msvc_win32_arm64/abi.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sal/config.h>
21#include <sal/types.h>
22
23#include <cassert>
24
25#include "abi.hxx"
26
28{
34};
35
36static StructKind getStructKind(typelib_CompoundTypeDescription const* type)
37{
38 StructKind k = type->pBaseTypeDescription == 0 ? STRUCT_KIND_EMPTY
39 : getStructKind(type->pBaseTypeDescription);
40
41 for (sal_Int32 i = 0; i != type->nMembers; ++i)
42 {
44 switch (type->ppTypeRefs[i]->eTypeClass)
45 {
46 case typelib_TypeClass_BOOLEAN:
47 case typelib_TypeClass_BYTE:
48 case typelib_TypeClass_SHORT:
49 case typelib_TypeClass_UNSIGNED_SHORT:
50 case typelib_TypeClass_LONG:
51 case typelib_TypeClass_UNSIGNED_LONG:
52 case typelib_TypeClass_HYPER:
53 case typelib_TypeClass_UNSIGNED_HYPER:
54 case typelib_TypeClass_CHAR:
55 case typelib_TypeClass_ENUM:
56 k2 = STRUCT_KIND_POD;
57 break;
58 case typelib_TypeClass_FLOAT:
60 break;
61 case typelib_TypeClass_DOUBLE:
63 break;
64 case typelib_TypeClass_STRING:
65 case typelib_TypeClass_TYPE:
66 case typelib_TypeClass_ANY:
67 case typelib_TypeClass_SEQUENCE:
68 case typelib_TypeClass_INTERFACE:
70 break;
71 case typelib_TypeClass_STRUCT:
72 {
74 TYPELIB_DANGER_GET(&td, type->ppTypeRefs[i]);
75 k2 = getStructKind(reinterpret_cast<typelib_CompoundTypeDescription const*>(td));
76 TYPELIB_DANGER_RELEASE(td);
77 break;
78 }
79 default:
80 assert(false);
81 }
82 switch (k2)
83 {
85 // this means an empty sub-object, which nevertheless obtains a byte
86 // of storage (TODO: does it?), so the full object cannot be a
87 // homogeneous collection of float or double
88 case STRUCT_KIND_POD:
89 assert(k != STRUCT_KIND_DTOR);
91 break;
94 if (k == STRUCT_KIND_EMPTY)
95 {
96 k = k2;
97 }
98 else if (k != k2)
99 {
100 assert(k != STRUCT_KIND_DTOR);
101 k = STRUCT_KIND_POD;
102 }
103 break;
104 case STRUCT_KIND_DTOR:
105 return STRUCT_KIND_DTOR;
106 }
107 }
108 return k;
109}
110
112{
113 switch (type->eTypeClass)
114 {
115 default:
116 assert(false);
117 [[fallthrough]];
118 case typelib_TypeClass_VOID:
119 case typelib_TypeClass_BOOLEAN:
120 case typelib_TypeClass_BYTE:
121 case typelib_TypeClass_SHORT:
122 case typelib_TypeClass_UNSIGNED_SHORT:
123 case typelib_TypeClass_LONG:
124 case typelib_TypeClass_UNSIGNED_LONG:
125 case typelib_TypeClass_HYPER:
126 case typelib_TypeClass_UNSIGNED_HYPER:
127 case typelib_TypeClass_FLOAT:
128 case typelib_TypeClass_DOUBLE:
129 case typelib_TypeClass_CHAR:
130 case typelib_TypeClass_ENUM:
131 assert(type->nSize <= 16);
132 return RETURN_KIND_REG;
133 case typelib_TypeClass_STRING:
134 case typelib_TypeClass_TYPE:
135 case typelib_TypeClass_ANY:
136 case typelib_TypeClass_SEQUENCE:
137 case typelib_TypeClass_INTERFACE:
139 case typelib_TypeClass_STRUCT:
140 if (type->nSize > 16)
141 {
143 }
144 switch (getStructKind(reinterpret_cast<typelib_CompoundTypeDescription const*>(type)))
145 {
150 case STRUCT_KIND_DTOR:
152 default:
153 return RETURN_KIND_REG;
154 }
155 }
156}
157
158/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _typelib_TypeDescription typelib_TypeDescription
Definition: msvc/except.hxx:53
@ STRUCT_KIND_FLOAT
@ STRUCT_KIND_DTOR
@ STRUCT_KIND_DOUBLE
@ STRUCT_KIND_POD
@ STRUCT_KIND_EMPTY
ReturnKind getReturnKind(typelib_TypeDescription const *type)
static StructKind getStructKind(typelib_CompoundTypeDescription const *type)
@ RETURN_KIND_HFA_DOUBLE
@ RETURN_KIND_INDIRECT
@ RETURN_KIND_REG
@ RETURN_KIND_HFA_FLOAT
int i
ResultType type