summaryrefslogtreecommitdiffstats
path: root/include/clang/AST/RecordLayout.h
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
committerdim <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
commit952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch)
treedf8df0b0067b381eab470a3b8f28d14a552a6340 /include/clang/AST/RecordLayout.h
parentea266cad53e3d49771fa38103913d3ec7a166694 (diff)
downloadFreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip
FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'include/clang/AST/RecordLayout.h')
-rw-r--r--include/clang/AST/RecordLayout.h55
1 files changed, 53 insertions, 2 deletions
diff --git a/include/clang/AST/RecordLayout.h b/include/clang/AST/RecordLayout.h
index 3655646..7268b3a 100644
--- a/include/clang/AST/RecordLayout.h
+++ b/include/clang/AST/RecordLayout.h
@@ -93,10 +93,22 @@ private:
/// HasOwnVFPtr - Does this class provide a virtual function table
/// (vtable in Itanium, vftbl in Microsoft) that is independent from
/// its base classes?
- bool HasOwnVFPtr; // TODO: stash this somewhere more efficient
+ bool HasOwnVFPtr : 1;
+
+ /// HasVFPtr - Does this class have a vftable that could be extended by
+ /// a derived class. The class may have inherited this pointer from
+ /// a primary base class.
+ bool HasExtendableVFPtr : 1;
+
+ /// AlignAfterVBases - Force appropriate alignment after virtual bases are
+ /// laid out in MS-C++-ABI.
+ bool AlignAfterVBases : 1;
/// PrimaryBase - The primary base info for this record.
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 :)
typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
@@ -122,13 +134,16 @@ private:
typedef CXXRecordLayoutInfo::BaseOffsetsMapTy BaseOffsetsMapTy;
ASTRecordLayout(const ASTContext &Ctx,
CharUnits size, CharUnits alignment,
- bool hasOwnVFPtr, CharUnits vbptroffset,
+ bool hasOwnVFPtr, bool hasExtendableVFPtr,
+ CharUnits vbptroffset,
CharUnits datasize,
const uint64_t *fieldoffsets, unsigned fieldcount,
CharUnits nonvirtualsize, CharUnits nonvirtualalign,
CharUnits SizeOfLargestEmptySubobject,
const CXXRecordDecl *PrimaryBase,
bool IsPrimaryBaseVirtual,
+ const CXXRecordDecl *BaseSharingVBPtr,
+ bool ForceAlign,
const BaseOffsetsMapTy& BaseOffsets,
const VBaseOffsetsMapTy& VBaseOffsets);
@@ -226,6 +241,37 @@ public:
return CXXInfo->HasOwnVFPtr;
}
+ /// hasVFPtr - Does this class have a virtual function table pointer
+ /// that can be extended by a derived class? This is synonymous with
+ /// this class having a VFPtr at offset zero.
+ bool hasExtendableVFPtr() const {
+ assert(CXXInfo && "Record layout does not have C++ specific info!");
+ return CXXInfo->HasExtendableVFPtr;
+ }
+
+ /// hasOwnVBPtr - Does this class provide its own virtual-base
+ /// table pointer, rather than inheriting one from a primary base
+ /// class?
+ ///
+ /// This implies that the ABI has no primary base class, meaning
+ /// that it has no base classes that are suitable under the conditions
+ /// of the ABI.
+ bool hasOwnVBPtr() const {
+ assert(CXXInfo && "Record layout does not have C++ specific info!");
+ return hasVBPtr() && !CXXInfo->BaseSharingVBPtr;
+ }
+
+ /// hasVBPtr - Does this class have a virtual function table pointer.
+ bool hasVBPtr() const {
+ assert(CXXInfo && "Record layout does not have C++ specific info!");
+ return !CXXInfo->VBPtrOffset.isNegative();
+ }
+
+ bool getAlignAfterVBases() const {
+ assert(CXXInfo && "Record layout does not have C++ specific info!");
+ return CXXInfo->AlignAfterVBases;
+ }
+
/// getVBPtrOffset - Get the offset for virtual base table pointer.
/// This is only meaningful with the Microsoft ABI.
CharUnits getVBPtrOffset() const {
@@ -233,6 +279,11 @@ public:
return CXXInfo->VBPtrOffset;
}
+ const CXXRecordDecl *getBaseSharingVBPtr() const {
+ assert(CXXInfo && "Record layout does not have C++ specific info!");
+ return CXXInfo->BaseSharingVBPtr;
+ }
+
const VBaseOffsetsMapTy &getVBaseOffsetsMap() const {
assert(CXXInfo && "Record layout does not have C++ specific info!");
return CXXInfo->VBaseOffsets;
OpenPOWER on IntegriCloud