[llvm] 93ab50a - [APInt] Replace enum with static constexpr member variables. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 17 22:19:09 PDT 2024


Author: Craig Topper
Date: 2024-08-17T22:18:35-07:00
New Revision: 93ab50ab3530d82579062fc471f5e91c42eacdde

URL: https://github.com/llvm/llvm-project/commit/93ab50ab3530d82579062fc471f5e91c42eacdde
DIFF: https://github.com/llvm/llvm-project/commit/93ab50ab3530d82579062fc471f5e91c42eacdde.diff

LOG: [APInt] Replace enum with static constexpr member variables. NFC

With C++17 we no longer need the enum to prevent ODR use.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/APInt.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 108df7e0eaeaa3..65ba3f15305c78 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -79,13 +79,11 @@ class [[nodiscard]] APInt {
 public:
   typedef uint64_t WordType;
 
-  /// This enum is used to hold the constants we needed for APInt.
-  enum : unsigned {
-    /// Byte size of a word.
-    APINT_WORD_SIZE = sizeof(WordType),
-    /// Bits in a word.
-    APINT_BITS_PER_WORD = APINT_WORD_SIZE * CHAR_BIT
-  };
+  /// Byte size of a word.
+  static constexpr unsigned APINT_WORD_SIZE = sizeof(WordType);
+
+  /// Bits in a word.
+  static constexpr unsigned APINT_BITS_PER_WORD = APINT_WORD_SIZE * CHAR_BIT;
 
   enum class Rounding {
     DOWN,


        


More information about the llvm-commits mailing list