[llvm] r281054 - Attempt to fix static_asserts in SelectionDAGNodes.h that MSVC chokes on.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 09:29:13 PDT 2016


Author: jlebar
Date: Fri Sep  9 11:29:13 2016
New Revision: 281054

URL: http://llvm.org/viewvc/llvm-project?rev=281054&view=rev
Log:
Attempt to fix static_asserts in SelectionDAGNodes.h that MSVC chokes on.

These were added in r281051, which, I am embarrassed to admit, has an
incomplete commit message that I forgot to update before pushing.  You
can ignore element (2) in that list.

Modified:
    llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h

Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=281054&r1=281053&r2=281054&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Fri Sep  9 11:29:13 2016
@@ -472,20 +472,15 @@ protected:
     StoreSDNodeBitfields StoreSDNodeBits;
   };
 
-  // RawSDNodeBits must cover the entirety of the union.  This means that all
-  // of the union's members must have size <= RawSDNodeBits.
-  static_assert(sizeof(SDNodeBits) <= sizeof(RawSDNodeBits),
-                "SDNodeBits too wide");
-  static_assert(sizeof(ConstantSDNodeBits) <= sizeof(RawSDNodeBits),
-                "ConstantSDNodeBits too wide");
-  static_assert(sizeof(MemSDNodeBits) <= sizeof(RawSDNodeBits),
-                "MemSDNodeBits too wide");
-  static_assert(sizeof(LSBaseSDNodeBits) <= sizeof(RawSDNodeBits),
-                "LSBaseSDNodeBits too wide");
-  static_assert(sizeof(LoadSDNodeBits) <= sizeof(RawSDNodeBits),
-                "LoadSDNodeBits too wide");
-  static_assert(sizeof(StoreSDNodeBits) <= sizeof(RawSDNodeBits),
-                "StoreSDNodeBits too wide");
+  // RawSDNodeBits must cover the entirety of the union.  This means that all of
+  // the union's members must have size <= RawSDNodeBits.  We write the RHS as
+  // "2" instead of sizeof(RawSDNodeBits) because MSVC can't handle the latter.
+  static_assert(sizeof(SDNodeBitfields) <= 2, "field too wide");
+  static_assert(sizeof(ConstantSDNodeBitfields) <= 2, "field too wide");
+  static_assert(sizeof(MemSDNodeBitfields) <= 2, "field too wide");
+  static_assert(sizeof(LSBaseSDNodeBitfields) <= 2, "field too wide");
+  static_assert(sizeof(LoadSDNodeBitfields) <= 2, "field too wide");
+  static_assert(sizeof(StoreSDNodeBitfields) <= 2, "field too wide");
 
 private:
   /// Unique id per SDNode in the DAG.




More information about the llvm-commits mailing list