10 #ifndef LLVM_CLANG_LIB_CODEGEN_CGRECORDLAYOUT_H 11 #define LLVM_CLANG_LIB_CODEGEN_CGRECORDLAYOUT_H 16 #include "llvm/ADT/DenseMap.h" 17 #include "llvm/IR/DerivedTypes.h" 85 :
Offset(), Size(), IsSigned(), StorageSize(), StorageOffset() {}
88 unsigned StorageSize,
CharUnits StorageOffset)
89 : Offset(Offset), Size(Size), IsSigned(IsSigned),
90 StorageSize(StorageSize), StorageOffset(StorageOffset) {}
92 void print(raw_ostream &OS)
const;
100 uint64_t
Offset, uint64_t Size,
101 uint64_t StorageSize,
118 llvm::StructType *CompleteObjectType;
122 llvm::StructType *BaseSubobjectType;
126 llvm::DenseMap<const FieldDecl *, unsigned> FieldInfo;
130 llvm::DenseMap<const FieldDecl *, CGBitFieldInfo> BitFields;
134 llvm::DenseMap<const CXXRecordDecl *, unsigned> NonVirtualBases;
137 llvm::DenseMap<const CXXRecordDecl *, unsigned> CompleteObjectVirtualBases;
142 bool IsZeroInitializable : 1;
147 bool IsZeroInitializableAsBase : 1;
151 llvm::StructType *BaseSubobjectType,
152 bool IsZeroInitializable,
153 bool IsZeroInitializableAsBase)
154 : CompleteObjectType(CompleteObjectType),
155 BaseSubobjectType(BaseSubobjectType),
156 IsZeroInitializable(IsZeroInitializable),
157 IsZeroInitializableAsBase(IsZeroInitializableAsBase) {}
162 return CompleteObjectType;
168 return BaseSubobjectType;
174 return IsZeroInitializable;
180 return IsZeroInitializableAsBase;
187 assert(FieldInfo.count(FD) &&
"Invalid field for record!");
188 return FieldInfo.lookup(FD);
192 assert(NonVirtualBases.count(RD) &&
"Invalid non-virtual base!");
193 return NonVirtualBases.lookup(RD);
199 assert(CompleteObjectVirtualBases.count(base) &&
"Invalid virtual base!");
200 return CompleteObjectVirtualBases.lookup(base);
206 assert(FD->
isBitField() &&
"Invalid call for non-bit-field decl!");
207 llvm::DenseMap<const FieldDecl *, CGBitFieldInfo>::const_iterator
208 it = BitFields.find(FD);
209 assert(it != BitFields.end() &&
"Unable to find bitfield info");
213 void print(raw_ostream &OS)
const;
const CGBitFieldInfo & getBitFieldInfo(const FieldDecl *FD) const
Return the BitFieldInfo that corresponds to the field FD.
CGRecordLayout - This class handles struct and union layout info while lowering AST types to LLVM typ...
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
CGBitFieldInfo(unsigned Offset, unsigned Size, bool IsSigned, unsigned StorageSize, CharUnits StorageOffset)
bool isZeroInitializableAsBase() const
Check whether this struct can be C++ zero-initialized with a zeroinitializer when considered as a bas...
FieldDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this field.
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
unsigned getNonVirtualBaseLLVMFieldNo(const CXXRecordDecl *RD) const
unsigned Size
The total size of the bit-field, in bits.
bool isBitField() const
Determines whether this field is a bitfield.
CharUnits - This is an opaque type for sizes expressed in character units.
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
CharUnits StorageOffset
The offset of the bitfield storage from the start of the struct.
llvm::StructType * getBaseSubobjectLLVMType() const
Return the "base subobject" LLVM type associated with this record.
unsigned Offset
The offset within a contiguous run of bitfields that are represented as a single "field" within the L...
bool isZeroInitializable() const
Check whether this struct can be C++ zero-initialized with a zeroinitializer.
CGRecordLayout(llvm::StructType *CompleteObjectType, llvm::StructType *BaseSubobjectType, bool IsZeroInitializable, bool IsZeroInitializableAsBase)
Dataflow Directional Tag Classes.
unsigned IsSigned
Whether the bit-field is signed.
unsigned StorageSize
The storage size in bits which should be used when accessing this bitfield.
This class organizes the cross-module state that is used while lowering AST types to LLVM types...
llvm::StructType * getLLVMType() const
Return the "complete object" LLVM type associated with this record.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Represents a C++ struct/union/class.
unsigned getVirtualBaseIndex(const CXXRecordDecl *base) const
Return the LLVM field index corresponding to the given virtual base.
Structure with information about how a bitfield should be accessed.
unsigned getLLVMFieldNo(const FieldDecl *FD) const
Return llvm::StructType element number that corresponds to the field FD.