Bug 1623957 - Part 11: Replace mozilla::IsEnum with std::is_enum. r=jwalden
authorAndré Bargull <andre.bargull@gmail.com>
Sat, 21 Mar 2020 14:25:24 +0000
changeset 520012 1079682d79674503220a89867e11308f88f90609
parent 520011 49efd8881aab338d6f6801629226c78ffc9ad702
child 520013 2b72c54537e7334275160f9fadcd3d6f12011cdb
push id110801
push usershindli@mozilla.com
push dateSat, 21 Mar 2020 15:31:45 +0000
treeherderautoland@61a44ad12b15 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs1623957
milestone76.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1623957 - Part 11: Replace mozilla::IsEnum with std::is_enum. r=jwalden Differential Revision: https://phabricator.services.mozilla.com/D67659
js/src/vm/Xdr.h
--- a/js/src/vm/Xdr.h
+++ b/js/src/vm/Xdr.h
@@ -4,17 +4,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef vm_Xdr_h
 #define vm_Xdr_h
 
 #include "mozilla/EndianUtils.h"
 #include "mozilla/MaybeOneOf.h"
-#include "mozilla/TypeTraits.h"
 #include "mozilla/Utf8.h"
 
 #include <type_traits>
 
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "NamespaceImports.h"
 
@@ -341,19 +340,17 @@ class XDRState : public XDRCoderBase {
   }
 
   /*
    * Use SFINAE to refuse any specialization which is not an enum.  Uses of
    * this function do not have to specialize the type of the enumerated field
    * as C++ will extract the parameterized from the argument list.
    */
   template <typename T>
-  XDRResult codeEnum32(
-      T* val,
-      std::enable_if_t<mozilla::IsEnum<T>::value>* = nullptr) {
+  XDRResult codeEnum32(T* val, std::enable_if_t<std::is_enum_v<T>>* = nullptr) {
     // Mix the enumeration value with a random magic number, such that a
     // corruption with a low-ranged value (like 0) is less likely to cause a
     // miss-interpretation of the XDR content and instead cause a failure.
     const uint32_t MAGIC = 0x21AB218C;
     uint32_t tmp;
     if (mode == XDR_ENCODE) {
       tmp = uint32_t(*val) ^ MAGIC;
     }