r194609 - No functional change. Renaming a variable in RecordLayoutBuilder and
Warren Hunt
whunt at google.com
Wed Nov 13 14:16:13 PST 2013
Author: whunt
Date: Wed Nov 13 16:16:13 2013
New Revision: 194609
URL: http://llvm.org/viewvc/llvm-project?rev=194609&view=rev
Log:
No functional change. Renaming a variable in RecordLayoutBuilder and
improving comments to make documentation more accurate.
Differential Revision:http://llvm-reviews.chandlerc.com/D2172
Modified:
cfe/trunk/include/clang/AST/RecordLayout.h
cfe/trunk/lib/AST/RecordLayout.cpp
cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
Modified: cfe/trunk/include/clang/AST/RecordLayout.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecordLayout.h?rev=194609&r1=194608&r2=194609&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecordLayout.h (original)
+++ cfe/trunk/include/clang/AST/RecordLayout.h Wed Nov 13 16:16:13 2013
@@ -95,9 +95,10 @@ private:
/// its base classes?
bool HasOwnVFPtr : 1;
- /// HasVFPtr - Does this class have a vftable at all (could be inherited
- /// from its primary base.)
- bool HasVFPtr : 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.
@@ -133,7 +134,7 @@ private:
typedef CXXRecordLayoutInfo::BaseOffsetsMapTy BaseOffsetsMapTy;
ASTRecordLayout(const ASTContext &Ctx,
CharUnits size, CharUnits alignment,
- bool hasOwnVFPtr, bool hasVFPtr,
+ bool hasOwnVFPtr, bool hasExtendableVFPtr,
CharUnits vbptroffset,
CharUnits datasize,
const uint64_t *fieldoffsets, unsigned fieldcount,
@@ -240,10 +241,12 @@ public:
return CXXInfo->HasOwnVFPtr;
}
- /// hasVFPtr - Does this class have a virtual function table pointer.
- bool hasVFPtr() const {
+ /// 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->HasVFPtr;
+ return CXXInfo->HasExtendableVFPtr;
}
/// hasOwnVBPtr - Does this class provide its own virtual-base
Modified: cfe/trunk/lib/AST/RecordLayout.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayout.cpp?rev=194609&r1=194608&r2=194609&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayout.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayout.cpp Wed Nov 13 16:16:13 2013
@@ -43,7 +43,7 @@ ASTRecordLayout::ASTRecordLayout(const A
// Constructor for C++ records.
ASTRecordLayout::ASTRecordLayout(const ASTContext &Ctx,
CharUnits size, CharUnits alignment,
- bool hasOwnVFPtr, bool hasVFPtr,
+ bool hasOwnVFPtr, bool hasExtendableVFPtr,
CharUnits vbptroffset,
CharUnits datasize,
const uint64_t *fieldoffsets,
@@ -74,7 +74,7 @@ ASTRecordLayout::ASTRecordLayout(const A
CXXInfo->VBaseOffsets = VBaseOffsets;
CXXInfo->HasOwnVFPtr = hasOwnVFPtr;
CXXInfo->VBPtrOffset = vbptroffset;
- CXXInfo->HasVFPtr = hasVFPtr;
+ CXXInfo->HasExtendableVFPtr = hasExtendableVFPtr;
CXXInfo->BaseSharingVBPtr = BaseSharingVBPtr;
CXXInfo->AlignAfterVBases = AlignAfterVBases;
Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=194609&r1=194608&r2=194609&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Wed Nov 13 16:16:13 2013
@@ -2118,8 +2118,10 @@ public:
const CXXRecordDecl *PrimaryBase;
/// \brief The class we share our vb-pointer with.
const CXXRecordDecl *SharedVBPtrBase;
- /// \brief True if the class has a (not necessarily its own) vftable pointer.
- bool HasVFPtr : 1;
+ /// \brief True if the class has a vftable pointer that can be extended
+ /// by this class or classes derived from it. Such a vfptr will always occur
+ /// at offset 0.
+ bool HasExtendableVFPtr : 1;
/// \brief True if the class has a (not necessarily its own) vbtable pointer.
bool HasVBPtr : 1;
/// \brief Offset to the virtual base table pointer (if one exists).
@@ -2226,7 +2228,7 @@ MicrosoftRecordLayoutBuilder::initialize
// Initialize information about the bases.
HasVBPtr = false;
- HasVFPtr = false;
+ HasExtendableVFPtr = false;
SharedVBPtrBase = 0;
PrimaryBase = 0;
VirtualAlignment = CharUnits::One();
@@ -2251,9 +2253,9 @@ MicrosoftRecordLayoutBuilder::initialize
continue;
}
// We located a primary base class!
- if (!PrimaryBase && Layout.hasVFPtr()) {
+ if (!PrimaryBase && Layout.hasExtendableVFPtr()) {
PrimaryBase = BaseDecl;
- HasVFPtr = true;
+ HasExtendableVFPtr = true;
}
// We located a base to share a VBPtr with!
if (!SharedVBPtrBase && Layout.hasVBPtr()) {
@@ -2279,12 +2281,12 @@ void MicrosoftRecordLayoutBuilder::layou
// Look at all of our methods to determine if we need a VFPtr. We need a
// vfptr if we define a new virtual function.
- if (!HasVFPtr && RD->isDynamicClass())
+ if (!HasExtendableVFPtr && RD->isDynamicClass())
for (CXXRecordDecl::method_iterator i = RD->method_begin(),
e = RD->method_end();
- !HasVFPtr && i != e; ++i)
- HasVFPtr = i->isVirtual() && i->size_overridden_methods() == 0;
- if (!HasVFPtr)
+ !HasExtendableVFPtr && i != e; ++i)
+ HasExtendableVFPtr = i->isVirtual() && i->size_overridden_methods() == 0;
+ if (!HasExtendableVFPtr)
return;
// MSVC 32 (but not 64) potentially over-aligns the vf-table pointer by giving
@@ -2672,7 +2674,8 @@ ASTContext::BuildMicrosoftASTRecordLayou
Builder.cxxLayout(RD);
return new (*this) ASTRecordLayout(
*this, Builder.Size, Builder.Alignment,
- Builder.HasVFPtr && !Builder.PrimaryBase, Builder.HasVFPtr,
+ Builder.HasExtendableVFPtr && !Builder.PrimaryBase,
+ Builder.HasExtendableVFPtr,
Builder.VBPtrOffset, Builder.DataSize, Builder.FieldOffsets.data(),
Builder.FieldOffsets.size(), Builder.DataSize,
Builder.NonVirtualAlignment, CharUnits::Zero(), Builder.PrimaryBase,
More information about the cfe-commits
mailing list