Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 14 | pmbaty | 1 | //===-- CXXRecordDeclDefinitionBits.def - Class definition bits -*- C++ -*-===// |
| 2 | // |
||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
||
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
||
| 6 | // |
||
| 7 | //===----------------------------------------------------------------------===// |
||
| 8 | // |
||
| 9 | // This file enumerates the various bitfields that we want to store on C++ class |
||
| 10 | // definitions. |
||
| 11 | // |
||
| 12 | //===----------------------------------------------------------------------===// |
||
| 13 | // |
||
| 14 | /// @file CXXRecordDeclDefinitionBits.def |
||
| 15 | /// |
||
| 16 | /// In this file, each of the bitfields representing data about a C++ class |
||
| 17 | /// results in an expansion of the FIELD macro, which should be defined before |
||
| 18 | /// including this file. |
||
| 19 | /// |
||
| 20 | /// The macro have three operands: |
||
| 21 | /// |
||
| 22 | /// Name: The name of the field, as a member of CXXRecordDecl::DefinitionData. |
||
| 23 | /// |
||
| 24 | /// BitWidth: The width of the field in bits. |
||
| 25 | /// |
||
| 26 | /// MergePolicy: How to behave when the value of the field is different in |
||
| 27 | /// multiple translation units, one of: |
||
| 28 | /// NO_MERGE: It is an ODR violation if the fields do not match. |
||
| 29 | /// MERGE_OR: Merge the fields by ORing them together. |
||
| 30 | |||
| 31 | #ifndef FIELD |
||
| 32 | #error define FIELD before including this file |
||
| 33 | #endif |
||
| 34 | |||
| 35 | /// True if this class has any user-declared constructors. |
||
| 36 | FIELD(UserDeclaredConstructor, 1, NO_MERGE) |
||
| 37 | |||
| 38 | /// The user-declared special members which this class has. |
||
| 39 | FIELD(UserDeclaredSpecialMembers, 6, NO_MERGE) |
||
| 40 | |||
| 41 | /// True when this class is an aggregate. |
||
| 42 | FIELD(Aggregate, 1, NO_MERGE) |
||
| 43 | |||
| 44 | /// True when this class is a POD-type. |
||
| 45 | FIELD(PlainOldData, 1, NO_MERGE) |
||
| 46 | |||
| 47 | /// True when this class is empty for traits purposes, that is: |
||
| 48 | /// * has no data members other than 0-width bit-fields and empty fields |
||
| 49 | /// marked [[no_unique_address]] |
||
| 50 | /// * has no virtual function/base, and |
||
| 51 | /// * doesn't inherit from a non-empty class. |
||
| 52 | /// Doesn't take union-ness into account. |
||
| 53 | FIELD(Empty, 1, NO_MERGE) |
||
| 54 | |||
| 55 | /// True when this class is polymorphic, i.e., has at |
||
| 56 | /// least one virtual member or derives from a polymorphic class. |
||
| 57 | FIELD(Polymorphic, 1, NO_MERGE) |
||
| 58 | |||
| 59 | /// True when this class is abstract, i.e., has at least |
||
| 60 | /// one pure virtual function, (that can come from a base class). |
||
| 61 | FIELD(Abstract, 1, NO_MERGE) |
||
| 62 | |||
| 63 | /// True when this class is standard-layout, per the applicable |
||
| 64 | /// language rules (including DRs). |
||
| 65 | FIELD(IsStandardLayout, 1, NO_MERGE) |
||
| 66 | |||
| 67 | /// True when this class was standard-layout under the C++11 |
||
| 68 | /// definition. |
||
| 69 | /// |
||
| 70 | /// C++11 [class]p7. A standard-layout class is a class that: |
||
| 71 | /// * has no non-static data members of type non-standard-layout class (or |
||
| 72 | /// array of such types) or reference, |
||
| 73 | /// * has no virtual functions (10.3) and no virtual base classes (10.1), |
||
| 74 | /// * has the same access control (Clause 11) for all non-static data |
||
| 75 | /// members |
||
| 76 | /// * has no non-standard-layout base classes, |
||
| 77 | /// * either has no non-static data members in the most derived class and at |
||
| 78 | /// most one base class with non-static data members, or has no base |
||
| 79 | /// classes with non-static data members, and |
||
| 80 | /// * has no base classes of the same type as the first non-static data |
||
| 81 | /// member. |
||
| 82 | FIELD(IsCXX11StandardLayout, 1, NO_MERGE) |
||
| 83 | |||
| 84 | /// True when any base class has any declared non-static data |
||
| 85 | /// members or bit-fields. |
||
| 86 | /// This is a helper bit of state used to implement IsStandardLayout more |
||
| 87 | /// efficiently. |
||
| 88 | FIELD(HasBasesWithFields, 1, NO_MERGE) |
||
| 89 | |||
| 90 | /// True when any base class has any declared non-static data |
||
| 91 | /// members. |
||
| 92 | /// This is a helper bit of state used to implement IsCXX11StandardLayout |
||
| 93 | /// more efficiently. |
||
| 94 | FIELD(HasBasesWithNonStaticDataMembers, 1, NO_MERGE) |
||
| 95 | |||
| 96 | /// True when there are private non-static data members. |
||
| 97 | FIELD(HasPrivateFields, 1, NO_MERGE) |
||
| 98 | |||
| 99 | /// True when there are protected non-static data members. |
||
| 100 | FIELD(HasProtectedFields, 1, NO_MERGE) |
||
| 101 | |||
| 102 | /// True when there are private non-static data members. |
||
| 103 | FIELD(HasPublicFields, 1, NO_MERGE) |
||
| 104 | |||
| 105 | /// True if this class (or any subobject) has mutable fields. |
||
| 106 | FIELD(HasMutableFields, 1, NO_MERGE) |
||
| 107 | |||
| 108 | /// True if this class (or any nested anonymous struct or union) |
||
| 109 | /// has variant members. |
||
| 110 | FIELD(HasVariantMembers, 1, NO_MERGE) |
||
| 111 | |||
| 112 | /// True if there no non-field members declared by the user. |
||
| 113 | FIELD(HasOnlyCMembers, 1, NO_MERGE) |
||
| 114 | |||
| 115 | /// True if there is an '__init' method defined by the user. |
||
| 116 | FIELD(HasInitMethod, 1, NO_MERGE) |
||
| 117 | |||
| 118 | /// True if any field has an in-class initializer, including those |
||
| 119 | /// within anonymous unions or structs. |
||
| 120 | FIELD(HasInClassInitializer, 1, NO_MERGE) |
||
| 121 | |||
| 122 | /// True if any field is of reference type, and does not have an |
||
| 123 | /// in-class initializer. |
||
| 124 | /// |
||
| 125 | /// In this case, value-initialization of this class is illegal in C++98 |
||
| 126 | /// even if the class has a trivial default constructor. |
||
| 127 | FIELD(HasUninitializedReferenceMember, 1, NO_MERGE) |
||
| 128 | |||
| 129 | /// True if any non-mutable field whose type doesn't have a user- |
||
| 130 | /// provided default ctor also doesn't have an in-class initializer. |
||
| 131 | FIELD(HasUninitializedFields, 1, NO_MERGE) |
||
| 132 | |||
| 133 | /// True if there are any member using-declarations that inherit |
||
| 134 | /// constructors from a base class. |
||
| 135 | FIELD(HasInheritedConstructor, 1, NO_MERGE) |
||
| 136 | |||
| 137 | /// True if there are any member using-declarations that inherit |
||
| 138 | /// default constructors from a base class. |
||
| 139 | FIELD(HasInheritedDefaultConstructor, 1, NO_MERGE) |
||
| 140 | |||
| 141 | /// True if there are any member using-declarations named |
||
| 142 | /// 'operator='. |
||
| 143 | FIELD(HasInheritedAssignment, 1, NO_MERGE) |
||
| 144 | |||
| 145 | /// These flags are \c true if a defaulted corresponding special |
||
| 146 | /// member can't be fully analyzed without performing overload resolution. |
||
| 147 | /// @{ |
||
| 148 | FIELD(NeedOverloadResolutionForCopyConstructor, 1, NO_MERGE) |
||
| 149 | FIELD(NeedOverloadResolutionForMoveConstructor, 1, NO_MERGE) |
||
| 150 | FIELD(NeedOverloadResolutionForCopyAssignment, 1, NO_MERGE) |
||
| 151 | FIELD(NeedOverloadResolutionForMoveAssignment, 1, NO_MERGE) |
||
| 152 | FIELD(NeedOverloadResolutionForDestructor, 1, NO_MERGE) |
||
| 153 | /// @} |
||
| 154 | |||
| 155 | /// These flags are \c true if an implicit defaulted corresponding |
||
| 156 | /// special member would be defined as deleted. |
||
| 157 | /// @{ |
||
| 158 | FIELD(DefaultedCopyConstructorIsDeleted, 1, NO_MERGE) |
||
| 159 | FIELD(DefaultedMoveConstructorIsDeleted, 1, NO_MERGE) |
||
| 160 | FIELD(DefaultedCopyAssignmentIsDeleted, 1, NO_MERGE) |
||
| 161 | FIELD(DefaultedMoveAssignmentIsDeleted, 1, NO_MERGE) |
||
| 162 | FIELD(DefaultedDestructorIsDeleted, 1, NO_MERGE) |
||
| 163 | /// @} |
||
| 164 | |||
| 165 | /// The trivial special members which this class has, per |
||
| 166 | /// C++11 [class.ctor]p5, C++11 [class.copy]p12, C++11 [class.copy]p25, |
||
| 167 | /// C++11 [class.dtor]p5, or would have if the member were not suppressed. |
||
| 168 | /// |
||
| 169 | /// This excludes any user-declared but not user-provided special members |
||
| 170 | /// which have been declared but not yet defined. |
||
| 171 | FIELD(HasTrivialSpecialMembers, 6, MERGE_OR) |
||
| 172 | |||
| 173 | /// These bits keep track of the triviality of special functions for the |
||
| 174 | /// purpose of calls. Only the bits corresponding to SMF_CopyConstructor, |
||
| 175 | /// SMF_MoveConstructor, and SMF_Destructor are meaningful here. |
||
| 176 | FIELD(HasTrivialSpecialMembersForCall, 6, MERGE_OR) |
||
| 177 | |||
| 178 | /// The declared special members of this class which are known to be |
||
| 179 | /// non-trivial. |
||
| 180 | /// |
||
| 181 | /// This excludes any user-declared but not user-provided special members |
||
| 182 | /// which have been declared but not yet defined, and any implicit special |
||
| 183 | /// members which have not yet been declared. |
||
| 184 | FIELD(DeclaredNonTrivialSpecialMembers, 6, MERGE_OR) |
||
| 185 | |||
| 186 | /// These bits keep track of the declared special members that are |
||
| 187 | /// non-trivial for the purpose of calls. |
||
| 188 | /// Only the bits corresponding to SMF_CopyConstructor, |
||
| 189 | /// SMF_MoveConstructor, and SMF_Destructor are meaningful here. |
||
| 190 | FIELD(DeclaredNonTrivialSpecialMembersForCall, 6, MERGE_OR) |
||
| 191 | |||
| 192 | /// True when this class has a destructor with no semantic effect. |
||
| 193 | FIELD(HasIrrelevantDestructor, 1, NO_MERGE) |
||
| 194 | |||
| 195 | /// True when this class has at least one user-declared constexpr |
||
| 196 | /// constructor which is neither the copy nor move constructor. |
||
| 197 | FIELD(HasConstexprNonCopyMoveConstructor, 1, MERGE_OR) |
||
| 198 | |||
| 199 | /// True if this class has a (possibly implicit) defaulted default |
||
| 200 | /// constructor. |
||
| 201 | FIELD(HasDefaultedDefaultConstructor, 1, MERGE_OR) |
||
| 202 | |||
| 203 | /// True if a defaulted default constructor for this class would |
||
| 204 | /// be constexpr. |
||
| 205 | FIELD(DefaultedDefaultConstructorIsConstexpr, 1, NO_MERGE) |
||
| 206 | |||
| 207 | /// True if this class has a constexpr default constructor. |
||
| 208 | /// |
||
| 209 | /// This is true for either a user-declared constexpr default constructor |
||
| 210 | /// or an implicitly declared constexpr default constructor. |
||
| 211 | FIELD(HasConstexprDefaultConstructor, 1, MERGE_OR) |
||
| 212 | |||
| 213 | /// True if a defaulted destructor for this class would be constexpr. |
||
| 214 | FIELD(DefaultedDestructorIsConstexpr, 1, NO_MERGE) |
||
| 215 | |||
| 216 | /// True when this class contains at least one non-static data |
||
| 217 | /// member or base class of non-literal or volatile type. |
||
| 218 | FIELD(HasNonLiteralTypeFieldsOrBases, 1, NO_MERGE) |
||
| 219 | |||
| 220 | /// True if this class is a structural type, assuming it is a literal type. |
||
| 221 | FIELD(StructuralIfLiteral, 1, NO_MERGE) |
||
| 222 | |||
| 223 | /// Whether we have a C++11 user-provided default constructor (not |
||
| 224 | /// explicitly deleted or defaulted). |
||
| 225 | FIELD(UserProvidedDefaultConstructor, 1, NO_MERGE) |
||
| 226 | |||
| 227 | /// The special members which have been declared for this class, |
||
| 228 | /// either by the user or implicitly. |
||
| 229 | FIELD(DeclaredSpecialMembers, 6, MERGE_OR) |
||
| 230 | |||
| 231 | /// Whether an implicit copy constructor could have a const-qualified |
||
| 232 | /// parameter, for initializing virtual bases and for other subobjects. |
||
| 233 | FIELD(ImplicitCopyConstructorCanHaveConstParamForVBase, 1, NO_MERGE) |
||
| 234 | FIELD(ImplicitCopyConstructorCanHaveConstParamForNonVBase, 1, NO_MERGE) |
||
| 235 | |||
| 236 | /// Whether an implicit copy assignment operator would have a |
||
| 237 | /// const-qualified parameter. |
||
| 238 | FIELD(ImplicitCopyAssignmentHasConstParam, 1, NO_MERGE) |
||
| 239 | |||
| 240 | /// Whether any declared copy constructor has a const-qualified |
||
| 241 | /// parameter. |
||
| 242 | FIELD(HasDeclaredCopyConstructorWithConstParam, 1, MERGE_OR) |
||
| 243 | |||
| 244 | /// Whether any declared copy assignment operator has either a |
||
| 245 | /// const-qualified reference parameter or a non-reference parameter. |
||
| 246 | FIELD(HasDeclaredCopyAssignmentWithConstParam, 1, MERGE_OR) |
||
| 247 | |||
| 248 | /// Whether the destructor is no-return. Either explicitly, or if any |
||
| 249 | /// base classes or fields have a no-return destructor |
||
| 250 | FIELD(IsAnyDestructorNoReturn, 1, NO_MERGE) |
||
| 251 | |||
| 252 | #undef FIELD |