Home | History | Annotate | Download | only in Sema

Lines Matching defs:Base

671     //  - the class shall not have any virtual base classes;
900 // - every non-static data member and base class sub-object shall be
925 // Check initialization of non-static data members. Base classes are
949 // and base class sub-objects shall be a constexpr constructor;
997 /// \brief Check the validity of a C++ base class specifier.
1010 // A union shall not have base classes.
1031 // Base specifiers must be record types.
1038 // A union shall not be used as a base class.
1045 // The class-name in a base-specifier shall not be an incompletely
1054 // If the base class is polymorphic or isn't empty, the new one is/isn't, too.
1058 assert(BaseDecl && "Base type is not incomplete, but has no definition");
1060 assert(CXXBaseDecl && "Base type is not a C++ type");
1063 // If a class is marked final and it appears as a base-type-specifier in
1064 // base-clause, the program is ill-formed.
1076 // Create the base specifier.
1082 /// ActOnBaseSpecifier - Parsed a base specifier. A base specifier is
1083 /// one entry in the base class list of a class specifier, for
1086 /// 'public bar' and 'virtual private baz' are each base-specifiers.
1116 /// \brief Performs the actual work of attaching the given base class
1123 // Used to keep track of which base types we have already seen, so
1124 // that we can properly diagnose redundant direct base types. Note
1125 // that the key is always the unqualified canonical type of the base
1129 // Copy non-redundant base specifiers into permanent storage.
1138 // A class shall not be specified as a direct base class of a
1145 // Delete the duplicate base class specifier; we're going to
1151 // Okay, add this new base class.
1157 // Attach the remaining base class specifiers to the derived class.
1160 // Delete the remaining (good) base class specifiers, since their
1168 /// ActOnBaseSpecifiers - Attach the given base specifiers to the
1169 /// class, after checking whether there are any duplicate base
1191 /// derived from the type \p Base.
1192 bool Sema::IsDerivedFrom(QualType Derived, QualType Base) {
1200 CXXRecordDecl *BaseRD = GetClassForType(Base);
1209 /// derived from the type \p Base.
1210 bool Sema::IsDerivedFrom(QualType Derived, QualType Base, CXXBasePaths &Paths) {
1218 CXXRecordDecl *BaseRD = GetClassForType(Base);
1227 assert(BasePathArray.empty() && "Base path array must be empty!");
1232 // We first go backward and check if we have a virtual base.
1233 // FIXME: It would be better if CXXBasePath had the base specifier for
1234 // the nearest virtual base.
1237 if (Path[I - 1].Base->isVirtual()) {
1245 BasePathArray.push_back(const_cast<CXXBaseSpecifier*>(Path[I].Base));
1248 /// \brief Determine whether the given base path includes a virtual
1249 /// base class.
1260 /// CheckDerivedToBaseConversion - Check whether the Derived-to-Base
1261 /// conversion (where Derived and Base are class types) is
1263 /// that all of the base classes are accessible). Returns true
1269 Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
1275 // First, determine whether the path from Derived to Base is
1277 // the Derived to Base conversion exists, because here we need to
1281 bool DerivationOkay = IsDerivedFrom(Derived, Base, Paths);
1283 "Can only be used with a derived-to-base conversion");
1286 if (!Paths.isAmbiguous(Context.getCanonicalType(Base).getUnqualifiedType())) {
1288 // Check that the base class can be accessed.
1289 switch (CheckBaseClassAccess(Loc, Base, Derived, Paths.front(),
1300 // Build a base path if necessary.
1306 // We know that the derived-to-base conversion is ambiguous, and
1307 // we're going to produce a diagnostic. Perform the derived-to-base
1310 // the previous derived-to-base checks we've done, but at this point
1314 bool StillOkay = IsDerivedFrom(Derived, Base, Paths);
1315 assert(StillOkay && "Can only be used with a derived-to-base conversion");
1321 // to each base class subobject.
1325 << Derived << Base << PathDisplayStr << Range << Name;
1330 Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
1334 return CheckDerivedToBaseConversion(Derived, Base,
1344 /// specific derived class to different subobjects of the same base
1350 /// subobjects of a base class. The result looks something like this:
1361 // We haven't displayed a path to this particular base
1367 PathDisplayStr += " -> " + Element->Base->getType().getAsString();
1401 // not override a member function of a base class,
1647 // C++0x [class.base.init]p7:
1648 // The initialization of each base and member constitutes a
1661 /// \brief Find the direct and/or virtual base specifiers that
1662 /// correspond to the given base type, for use in base initialization
1669 // First, check for a direct base class.
1671 for (CXXRecordDecl::base_class_const_iterator Base
1673 Base != ClassDecl->bases_end(); ++Base) {
1674 if (SemaRef.Context.hasSameUnqualifiedType(BaseType, Base->getType())) {
1675 // We found a direct base of this type. That's what we're
1677 DirectBaseSpec = &*Base;
1682 // Check for a virtual base class.
1687 // We haven't found a base yet; search the class hierarchy for a
1688 // virtual base class.
1695 if (Path->back().Base->isVirtual()) {
1696 VirtualBaseSpec = Path->back().Base;
1765 // C++ [class.base.init]p2:
1770 // same name as a direct or virtual base class of the class, a
1771 // mem-initializer-id naming the member or base class and composed
1773 // mem-initializer-id for the hidden base class may be specified
1865 // We have found a direct or virtual base class with a
1867 // that base class.
2002 const Expr *base = ME->getBase();
2003 if (base != NULL && !isa<CXXThisExpr>(base->IgnoreParenCasts())) {
2089 // C++0x [class.base.init]p7:
2090 // The initialization of each base and member constitutes a
2152 // C++0x [class.base.init]p7:
2153 // The initialization of each base and member constitutes a
2180 // C++ [class.base.init]p2:
2182 // member of the constructor's class or a direct or virtual base
2184 // mem-initializer-list can initialize a base class using any
2185 // name that denotes that base class type.
2205 // Check for direct and virtual base classes.
2216 // C++ [base.class.init]p2:
2218 // constructor's class or a direct or virtual base of that class, the
2223 // BaseType. Therefore, just treat this as a dependent base
2236 // Can't check initialization for a base of dependent type or when
2248 // C++ [base.class.init]p2:
2250 // a direct non-virtual base class and an inherited virtual base
2261 // Initialize the base.
2274 // C++0x [class.base.init]p7:
2275 // The initialization of each base and member constitutes a
2285 // of the information that we have about the base
2311 /// ImplicitInitializerKind - How an implicit base or member initializer should
2312 /// initialize its base or member.
2352 // Cast to the base class to avoid ambiguities.
2665 // C++0x [class.base.init]p8: if the entity is a non-static data member that
2795 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
2796 E = ClassDecl->bases_end(); Base != E; ++Base) {
2797 // Virtuals are in the virtual base list and already constructed.
2798 if (Base->isVirtual())
2802 = Info.AllBaseFields.lookup(Base->getType()->getAs<RecordType>())) {
2807 Base, /*IsInheritedVirtualBase=*/false,
2874 // Constructors implicitly reference the base and member
2960 for (CXXRecordDecl::base_class_const_iterator Base = ClassDecl->bases_begin(),
2961 E = ClassDecl->bases_end(); Base != E; ++Base) {
2962 if (Base->isVirtual())
2964 IdealInitKeys.push_back(GetKeyForBase(SemaRef.Context, Base->getType()));
3037 assert(BaseClass && "neither field nor base");
3110 // For base initializers, this is keyed with a Type*.
3165 // field/base declaration. That's probably good; that said, the
3200 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
3201 E = ClassDecl->bases_end(); Base != E; ++Base) {
3203 const RecordType *RT = Base->getType()->getAs<RecordType>();
3206 if (Base->isVirtual())
3210 // If our base class is invalid, we probably can't get its dtor anyway.
3221 CheckDestructorAccess(Base->getSourceRange().getBegin(), Dtor,
3223 << Base->getType()
3224 << Base->getSourceRange());
3241 // If our base class is invalid, we probably can't get its dtor anyway.
3597 // See if a method overloads virtual methods in a base
4159 assert(BaseDecl && "base isn't a CXXRecordDecl");
4161 // Unless we have an assignment operator, the base's destructor must
4172 // Finding the corresponding member in the base should lead to a
4202 assert(BaseDecl && "base isn't a CXXRecordDecl");
4204 // Unless we have an assignment operator, the base's destructor must
4215 // Finding the corresponding member in the base should lead to a
4436 assert(BaseDecl && "base isn't a CXXRecordDecl");
4438 // -- a [direct base class] B that cannot be [copied] because overload
4455 assert(BaseDecl && "base isn't a CXXRecordDecl");
4457 // -- a [virtual base class] B that cannot be [copied] because overload
4549 // -- for the move constructor, [...] any direct or indirect virtual base
4560 assert(BaseDecl && "base isn't a CXXRecordDecl");
4562 // -- a [direct base class] B that cannot be [moved] because overload
4572 // -- for the move assignment operator, a [direct base class] with a type
4673 assert(BaseDtor && "base has no destructor");
4675 // -- any direct or virtual base class has a deleted destructor or
4689 assert(BaseDtor && "base has no destructor");
4691 // -- any direct or virtual base class has a deleted destructor or
4765 /// method overloads virtual methods in a base class without overriding any,
4790 // If the method we are checking overrides a method from its base
4806 /// \brief See if a method overloads virtual methods in a base class without
4822 // Keep the base methods that were overriden or introduced in the subclass
4823 // by 'using' in a set. A base method not in this set is hidden.
5370 // cv-qualified) base class of that type (or a reference to it),
5373 // virtual function that overrides a virtual function in a base class.
5874 // Diagnose finding a decl which is not from a base class of the
5888 // resolves to the using decl in B, which is not a base class of D<T>.
6033 /// struct Base { void foo(int); };
6034 /// struct Derived : Base {
6035 /// using Base::foo;
6041 /// When a using-declaration brings names from a base class into a
6044 /// parameter types in a base class (rather than conflicting).
6241 // Check whether the named type is a direct base class.
6354 // nested-name-specifier does not refer to a base class, which is
6378 // nested-name-specifier shall name a base class of the class
6403 // to a member of a base class of the class being defined [etc.].
6405 // Salient point: SS doesn't have to name a base class as long as
6406 // lookup only finds members from base classes. Therefore we can
6417 static bool collect(const CXXRecordDecl *Base, void *OpaqueData) {
6419 Data->Bases.insert(Base);
6427 /// Returns true if the base is dependent or is one of the
6428 /// accumulated base classes.
6429 static bool doesNotContain(const CXXRecordDecl *Base, void *OpaqueData) {
6431 return !Data->Bases.count(Base);
6441 // Returns false if we find a dependent base.
6445 // Returns false if the class has a dependent base or if it or one
6446 // of its bases is present in the base set of the current context.
6688 // Direct base-class constructors.
6705 // Virtual base-class constructors.
6880 // We start with an initial pass over the base classes to collect those that
6889 QualType Base = BaseIt->getType();
6890 if (Base->isDependentType()) {
6896 BasesToInheritFrom.push_back(Base->castAs<RecordType>());
6921 // First, we keep a map from constructor types to the base that introduced
6930 const RecordType *Base = *BaseIt;
6931 CanQualType CanonicalBase = Base->getCanonicalTypeUnqualified();
6932 CXXRecordDecl *BaseDecl = cast<CXXRecordDecl>(Base->getDecl());
6936 // Find the using declaration for inheriting this base's constructors.
7068 // Direct base-class destructors.
7080 // Virtual base-class destructors.
7234 /// \param CopyingBaseSubobject Whether we're copying/moving a base subobject.
7279 // we're assigning via a base classes's copy-assignment operator. To
7280 // ensure that we're getting the right base class subobject (without
7283 // to qualify the operator= name with the base class (see below). However,
7284 // this means that if the base class has a protected copy assignment
7425 // -- each direct base class B of X has a copy assignment operator
7428 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
7430 HasConstCopyAssignment && Base != BaseEnd; ++Base) {
7432 if (LangOpts.CPlusPlus0x && Base->isVirtual())
7435 assert(!Base->getType()->isDependentType() &&
7437 CXXRecordDecl *BaseClassDecl = Base->getType()->getAsCXXRecordDecl();
7444 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->vbases_begin(),
7446 HasConstCopyAssignment && Base != BaseEnd; ++Base) {
7447 assert(!Base->getType()->isDependentType() &&
7449 CXXRecordDecl *BaseClassDecl = Base->getType()->getAsCXXRecordDecl();
7487 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
7489 Base != BaseEnd; ++Base) {
7490 if (Base->isVirtual())
7494 = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
7500 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->vbases_begin(),
7502 Base != BaseEnd; ++Base) {
7504 = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
7611 // subobjects. The direct base classes of X are assigned first, in the
7612 // order of their declaration in the base-specifier-list, and then the
7642 // Assign base classes.
7644 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
7645 E = ClassDecl->bases_end(); Base != E; ++Base) {
7647 // static_cast<Base*>(this)->Base::operator=(static_cast<Base&>(other));
7648 QualType BaseType = Base->getType().getUnqualifiedType();
7655 BasePath.push_back(Base);
7658 // appropriately-qualified base type.
7667 // Implicitly cast "this" to the appropriately-qualified base type.
7909 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
7911 Base != BaseEnd; ++Base) {
7912 if (Base->isVirtual())
7916 = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
7922 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->vbases_begin(),
7924 Base != BaseEnd; ++Base) {
7926 = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
8032 // X performs memberwise move assignment of its subobjects. The direct base
8034 // base-specifier-list, and then the immediate non-static data members of X
8063 // Assign base classes.
8065 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
8066 E = ClassDecl->bases_end(); Base != E; ++Base) {
8068 // static_cast<Base*>(this)->Base::operator=(static_cast<Base&&>(other));
8069 QualType BaseType = Base->getType().getUnqualifiedType();
8076 BasePath.push_back(Base);
8079 // appropriately-qualified base type.
8087 // Implicitly cast "this" to the appropriately-qualified base type.
8172 "Member reference with rvalue base must be rvalue except for reference "
8335 // -- each direct or virtual base class B of X has a copy
8338 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
8340 HasConstCopyConstructor && Base != BaseEnd;
8341 ++Base) {
8343 if (Base->isVirtual())
8347 = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
8352 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->vbases_begin(),
8354 HasConstCopyConstructor && Base != BaseEnd;
8355 ++Base) {
8357 = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
8386 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
8388 Base != BaseEnd;
8389 ++Base) {
8391 if (Base->isVirtual())
8395 = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
8400 for (CXXRecordDecl::base_class_iterator Base = ClassDecl->vbases_begin(),
8402 Base != BaseEnd;
8403 ++Base) {
8405 = cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
8536 // Direct base-class constructors.
8553 // Virtual base-class constructors.
10340 // Check if we the conversion from derived to base is valid.
10608 const CXXRecordDecl *Base =
10610 if (Base->getNumVBases() == 0)
10612 MarkVirtualMembersReferenced(Loc, Base);