Home | History | Annotate | Download | only in AST

Lines Matching defs:Base

28 /// BaseSubobjectInfo - Represents a single base subobject in a complete class.
38 /// If a base is virtual, it will only have one BaseSubobjectInfo allocated.
40 /// Class - The class for this base info.
43 /// IsVirtual - Whether the BaseInfo represents a virtual base or not.
46 /// Bases - Information about the base subobjects.
49 /// PrimaryVirtualBaseInfo - Holds the base info for the primary virtual base
50 /// of this base info (if one exists).
72 /// base subobject.
75 /// ComputeEmptySubobjectSizes - Compute the size of the largest base or
118 /// This holds the size of the largest empty subobject (either a base
128 /// CanPlaceBaseAtOffset - Return whether the given base class can be placed
241 BaseSubobjectInfo* Base = Info->Bases[I];
242 if (Base->IsVirtual)
245 CharUnits BaseOffset = Offset + Layout.getBaseClassOffset(Base->Class);
247 if (!CanPlaceBaseSubobjectAtOffset(Base, BaseOffset))
282 // offset zero. Because of this, we only need to keep track of empty base
293 BaseSubobjectInfo* Base = Info->Bases[I];
294 if (Base->IsVirtual)
297 CharUnits BaseOffset = Offset + Layout.getBaseClassOffset(Base->Class);
298 UpdateEmptyBaseSubobjects(Base, BaseOffset, PlacingEmptyBase);
332 // We are able to place the base at this offset. Make sure to update the
333 // empty base subobject map.
445 // Make sure to update the empty base subobject map.
587 /// PrimaryBase - the primary base class (if one exists) of the class
591 /// PrimaryBaseIsVirtual - Whether the primary base of the class we're laying
595 /// VBPtrOffset - Virtual base table offset. Only for MS layout.
600 /// Bases - base classes and their offsets in the record.
603 // VBases - virtual base classes and their offsets in the record.
606 /// IndirectPrimaryBases - Virtual base classes, direct or indirect, that are
607 /// primary base classes for some other direct or indirect base class.
610 /// FirstNearlyEmptyVBase - The first nearly empty virtual base class in
611 /// inheritance graph order. Used for determining the primary base class.
650 /// of the class we're laying out to their base subobject info.
654 /// class we're laying out to their base subobject info.
657 /// ComputeBaseSubobjectInfo - Compute the base subobject information for the
661 /// ComputeBaseSubobjectInfo - Compute the base subobject information for a
662 /// single class and all of its base classes.
667 /// DeterminePrimaryBase - Determine the primary base of the given class.
674 /// LayoutNonVirtualBases - Determines the primary base class (if any) and
675 /// lays it out. Will then proceed to lay out all non-virtual base clasess.
678 /// LayoutNonVirtualBase - Lays out a single non-virtual base.
679 void LayoutNonVirtualBase(const BaseSubobjectInfo *Base);
691 /// LayoutVirtualBase - Lays out a single virtual base.
692 void LayoutVirtualBase(const BaseSubobjectInfo *Base);
694 /// LayoutBase - Will lay out a base and return the offset where it was
696 CharUnits LayoutBase(const BaseSubobjectInfo *Base);
754 const CXXRecordDecl *Base =
757 // Check if this is a nearly empty virtual base.
758 if (I->isVirtual() && Context.isNearlyEmpty(Base)) {
759 // If it's not an indirect primary base, then we've found our primary
760 // base.
761 if (!IndirectPrimaryBases.count(Base)) {
762 PrimaryBase = Base;
767 // Is this the first nearly empty virtual base?
769 FirstNearlyEmptyVBase = Base;
772 SelectPrimaryVBase(Base);
778 /// DeterminePrimaryBase - Determine the primary base of the given class.
780 // If the class isn't dynamic, it won't have a primary base.
785 // indirect bases, and record all their primary virtual base classes.
788 // If the record has a dynamic base class, attempt to choose a primary base
789 // class. It is the first (in direct base class order) non-virtual dynamic
790 // base class, if one exists.
797 const CXXRecordDecl *Base =
800 if (Base->isDynamicClass()) {
802 PrimaryBase = Base;
810 assert(!PrimaryBase && "Should not get here with a primary base!");
814 // Under the Itanium ABI, if there is no non-virtual primary base class,
815 // try to compute the primary virtual base. The primary virtual base is
816 // the first nearly empty virtual base that is not an indirect primary
817 // virtual base class, if one exists.
824 // Otherwise, it is the first indirect primary base class, if one exists.
831 assert(!PrimaryBase && "Should not get here with a primary base!");
841 // Check if we already have info about this virtual base.
844 assert(InfoSlot->Class == RD && "Wrong class for virtual base info!");
863 // Check if this base has a primary virtual base.
867 // This base does have a primary virtual base.
869 assert(PrimaryVirtualBase && "Didn't have a primary virtual base!");
871 // Now check if we have base subobject info about this primary base.
876 // We did have info about this primary base, and it turns out that it
877 // has already been claimed as a primary virtual base for another
878 // base.
881 // We can claim this base as our primary base.
901 // Traversing the bases must have created the base info for our primary
902 // virtual base.
905 "Did not create a primary virtual base!");
907 // Claim the primary virtual base as our primary virtual base.
923 // Compute the base subobject info for this base.
927 // ComputeBaseInfo has already added this base for us.
929 "Did not add virtual base!");
931 // Add the base info to the map of non-virtual bases.
933 "Non-virtual base already exists!");
945 // The maximum field alignment overrides base align.
960 // Then, determine the primary base class.
963 // Compute base subobject info.
966 // If we have a primary base class, lay it out.
969 // If the primary virtual base was a primary virtual base of some other
970 // base class we'll have to steal it.
974 // We have a virtual primary base, insert it as an indirect primary base.
986 "Did not find base info for non-virtual primary base!");
994 // Under the Itanium ABI, a dynamic class without a primary base has a
1015 // Skip the primary base.
1019 // Lay out the base.
1021 assert(BaseInfo && "Did not find base info for non-virtual base!");
1028 // virtual base table pointers. A vfptr is necessary a if a class defines
1029 // a virtual function which is not overriding a function from a base;
1031 // from a primary base, if it exists. Otherwise, they are placed
1032 // after any base classes.
1051 void RecordLayoutBuilder::LayoutNonVirtualBase(const BaseSubobjectInfo *Base) {
1052 // Layout the base.
1053 CharUnits Offset = LayoutBase(Base);
1055 // Add its base class offset.
1056 assert(!Bases.count(Base->Class) && "base offset already exists!");
1057 Bases.insert(std::make_pair(Base->Class, Offset));
1059 AddPrimaryVirtualBaseOffsets(Base, Offset);
1065 // This base isn't interesting, it has no virtual bases.
1069 // First, check if we have a virtual primary base to add offsets for.
1072 "Primary virtual base is not virtual!");
1080 // Traverse the primary virtual base.
1088 const BaseSubobjectInfo *Base = Info->Bases[I];
1089 if (Base->IsVirtual)
1092 CharUnits BaseOffset = Offset + Layout.getBaseClassOffset(Base->Class);
1093 AddPrimaryVirtualBaseOffsets(Base, BaseOffset);
1111 RecordLayoutBuilder::BaseHasVFPtr(const CXXRecordDecl *Base) const {
1113 if (HasNewVirtualFunction(Base))
1115 const ASTRecordLayout &Layout = Context.getASTRecordLayout(Base);
1148 // Only lay out the virtual base if it's not an indirect primary base.
1155 assert(BaseInfo && "Did not find virtual base info!");
1162 // This base isn't interesting since it doesn't have any virtual bases.
1170 void RecordLayoutBuilder::LayoutVirtualBase(const BaseSubobjectInfo *Base) {
1171 assert(!Base->Derived && "Trying to lay out a primary virtual base!");
1173 // Layout the base.
1174 CharUnits Offset = LayoutBase(Base);
1176 // Add its base class offset.
1177 assert(!VBases.count(Base->Class) && "vbase offset already exists!");
1178 VBases.insert(std::make_pair(Base->Class, Offset));
1180 AddPrimaryVirtualBaseOffsets(Base, Offset);
1183 CharUnits RecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) {
1184 const ASTRecordLayout &Layout = Context.getASTRecordLayout(Base->Class);
1186 // If we have an empty base class, try to place it at offset 0.
1187 if (Base->Class->isEmpty() &&
1188 EmptySubobjects->CanPlaceBaseAtOffset(Base, CharUnits::Zero())) {
1197 // The maximum field alignment overrides base align.
1203 // Round up the current record size to the base's alignment boundary.
1206 // Try to place the base.
1207 while (!EmptySubobjects->CanPlaceBaseAtOffset(Base, Offset))
1210 if (!Base->Class->isEmpty()) {
1281 // Lay out the virtual bases and add the primary virtual base offsets.
1291 // Check that we have base offsets for all bases.
1300 assert(Bases.count(BaseDecl) && "Did not find base offset!");
1309 assert(VBases.count(BaseDecl) && "Did not find base offset!");
1692 // Resolve all typedefs down to their base type and round up the field
1766 assert(BaseInfo && "Did not find virtual base info!");
1807 // Check that we have base offsets for all bases.
1816 assert(Bases.count(BaseDecl) && "Did not find base offset!");
1825 assert(VBases.count(BaseDecl) && "Did not find base offset!");
2202 const CXXRecordDecl *Base =
2205 CharUnits BaseOffset = Offset + Layout.getBaseClassOffset(Base);
2207 DumpCXXRecordLayout(OS, Base, C, BaseOffset, IndentLevel,
2208 Base == PrimaryBase ? "(primary base)" : "(base)",
2251 "(primary virtual base)" : "(virtual base)",