9#ifndef LLVM_CLANG_LIB_CIR_CIRGENRECORDLAYOUT_H
10#define LLVM_CLANG_LIB_CIR_CIRGENRECORDLAYOUT_H
113 void print(llvm::raw_ostream &os)
const;
114 LLVM_DUMP_METHOD
void dump()
const;
130 cir::RecordType completeObjectType;
134 cir::RecordType baseSubobjectType;
138 llvm::DenseMap<const clang::FieldDecl *, unsigned> fieldIdxMap;
142 llvm::DenseMap<const clang::CXXRecordDecl *, unsigned> nonVirtualBases;
145 llvm::DenseMap<const clang::CXXRecordDecl *, unsigned>
146 completeObjectVirtualBases;
150 llvm::DenseMap<const clang::FieldDecl *, CIRGenBitFieldInfo> bitFields;
155 LLVM_PREFERRED_TYPE(
bool)
156 unsigned zeroInitializable : 1;
160 LLVM_PREFERRED_TYPE(
bool)
161 unsigned zeroInitializableAsBase : 1;
165 cir::RecordType baseSubobjectType,
bool zeroInitializable,
166 bool zeroInitializableAsBase)
167 : completeObjectType(completeObjectType),
168 baseSubobjectType(baseSubobjectType),
169 zeroInitializable(zeroInitializable),
170 zeroInitializableAsBase(zeroInitializableAsBase) {}
174 cir::RecordType
getCIRType()
const {
return completeObjectType; }
183 assert(fieldIdxMap.count(fd) &&
"Invalid field for record!");
184 return fieldIdxMap.lookup(fd);
198 assert(fd->
isBitField() &&
"Invalid call for non-bit-field decl!");
199 llvm::DenseMap<const clang::FieldDecl *, CIRGenBitFieldInfo>::const_iterator
200 it = bitFields.find(fd);
201 assert(it != bitFields.end() &&
"Unable to find bitfield info");
204 void print(raw_ostream &os)
const;
205 LLVM_DUMP_METHOD
void dump()
const;
This class handles record and union layout info while lowering AST types to CIR types.
CIRGenRecordLayout(cir::RecordType completeObjectType, cir::RecordType baseSubobjectType, bool zeroInitializable, bool zeroInitializableAsBase)
cir::RecordType getCIRType() const
Return the "complete object" LLVM type associated with this record.
cir::RecordType getBaseSubobjectCIRType() const
Return the "base subobject" LLVM type associated with this record.
const CIRGenBitFieldInfo & getBitFieldInfo(const clang::FieldDecl *fd) const
Return the BitFieldInfo that corresponds to the field FD.
LLVM_DUMP_METHOD void dump() const
unsigned getCIRFieldNo(const clang::FieldDecl *fd) const
Return cir::RecordType element number that corresponds to the field FD.
bool isZeroInitializableAsBase() const
Check whether this struct can be C++ zero-initialized with a zeroinitializer when considered as a bas...
void print(raw_ostream &os) const
bool isZeroInitializable() const
Check whether this struct can be C++ zero-initialized with a zeroinitializer.
This class organizes the cross-module state that is used while lowering AST types to CIR types.
CharUnits - This is an opaque type for sizes expressed in character units.
Represents a member of a struct/union/class.
bool isBitField() const
Determines whether this field is a bitfield.
FieldDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this field.
Record with information about how a bitfield should be accessed.
unsigned offset
The offset within a contiguous run of bitfields that are represented as a single "field" within the c...
void print(llvm::raw_ostream &os) const
CIRGenBitFieldInfo(unsigned offset, unsigned size, bool isSigned, unsigned storageSize, clang::CharUnits storageOffset)
LLVM_DUMP_METHOD void dump() const
unsigned storageSize
The storage size in bits which should be used when accessing this bitfield.
unsigned volatileStorageSize
The storage size in bits which should be used when accessing this bitfield.
clang::CharUnits storageOffset
The offset of the bitfield storage from the start of the record.
unsigned size
The total size of the bit-field, in bits.
unsigned isSigned
Whether the bit-field is signed.
clang::CharUnits volatileStorageOffset
The offset of the bitfield storage from the start of the record.
unsigned volatileOffset
The offset within a contiguous run of bitfields that are represented as a single "field" within the c...
llvm::StringRef name
The name of a bitfield.