[cfe-commits] r123720 - in /cfe/trunk/lib/CodeGen: CGDecl.cpp CodeGenModule.cpp

John McCall rjmccall at apple.com
Tue Jan 18 10:28:09 PST 2011

On Jan 18, 2011, at 9:13 AM, Chris Lattner wrote:

> On Jan 17, 2011, at 9:38 PM, John McCall wrote:
>> On Jan 17, 2011, at 6:01 PM, Ken Dyck wrote:
>>> Author: kjdyck
>>> Date: Mon Jan 17 20:01:14 2011
>>> New Revision: 123720
>>> URL: http://llvm.org/viewvc/llvm-project?rev=123720&view=rev
>>> Log:
>>> Replace calls to CharUnits::fromQuantity() with ones to 
>>> ASTContext::toCharUnitsFromBits() when converting from bit sizes to char units.
>> Is there any good reason why TargetInfo and ASTContext compute size and alignment in bits rather than chars in the first place?  I think most consumers of this information want it in chars, and for the ones that want bits, well, a multiply is a lot cheaper than a divide.
> Size in bits makes sense for bitfields etc.  Alignment in bits doesn't make sense to me, other than for consistency.

Almost of these computations are for types, not declarations.  Even in the calls which work on declarations, there's no value in providing a consistent interface for bitfields;  bitfields have to be a huge special case in every caller anyway, because "char x;" is a totally different beast from "int x : 8;".


More information about the cfe-commits mailing list