[cfe-commits] r89760 - /cfe/trunk/include/clang/AST/ASTContext.h
Ken Dyck
ken.dyck at onsemi.com
Tue Nov 24 04:04:54 PST 2009
Author: kjdyck
Date: Tue Nov 24 06:04:54 2009
New Revision: 89760
URL: http://llvm.org/viewvc/llvm-project?rev=89760&view=rev
Log:
Add getByteSize() and getTypeSizeInBytes().
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=89760&r1=89759&r2=89760&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Tue Nov 24 06:04:54 2009
@@ -795,6 +795,20 @@
return getTypeInfo(T).first;
}
+ /// getByteWidth - Return the size of a byte, in bits
+ uint64_t getByteSize() {
+ return getTypeSize(CharTy);
+ }
+
+ /// getTypeSizeInBytes - Return the size of the specified type, in bytes.
+ /// This method does not work on incomplete types.
+ uint64_t getTypeSizeInBytes(QualType T) {
+ return getTypeSize(T) / getByteSize();
+ }
+ uint64_t getTypeSizeInBytes(const Type *T) {
+ return getTypeSize(T) / getByteSize();
+ }
+
/// getTypeAlign - Return the ABI-specified alignment of a type, in bits.
/// This method does not work on incomplete types.
unsigned getTypeAlign(QualType T) {
More information about the cfe-commits
mailing list