[cfe-commits] [Review] rolling out ASTContext::getTypeSizeInBytes()
Eli Friedman
eli.friedman at gmail.com
Tue Nov 24 13:38:58 PST 2009
On Tue, Nov 24, 2009 at 1:25 PM, John McCall <rjmccall at apple.com> wrote:
> This implicitly assumes that arithmetic on void* is in 1-byte chunks.
Arithmetic on void* is in sizeof(char) chunks, which are "1-byte" by definition.
> --- lib/AST/ASTContext.cpp (revision 89760)
> +++ lib/AST/ASTContext.cpp (working copy)
> @@ -3085,15 +3085,15 @@
> /// getObjCEncodingTypeSize returns size of type for objective-c encoding
> /// purpose.
> int ASTContext::getObjCEncodingTypeSize(QualType type) {
> - uint64_t sz = getTypeSize(type);
> + uint64_t sz = getTypeSizeInBytes(type);
>
> // Make all integer and enum types at least as large as an int
> if (sz > 0 && type->isIntegralType())
> - sz = std::max(sz, getTypeSize(IntTy));
> + sz = std::max(sz, getTypeSizeInBytes(IntTy));
> // Treat arrays as pointers, since that's how they're passed in.
> else if (type->isArrayType())
> - sz = getTypeSize(VoidPtrTy);
> - return sz / getTypeSize(CharTy);
> + sz = getTypeSizeInBytes(VoidPtrTy);
> + return sz;
> }
>
>
> You've changed this function from returning the size in chars to the size in
> bytes. Intentional? If so, please document.
Read a bit more carefully; the returned units aren't changing.
-Eli
More information about the cfe-commits
mailing list