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. 36FIELD(UserDeclaredConstructor, 1, NO_MERGE) 37 38/// The user-declared special members which this class has. 39FIELD(UserDeclaredSpecialMembers, 6, NO_MERGE) 40 41/// True when this class is an aggregate. 42FIELD(Aggregate, 1, NO_MERGE) 43 44/// True when this class is a POD-type. 45FIELD(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. 53FIELD(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. 57FIELD(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). 61FIELD(Abstract, 1, NO_MERGE) 62 63/// True when this class is standard-layout, per the applicable 64/// language rules (including DRs). 65FIELD(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. 82FIELD(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. 88FIELD(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. 94FIELD(HasBasesWithNonStaticDataMembers, 1, NO_MERGE) 95 96/// True when there are private non-static data members. 97FIELD(HasPrivateFields, 1, NO_MERGE) 98 99/// True when there are protected non-static data members. 100FIELD(HasProtectedFields, 1, NO_MERGE) 101 102/// True when there are private non-static data members. 103FIELD(HasPublicFields, 1, NO_MERGE) 104 105/// True if this class (or any subobject) has mutable fields. 106FIELD(HasMutableFields, 1, NO_MERGE) 107 108/// True if this class (or any nested anonymous struct or union) 109/// has variant members. 110FIELD(HasVariantMembers, 1, NO_MERGE) 111 112/// True if there no non-field members declared by the user. 113FIELD(HasOnlyCMembers, 1, NO_MERGE) 114 115/// True if any field has an in-class initializer, including those 116/// within anonymous unions or structs. 117FIELD(HasInClassInitializer, 1, NO_MERGE) 118 119/// True if any field is of reference type, and does not have an 120/// in-class initializer. 121/// 122/// In this case, value-initialization of this class is illegal in C++98 123/// even if the class has a trivial default constructor. 124FIELD(HasUninitializedReferenceMember, 1, NO_MERGE) 125 126/// True if any non-mutable field whose type doesn't have a user- 127/// provided default ctor also doesn't have an in-class initializer. 128FIELD(HasUninitializedFields, 1, NO_MERGE) 129 130/// True if there are any member using-declarations that inherit 131/// constructors from a base class. 132FIELD(HasInheritedConstructor, 1, NO_MERGE) 133 134/// True if there are any member using-declarations named 135/// 'operator='. 136FIELD(HasInheritedAssignment, 1, NO_MERGE) 137 138/// These flags are \c true if a defaulted corresponding special 139/// member can't be fully analyzed without performing overload resolution. 140/// @{ 141FIELD(NeedOverloadResolutionForCopyConstructor, 1, NO_MERGE) 142FIELD(NeedOverloadResolutionForMoveConstructor, 1, NO_MERGE) 143FIELD(NeedOverloadResolutionForCopyAssignment, 1, NO_MERGE) 144FIELD(NeedOverloadResolutionForMoveAssignment, 1, NO_MERGE) 145FIELD(NeedOverloadResolutionForDestructor, 1, NO_MERGE) 146/// @} 147 148/// These flags are \c true if an implicit defaulted corresponding 149/// special member would be defined as deleted. 150/// @{ 151FIELD(DefaultedCopyConstructorIsDeleted, 1, NO_MERGE) 152FIELD(DefaultedMoveConstructorIsDeleted, 1, NO_MERGE) 153FIELD(DefaultedCopyAssignmentIsDeleted, 1, NO_MERGE) 154FIELD(DefaultedMoveAssignmentIsDeleted, 1, NO_MERGE) 155FIELD(DefaultedDestructorIsDeleted, 1, NO_MERGE) 156/// @} 157 158/// The trivial special members which this class has, per 159/// C++11 [class.ctor]p5, C++11 [class.copy]p12, C++11 [class.copy]p25, 160/// C++11 [class.dtor]p5, or would have if the member were not suppressed. 161/// 162/// This excludes any user-declared but not user-provided special members 163/// which have been declared but not yet defined. 164FIELD(HasTrivialSpecialMembers, 6, MERGE_OR) 165 166/// These bits keep track of the triviality of special functions for the 167/// purpose of calls. Only the bits corresponding to SMF_CopyConstructor, 168/// SMF_MoveConstructor, and SMF_Destructor are meaningful here. 169FIELD(HasTrivialSpecialMembersForCall, 6, MERGE_OR) 170 171/// The declared special members of this class which are known to be 172/// non-trivial. 173/// 174/// This excludes any user-declared but not user-provided special members 175/// which have been declared but not yet defined, and any implicit special 176/// members which have not yet been declared. 177FIELD(DeclaredNonTrivialSpecialMembers, 6, MERGE_OR) 178 179/// These bits keep track of the declared special members that are 180/// non-trivial for the purpose of calls. 181/// Only the bits corresponding to SMF_CopyConstructor, 182/// SMF_MoveConstructor, and SMF_Destructor are meaningful here. 183FIELD(DeclaredNonTrivialSpecialMembersForCall, 6, MERGE_OR) 184 185/// True when this class has a destructor with no semantic effect. 186FIELD(HasIrrelevantDestructor, 1, NO_MERGE) 187 188/// True when this class has at least one user-declared constexpr 189/// constructor which is neither the copy nor move constructor. 190FIELD(HasConstexprNonCopyMoveConstructor, 1, MERGE_OR) 191 192/// True if this class has a (possibly implicit) defaulted default 193/// constructor. 194FIELD(HasDefaultedDefaultConstructor, 1, MERGE_OR) 195 196/// True if a defaulted default constructor for this class would 197/// be constexpr. 198FIELD(DefaultedDefaultConstructorIsConstexpr, 1, NO_MERGE) 199 200/// True if this class has a constexpr default constructor. 201/// 202/// This is true for either a user-declared constexpr default constructor 203/// or an implicitly declared constexpr default constructor. 204FIELD(HasConstexprDefaultConstructor, 1, MERGE_OR) 205 206/// True if a defaulted destructor for this class would be constexpr. 207FIELD(DefaultedDestructorIsConstexpr, 1, NO_MERGE) 208 209/// True when this class contains at least one non-static data 210/// member or base class of non-literal or volatile type. 211FIELD(HasNonLiteralTypeFieldsOrBases, 1, NO_MERGE) 212 213/// True if this class is a structural type, assuming it is a literal type. 214FIELD(StructuralIfLiteral, 1, NO_MERGE) 215 216/// Whether we have a C++11 user-provided default constructor (not 217/// explicitly deleted or defaulted). 218FIELD(UserProvidedDefaultConstructor, 1, NO_MERGE) 219 220/// The special members which have been declared for this class, 221/// either by the user or implicitly. 222FIELD(DeclaredSpecialMembers, 6, MERGE_OR) 223 224/// Whether an implicit copy constructor could have a const-qualified 225/// parameter, for initializing virtual bases and for other subobjects. 226FIELD(ImplicitCopyConstructorCanHaveConstParamForVBase, 1, NO_MERGE) 227FIELD(ImplicitCopyConstructorCanHaveConstParamForNonVBase, 1, NO_MERGE) 228 229/// Whether an implicit copy assignment operator would have a 230/// const-qualified parameter. 231FIELD(ImplicitCopyAssignmentHasConstParam, 1, NO_MERGE) 232 233/// Whether any declared copy constructor has a const-qualified 234/// parameter. 235FIELD(HasDeclaredCopyConstructorWithConstParam, 1, MERGE_OR) 236 237/// Whether any declared copy assignment operator has either a 238/// const-qualified reference parameter or a non-reference parameter. 239FIELD(HasDeclaredCopyAssignmentWithConstParam, 1, MERGE_OR) 240 241#undef FIELD 242