1515#define CPPINTEROP_CPPINTEROP_H
1616
1717#include < cassert>
18+ #include < cstddef>
1819#include < cstdint>
1920#include < set>
2021#include < string>
@@ -41,7 +42,7 @@ using TCppFuncAddr_t = void*;
4142using TInterp_t = void *;
4243using TCppObject_t = void *;
4344
44- enum Operator {
45+ enum Operator : unsigned char {
4546 OP_None,
4647 OP_New,
4748 OP_Delete,
@@ -90,7 +91,7 @@ enum Operator {
9091 OP_Coawait,
9192};
9293
93- enum OperatorArity { kUnary = 1 , kBinary , kBoth };
94+ enum OperatorArity : unsigned char { kUnary = 1 , kBinary , kBoth };
9495
9596// / A class modeling function calls for functions produced by the interpreter
9697// / in compiled code. It provides an information if we are calling a standard
@@ -108,7 +109,7 @@ class JitCall {
108109 void ** m_Args = nullptr ;
109110 size_t m_ArgSize = 0 ;
110111 // Clang struggles with =default...
111- ArgList () : m_Args( nullptr ), m_ArgSize( 0 ) {}
112+ ArgList () {}
112113 ArgList (void ** Args, size_t ArgSize) : m_Args(Args), m_ArgSize(ArgSize) {}
113114 };
114115 // FIXME: Figure out how to unify the wrapper signatures.
@@ -122,13 +123,13 @@ class JitCall {
122123 GenericCall m_GenericCall;
123124 DestructorCall m_DestructorCall;
124125 };
125- const Kind m_Kind;
126+ Kind m_Kind;
126127 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 ) {}
128129 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) {}
130131 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) {}
132133
133134 // / Checks if the passed arguments are valid for the given function.
134135 CPPINTEROP_API bool AreArgumentsValid (void * result, ArgList args,
@@ -162,15 +163,19 @@ class JitCall {
162163 // by default. These changes should be synchronized with the wrapper if we
163164 // decide to directly.
164165 void Invoke (void * result, ArgList args = {}, void * self = nullptr ) const {
166+ // NOLINTBEGIN(*-type-union-access)
165167 // 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+ }
168172
169173#ifndef NDEBUG
170174 assert (AreArgumentsValid (result, args, self) && " Invalid args!" );
171175 ReportInvokeStart (result, args, self);
172176#endif // NDEBUG
173177 m_GenericCall (self, args.m_ArgSize , args.m_Args , result);
178+ // NOLINTEND(*-type-union-access)
174179 }
175180 // / Makes a call to a destructor.
176181 // /\param[in] object - the pointer of the object whose destructor we call.
@@ -746,6 +751,7 @@ CPPINTEROP_API void GetAllCppNames(TCppScope_t scope,
746751
747752CPPINTEROP_API void DumpScope (TCppScope_t scope);
748753
754+ // FIXME: Rework the GetDimensions and make this enum redundant.
749755namespace DimensionValue {
750756enum : long int {
751757 UNKNOWN_SIZE = -1 ,
0 commit comments