@@ -183,30 +183,32 @@ class CTypeInfo {
183183 kUnwrappedApiObject ,
184184 };
185185
186- enum ArgFlags : char {
187- None = 0 ,
188- IsArrayBit = 1 << 0 , // This argument is first in an array of values.
186+ enum class ArgFlags : uint8_t {
187+ kNone = 0 ,
188+ kIsArrayBit = 1 << 0 , // This argument is first in an array of values.
189189 };
190190
191191 static CTypeInfo FromWrapperType (const void * wrapper_type_info,
192- ArgFlags flags = ArgFlags::None ) {
192+ ArgFlags flags = ArgFlags::kNone ) {
193193 uintptr_t wrapper_type_info_ptr =
194194 reinterpret_cast <uintptr_t >(wrapper_type_info);
195195 // Check that the lower kIsWrapperTypeBit bits are 0's.
196196 CHECK_EQ (
197197 wrapper_type_info_ptr & ~(static_cast <uintptr_t >(~0 )
198198 << static_cast <uintptr_t >(kIsWrapperTypeBit )),
199- 0 );
199+ 0u );
200200 // TODO(mslekova): Refactor the manual bit manipulations to use
201201 // PointerWithPayload instead.
202- return CTypeInfo (wrapper_type_info_ptr | flags | kIsWrapperTypeBit );
202+ return CTypeInfo (wrapper_type_info_ptr | static_cast <int >(flags) |
203+ kIsWrapperTypeBit );
203204 }
204205
205206 static constexpr CTypeInfo FromCType (Type ctype,
206- ArgFlags flags = ArgFlags::None ) {
207+ ArgFlags flags = ArgFlags::kNone ) {
207208 // ctype cannot be Type::kUnwrappedApiObject.
208209 return CTypeInfo (
209- ((static_cast <uintptr_t >(ctype) << kTypeOffset ) & kTypeMask ) | flags);
210+ ((static_cast <uintptr_t >(ctype) << kTypeOffset ) & kTypeMask ) |
211+ static_cast <int >(flags));
210212 }
211213
212214 const void * GetWrapperInfo () const ;
@@ -218,7 +220,9 @@ class CTypeInfo {
218220 return static_cast <Type>((payload_ & kTypeMask ) >> kTypeOffset );
219221 }
220222
221- constexpr bool IsArray () const { return payload_ & ArgFlags::IsArrayBit; }
223+ constexpr bool IsArray () const {
224+ return payload_ & static_cast <int >(ArgFlags::kIsArrayBit );
225+ }
222226
223227 private:
224228 explicit constexpr CTypeInfo (uintptr_t payload) : payload_(payload) {}
@@ -283,9 +287,6 @@ SUPPORTED_C_TYPES(SPECIALIZE_GET_C_TYPE_FOR)
283287template <typename T, typename = void >
284288struct EnableIfHasWrapperTypeInfo {};
285289
286- template <>
287- struct EnableIfHasWrapperTypeInfo <void > {};
288-
289290template <typename T>
290291struct EnableIfHasWrapperTypeInfo <T, decltype (WrapperTraits<T>::GetTypeInfo(),
291292 void ())> {
@@ -297,7 +298,7 @@ template <typename T, typename = void>
297298struct GetCTypePointerImpl {
298299 static constexpr CTypeInfo Get () {
299300 return CTypeInfo::FromCType (GetCType<T>::Get ().GetType (),
300- CTypeInfo::IsArrayBit );
301+ CTypeInfo::ArgFlags:: kIsArrayBit );
301302 }
302303};
303304
@@ -321,7 +322,7 @@ struct GetCTypePointerPointerImpl<
321322 T, typename EnableIfHasWrapperTypeInfo<T>::type> {
322323 static constexpr CTypeInfo Get () {
323324 return CTypeInfo::FromWrapperType (WrapperTraits<T>::GetTypeInfo (),
324- CTypeInfo::IsArrayBit );
325+ CTypeInfo::ArgFlags:: kIsArrayBit );
325326 }
326327};
327328
@@ -335,11 +336,12 @@ template <typename R, typename... Args>
335336class CFunctionInfoImpl : public CFunctionInfo {
336337 public:
337338 CFunctionInfoImpl ()
338- : return_info_(i ::GetCType<R>::Get()),
339+ : return_info_(internal ::GetCType<R>::Get()),
339340 arg_count_ (sizeof ...(Args)),
340- arg_info_{i::GetCType<Args>::Get ()...} {
341- static_assert (i::GetCType<R>::Get ().GetType () == CTypeInfo::Type::kVoid ,
342- " Only void return types are currently supported." );
341+ arg_info_{internal::GetCType<Args>::Get ()...} {
342+ static_assert (
343+ internal::GetCType<R>::Get ().GetType () == CTypeInfo::Type::kVoid ,
344+ " Only void return types are currently supported." );
343345 }
344346
345347 const CTypeInfo& ReturnInfo () const override { return return_info_; }
@@ -359,6 +361,8 @@ class CFunctionInfoImpl : public CFunctionInfo {
359361
360362class V8_EXPORT CFunction {
361363 public:
364+ constexpr CFunction () : address_(nullptr ), type_info_(nullptr ) {}
365+
362366 const CTypeInfo& ReturnInfo () const { return type_info_->ReturnInfo (); }
363367
364368 const CTypeInfo& ArgumentInfo (unsigned int index) const {
0 commit comments