Home | History | Annotate | Download | only in AST

Lines Matching defs:Base

29 /// indirect base class.
34 /// VirtualBase - If the path from the derived class to the base class
35 /// involves a virtual base class, this holds its declaration.
38 /// NonVirtualOffset - The offset from the derived class to the base class.
39 /// (Or the offset from the virtual base class to the base class, if the
40 /// path from the derived class to the base class involves a virtual base
55 /// member functions in the base subobjects of a class.
63 /// Offset - the base offset of the overrider in the layout class.
90 /// in a base subobject.
97 /// all the base subobjects of the most derived class.
100 /// SubobjectsToOffsetsMapTy - A mapping from a base subobject (represented
108 /// ComputeBaseOffsets - Compute the offsets for all base subobjects of the
109 /// given base.
110 void ComputeBaseOffsets(BaseSubobject Base, bool IsVirtual,
118 /// dump - dump the final overriders for a base subobject, and all its direct
119 /// and indirect base subobjects.
120 void dump(raw_ostream &Out, BaseSubobject Base,
129 /// the subobject with the given base offset.
157 // Compute base offsets.
219 // First, look for the virtual base class.
223 if (Element.Base->isVirtual()) {
224 // FIXME: Can we break when we find the first virtual base?
227 QualType VBaseType = Element.Base->getType();
237 // Check the base class offset.
240 const RecordType *BaseType = Element.Base->getType()->getAs<RecordType>();
241 const CXXRecordDecl *Base = cast<CXXRecordDecl>(BaseType->getDecl());
243 NonVirtualOffset += Layout.getBaseClassOffset(Base);
247 // even change the base offsets in ASTRecordLayout to be specified in
261 llvm_unreachable("Class must be derived from the passed in base class!");
304 // const T *Base::foo();
322 FinalOverriders::ComputeBaseOffsets(BaseSubobject Base, bool IsVirtual,
327 const CXXRecordDecl *RD = Base.getBase();
339 SubobjectOffsets[std::make_pair(RD, SubobjectNumber)] = Base.getBaseOffset();
352 // Check if we've visited this virtual base before.
366 BaseOffset = Base.getBaseOffset() + Offset;
377 void FinalOverriders::dump(raw_ostream &Out, BaseSubobject Base,
379 const CXXRecordDecl *RD = Base.getBase();
394 // We've visited this base before.
400 BaseOffset = Layout.getBaseClassOffset(BaseDecl) + Base.getBaseOffset();
407 Out << Base.getBaseOffset().getQuantity() << ")\n";
409 // Now dump the overriders for this base subobject.
417 OverriderInfo Overrider = getOverrider(MD, Base.getBaseOffset());
563 /// VBaseOffsetOffsets - Contains the offsets of the virtual base offsets,
572 /// given base subobject.
573 void AddVCallAndVBaseOffsets(BaseSubobject Base, bool BaseIsVirtual,
576 /// AddVCallOffsets - Add vcall offsets for the given base subobject.
577 void AddVCallOffsets(BaseSubobject Base, CharUnits VBaseOffset);
580 void AddVBaseOffsets(const CXXRecordDecl *Base,
591 BaseSubobject Base, bool BaseIsVirtual,
597 AddVCallAndVBaseOffsets(Base, BaseIsVirtual, OffsetInLayoutClass);
612 VCallAndVBaseOffsetBuilder::AddVCallAndVBaseOffsets(BaseSubobject Base,
615 const ASTRecordLayout &Layout = Context.getASTRecordLayout(Base.getBase());
618 // ..in classes sharing a virtual table with a primary base class, the vcall
620 // and vbase offsets required by the base class, so that the latter may be
621 // laid out as required by the base class without regard to additions from
625 // emit them for the primary base first).
631 // Get the base offset of the primary base.
643 "Primary base should have a zero offset!");
645 PrimaryBaseOffset = Base.getBaseOffset();
653 AddVBaseOffsets(Base.getBase(), RealBaseOffset);
657 AddVCallOffsets(Base, RealBaseOffset);
673 void VCallAndVBaseOffsetBuilder::AddVCallOffsets(BaseSubobject Base,
675 const CXXRecordDecl *RD = Base.getBase();
680 // Handle the primary base first.
681 // We only want to add vcall offsets if the base is non-virtual; a virtual
682 // primary base will have its vcall and vbase offsets emitted already.
684 // Get the base offset of the primary base.
686 "Primary base should have a zero offset!");
688 AddVCallOffsets(BaseSubobject(PrimaryBase, Base.getBaseOffset()),
712 Overriders->getOverrider(MD, Base.getBaseOffset());
714 /// The vcall offset is the offset from the virtual base to the object
723 // And iterate over all non-virtual bases (ignoring the primary base).
735 // Get the base offset of this base.
736 CharUnits BaseOffset = Base.getBaseOffset() +
756 // Check if this is a virtual base that we haven't visited before.
773 // Check the base class looking for more vbase offsets.
805 /// base. (This only makes sense when building a construction vtable).
823 /// VBaseOffsetOffsets - Contains the offsets of the virtual base offsets for
836 /// BaseOffset - The base offset of this method.
839 /// BaseOffsetInLayoutClass - The base offset in the layout class of this
887 /// PrimaryVirtualBases - All known virtual bases who are a primary base of
888 /// some other base.
892 /// adjustment base offset.
895 /// ComputeThisAdjustmentBaseOffset - Compute the base offset for adjusting
896 /// the 'this' pointer from the base subobject to the derived subobject.
897 BaseOffset ComputeThisAdjustmentBaseOffset(BaseSubobject Base,
922 /// When B and C are declared, A is a primary base in each case, so although
925 /// objects, A is no longer a primary base of C, so if we allowed calls to
937 /// AddMethods - Add the methods of this base subobject and all its
939 void AddMethods(BaseSubobject Base, CharUnits BaseOffsetInLayoutClass,
944 // LayoutVTable - Layout the vtable for the given base class, including its
949 /// given base subobject, as well as all its secondary vtables.
951 /// \param BaseIsMorallyVirtual whether the base subobject is a virtual base
952 /// or a direct or indirect base of a virtual base.
954 /// \param BaseIsVirtualInLayoutClass - Whether the base subobject is virtual
956 void LayoutPrimaryAndSecondaryVTables(BaseSubobject Base,
961 /// LayoutSecondaryVTables - Layout the secondary vtables for the given base
964 /// \param BaseIsMorallyVirtual whether the base subobject is a virtual base
965 /// or a direct or indirect base of a virtual base.
966 void LayoutSecondaryVTables(BaseSubobject Base, bool BaseIsMorallyVirtual,
976 /// given base (excluding any primary bases).
1111 // virtual base, gcc uses a virtual 'this' adjustment as well.
1172 // Get the virtual base offset offset.
1191 VTableBuilder::ComputeThisAdjustmentBaseOffset(BaseSubobject Base,
1193 const CXXRecordDecl *BaseRD = Base.getBase();
1201 llvm_unreachable("Class must be derived from the passed in base class!");
1205 // right base subobject.
1213 // If we have a virtual base class, the non-virtual offset is relative
1214 // to the virtual base class offset.
1218 /// Get the virtual base offset, relative to the most derived class
1228 // Check if this path gives us the right base subobject.
1229 if (OffsetToBaseSubobject == Base.getBaseOffset()) {
1230 // Since we're going from the base class _to_ the derived class, we'll
1263 // Get the vcall offset map for this virtual base.
1267 // We don't have vcall offsets for this virtual base, go ahead and
1344 // If the base and the first base in the primary base chain have the same
1349 // We know now that Base (or a direct or indirect base of it) is a primary
1350 // base in part of the class hierarchy, but not a primary base in the most
1353 // If the overrider is the first base in the primary base chain, we know
1363 // Now traverse the base chain, starting with the first base, until we find
1364 // the base that is no longer a primary base.
1374 "Primary base should always be at offset 0!");
1379 // Now check if this is the primary base that is not a primary base in the
1388 "Primary base should always be at offset 0!");
1392 llvm_unreachable("Found a duplicate primary base!");
1403 /// from the nearest base. Returns null if no method was found.
1428 VTableBuilder::AddMethods(BaseSubobject Base, CharUnits BaseOffsetInLayoutClass,
1432 const CXXRecordDecl *RD = Base.getBase();
1455 "Primary base should have a zero offset!");
1457 PrimaryBaseOffset = Base.getBaseOffset();
1466 llvm_unreachable("Found a duplicate primary base!");
1479 Overriders.getOverrider(MD, Base.getBaseOffset());
1482 // base. If this is the case, and the return type doesn't require adjustment
1483 // then we can just use the member function from the primary base.
1494 MethodInfo MethodInfo(Base.getBaseOffset(), BaseOffsetInLayoutClass,
1503 // If the overridden method exists in a virtual base class or a direct
1504 // or indirect base class of a virtual base class, we need to emit a
1505 // thunk if we ever have a class hierarchy where the base class is not
1506 // a primary base in the complete object.
1535 MethodInfo MethodInfo(Base.getBaseOffset(), BaseOffsetInLayoutClass,
1589 VTableBuilder::LayoutPrimaryAndSecondaryVTables(BaseSubobject Base,
1593 assert(Base.getBase()->isDynamicClass() && "class does not have a vtable!");
1597 Base, BaseIsVirtualInLayoutClass,
1603 VCallOffsetMap &VCallOffsets = VCallOffsetsForVBases[Base.getBase()];
1610 // virtual base class offset offsets.
1611 if (Base.getBase() == MostDerivedClass)
1626 AddMethods(Base, OffsetInLayoutClass,
1627 Base.getBase(), OffsetInLayoutClass,
1634 const CXXRecordDecl *RD = Base.getBase();
1647 // Check if this virtual primary base is a primary base in the layout
1663 LayoutSecondaryVTables(Base, BaseIsMorallyVirtual, OffsetInLayoutClass);
1666 void VTableBuilder::LayoutSecondaryVTables(BaseSubobject Base,
1671 // virtual tables for each of its proper base classes, except any primary
1672 // base(s) with which it shares its primary virtual table.
1674 const CXXRecordDecl *RD = Base.getBase();
1693 // Some of the base class subobjects may not need construction virtual
1701 // Get the base offset of this base.
1703 CharUnits BaseOffset = Base.getBaseOffset() + RelativeBaseOffset;
1708 // Don't emit a secondary vtable for a primary base. We might however want
1709 // to emit secondary vtables for other bases of this base.
1716 // Layout the primary vtable (and any secondary vtables) for this base.
1731 // Check if this base has a primary base.
1739 // Check if the base is actually a primary base in the class we use for
1747 // We know that the base is not a primary base in the layout class if
1748 // the base offsets are different.
1788 // Then come the virtual base virtual tables, also in inheritance graph
1796 // Check if this base needs a vtable. (If it's virtual, not a primary base
1817 // We only need to check the base for virtual base vtables if it actually
1839 // they are keyed by the index and not the base object.
1845 const BaseSubobject& Base = I->first;
1848 AddressPointsByIndex.insert(std::make_pair(Index, Base));
1979 const BaseSubobject &Base =
1982 Out << " -- (" << Base.getBase()->getQualifiedNameAsString();
1983 Out << ", " << Base.getBaseOffset().getQuantity();
1995 "Invalid base offset!");
2015 // We store the virtual base class names and their offsets in a map to get
2027 Out << "Virtual base offset offsets for '";
2183 llvm_unreachable("Found a duplicate primary base!");
2193 // whether it is a new function or overrides a base class function,
2194 // unless it overrides a function from the primary base, and conversion
2204 "Should have the definition decl of the primary base!");
2206 // Since the record decl shares its vtable pointer with the primary base
2207 // we need to start counting at the end of the primary base's vtable.
2212 // a method from the base.
2226 // Check if this method overrides a method in the primary base.
2234 // base class.