|
@@ -98,18 +98,16 @@ private:
|
|
/// HasVFPtr - Does this class have a vftable at all (could be inherited
|
|
/// HasVFPtr - Does this class have a vftable at all (could be inherited
|
|
/// from its primary base.)
|
|
/// from its primary base.)
|
|
bool HasVFPtr : 1;
|
|
bool HasVFPtr : 1;
|
|
-
|
|
|
|
- /// HasOwnVBPtr - Does this class provide a virtual function table
|
|
|
|
- /// (vtable in Itanium, VBtbl in Microsoft) that is independent from
|
|
|
|
- /// its base classes?
|
|
|
|
- bool HasOwnVBPtr : 1;
|
|
|
|
-
|
|
|
|
|
|
+
|
|
/// AlignAfterVBases - Force appropriate alignment after virtual bases are
|
|
/// AlignAfterVBases - Force appropriate alignment after virtual bases are
|
|
/// laid out in MS-C++-ABI.
|
|
/// laid out in MS-C++-ABI.
|
|
bool AlignAfterVBases : 1;
|
|
bool AlignAfterVBases : 1;
|
|
|
|
|
|
/// PrimaryBase - The primary base info for this record.
|
|
/// PrimaryBase - The primary base info for this record.
|
|
llvm::PointerIntPair<const CXXRecordDecl *, 1, bool> PrimaryBase;
|
|
llvm::PointerIntPair<const CXXRecordDecl *, 1, bool> PrimaryBase;
|
|
|
|
+
|
|
|
|
+ /// BaseSharingVBPtr - The base we share vbptr with.
|
|
|
|
+ const CXXRecordDecl *BaseSharingVBPtr;
|
|
|
|
|
|
/// FIXME: This should really use a SmallPtrMap, once we have one in LLVM :)
|
|
/// FIXME: This should really use a SmallPtrMap, once we have one in LLVM :)
|
|
typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
|
|
typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
|
|
@@ -135,7 +133,7 @@ private:
|
|
typedef CXXRecordLayoutInfo::BaseOffsetsMapTy BaseOffsetsMapTy;
|
|
typedef CXXRecordLayoutInfo::BaseOffsetsMapTy BaseOffsetsMapTy;
|
|
ASTRecordLayout(const ASTContext &Ctx,
|
|
ASTRecordLayout(const ASTContext &Ctx,
|
|
CharUnits size, CharUnits alignment,
|
|
CharUnits size, CharUnits alignment,
|
|
- bool hasOwnVFPtr, bool hasVFPtr, bool hasOwnVBPtr,
|
|
|
|
|
|
+ bool hasOwnVFPtr, bool hasVFPtr,
|
|
CharUnits vbptroffset,
|
|
CharUnits vbptroffset,
|
|
CharUnits datasize,
|
|
CharUnits datasize,
|
|
const uint64_t *fieldoffsets, unsigned fieldcount,
|
|
const uint64_t *fieldoffsets, unsigned fieldcount,
|
|
@@ -143,6 +141,7 @@ private:
|
|
CharUnits SizeOfLargestEmptySubobject,
|
|
CharUnits SizeOfLargestEmptySubobject,
|
|
const CXXRecordDecl *PrimaryBase,
|
|
const CXXRecordDecl *PrimaryBase,
|
|
bool IsPrimaryBaseVirtual,
|
|
bool IsPrimaryBaseVirtual,
|
|
|
|
+ const CXXRecordDecl *BaseSharingVBPtr,
|
|
bool ForceAlign,
|
|
bool ForceAlign,
|
|
const BaseOffsetsMapTy& BaseOffsets,
|
|
const BaseOffsetsMapTy& BaseOffsets,
|
|
const VBaseOffsetsMapTy& VBaseOffsets);
|
|
const VBaseOffsetsMapTy& VBaseOffsets);
|
|
@@ -256,7 +255,7 @@ public:
|
|
/// of the ABI.
|
|
/// of the ABI.
|
|
bool hasOwnVBPtr() const {
|
|
bool hasOwnVBPtr() const {
|
|
assert(CXXInfo && "Record layout does not have C++ specific info!");
|
|
assert(CXXInfo && "Record layout does not have C++ specific info!");
|
|
- return CXXInfo->HasOwnVBPtr;
|
|
|
|
|
|
+ return hasVBPtr() && !CXXInfo->BaseSharingVBPtr;
|
|
}
|
|
}
|
|
|
|
|
|
/// hasVBPtr - Does this class have a virtual function table pointer.
|
|
/// hasVBPtr - Does this class have a virtual function table pointer.
|
|
@@ -277,6 +276,11 @@ public:
|
|
return CXXInfo->VBPtrOffset;
|
|
return CXXInfo->VBPtrOffset;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const CXXRecordDecl *getBaseSharingVBPtr() const {
|
|
|
|
+ assert(CXXInfo && "Record layout does not have C++ specific info!");
|
|
|
|
+ return CXXInfo->BaseSharingVBPtr;
|
|
|
|
+ }
|
|
|
|
+
|
|
const VBaseOffsetsMapTy &getVBaseOffsetsMap() const {
|
|
const VBaseOffsetsMapTy &getVBaseOffsetsMap() const {
|
|
assert(CXXInfo && "Record layout does not have C++ specific info!");
|
|
assert(CXXInfo && "Record layout does not have C++ specific info!");
|
|
return CXXInfo->VBaseOffsets;
|
|
return CXXInfo->VBaseOffsets;
|