Home | History | Annotate | Download | only in Sema

Lines Matching refs:CLASS

55   class CheckDefaultArgumentVisitor
91 // class member names.
314 /// because we're inside a class definition. Note that this default
410 // Except for member functions of class templates, the default arguments
411 // in a member function definition that appears outside of the class
413 // member function declaration in the class definition.
433 // of template class. The new default parameter's value is ignored.
499 // - the explicit specialization of a member function of a class
500 // template where the class template specialization to which the
509 // Default arguments for a member function of a class template shall
511 // within the class template.
536 // DR1344: If a default argument is added outside a class definition and that
723 // - the class shall not have any virtual base classes;
841 /// struct or union nested within the class being checked.
936 // - every non-variant non-static data member and base class sub-object
938 // - if the class is a non-empty union, or for each non-empty anonymous
939 // union member of a non-union class, exactly one non-static data member
1006 // base class sub-objects shall be a constexpr constructor.
1021 /// name of the class type currently being defined. In the case of
1023 /// the innermost class.
1026 assert(getLangOpts().CPlusPlus && "No class names in C!");
1041 /// \brief Determine whether the given class is a base class of the given
1042 /// class, including looking at dependent bases.
1043 static bool findCircularInheritance(const CXXRecordDecl *Class,
1047 Class = Class->getCanonicalDecl();
1060 if (Base->getCanonicalDecl() == Class)
1076 /// \brief Check the validity of a C++ base class specifier.
1081 Sema::CheckBaseSpecifier(CXXRecordDecl *Class,
1088 // C++ [class.union]p1:
1090 if (Class->isUnion()) {
1091 Diag(Class->getLocation(), diag::err_base_clause_on_union)
1110 if (BaseDecl->getCanonicalDecl() == Class->getCanonicalDecl() ||
1112 findCircularInheritance(Class, BaseDecl))) {
1114 << BaseType << Context.getTypeDeclType(Class);
1116 if (BaseDecl->getCanonicalDecl() != Class->getCanonicalDecl())
1125 Class->getTagKind() == TTK_Class,
1135 // C++ [class.union]p1:
1136 // A union shall not be used as a base class.
1142 // C++ [class.derived]p2:
1143 // The class-name in a base-specifier shall not be an incompletely
1144 // defined class.
1147 Class->setInvalidDecl();
1151 // If the base class is polymorphic or isn't empty, the new one is/isn't, too.
1159 // C++ [class]p3:
1160 // If a class is marked final and it appears as a base-type-specifier in
1171 Class->setInvalidDecl();
1175 Class->getTagKind() == TTK_Class,
1180 /// one entry in the base class list of a class specifier, for
1182 /// class foo : public bar, virtual private baz {
1194 CXXRecordDecl *Class = dyn_cast<CXXRecordDecl>(classdecl);
1195 if (!Class)
1222 if (CXXBaseSpecifier *BaseSpec = CheckBaseSpecifier(Class, SpecifierRange,
1227 Class->setInvalidDecl();
1232 /// \brief Performs the actual work of attaching the given base class
1233 /// specifiers to a C++ class.
1234 bool Sema::AttachBaseSpecifiers(CXXRecordDecl *Class, CXXBaseSpecifier **Bases,
1242 // class.
1255 // C++ [class.mi]p3:
1256 // A class shall not be specified as a direct base class of a
1257 // derived class more than once.
1263 // Delete the duplicate base class specifier; we're going to
1269 // Okay, add this new base class.
1274 if (Class->isInterface() &&
1285 Class->addAttr(::new (Context) WeakAttr(SourceRange(), Context));
1290 // Attach the remaining base class specifiers to the derived class.
1291 Class->setBases(Bases, NumGoodBases);
1293 // Delete the remaining (good) base class specifiers, since their
1302 /// class, after checking whether there are any duplicate base
1323 /// \brief Determine whether the type \p Derived is a C++ class that is
1341 /// \brief Determine whether the type \p Derived is a C++ class that is
1382 /// base class.
1394 /// conversion (where Derived and Base are class types) is
1421 // Check that the base class can be accessed.
1454 // to each base class subobject.
1477 /// specific derived class to different subobjects of the same base
1478 /// class.
1482 /// inheritance hierarchy to go from the derived class to different
1483 /// subobjects of a base class. The result looks something like this:
1495 // class subobject yet.
1508 // C++ class member Handling
1556 // C++11 [class.virtual]p5:
1558 // does not override a member function of a base class, the program is
1569 /// C++11 [class.virtual]p4.
1591 /// ActOnCXXMemberDeclarator - This is invoked when a C++ class member
1594 /// one has been parsed, and 'InitStyle' is set if an in-class initializer is
1662 // duration (auto, register) or with the extern storage-class-specifier.
1663 // C++ 7.1.1p8: The mutable specifier can be applied only to names of class
1761 // The user provided a superfluous scope specifier inside a class
1764 // class X {
1857 class UninitializedFieldVisitor
1964 /// in-class initializer for a non-static C++ class member, and after
1965 /// instantiating an in-class initializer in a class template. Such actions
1966 /// are deferred until the class is complete.
2011 // C++11 [class.base.init]p7:
2033 // First, check for a direct base class.
2046 // Check for a virtual base class.
2051 // We haven't found a base yet; search the class hierarchy for a
2052 // virtual base class.
2109 // intializer: either a non-static field member or a base class.
2110 class MemInitializerValidatorCCC : public CorrectionCandidateCallback {
2159 // C++ [class.base.init]p2:
2161 // constructor's class and, if not found in that scope, are looked
2163 // [Note: if the constructor's class contains a member with the
2164 // same name as a direct or virtual base class of the class, a
2165 // mem-initializer-id naming the member or base class and composed
2166 // of a single identifier refers to the class member. A
2167 // mem-initializer-id for the hidden base class may be specified
2186 // It didn't name a member, so see if it names a class.
2250 // We have found a direct or virtual base class with a
2252 // that base class.
2391 // in-class initializers, see C++11 [class.base.init]p9.
2429 // C++11 [class.base.init]p7:
2487 // C++11 [class.base.init]p7:
2521 // C++ [class.base.init]p2:
2523 // member of the constructor's class or a direct or virtual base
2524 // of that class, the mem-initializer is ill-formed. A
2525 // mem-initializer-list can initialize a base class using any
2526 // name that denotes that base class type.
2558 // C++ [base.class.init]p2:
2560 // constructor's class or a direct or virtual base of that class, the
2563 // If the class has any dependent bases, then it's possible that
2566 // class initialization. FIXME: Should we try to check the
2586 // C++ [base.class.init]p2:
2588 // a direct non-virtual base class and an inherited virtual base
2589 // class, the mem-initializer is ill-formed.
2620 // C++11 [class.base.init]p7:
2685 // C++11 [class.inhctor]p8:
2731 // Cast to the base class to avoid ambiguities.
2829 // C++11 [class.copy]p15:
3092 // C++11 [class.base.init]p8: if the entity is a non-static data member that
3254 // C++ [class.bit]p2:
3616 // Bases are always records in a well-formed non-dependent class.
3624 // If our base class is invalid, we probably can't get its dtor anyway.
3633 // FIXME: caret should be on the start of the class name
3648 // Bases are always records in a well-formed non-dependent class.
3656 // If our base class is invalid, we probably can't get its dtor anyway.
3685 class NonAbstractTypeDiagnoser : public TypeDiagnoser {
3746 // for this class.
3764 // C++ [class.abstract]p4:
3765 // A class is abstract if it contains or inherits at least one
3821 #define ABSTRACT_TYPELOC(CLASS, PARENT)
3822 #define TYPELOC(CLASS, PARENT) \
3823 case TypeLoc::CLASS: Check(TL.castAs<CLASS##TypeLoc>(), Sel); break;
3921 /// Check for invalid uses of an abstract type within a class definition.
3946 // Nested classes and class templates.
3956 /// \brief Perform semantic checks on a class definition that has been
4000 // C++ [class.mem]p13:
4001 // If T is the name of a class, then each of the following shall have a
4003 // - every member of every anonymous union that is a member of class T.
4005 // C++ [class.mem]p14:
4006 // In addition, if class T has a user-declared constructor (12.1), every
4007 // non-static data member of class T shall have a name different from T.
4021 // Warn if the class has virtual methods but non-virtual public destructor.
4039 // class without overriding any.
4048 // determining triviality until the class is complete. That time is now!
4054 // Inform the class that we've finished declaring this member.
4063 // const. [...] The class of which that function is a member shall be
4066 // If the class has virtual bases, any constexpr members will already have
4071 // destructor for the class is trivial.
4094 // Only produce one error per class.
4111 /// specified operation on the specified class type a constexpr constructor?
4157 // -- if the class is a non-empty union, or for each non-empty anonymous
4158 // union member of a non-union class, exactly one non-static data member
4167 // -- the class shall not have any virtual base classes;
4171 // -- every constructor involved in initializing [...] base class
4186 // -- every non-static data member and base class sub-object shall be
4250 // A user-provided destructor can be defined outside the class. When that
4362 // Do not apply this rule to members of class templates, since core issue 1358
4378 // since we may not have parsed some necessary in-class initializers yet.
4497 /// Look up the corresponding special member in the given class.
4498 Sema::SpecialMemberOverloadResult *lookupIn(CXXRecordDecl *Class,
4501 // cv-qualifiers on class members don't affect default ctor / dtor calls.
4504 return S.LookupSpecialMember(Class, CSM,
4518 bool shouldDeleteForClassSubobject(CXXRecordDecl *Class, Subobject Subobj,
4532 /// If we're operating on a base class, the object type is the
4600 /// direct or virtual base class or non-static data member of class type M.
4602 CXXRecordDecl *Class, Subobject Subobj, unsigned Quals) {
4605 // C++11 [class.ctor]p5:
4606 // -- any direct or virtual base class, or non-static data member with no
4607 // brace-or-equal-initializer, has class type M (or array thereof) and
4611 // C++11 [class.copy]p11, C++11 [class.copy]p23:
4612 // -- a direct or virtual base class B that cannot be copied/moved because
4616 // C++11 [class.dtor]p5:
4617 // -- any direct or virtual base class [...] has a type with a destructor
4621 shouldDeleteForSubobjectCall(Subobj, lookupIn(Class, Quals), false))
4624 // C++11 [class.ctor]p5, C++11 [class.copy]p11:
4625 // -- any direct or virtual base class or non-static data member has a
4629 S.LookupSpecialMember(Class, Sema::CXXDestructor,
4638 /// Check whether we should delete a special member function due to the class
4639 /// having a particular direct or virtual base class.
4645 /// Check whether we should delete a special member function due to the class
4652 // For a default constructor, all references must be initialized in-class
4660 // C++11 [class.ctor]p5: any non-variant non-static data member of
4693 // C++11 [class.copy]p23:
4694 // -- a non-static data member of const non-class type (or array thereof)
4747 /// C++11 [class.ctor] p5:
4748 /// A defaulted default constructor for a class X is defined as deleted if
4765 /// deleted, as specified in C++11 [class.ctor]p5, C++11 [class.copy]p11,
4766 /// C++11 [class.copy]p23, and C++11 [class.dtor]p5.
4794 // C++11 [class.copy]p7, p18:
4795 // If the class definition declares a move constructor or move assignment
4844 // C++11 [class.dtor]p5:
4903 // C++11 [class.ctor]p5:
4933 // C++11 [class.dtor]p5:
4948 // C++11 [class.copy]p12:
4967 // C++11 [class.copy]p25:
5034 /// The subobject is a base class.
5088 /// Check whether the members of a class type allow a special member to be
5100 // Pretend anonymous struct or union members are members of this class.
5108 // C++11 [class.ctor]p5:
5110 // -- no non-static data member of its class has a
5140 /// Diagnose why the specified class does not have a trivial special member of
5152 /// as specified in C++11 [class.ctor]p5, C++11 [class.copy]p12,
5153 /// C++11 [class.copy]p25, and C++11 [class.dtor]p5.
5162 // C++11 [class.copy]p12, p25:
5226 // C++11 [class.ctor]p5, C++11 [class.dtor]p5:
5228 // -- the [member] selected to copy/move each direct base class subobject
5231 // C++11 [class.copy]p12, C++11 [class.copy]p25:
5243 // C++11 [class.ctor]p5, C++11 [class.dtor]p5:
5244 // A copy/move [constructor or assignment operator] for a class X is
5246 // -- for each non-static data member of X that is of class type (or array
5250 // C++11 [class.copy]p12, C++11 [class.copy]p25:
5252 // -- for all of the non-static data members of its class that are of class
5253 // type (or array thereof), each such class has a trivial [default
5258 // C++11 [class.dtor]p5:
5267 // C++11 [class.ctor]p5, C++11 [class.copy]p12, C++11 [class.copy]p25:
5268 // A [special member] for class X is trivial if [...]
5269 // -- class X has no virtual functions and no virtual base classes
5293 llvm_unreachable("dynamic class with no vbases and no virtual functions");
5324 /// method overloads virtual methods in a base class without overriding any,
5376 /// \brief See if a method overloads virtual methods in a base class without
5445 /// constructor, or destructor, to the given C++ class (C++
5447 /// definition of the class is complete.
5456 // determined while the class was being declared, force a declaration
5472 // If we have a dynamic class, then the copy assignment operator may be
5493 // If we have a dynamic class, then the destructor may be virtual, so we
5559 /// parsing a top-level (non-nested) C++ class, and we are now
5561 /// not be parsed earlier (C++ [class.mem]p2), such as default
5595 /// class body.
5606 // the class has implicitly-declared destructors, among other
5626 // C++ [class.ctor]p3:
5661 // C++0x [class.ctor]p4:
5693 // C++ [class.copy]p3:
5694 // A declaration of a constructor for a class X is ill-formed if
5765 // C++ [class.dtor]p1:
5766 // [...] A typedef-name that names a class is a class-name
5767 // (7.1.3); however, a typedef-name that names a class shall not
5780 // C++ [class.dtor]p2:
5781 // A destructor is used to destroy objects of its class type. A
5801 // class X {
5825 // C++0x [class.dtor]p2:
5872 // C++ [class.conv.fct]p1:
5891 // class X {
5925 // C++ [class.conv.fct]p4:
5957 /// class, if possible.
5966 // C++ [class.conv.fct]p1:
5970 // cv-qualified) base class of that type (or a reference to it),
5973 // virtual function that overrides a virtual function in a base class.
6254 // template <typename E> class std::initializer_list.
6391 class NamespaceValidatorCCC : public CorrectionCandidateCallback {
6628 // Diagnose finding a decl which is not from a base class of the
6629 // current class. We do this now because there are cases where this
6639 // template <class T> struct C : A {};
6640 // template <class T> struct D : C<T> { using B::foo; } // <---
6642 // resolves to the using decl in B, which is not a base class of D<T>.
6784 /// class is followed by a declaration which would hide or override
6795 /// When a using-declaration brings names from a base class into a
6796 /// derived class scope, member functions in the derived class
6798 /// parameter types in a base class (rather than conflicting).
6804 /// visible) until we've fully parsed/instantiated the class.
6999 // Check whether the named type is a direct base class.
7096 // A using-declaration for a class member shall be a member-declaration.
7099 // dependent class scope.
7115 // nested-name-specifier does not refer to a base class, which is
7139 // nested-name-specifier shall name a base class of the class
7164 // to a member of a base class of the class being defined [etc.].
7166 // Salient point: SS doesn't have to name a base class as long as
7169 // i.e. if the class hierarchies provably don't intersect.
7184 bool hasDependentBases(const CXXRecordDecl *Class) {
7185 return !Class->forallBases(collect, this);
7195 bool mightShareBases(const CXXRecordDecl *Class) {
7196 return Bases.count(Class) || !Class->forallBases(doesNotContain, this);
7206 // Returns false if the class has a dependent base or if it or one
7432 // Direct base-class constructors.
7449 // Virtual base-class constructors.
7473 // invokes a defaulted default constructor of its class or of an
7474 // enclosing class in a potentially evaluated subexpression, the
7480 // unable to compute an exception specification for an enclosed class.
7482 // We do not allow an in-class initializer to require the evaluation
7483 // of the exception specification for any in-class initializer whose
7542 // C++ [class.ctor]p5:
7543 // A default constructor for a class X is a constructor of class X
7545 // user-declared constructor for class X, a default constructor is
7547 // is an inline public member of its class.
7651 // FIXME: We need to ensure that any call to a constructor of this class
7663 // Now collect the constructors that we already have in the current class.
7665 // C++11 [class.inhctor]p3: [...] a constructor is implicitly declared [...]
7667 // the class where the using-declaration appears.
7705 // C++11 [class.inhctor]p1:
7706 // The candidate set of inherited constructors from the class X named in
7723 // derived class.
7748 // Skip copy and move constructors for both base and derived class
7760 // C++11 [class.inhctor]p3:
7763 // the same signature in the class where the using-declaration appears
7767 // C++11 [class.inhctor]p7:
7775 // Already in the map. If it came from a different class, that's an
7793 // produced by multiple base class constructors from the same base
7794 // class, the inheriting constructor is defined as deleted.
7880 // Direct base-class destructors.
7892 // Virtual base-class destructors.
7915 // C++ [class.dtor]p2:
7916 // If a class has no user-declared destructor, a destructor is
7918 // inline public member of its class.
8006 /// pending class member declarations have been parsed.
8008 // If the context is an invalid C++ class, just suppress these checks.
8035 // C++11 [class.dtor]p3:
8064 /// of class type where the selected copy/move-assignment operator is trivial.
8118 /// This routine is used to copy/move the members of a class with an
8147 // C++11 [class.copy]p28:
8150 // - if the subobject is of class type, as if by a call to operator= with
8156 // C++03 [class.copy]p13:
8157 // - if the subobject is of class type, the copy assignment operator for
8158 // the class is used (as if by explicit qualification; that is,
8186 // Suppress the protected check (C++ [class.protected]) for each of the
8189 // ensure that we're getting the right base class subobject (without
8192 // to qualify the operator= name with the base class (see below). However,
8193 // this means that if the base class has a protected copy assignment
8196 // know by construction that we're calling from a derived class.
8347 // non-trivially-copyable class type, just emit a memcpy.
8434 // member of its class.
8469 // C++0x [class.copy]p19:
8470 // .... If the class definition does not explicitly declare a copy
8508 // C++0x [class.copy]p30:
8510 // for a non-union class X performs memberwise copy assignment of its
8514 // which they were declared in the class definition.
8608 // Check for members of const-qualified, non-class type.
8761 /// Determine whether the class type has any direct or indirect virtual base
8772 // class does not have a non-trivial move assignment.
8789 // FIXME: Technically, non-trivially-copyable non-class types, such as
8815 /// of class \p ClassDecl have either a move operation, or are trivially
8847 // C++11 [class.copy]p20:
8848 // If the definition of a class X does not explicitly declare a move
8864 // - X has no direct or indirect virtual base class with a non-trivial
8883 // member of its class.
8919 // C++0x [class.copy]p9:
8920 // If the definition of a class X does not explicitly declare a move
8964 // C++0x [class.copy]p28:
8965 // The implicitly-defined or move assignment operator for a non-union class
8969 // are assigned, in the order in which they were declared in the class
9062 // Check for members of const-qualified, non-class type.
9216 // C++ [class.copy]p4:
9217 // If the class definition does not explicitly declare a copy
9243 // member of its class.
9272 // C++11 [class.copy]p8:
9273 // ... If the class definition does not explicitly declare a copy
9336 // Direct base-class constructors.
9354 // Virtual base-class constructors.
9392 // C++11 [class.copy]p9:
9393 // If the definition of a class X does not explicitly declare a move
9428 // C++0x [class.copy]p11:
9430 // member of its class.
9459 // C++0x [class.copy]p9:
9460 // If the definition of a class X does not explicitly declare a move
9654 // C++0x [class.copy]p34:
9656 // omit the copy/move construction of a class object, even if the
9659 // - when a temporary class object that has not been bound to a
9660 // reference (12.2) would be copied/moved to a class object
9715 // class-static, function-static).
9913 // parameter whose type is a class, a reference to a class, an
10009 // parameter of class or enumeration type, it defines the prefix
10447 // C++03 [class.friend]p2:
10449 // for a class.*
10451 // * The class-key of the elaborated-type-specifier is required.
10490 // C++11 [class.friend]p3:
10501 // cv-qualified) class type, that class is declared as a friend; otherwise,
10528 // This is a declaration of a class template.
10607 // Handle the case of a templated-scope friend class. e.g.
10608 // template <class T> class A<T>::B;
10630 /// Notes on friend class templates:
10632 /// We generally treat friend class declarations as if they were
10633 /// declaring a class. So, for example, the elaborated type specifier
10635 /// class-head (i.e. no typedefs in the scope chain), template
10640 /// friend class A<T>::B<unsigned>;
10643 /// template <> template \<class T> friend class A<int>::B;
10669 // where deciding whether a class C is a friend or not now hinges
10671 // 'foo' to equal C. There are restrictions on class-heads
10675 // FIXME: handle "template <> friend class A<T>;", which
10683 // C++98 [class.friend]p1: A friend of a class is a function
10684 // or class that is not a member of the class . . .
10723 // C++ [class.friend]p1
10724 // A friend of a class is a function or class....
10742 // - If a friend declaration in a non-local class first declares a
10743 // class or function, the friend class or function is a member
10747 // scope (either before or after the class declaration granting
10752 // - When looking for a prior declaration of a class or a function
10788 // C++0x [class.friend]p11:
10789 // If a friend declaration appears in a local class and the name
10792 // innermost enclosing non-class scope. For a friend function
10801 // Skip class contexts. If someone can cite chapter and verse
10825 // C++ [class.friend]p1: A friend of a class is a function or
10826 // class that is not a member of the class . . .
10838 // C++ [class.friend]p6:
10839 // A function can be defined in a friend declaration of a class if and
10840 // only if the class is a non-local class (9.8), the function name is
10876 // C++ [class.friend]p1: A friend of a class is a function or
10877 // class that is not a member of the class . . .
10885 // C++ [class.friend]p6:
10886 // A function can be defined in a friend declaration of a class if and
10887 // only if the class is a non-local class (9.8), the function name is
10905 // C++ [class.friend]p6:
10906 // A function can be defined in a friend declaration of a class if and
10907 // only if the class is a non-local class (9.8), the function name is
10914 assert(isa<CXXRecordDecl>(DC) && "friend declaration not in class?");
10931 // definition of a class.
10948 // want to do this yet if the friending class is dependent.
11173 // The return types aren't either both pointers or references to a class type.
11183 // C++ [class.virtual]p6:
11185 // class type in the return type of D::f shall be complete at the point of
11186 // declaration of D::f or shall be the class type D.
11196 // Check if the new class derives from the old class.
11230 // The new class type must have the same or less qualifiers as the old type.
11276 /// static data member of class X, names should be looked up in the scope of
11277 /// class X.
11314 // new class or enumeration.
11316 "Parser allowed 'typedef' as storage class of condition decl.");
11355 void Sema::MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class,
11359 if (!Class->isDynamicClass() || Class->isDependentContext() ||
11364 // Try to insert this class into the map.
11366 Class = cast<CXXRecordDecl>(Class->getCanonicalDecl());
11368 Pos = VTablesUsed.insert(std::make_pair(Class, DefinitionRequired));
11384 if (Class->isLocalClass())
11385 MarkVirtualMembersReferenced(Loc, Class);
11387 VTableUses.push_back(std::make_pair(Class, Loc));
11396 // the members of a class as "used", so we check the size each
11401 CXXRecordDecl *Class = VTableUses[I].first->getDefinition();
11402 if (!Class)
11409 // If this class has a key function, but that key function is
11412 const CXXMethodDecl *KeyFunction = Context.getCurrentKeyFunction(Class);
11428 // If we have a class with no key function that is the subject
11433 = Class->getTemplateSpecializationKind()
11435 for (TagDecl::redecl_iterator R = Class->redecls_begin(),
11436 REnd = Class->redecls_end();
11456 MarkVirtualMemberExceptionSpecsNeeded(Loc, Class);
11460 // Mark all of the virtual members of this class as referenced, so
11462 // vtable for this class is required.
11464 MarkVirtualMembersReferenced(Loc, Class);
11465 CXXRecordDecl *Canonical = cast<CXXRecordDecl>(Class->getCanonicalDecl());
11466 Consumer.HandleVTable(Class, VTablesUsed[Canonical]);
11469 if (Class->hasExternalLinkage() &&
11470 Class->getTemplateSpecializationKind() != TSK_ImplicitInstantiation) {
11475 Diag(Class->getLocation(), Class->getTemplateSpecializationKind() ==
11478 << Class;
11671 class FindCXXThisExpr : public RecursiveASTVisitor<FindCXXThisExpr> {