diff options
Diffstat (limited to 'include/clang/AST/RecordLayout.h')
-rw-r--r-- | include/clang/AST/RecordLayout.h | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/include/clang/AST/RecordLayout.h b/include/clang/AST/RecordLayout.h index 77e8553d74..66792d715d 100644 --- a/include/clang/AST/RecordLayout.h +++ b/include/clang/AST/RecordLayout.h @@ -22,38 +22,38 @@ namespace clang { class RecordDecl; class CXXRecordDecl; -/// ASTRecordLayout - +/// ASTRecordLayout - /// This class contains layout information for one RecordDecl, /// which is a struct/union/class. The decl represented must be a definition, -/// not a forward declaration. -/// This class is also used to contain layout information for one +/// not a forward declaration. +/// This class is also used to contain layout information for one /// ObjCInterfaceDecl. FIXME - Find appropriate name. /// These objects are managed by ASTContext. class ASTRecordLayout { /// Size - Size of record in bits. uint64_t Size; - + /// DataSize - Size of record in bits without tail padding. uint64_t DataSize; - + /// FieldOffsets - Array of field offsets in bits. uint64_t *FieldOffsets; - + // Alignment - Alignment of record in bits. - unsigned Alignment; - + unsigned Alignment; + // FieldCount - Number of fields. unsigned FieldCount; struct CXXRecordLayoutInfo { - /// NonVirtualSize - The non-virtual size (in bits) of an object, which is + /// NonVirtualSize - The non-virtual size (in bits) of an object, which is /// the size of the object without virtual bases. uint64_t NonVirtualSize; - + /// NonVirtualAlign - The non-virtual alignment (in bits) of an object, /// which is the alignment of the object without virtual bases. uint64_t NonVirtualAlign; - + /// PrimaryBase - The primary base for our vtable. const CXXRecordDecl *PrimaryBase; /// PrimaryBase - Wether or not the primary base was a virtual base. @@ -67,16 +67,16 @@ class ASTRecordLayout { /// FIXME: This should really use a SmallPtrMap, once we have one in LLVM :) llvm::DenseMap<const CXXRecordDecl *, uint64_t> VBaseOffsets; }; - - /// CXXInfo - If the record layout is for a C++ record, this will have + + /// CXXInfo - If the record layout is for a C++ record, this will have /// C++ specific information about the record. CXXRecordLayoutInfo *CXXInfo; - + friend class ASTContext; friend class ASTRecordLayoutBuilder; ASTRecordLayout(uint64_t size, unsigned alignment, unsigned datasize, - const uint64_t *fieldoffsets, unsigned fieldcount) + const uint64_t *fieldoffsets, unsigned fieldcount) : Size(size), DataSize(datasize), FieldOffsets(0), Alignment(alignment), FieldCount(fieldcount), CXXInfo(0) { if (FieldCount > 0) { @@ -85,7 +85,7 @@ class ASTRecordLayout { FieldOffsets[i] = fieldoffsets[i]; } } - + // Constructor for C++ records. ASTRecordLayout(uint64_t size, unsigned alignment, uint64_t datasize, const uint64_t *fieldoffsets, unsigned fieldcount, @@ -101,7 +101,7 @@ class ASTRecordLayout { for (unsigned i = 0; i < FieldCount; ++i) FieldOffsets[i] = fieldoffsets[i]; } - + CXXInfo->PrimaryBase = PB; CXXInfo->PrimaryBaseWasVirtual = PBVirtual; CXXInfo->NonVirtualSize = nonvirtualsize; @@ -111,7 +111,7 @@ class ASTRecordLayout { for (unsigned i = 0; i != vbasecount; ++i) CXXInfo->VBaseOffsets[vbases[i]] = vbaseoffsets[i]; } - + ~ASTRecordLayout() { delete [] FieldOffsets; delete CXXInfo; @@ -120,55 +120,55 @@ class ASTRecordLayout { ASTRecordLayout(const ASTRecordLayout&); // DO NOT IMPLEMENT void operator=(const ASTRecordLayout&); // DO NOT IMPLEMENT public: - + /// getAlignment - Get the record alignment in bits. unsigned getAlignment() const { return Alignment; } /// getSize - Get the record size in bits. uint64_t getSize() const { return Size; } - + /// getFieldCount - Get the number of fields in the layout. unsigned getFieldCount() const { return FieldCount; } - + /// getFieldOffset - Get the offset of the given field index, in /// bits. uint64_t getFieldOffset(unsigned FieldNo) const { assert (FieldNo < FieldCount && "Invalid Field No"); return FieldOffsets[FieldNo]; } - + /// getDataSize() - Get the record data size, which is the record size /// without tail padding, in bits. uint64_t getDataSize() const { return DataSize; } - - /// getNonVirtualSize - Get the non-virtual size (in bits) of an object, + + /// getNonVirtualSize - Get the non-virtual size (in bits) of an object, /// which is the size of the object without virtual bases. - uint64_t getNonVirtualSize() const { + uint64_t getNonVirtualSize() const { assert(CXXInfo && "Record layout does not have C++ specific info!"); - + return CXXInfo->NonVirtualSize; } - + /// getNonVirtualSize - Get the non-virtual alignment (in bits) of an object, /// which is the alignment of the object without virtual bases. unsigned getNonVirtualAlign() const { assert(CXXInfo && "Record layout does not have C++ specific info!"); - + return CXXInfo->NonVirtualAlign; } - + /// getPrimaryBase - Get the primary base. const CXXRecordDecl *getPrimaryBase() const { assert(CXXInfo && "Record layout does not have C++ specific info!"); - + return CXXInfo->PrimaryBase; } /// getPrimaryBaseWasVirtual - Indicates if the primary base was virtual. bool getPrimaryBaseWasVirtual() const { assert(CXXInfo && "Record layout does not have C++ specific info!"); - + return CXXInfo->PrimaryBaseWasVirtual; } @@ -176,7 +176,7 @@ public: uint64_t getBaseClassOffset(const CXXRecordDecl *Base) const { assert(CXXInfo && "Record layout does not have C++ specific info!"); assert(CXXInfo->BaseOffsets.count(Base) && "Did not find base!"); - + return CXXInfo->BaseOffsets[Base]; } @@ -184,7 +184,7 @@ public: uint64_t getVBaseClassOffset(const CXXRecordDecl *VBase) const { assert(CXXInfo && "Record layout does not have C++ specific info!"); assert(CXXInfo->VBaseOffsets.count(VBase) && "Did not find base!"); - + return CXXInfo->VBaseOffsets[VBase]; } }; |