Home | History | Annotate | Download | only in AST

Lines Matching defs:base

29 /// BaseSubobjectInfo - Represents a single base subobject in a complete class.
39 /// If a base is virtual, it will only have one BaseSubobjectInfo allocated.
41 /// Class - The class for this base info.
44 /// IsVirtual - Whether the BaseInfo represents a virtual base or not.
47 /// Bases - Information about the base subobjects.
50 /// PrimaryVirtualBaseInfo - Holds the base info for the primary virtual base
51 /// of this base info (if one exists).
73 /// base subobject.
76 /// ComputeEmptySubobjectSizes - Compute the size of the largest base or
119 /// This holds the size of the largest empty subobject (either a base
129 /// 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))
281 // offset zero. Because of this, we only need to keep track of empty base
292 BaseSubobjectInfo* Base = Info->Bases[I];
293 if (Base->IsVirtual)
296 CharUnits BaseOffset = Offset + Layout.getBaseClassOffset(Base->Class);
297 UpdateEmptyBaseSubobjects(Base, BaseOffset, PlacingEmptyBase);
330 // We are able to place the base at this offset. Make sure to update the
331 // empty base subobject map.
442 // Make sure to update the empty base subobject map.
593 /// PrimaryBase - the primary base class (if one exists) of the class
597 /// PrimaryBaseIsVirtual - Whether the primary base of the class we're laying
602 /// pointer, as opposed to inheriting one from a primary base class.
605 /// VBPtrOffset - Virtual base table offset. Only for MS layout.
610 /// Bases - base classes and their offsets in the record.
613 // VBases - virtual base classes and their offsets in the record.
616 /// IndirectPrimaryBases - Virtual base classes, direct or indirect, that are
617 /// primary base classes for some other direct or indirect base class.
620 /// FirstNearlyEmptyVBase - The first nearly empty virtual base class in
621 /// inheritance graph order. Used for determining the primary base class.
637 /// \brief Externally-provided direct, non-virtual base offsets.
640 /// \brief Externally-provided virtual base offsets.
692 /// of the class we're laying out to their base subobject info.
696 /// class we're laying out to their base subobject info.
699 /// ComputeBaseSubobjectInfo - Compute the base subobject information for the
703 /// ComputeBaseSubobjectInfo - Compute the base subobject information for a
704 /// single class and all of its base classes.
709 /// DeterminePrimaryBase - Determine the primary base of the given class.
716 /// LayoutNonVirtualBases - Determines the primary base class (if any) and
717 /// lays it out. Will then proceed to lay out all non-virtual base clasess.
720 /// LayoutNonVirtualBase - Lays out a single non-virtual base.
721 void LayoutNonVirtualBase(const BaseSubobjectInfo *Base);
729 bool isPossiblePrimaryBase(const CXXRecordDecl *Base) const;
738 /// LayoutVirtualBase - Lays out a single virtual base.
739 void LayoutVirtualBase(const BaseSubobjectInfo *Base,
742 /// LayoutBase - Will lay out a base and return the offset where it was
744 CharUnits LayoutBase(const BaseSubobjectInfo *Base);
806 const CXXRecordDecl *Base =
809 // Check if this is a nearly empty virtual base.
810 if (I->isVirtual() && Context.isNearlyEmpty(Base)) {
811 // If it's not an indirect primary base, then we've found our primary
812 // base.
813 if (!IndirectPrimaryBases.count(Base)) {
814 PrimaryBase = Base;
819 // Is this the first nearly empty virtual base?
821 FirstNearlyEmptyVBase = Base;
824 SelectPrimaryVBase(Base);
830 /// DeterminePrimaryBase - Determine the primary base of the given class.
832 // If the class isn't dynamic, it won't have a primary base.
837 // indirect bases, and record all their primary virtual base classes.
840 // If the record has a dynamic base class, attempt to choose a primary base
841 // class. It is the first (in direct base class order) non-virtual dynamic
842 // base class, if one exists.
849 const CXXRecordDecl *Base =
852 if (isPossiblePrimaryBase(Base)) {
854 PrimaryBase = Base;
862 assert(!PrimaryBase && "Should not get here with a primary base!");
866 // Under the Itanium ABI, if there is no non-virtual primary base class,
867 // try to compute the primary virtual base. The primary virtual base is
868 // the first nearly empty virtual base that is not an indirect primary
869 // virtual base class, if one exists.
876 // Otherwise, it is the first indirect primary base class, if one exists.
883 assert(!PrimaryBase && "Should not get here with a primary base!");
893 // Check if we already have info about this virtual base.
896 assert(InfoSlot->Class == RD && "Wrong class for virtual base info!");
915 // Check if this base has a primary virtual base.
919 // This base does have a primary virtual base.
921 assert(PrimaryVirtualBase && "Didn't have a primary virtual base!");
923 // Now check if we have base subobject info about this primary base.
928 // We did have info about this primary base, and it turns out that it
929 // has already been claimed as a primary virtual base for another
930 // base.
933 // We can claim this base as our primary base.
953 // Traversing the bases must have created the base info for our primary
954 // virtual base.
957 "Did not create a primary virtual base!");
959 // Claim the primary virtual base as our primary virtual base.
975 // Compute the base subobject info for this base.
979 // ComputeBaseInfo has already added this base for us.
981 "Did not add virtual base!");
983 // Add the base info to the map of non-virtual bases.
985 "Non-virtual base already exists!");
995 // The maximum field alignment overrides base align.
1011 // Then, determine the primary base class.
1014 // Compute base subobject info.
1017 // If we have a primary base class, lay it out.
1020 // If the primary virtual base was a primary virtual base of some other
1021 // base class we'll have to steal it.
1025 // We have a virtual primary base, insert it as an indirect primary base.
1037 "Did not find base info for non-virtual primary base!");
1043 // primary base, add it in now.
1072 // Remember if this base has virtual bases itself.
1076 // Skip the primary base, because we've already laid it out. The
1078 // non-virtual base of the same type as a primary virtual base.
1082 // Lay out the base.
1084 assert(BaseInfo && "Did not find base info for non-virtual base!");
1090 // whenever we have a virtual base and we can't re-use a vb-table
1091 // pointer from a non-virtual base.
1121 void RecordLayoutBuilder::LayoutNonVirtualBase(const BaseSubobjectInfo *Base) {
1122 // Layout the base.
1123 CharUnits Offset = LayoutBase(Base);
1125 // Add its base class offset.
1126 assert(!Bases.count(Base->Class) && "base offset already exists!");
1127 Bases.insert(std::make_pair(Base->Class, Offset));
1129 AddPrimaryVirtualBaseOffsets(Base, Offset);
1135 // This base isn't interesting, it has no virtual bases.
1139 // First, check if we have a virtual primary base to add offsets for.
1142 "Primary virtual base is not virtual!");
1150 // Traverse the primary virtual base.
1158 const BaseSubobjectInfo *Base = Info->Bases[I];
1159 if (Base->IsVirtual)
1162 CharUnits BaseOffset = Offset + Layout.getBaseClassOffset(Base->Class);
1163 AddPrimaryVirtualBaseOffsets(Base, BaseOffset);
1168 /// when laid out as a base class. These are treated the same because
1171 /// This function assumes that the class has no primary base.
1176 // this class has no virtual functions as a base class (i.e. it's
1193 // case we would have a primary base.
1208 // Check whether the set contains the base.
1209 const CXXRecordDecl *base = I->getType()->getAsCXXRecordDecl();
1210 if (set.count(base))
1214 if (hasNonVirtualBaseInSet(base, set))
1236 // base in the derived class, ignore it.
1264 // A virtual base requires a vtordisp field in a derived class if it
1265 // requires a vtordisp field in a base class. Walk all the direct
1269 const CXXRecordDecl *base = I->getType()->getAsCXXRecordDecl();
1270 const ASTRecordLayout &baseLayout = Context.getASTRecordLayout(base);
1276 // If it doesn't need a vtordisp in this base, ignore it.
1293 // virtual base requires a vtordisp if any the non-destructor
1295 // provided by that virtual base. (If so, we need to emit a thunk
1304 // a method provided by a virtual copy of a base class, but we do directly
1305 // override a method provided by a non-virtual copy of that base class,
1306 // then we must indirectly override the method provided by the virtual base,
1332 base.
1348 // subobject containing the base.
1358 /// base classes?
1376 /// isPossiblePrimaryBase - Is the given base class an acceptable
1377 /// primary base class?
1379 RecordLayoutBuilder::isPossiblePrimaryBase(const CXXRecordDecl *base) const {
1380 // In the Itanium ABI, a class can be a primary base class if it has
1383 return base->isDynamicClass();
1385 // In the MS ABI, a class can only be a primary base class if it
1387 // non-virtual base. The existence of a separate vb-table means
1389 // base, which we have to guard against.
1392 if (!base->isPolymorphic()) return false;
1395 if (!base->getNumVBases()) return true;
1398 const ASTRecordLayout &layout = Context.getASTRecordLayout(base);
1400 // If the base has its own vfptr, it can be a primary base.
1403 // If the base has a primary base class, then it can be a primary base.
1437 // Only lay out the virtual base if it's not an indirect primary base.
1444 assert(BaseInfo && "Did not find virtual base info!");
1451 // This base isn't interesting since it doesn't have any virtual bases.
1472 assert(BaseInfo && "Did not find virtual base info!");
1474 // If this base requires a vtordisp, add enough space for an int field.
1490 void RecordLayoutBuilder::LayoutVirtualBase(const BaseSubobjectInfo *Base,
1492 assert(!Base->Derived && "Trying to lay out a primary virtual base!");
1494 // Layout the base.
1495 CharUnits Offset = LayoutBase(Base);
1497 // Add its base class offset.
1498 assert(!VBases.count(Base->Class) && "vbase offset already exists!");
1499 VBases.insert(std::make_pair(Base->Class,
1503 AddPrimaryVirtualBaseOffsets(Base, Offset);
1506 CharUnits RecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) {
1507 const ASTRecordLayout &Layout = Context.getASTRecordLayout(Base->Class);
1516 if (Base->IsVirtual) {
1517 Known = ExternalVirtualBaseOffsets.find(Base->Class);
1523 Known = ExternalBaseOffsets.find(Base->Class);
1531 // If we have an empty base class, try to place it at offset 0.
1532 if (Base->Class->isEmpty() &&
1534 EmptySubobjects->CanPlaceBaseAtOffset(Base, CharUnits::Zero())) {
1543 // The maximum field alignment overrides base align.
1550 // Round up the current record size to the base's alignment boundary.
1553 // Try to place the base.
1554 while (!EmptySubobjects->CanPlaceBaseAtOffset(Base, Offset))
1557 bool Allowed = EmptySubobjects->CanPlaceBaseAtOffset(Base, Offset);
1559 assert(Allowed && "Base subobject externally placed at overlapping offset");
1562 if (!Base->Class->isEmpty()) {
1665 // Lay out the virtual bases and add the primary virtual base offsets.
1674 // Check that we have base offsets for all bases.
1683 assert(Bases.count(BaseDecl) && "Did not find base offset!");
1692 assert(VBases.count(BaseDecl) && "Did not find base offset!");
2092 // Resolve all typedefs down to their base type and round up the field
2599 const CXXRecordDecl *Base =
2602 CharUnits BaseOffset = Offset + Layout.getBaseClassOffset(Base);
2604 DumpCXXRecordLayout(OS, Base, C, BaseOffset, IndentLevel,
2605 Base == PrimaryBase ? "(primary base)" : "(base)",
2661 "(primary virtual base)" : "(virtual base)",