[llvm] 5b6ceaf - [Support] Use llvm::to_underlying (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 31 19:28:53 PDT 2023


Author: Kazu Hirata
Date: 2023-10-31T19:28:47-07:00
New Revision: 5b6ceaf8c325625bc291f97cd10dae5c51581f3c

URL: https://github.com/llvm/llvm-project/commit/5b6ceaf8c325625bc291f97cd10dae5c51581f3c
DIFF: https://github.com/llvm/llvm-project/commit/5b6ceaf8c325625bc291f97cd10dae5c51581f3c.diff

LOG: [Support] Use llvm::to_underlying (NFC)

Added: 
    

Modified: 
    llvm/include/llvm/Support/SwapByteOrder.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/SwapByteOrder.h b/llvm/include/llvm/Support/SwapByteOrder.h
index 18fd41ac5b04e49..e6d4c26838c6a79 100644
--- a/llvm/include/llvm/Support/SwapByteOrder.h
+++ b/llvm/include/llvm/Support/SwapByteOrder.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_SUPPORT_SWAPBYTEORDER_H
 #define LLVM_SUPPORT_SWAPBYTEORDER_H
 
+#include "llvm/ADT/STLForwardCompat.h"
 #include "llvm/ADT/bit.h"
 #include <cstdint>
 #include <type_traits>
@@ -53,8 +54,7 @@ inline double getSwappedBytes(double C) {
 
 template <typename T>
 inline std::enable_if_t<std::is_enum_v<T>, T> getSwappedBytes(T C) {
-  return static_cast<T>(
-      llvm::byteswap(static_cast<std::underlying_type_t<T>>(C)));
+  return static_cast<T>(llvm::byteswap(llvm::to_underlying(C)));
 }
 
 template<typename T>


        


More information about the llvm-commits mailing list