@@ -183,30 +183,32 @@ class CTypeInfo {
183
183
kUnwrappedApiObject ,
184
184
};
185
185
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.
189
189
};
190
190
191
191
static CTypeInfo FromWrapperType (const void * wrapper_type_info,
192
- ArgFlags flags = ArgFlags::None ) {
192
+ ArgFlags flags = ArgFlags::kNone ) {
193
193
uintptr_t wrapper_type_info_ptr =
194
194
reinterpret_cast <uintptr_t >(wrapper_type_info);
195
195
// Check that the lower kIsWrapperTypeBit bits are 0's.
196
196
CHECK_EQ (
197
197
wrapper_type_info_ptr & ~(static_cast <uintptr_t >(~0 )
198
198
<< static_cast <uintptr_t >(kIsWrapperTypeBit )),
199
- 0 );
199
+ 0u );
200
200
// TODO(mslekova): Refactor the manual bit manipulations to use
201
201
// PointerWithPayload instead.
202
- return CTypeInfo (wrapper_type_info_ptr | flags | kIsWrapperTypeBit );
202
+ return CTypeInfo (wrapper_type_info_ptr | static_cast <int >(flags) |
203
+ kIsWrapperTypeBit );
203
204
}
204
205
205
206
static constexpr CTypeInfo FromCType (Type ctype,
206
- ArgFlags flags = ArgFlags::None ) {
207
+ ArgFlags flags = ArgFlags::kNone ) {
207
208
// ctype cannot be Type::kUnwrappedApiObject.
208
209
return CTypeInfo (
209
- ((static_cast <uintptr_t >(ctype) << kTypeOffset ) & kTypeMask ) | flags);
210
+ ((static_cast <uintptr_t >(ctype) << kTypeOffset ) & kTypeMask ) |
211
+ static_cast <int >(flags));
210
212
}
211
213
212
214
const void * GetWrapperInfo () const ;
@@ -218,7 +220,9 @@ class CTypeInfo {
218
220
return static_cast <Type>((payload_ & kTypeMask ) >> kTypeOffset );
219
221
}
220
222
221
- constexpr bool IsArray () const { return payload_ & ArgFlags::IsArrayBit; }
223
+ constexpr bool IsArray () const {
224
+ return payload_ & static_cast <int >(ArgFlags::kIsArrayBit );
225
+ }
222
226
223
227
private:
224
228
explicit constexpr CTypeInfo (uintptr_t payload) : payload_(payload) {}
@@ -283,9 +287,6 @@ SUPPORTED_C_TYPES(SPECIALIZE_GET_C_TYPE_FOR)
283
287
template <typename T, typename = void >
284
288
struct EnableIfHasWrapperTypeInfo {};
285
289
286
- template <>
287
- struct EnableIfHasWrapperTypeInfo <void > {};
288
-
289
290
template <typename T>
290
291
struct EnableIfHasWrapperTypeInfo <T, decltype(WrapperTraits<T>::GetTypeInfo(),
291
292
void ())> {
@@ -297,7 +298,7 @@ template <typename T, typename = void>
297
298
struct GetCTypePointerImpl {
298
299
static constexpr CTypeInfo Get () {
299
300
return CTypeInfo::FromCType (GetCType<T>::Get ().GetType (),
300
- CTypeInfo::IsArrayBit );
301
+ CTypeInfo::ArgFlags:: kIsArrayBit );
301
302
}
302
303
};
303
304
@@ -321,7 +322,7 @@ struct GetCTypePointerPointerImpl<
321
322
T, typename EnableIfHasWrapperTypeInfo<T>::type> {
322
323
static constexpr CTypeInfo Get () {
323
324
return CTypeInfo::FromWrapperType (WrapperTraits<T>::GetTypeInfo (),
324
- CTypeInfo::IsArrayBit );
325
+ CTypeInfo::ArgFlags:: kIsArrayBit );
325
326
}
326
327
};
327
328
@@ -335,11 +336,12 @@ template <typename R, typename... Args>
335
336
class CFunctionInfoImpl : public CFunctionInfo {
336
337
public:
337
338
CFunctionInfoImpl ()
338
- : return_info_(i ::GetCType<R>::Get()),
339
+ : return_info_(internal ::GetCType<R>::Get()),
339
340
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." );
343
345
}
344
346
345
347
const CTypeInfo& ReturnInfo () const override { return return_info_; }
@@ -359,6 +361,8 @@ class CFunctionInfoImpl : public CFunctionInfo {
359
361
360
362
class V8_EXPORT CFunction {
361
363
public:
364
+ constexpr CFunction () : address_(nullptr ), type_info_(nullptr ) {}
365
+
362
366
const CTypeInfo& ReturnInfo () const { return type_info_->ReturnInfo (); }
363
367
364
368
const CTypeInfo& ArgumentInfo (unsigned int index) const {
0 commit comments