15
15
#define CPPINTEROP_CPPINTEROP_H
16
16
17
17
#include < cassert>
18
+ #include < cstddef>
18
19
#include < cstdint>
19
20
#include < set>
20
21
#include < string>
@@ -41,7 +42,7 @@ using TCppFuncAddr_t = void*;
41
42
using TInterp_t = void *;
42
43
using TCppObject_t = void *;
43
44
44
- enum Operator {
45
+ enum Operator : unsigned char {
45
46
OP_None,
46
47
OP_New,
47
48
OP_Delete,
@@ -90,7 +91,7 @@ enum Operator {
90
91
OP_Coawait,
91
92
};
92
93
93
- enum OperatorArity { kUnary = 1 , kBinary , kBoth };
94
+ enum OperatorArity : unsigned char { kUnary = 1 , kBinary , kBoth };
94
95
95
96
// / A class modeling function calls for functions produced by the interpreter
96
97
// / in compiled code. It provides an information if we are calling a standard
@@ -108,7 +109,7 @@ class JitCall {
108
109
void ** m_Args = nullptr ;
109
110
size_t m_ArgSize = 0 ;
110
111
// Clang struggles with =default...
111
- ArgList () : m_Args( nullptr ), m_ArgSize( 0 ) {}
112
+ ArgList () {}
112
113
ArgList (void ** Args, size_t ArgSize) : m_Args(Args), m_ArgSize(ArgSize) {}
113
114
};
114
115
// FIXME: Figure out how to unify the wrapper signatures.
@@ -122,13 +123,13 @@ class JitCall {
122
123
GenericCall m_GenericCall;
123
124
DestructorCall m_DestructorCall;
124
125
};
125
- const Kind m_Kind;
126
+ Kind m_Kind;
126
127
TCppConstFunction_t m_FD;
127
- JitCall () : m_Kind( kUnknown ), m_GenericCall( nullptr ), m_FD(nullptr ) {}
128
+ JitCall () : m_GenericCall( nullptr ), m_Kind( kUnknown ), m_FD(nullptr ) {}
128
129
JitCall (Kind K, GenericCall C, TCppConstFunction_t FD)
129
- : m_Kind(K ), m_GenericCall(C ), m_FD(FD) {}
130
+ : m_GenericCall(C ), m_Kind(K ), m_FD(FD) {}
130
131
JitCall (Kind K, DestructorCall C, TCppConstFunction_t Dtor)
131
- : m_Kind(K ), m_DestructorCall(C ), m_FD(Dtor) {}
132
+ : m_DestructorCall(C ), m_Kind(K ), m_FD(Dtor) {}
132
133
133
134
// / Checks if the passed arguments are valid for the given function.
134
135
CPPINTEROP_API bool AreArgumentsValid (void * result, ArgList args,
@@ -162,15 +163,19 @@ class JitCall {
162
163
// by default. These changes should be synchronized with the wrapper if we
163
164
// decide to directly.
164
165
void Invoke (void * result, ArgList args = {}, void * self = nullptr ) const {
166
+ // NOLINTBEGIN(*-type-union-access)
165
167
// Forward if we intended to call a dtor with only 1 parameter.
166
- if (m_Kind == kDestructorCall && result && !args.m_Args )
167
- return InvokeDestructor (result, /* nary=*/ 0UL , /* withFree=*/ true );
168
+ if (m_Kind == kDestructorCall && result && !args.m_Args ) {
169
+ InvokeDestructor (result, /* nary=*/ 0UL , /* withFree=*/ true );
170
+ return ;
171
+ }
168
172
169
173
#ifndef NDEBUG
170
174
assert (AreArgumentsValid (result, args, self) && " Invalid args!" );
171
175
ReportInvokeStart (result, args, self);
172
176
#endif // NDEBUG
173
177
m_GenericCall (self, args.m_ArgSize , args.m_Args , result);
178
+ // NOLINTEND(*-type-union-access)
174
179
}
175
180
// / Makes a call to a destructor.
176
181
// /\param[in] object - the pointer of the object whose destructor we call.
@@ -746,6 +751,7 @@ CPPINTEROP_API void GetAllCppNames(TCppScope_t scope,
746
751
747
752
CPPINTEROP_API void DumpScope (TCppScope_t scope);
748
753
754
+ // FIXME: Rework the GetDimensions and make this enum redundant.
749
755
namespace DimensionValue {
750
756
enum : long int {
751
757
UNKNOWN_SIZE = -1 ,
0 commit comments