diff options
author | Ken Dyck <ken.dyck@onsemi.com> | 2009-11-24 12:04:54 +0000 |
---|---|---|
committer | Ken Dyck <ken.dyck@onsemi.com> | 2009-11-24 12:04:54 +0000 |
commit | f5f514477d8a4e04e511d345b9fb896153f70e9d (patch) | |
tree | 8d8e37ed3c0316f42168e8d1feaa8fee8a9d5558 | |
parent | 6d901e340df666a64f295ddce4cc374035cedf63 (diff) |
Add getByteSize() and getTypeSizeInBytes().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89760 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/ASTContext.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 6017ef8d6d..2e2e298ec4 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -795,6 +795,20 @@ public: 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) { |