r222456 - The Syntax enumeration requires at least three bits to store all of its values. Increase the number of bits for SyntaxUsed. Decrease the number of expression arguments allowed by a single bit so that the bit fields continue to add up to 32-bits evenly.

Aaron Ballman aaron at aaronballman.com
Thu Nov 20 13:34:56 PST 2014


Author: aaronballman
Date: Thu Nov 20 15:34:56 2014
New Revision: 222456

URL: http://llvm.org/viewvc/llvm-project?rev=222456&view=rev
Log:
The Syntax enumeration requires at least three bits to store all of its values. Increase the number of bits for SyntaxUsed. Decrease the number of expression arguments allowed by a single bit so that the bit fields continue to add up to 32-bits evenly.

There is no test for this fix because I could find no reasonable way to trigger a visible failure from it.

Thanks to Doug Gregor for spotting this!

Modified:
    cfe/trunk/include/clang/Sema/AttributeList.h

Modified: cfe/trunk/include/clang/Sema/AttributeList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/AttributeList.h?rev=222456&r1=222455&r2=222456&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/AttributeList.h (original)
+++ cfe/trunk/include/clang/Sema/AttributeList.h Thu Nov 20 15:34:56 2014
@@ -94,10 +94,10 @@ private:
 
   /// The number of expression arguments this attribute has.
   /// The expressions themselves are stored after the object.
-  unsigned NumArgs : 16;
+  unsigned NumArgs : 15;
 
   /// Corresponds to the Syntax enum.
-  unsigned SyntaxUsed : 2;
+  unsigned SyntaxUsed : 3;
 
   /// True if already diagnosed as invalid.
   mutable unsigned Invalid : 1;





More information about the cfe-commits mailing list