[llvm] r300213 - [APSInt] Add a static_assert to ensure APSInt is packed well with APInt after r300171.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 09:34:49 PDT 2017


Author: ctopper
Date: Thu Apr 13 11:34:49 2017
New Revision: 300213

URL: http://llvm.org/viewvc/llvm-project?rev=300213&view=rev
Log:
[APSInt] Add a static_assert to ensure APSInt is packed well with APInt after r300171.

Modified:
    llvm/trunk/include/llvm/ADT/APSInt.h

Modified: llvm/trunk/include/llvm/ADT/APSInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APSInt.h?rev=300213&r1=300212&r2=300213&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APSInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APSInt.h Thu Apr 13 11:34:49 2017
@@ -24,7 +24,9 @@ class LLVM_NODISCARD APSInt : public API
 
 public:
   /// Default constructor that creates an uninitialized APInt.
-  explicit APSInt() : IsUnsigned(false) {}
+  explicit APSInt() : IsUnsigned(false) {
+    static_assert(sizeof(*this) == 16, "APSInt fields poorly packed");
+  }
 
   /// APSInt ctor - Create an APSInt with the specified width, default to
   /// unsigned.




More information about the llvm-commits mailing list