Replace most TypeTraits with <type_traits> alternatives
Categories
(Core :: MFBT, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox76 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
Details
Attachments
(41 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
Bug 1625138 - Part 2: Replace mozilla::AddLvalueReference with std::add_lvalue_reference. r=froydnj!
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
TypeTraits which aren't handled in this bug:
IsDestructible
and the TypeTraits which are transitively used from it (DeclVal
,AddRvalueReference
,IsVoid
,FalseType
,TrueType
,RemoveCV
,IntegralConstant
,RemoveConst
,RemoveVolatile
). These can't be replaced with<type_traits>
until theMOZ_CAN_RUN_SCRIPT
checker has been updated to supportstd::is_destructible
. [1]EnableIf
: bug 1606962IsSame
: Has too many in-tree uses, should probably be handled in a separate bug.IsPod
: bug 900042
[1] Using std::is_destructible
reports the following errors on OSX:
[task 2020-03-25T18:39:52.026Z] 18:39:52 ERROR - /builds/worker/fetches/clang/bin/../include/c++/v1/type_traits:2225:51: error: arguments must all be strong refs or caller's parameters when calling a function marked as MOZ_CAN_RUN_SCRIPT (including the implicit object argument). '_VSTD::declval<_Tp1&>()' is neither.
[task 2020-03-25T18:39:52.026Z] 18:39:52 INFO - typename __is_destructible_apply<decltype(_VSTD::declval<_Tp1&>().~_Tp1())>::type
[task 2020-03-25T18:39:52.026Z] 18:39:52 INFO - ^~~~~~~~~~~~~~~~~~~~~~~
[task 2020-03-25T18:39:52.026Z] 18:39:52 INFO - /builds/worker/fetches/clang/bin/../include/c++/v1/__config:758:15: note: expanded from macro '_VSTD'
[task 2020-03-25T18:39:52.026Z] 18:39:52 INFO - #define _VSTD std::_LIBCPP_ABI_NAMESPACE
[task 2020-03-25T18:39:52.026Z] 18:39:52 INFO - ^
and
[task 2020-03-25T18:39:52.027Z] 18:39:52 ERROR - /builds/worker/fetches/clang/bin/../include/c++/v1/type_traits:2225:51: error: functions marked as MOZ_CAN_RUN_SCRIPT can only be called from functions also marked as MOZ_CAN_RUN_SCRIPT
[task 2020-03-25T18:39:52.029Z] 18:39:52 INFO - typename __is_destructible_apply<decltype(_VSTD::declval<_Tp1&>().~_Tp1())>::type
[task 2020-03-25T18:39:52.029Z] 18:39:52 INFO - ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[task 2020-03-25T18:39:52.029Z] 18:39:52 INFO - /builds/worker/fetches/clang/bin/../include/c++/v1/__config:758:15: note: expanded from macro '_VSTD'
[task 2020-03-25T18:39:52.029Z] 18:39:52 INFO - #define _VSTD std::_LIBCPP_ABI_NAMESPACE
[task 2020-03-25T18:39:52.029Z] 18:39:52 INFO - ^
Assignee | ||
Comment 1•3 years ago
|
||
Assignee | ||
Comment 2•3 years ago
|
||
Depends on D68355
Assignee | ||
Comment 3•3 years ago
|
||
Depends on D68356
Assignee | ||
Comment 4•3 years ago
|
||
Depends on D68357
Assignee | ||
Comment 5•3 years ago
|
||
Depends on D68358
Assignee | ||
Comment 6•3 years ago
|
||
Depends on D68359
Assignee | ||
Comment 7•3 years ago
|
||
Depends on D68360
Assignee | ||
Comment 8•3 years ago
|
||
Depends on D68361
Assignee | ||
Comment 9•3 years ago
|
||
Depends on D68362
Assignee | ||
Comment 10•3 years ago
|
||
Depends on D68363
Assignee | ||
Comment 11•3 years ago
|
||
Depends on D68364
Assignee | ||
Comment 12•3 years ago
|
||
Depends on D68365
Assignee | ||
Comment 13•3 years ago
|
||
Depends on D68366
Assignee | ||
Comment 14•3 years ago
|
||
Depends on D68368
Assignee | ||
Comment 15•3 years ago
|
||
Depends on D68369
Assignee | ||
Comment 16•3 years ago
|
||
Depends on D68370
Assignee | ||
Comment 17•3 years ago
|
||
Depends on D68371
Assignee | ||
Comment 18•3 years ago
|
||
Depends on D68372
Assignee | ||
Comment 19•3 years ago
|
||
Depends on D68373
Assignee | ||
Comment 20•3 years ago
|
||
Depends on D68374
Assignee | ||
Comment 21•3 years ago
|
||
Depends on D68375
Assignee | ||
Comment 22•3 years ago
|
||
Depends on D68376
Assignee | ||
Comment 23•3 years ago
|
||
Depends on D68377
Assignee | ||
Comment 24•3 years ago
|
||
Depends on D68378
Assignee | ||
Comment 25•3 years ago
|
||
Depends on D68379
Assignee | ||
Comment 26•3 years ago
|
||
Depends on D68380
Assignee | ||
Comment 27•3 years ago
|
||
(In reply to André Bargull [:anba] from comment #0)
TypeTraits which aren't handled in this bug:
IsDestructible
and the TypeTraits which are transitively used from it (DeclVal
,AddRvalueReference
,IsVoid
,FalseType
,TrueType
,RemoveCV
,IntegralConstant
,RemoveConst
,RemoveVolatile
). These can't be replaced with<type_traits>
until theMOZ_CAN_RUN_SCRIPT
checker has been updated to supportstd::is_destructible
. [1]IsSame
: Has too many in-tree uses, should probably be handled in a separate bug.
So, it looks like it's possible to replace mozilla::DeclVal
with std::declval
in mozilla::IsDestructible
without triggering bug 1625152. That means we can actually also replace DeclVal
, AddRvalueReference
, IsVoid
, FalseType
, TrueType
, RemoveCV
, IntegralConstant
, RemoveConst
, RemoveVolatile
with their <type_traits>
alternatives. But when those are also replaced, I'll handle IsSame
here, too, for the sake of completeness.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 28•3 years ago
|
||
Depends on D68401
Assignee | ||
Comment 29•3 years ago
|
||
Depends on D68545
Assignee | ||
Comment 30•3 years ago
|
||
Depends on D68546
Assignee | ||
Comment 31•3 years ago
|
||
Depends on D68547
Assignee | ||
Comment 32•3 years ago
|
||
Depends on D68548
Assignee | ||
Comment 33•3 years ago
|
||
Depends on D68549
Assignee | ||
Comment 34•3 years ago
|
||
Depends on D68551
Assignee | ||
Comment 35•3 years ago
|
||
Depends on D68552
Assignee | ||
Comment 36•3 years ago
|
||
Depends on D68553
Assignee | ||
Comment 37•3 years ago
|
||
Depends on D68554
Assignee | ||
Comment 38•3 years ago
|
||
Depends on D68555
Assignee | ||
Comment 39•3 years ago
|
||
Depends on D68556
Assignee | ||
Comment 40•3 years ago
|
||
Depends on D68557
Assignee | ||
Comment 41•3 years ago
|
||
Depends on D68558
Assignee | ||
Comment 42•3 years ago
|
||
Also adds missing includes in some files, these were previously only transivitely
included through mozilla/TypeTraits.h.
Depends on D68560
Comment 45•3 years ago
|
||
Pushed by dvarga@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/733dde3fe35b Part 1: Replace mozilla::MakeSigned with std::make_signed. r=froydnj https://hg.mozilla.org/integration/autoland/rev/112b7ff16977 Part 2: Replace mozilla::AddLvalueReference with std::add_lvalue_reference. r=froydnj https://hg.mozilla.org/integration/autoland/rev/f1c42129fb0b Part 3: Replace mozilla::IsEmpty with std::is_empty. r=froydnj https://hg.mozilla.org/integration/autoland/rev/54f1de92d76e Part 4: Replace mozilla::MakeUnsigned with std::make_unsigned. r=froydnj https://hg.mozilla.org/integration/autoland/rev/847189efca00 Part 5: Replace mozilla::IsDefaultConstructible with std::is_default_constructible. r=froydnj https://hg.mozilla.org/integration/autoland/rev/ae96b293b960 Part 6: Replace mozilla::IsClass with std::is_class. r=froydnj https://hg.mozilla.org/integration/autoland/rev/a68131de6bea Part 7: Replace mozilla::IsScalar with std::is_scalar. r=froydnj https://hg.mozilla.org/integration/autoland/rev/463d286fcce9 Part 8: Replace mozilla::IsMemberPointer with std::is_member_pointer. r=froydnj https://hg.mozilla.org/integration/autoland/rev/14d9ef35878e Part 9: Replace mozilla::IsArithmetic with std::is_arithmetic. r=froydnj https://hg.mozilla.org/integration/autoland/rev/9156b33cd5ef Part 10: Replace mozilla::IsEnum with std::is_enum. r=froydnj https://hg.mozilla.org/integration/autoland/rev/f53bdabacea4 Part 11: Replace mozilla::IsConst with std::is_const. r=froydnj https://hg.mozilla.org/integration/autoland/rev/ca9941c7dc19 Part 12: Replace mozilla::IsPointer with std::is_pointer. r=froydnj https://hg.mozilla.org/integration/autoland/rev/4dd33e11fc70 Part 13: Replace mozilla::IsUnsigned with std::is_unsigned. r=froydnj https://hg.mozilla.org/integration/autoland/rev/05ebb33de1f9 Part 14: Replace mozilla::IsSigned with std::is_signed. r=froydnj https://hg.mozilla.org/integration/autoland/rev/83a01c8c31c7 Part 15: Replace mozilla::IsFloatingPoint with std::is_floating_point. r=froydnj https://hg.mozilla.org/integration/autoland/rev/8bbf59d19fa0 Part 16: Replace mozilla::IsIntegral with std::is_integral. r=froydnj https://hg.mozilla.org/integration/autoland/rev/1717b0704c0e Part 17: Replace mozilla::Decay with std::decay. r=froydnj https://hg.mozilla.org/integration/autoland/rev/c69047027239 Part 18: Replace mozilla::AddPointer with std::add_pointer. r=froydnj https://hg.mozilla.org/integration/autoland/rev/075f2316d9dd Part 19: Replace mozilla::RemoveExtent with std::remove_extent. r=froydnj https://hg.mozilla.org/integration/autoland/rev/fe17133c853f Part 20: Replace mozilla::IsVolatile with std::is_volatile. r=froydnj https://hg.mozilla.org/integration/autoland/rev/71ed5558e930 Part 21: Replace mozilla::IsFunction with std::is_function. r=froydnj https://hg.mozilla.org/integration/autoland/rev/ba1a4349471c Part 22: Replace mozilla::IsArray with std::is_array. r=froydnj https://hg.mozilla.org/integration/autoland/rev/056c1df81242 Part 23: Replace mozilla::RemovePointer with std::remove_pointer. r=froydnj https://hg.mozilla.org/integration/autoland/rev/d9345db452b3 Part 24: Replace mozilla::IsConvertible with std::is_convertible. r=froydnj https://hg.mozilla.org/integration/autoland/rev/1b923628c0e3 Part 25: Replace mozilla::RemoveReference with std::remove_reference. r=froydnj,jgilbert https://hg.mozilla.org/integration/autoland/rev/c12439823ae9 Part 26: Replace mozilla::Conditional with std::conditional. r=froydnj https://hg.mozilla.org/integration/autoland/rev/79be64101af3 Part 27: Replace mozilla::DeclVal with std::declval. r=froydnj https://hg.mozilla.org/integration/autoland/rev/f7c195e843e1 Part 28: Replace mozilla::AddRvalueReference with std::add_rvalue_reference. r=froydnj https://hg.mozilla.org/integration/autoland/rev/d62b8cbbb055 Part 30: Replace mozilla::RemoveCV with std::remove_cv. r=froydnj,jgilbert https://hg.mozilla.org/integration/autoland/rev/323db95684b7 Part 29: Replace mozilla::IsVoid with std::is_void. r=froydnj https://hg.mozilla.org/integration/autoland/rev/10643b2c4d6b Part 31: Replace mozilla::RemoveVolatile with std::remove_volatile. r=froydnj https://hg.mozilla.org/integration/autoland/rev/8e597f5deb77 Part 32: Replace mozilla::RemoveConst with std::remove_const. r=froydnj https://hg.mozilla.org/integration/autoland/rev/53733a2a5f06 Part 33: Replace mozilla::IntegralConstant with std::integral_constant. r=froydnj https://hg.mozilla.org/integration/autoland/rev/215f8c06c6d7 Part 34: Replace mozilla::FalseType with std::false_type. r=froydnj https://hg.mozilla.org/integration/autoland/rev/d1c40df1a74b Part 35: Replace mozilla::TrueType with std::true_type. r=froydnj,jgilbert https://hg.mozilla.org/integration/autoland/rev/a62dff0a7b04 Part 36: Replace mozilla::IsSame with std::is_same in mfbt/. r=froydnj https://hg.mozilla.org/integration/autoland/rev/3c82c7e7eb60 Part 37: Replace mozilla::IsSame with std::is_same in xpcom/. r=froydnj https://hg.mozilla.org/integration/autoland/rev/85b79a5f1f0b Part 38: Replace mozilla::IsSame with std::is_same in dom/. r=froydnj https://hg.mozilla.org/integration/autoland/rev/cbee2c2ada09 Part 39: Replace mozilla::IsSame with std::is_same in gfx/. r=froydnj https://hg.mozilla.org/integration/autoland/rev/43badf8b568e Part 40: Replace remaining mozilla::IsSame with std::is_same. r=froydnj https://hg.mozilla.org/integration/autoland/rev/29693da8f958 Part 41: Remove no longer needed includes for mozilla/TypeTraits. r=froydnj
Comment 46•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/733dde3fe35b
https://hg.mozilla.org/mozilla-central/rev/112b7ff16977
https://hg.mozilla.org/mozilla-central/rev/f1c42129fb0b
https://hg.mozilla.org/mozilla-central/rev/54f1de92d76e
https://hg.mozilla.org/mozilla-central/rev/847189efca00
https://hg.mozilla.org/mozilla-central/rev/ae96b293b960
https://hg.mozilla.org/mozilla-central/rev/a68131de6bea
https://hg.mozilla.org/mozilla-central/rev/463d286fcce9
https://hg.mozilla.org/mozilla-central/rev/14d9ef35878e
https://hg.mozilla.org/mozilla-central/rev/9156b33cd5ef
https://hg.mozilla.org/mozilla-central/rev/f53bdabacea4
https://hg.mozilla.org/mozilla-central/rev/ca9941c7dc19
https://hg.mozilla.org/mozilla-central/rev/4dd33e11fc70
https://hg.mozilla.org/mozilla-central/rev/05ebb33de1f9
https://hg.mozilla.org/mozilla-central/rev/83a01c8c31c7
https://hg.mozilla.org/mozilla-central/rev/8bbf59d19fa0
https://hg.mozilla.org/mozilla-central/rev/1717b0704c0e
https://hg.mozilla.org/mozilla-central/rev/c69047027239
https://hg.mozilla.org/mozilla-central/rev/075f2316d9dd
https://hg.mozilla.org/mozilla-central/rev/fe17133c853f
https://hg.mozilla.org/mozilla-central/rev/71ed5558e930
https://hg.mozilla.org/mozilla-central/rev/ba1a4349471c
https://hg.mozilla.org/mozilla-central/rev/056c1df81242
https://hg.mozilla.org/mozilla-central/rev/d9345db452b3
https://hg.mozilla.org/mozilla-central/rev/1b923628c0e3
https://hg.mozilla.org/mozilla-central/rev/c12439823ae9
https://hg.mozilla.org/mozilla-central/rev/79be64101af3
https://hg.mozilla.org/mozilla-central/rev/f7c195e843e1
https://hg.mozilla.org/mozilla-central/rev/d62b8cbbb055
https://hg.mozilla.org/mozilla-central/rev/323db95684b7
https://hg.mozilla.org/mozilla-central/rev/10643b2c4d6b
https://hg.mozilla.org/mozilla-central/rev/8e597f5deb77
https://hg.mozilla.org/mozilla-central/rev/53733a2a5f06
https://hg.mozilla.org/mozilla-central/rev/215f8c06c6d7
https://hg.mozilla.org/mozilla-central/rev/d1c40df1a74b
https://hg.mozilla.org/mozilla-central/rev/a62dff0a7b04
https://hg.mozilla.org/mozilla-central/rev/3c82c7e7eb60
https://hg.mozilla.org/mozilla-central/rev/85b79a5f1f0b
https://hg.mozilla.org/mozilla-central/rev/cbee2c2ada09
https://hg.mozilla.org/mozilla-central/rev/43badf8b568e
https://hg.mozilla.org/mozilla-central/rev/29693da8f958
![]() |
||
Comment 47•3 years ago
|
||
Thank you for doing this, anba!
Description
•