clang  14.0.0git
CXXInheritance.h
Go to the documentation of this file.
1 //===- CXXInheritance.h - C++ Inheritance -----------------------*- 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 provides routines that help analyzing C++ inheritance hierarchies.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_AST_CXXINHERITANCE_H
14 #define LLVM_CLANG_AST_CXXINHERITANCE_H
15 
16 #include "clang/AST/DeclBase.h"
17 #include "clang/AST/DeclCXX.h"
19 #include "clang/AST/Type.h"
20 #include "clang/AST/TypeOrdering.h"
21 #include "clang/Basic/Specifiers.h"
22 #include "llvm/ADT/DenseMap.h"
23 #include "llvm/ADT/DenseSet.h"
24 #include "llvm/ADT/MapVector.h"
25 #include "llvm/ADT/SmallSet.h"
26 #include "llvm/ADT/SmallVector.h"
27 #include "llvm/ADT/iterator_range.h"
28 #include <list>
29 #include <memory>
30 #include <utility>
31 
32 namespace clang {
33 
34 class ASTContext;
35 class NamedDecl;
36 
37 /// Represents an element in a path from a derived class to a
38 /// base class.
39 ///
40 /// Each step in the path references the link from a
41 /// derived class to one of its direct base classes, along with a
42 /// base "number" that identifies which base subobject of the
43 /// original derived class we are referencing.
45  /// The base specifier that states the link from a derived
46  /// class to a base class, which will be followed by this base
47  /// path element.
49 
50  /// The record decl of the class that the base is a base of.
52 
53  /// Identifies which base class subobject (of type
54  /// \c Base->getType()) this base path element refers to.
55  ///
56  /// This value is only valid if \c !Base->isVirtual(), because there
57  /// is no base numbering for the zero or one virtual bases of a
58  /// given type.
60 };
61 
62 /// Represents a path from a specific derived class
63 /// (which is not represented as part of the path) to a particular
64 /// (direct or indirect) base class subobject.
65 ///
66 /// Individual elements in the path are described by the \c CXXBasePathElement
67 /// structure, which captures both the link from a derived class to one of its
68 /// direct bases and identification describing which base class
69 /// subobject is being used.
70 class CXXBasePath : public SmallVector<CXXBasePathElement, 4> {
71 public:
72  /// The access along this inheritance path. This is only
73  /// calculated when recording paths. AS_none is a special value
74  /// used to indicate a path which permits no legal access.
76 
77  CXXBasePath() = default;
78 
79  /// The declarations found inside this base class subobject.
81 
82  void clear() {
84  Access = AS_public;
85  }
86 };
87 
88 /// BasePaths - Represents the set of paths from a derived class to
89 /// one of its (direct or indirect) bases. For example, given the
90 /// following class hierarchy:
91 ///
92 /// @code
93 /// class A { };
94 /// class B : public A { };
95 /// class C : public A { };
96 /// class D : public B, public C{ };
97 /// @endcode
98 ///
99 /// There are two potential BasePaths to represent paths from D to a
100 /// base subobject of type A. One path is (D,0) -> (B,0) -> (A,0)
101 /// and another is (D,0)->(C,0)->(A,1). These two paths actually
102 /// refer to two different base class subobjects of the same type,
103 /// so the BasePaths object refers to an ambiguous path. On the
104 /// other hand, consider the following class hierarchy:
105 ///
106 /// @code
107 /// class A { };
108 /// class B : public virtual A { };
109 /// class C : public virtual A { };
110 /// class D : public B, public C{ };
111 /// @endcode
112 ///
113 /// Here, there are two potential BasePaths again, (D, 0) -> (B, 0)
114 /// -> (A,v) and (D, 0) -> (C, 0) -> (A, v), but since both of them
115 /// refer to the same base class subobject of type A (the virtual
116 /// one), there is no ambiguity.
118  friend class CXXRecordDecl;
119 
120  /// The type from which this search originated.
121  const CXXRecordDecl *Origin = nullptr;
122 
123  /// Paths - The actual set of paths that can be taken from the
124  /// derived class to the same base class.
125  std::list<CXXBasePath> Paths;
126 
127  /// ClassSubobjects - Records the class subobjects for each class
128  /// type that we've seen. The first element IsVirtBase says
129  /// whether we found a path to a virtual base for that class type,
130  /// while NumberOfNonVirtBases contains the number of non-virtual base
131  /// class subobjects for that class type. The key of the map is
132  /// the cv-unqualified canonical type of the base class subobject.
133  struct IsVirtBaseAndNumberNonVirtBases {
134  unsigned IsVirtBase : 1;
135  unsigned NumberOfNonVirtBases : 31;
136  };
137  llvm::SmallDenseMap<QualType, IsVirtBaseAndNumberNonVirtBases, 8>
138  ClassSubobjects;
139 
140  /// VisitedDependentRecords - Records the dependent records that have been
141  /// already visited.
142  llvm::SmallPtrSet<const CXXRecordDecl *, 4> VisitedDependentRecords;
143 
144  /// DetectedVirtual - The base class that is virtual.
145  const RecordType *DetectedVirtual = nullptr;
146 
147  /// ScratchPath - A BasePath that is used by Sema::lookupInBases
148  /// to help build the set of paths.
149  CXXBasePath ScratchPath;
150 
151  /// FindAmbiguities - Whether Sema::IsDerivedFrom should try find
152  /// ambiguous paths while it is looking for a path from a derived
153  /// type to a base type.
154  bool FindAmbiguities;
155 
156  /// RecordPaths - Whether Sema::IsDerivedFrom should record paths
157  /// while it is determining whether there are paths from a derived
158  /// type to a base type.
159  bool RecordPaths;
160 
161  /// DetectVirtual - Whether Sema::IsDerivedFrom should abort the search
162  /// if it finds a path that goes across a virtual base. The virtual class
163  /// is also recorded.
164  bool DetectVirtual;
165 
166  bool lookupInBases(ASTContext &Context, const CXXRecordDecl *Record,
168  bool LookupInDependent = false);
169 
170 public:
171  using paths_iterator = std::list<CXXBasePath>::iterator;
172  using const_paths_iterator = std::list<CXXBasePath>::const_iterator;
174 
175  /// BasePaths - Construct a new BasePaths structure to record the
176  /// paths for a derived-to-base search.
177  explicit CXXBasePaths(bool FindAmbiguities = true, bool RecordPaths = true,
178  bool DetectVirtual = true)
179  : FindAmbiguities(FindAmbiguities), RecordPaths(RecordPaths),
180  DetectVirtual(DetectVirtual) {}
181 
182  paths_iterator begin() { return Paths.begin(); }
183  paths_iterator end() { return Paths.end(); }
184  const_paths_iterator begin() const { return Paths.begin(); }
185  const_paths_iterator end() const { return Paths.end(); }
186 
187  CXXBasePath& front() { return Paths.front(); }
188  const CXXBasePath& front() const { return Paths.front(); }
189 
190  using decl_range = llvm::iterator_range<decl_iterator>;
191 
192  /// Determine whether the path from the most-derived type to the
193  /// given base type is ambiguous (i.e., it refers to multiple subobjects of
194  /// the same base type).
195  bool isAmbiguous(CanQualType BaseType);
196 
197  /// Whether we are finding multiple paths to detect ambiguities.
198  bool isFindingAmbiguities() const { return FindAmbiguities; }
199 
200  /// Whether we are recording paths.
201  bool isRecordingPaths() const { return RecordPaths; }
202 
203  /// Specify whether we should be recording paths or not.
204  void setRecordingPaths(bool RP) { RecordPaths = RP; }
205 
206  /// Whether we are detecting virtual bases.
207  bool isDetectingVirtual() const { return DetectVirtual; }
208 
209  /// The virtual base discovered on the path (if we are merely
210  /// detecting virtuals).
212  return DetectedVirtual;
213  }
214 
215  /// Retrieve the type from which this base-paths search
216  /// began
217  const CXXRecordDecl *getOrigin() const { return Origin; }
218  void setOrigin(const CXXRecordDecl *Rec) { Origin = Rec; }
219 
220  /// Clear the base-paths results.
221  void clear();
222 
223  /// Swap this data structure's contents with another CXXBasePaths
224  /// object.
225  void swap(CXXBasePaths &Other);
226 };
227 
228 /// Uniquely identifies a virtual method within a class
229 /// hierarchy by the method itself and a class subobject number.
231  /// The overriding virtual method.
232  CXXMethodDecl *Method = nullptr;
233 
234  /// The subobject in which the overriding virtual method
235  /// resides.
236  unsigned Subobject = 0;
237 
238  /// The virtual base class subobject of which this overridden
239  /// virtual method is a part. Note that this records the closest
240  /// derived virtual base class subobject.
242 
243  UniqueVirtualMethod() = default;
244 
249 
250  friend bool operator==(const UniqueVirtualMethod &X,
251  const UniqueVirtualMethod &Y) {
252  return X.Method == Y.Method && X.Subobject == Y.Subobject &&
253  X.InVirtualSubobject == Y.InVirtualSubobject;
254  }
255 
256  friend bool operator!=(const UniqueVirtualMethod &X,
257  const UniqueVirtualMethod &Y) {
258  return !(X == Y);
259  }
260 };
261 
262 /// The set of methods that override a given virtual method in
263 /// each subobject where it occurs.
264 ///
265 /// The first part of the pair is the subobject in which the
266 /// overridden virtual function occurs, while the second part of the
267 /// pair is the virtual method that overrides it (including the
268 /// subobject in which that virtual function occurs).
271  using MapType = llvm::MapVector<unsigned, ValuesT>;
272 
273  MapType Overrides;
274 
275 public:
276  // Iterate over the set of subobjects that have overriding methods.
277  using iterator = MapType::iterator;
278  using const_iterator = MapType::const_iterator;
279 
280  iterator begin() { return Overrides.begin(); }
281  const_iterator begin() const { return Overrides.begin(); }
282  iterator end() { return Overrides.end(); }
283  const_iterator end() const { return Overrides.end(); }
284  unsigned size() const { return Overrides.size(); }
285 
286  // Iterate over the set of overriding virtual methods in a given
287  // subobject.
288  using overriding_iterator =
292 
293  // Add a new overriding method for a particular subobject.
294  void add(unsigned OverriddenSubobject, UniqueVirtualMethod Overriding);
295 
296  // Add all of the overriding methods from "other" into overrides for
297  // this method. Used when merging the overrides from multiple base
298  // class subobjects.
299  void add(const OverridingMethods &Other);
300 
301  // Replace all overriding virtual methods in all subobjects with the
302  // given virtual method.
303  void replaceAll(UniqueVirtualMethod Overriding);
304 };
305 
306 /// A mapping from each virtual member function to its set of
307 /// final overriders.
308 ///
309 /// Within a class hierarchy for a given derived class, each virtual
310 /// member function in that hierarchy has one or more "final
311 /// overriders" (C++ [class.virtual]p2). A final overrider for a
312 /// virtual function "f" is the virtual function that will actually be
313 /// invoked when dispatching a call to "f" through the
314 /// vtable. Well-formed classes have a single final overrider for each
315 /// virtual function; in abstract classes, the final overrider for at
316 /// least one virtual function is a pure virtual function. Due to
317 /// multiple, virtual inheritance, it is possible for a class to have
318 /// more than one final overrider. Athough this is an error (per C++
319 /// [class.virtual]p2), it is not considered an error here: the final
320 /// overrider map can represent multiple final overriders for a
321 /// method, and it is up to the client to determine whether they are
322 /// problem. For example, the following class \c D has two final
323 /// overriders for the virtual function \c A::f(), one in \c C and one
324 /// in \c D:
325 ///
326 /// \code
327 /// struct A { virtual void f(); };
328 /// struct B : virtual A { virtual void f(); };
329 /// struct C : virtual A { virtual void f(); };
330 /// struct D : B, C { };
331 /// \endcode
332 ///
333 /// This data structure contains a mapping from every virtual
334 /// function *that does not override an existing virtual function* and
335 /// in every subobject where that virtual function occurs to the set
336 /// of virtual functions that override it. Thus, the same virtual
337 /// function \c A::f can actually occur in multiple subobjects of type
338 /// \c A due to multiple inheritance, and may be overridden by
339 /// different virtual functions in each, as in the following example:
340 ///
341 /// \code
342 /// struct A { virtual void f(); };
343 /// struct B : A { virtual void f(); };
344 /// struct C : A { virtual void f(); };
345 /// struct D : B, C { };
346 /// \endcode
347 ///
348 /// Unlike in the previous example, where the virtual functions \c
349 /// B::f and \c C::f both overrode \c A::f in the same subobject of
350 /// type \c A, in this example the two virtual functions both override
351 /// \c A::f but in *different* subobjects of type A. This is
352 /// represented by numbering the subobjects in which the overridden
353 /// and the overriding virtual member functions are located. Subobject
354 /// 0 represents the virtual base class subobject of that type, while
355 /// subobject numbers greater than 0 refer to non-virtual base class
356 /// subobjects of that type.
358  : public llvm::MapVector<const CXXMethodDecl *, OverridingMethods> {};
359 
360 /// A set of all the primary bases for a class.
362  : public llvm::SmallSet<const CXXRecordDecl*, 32> {};
363 
364 inline bool
366  return Inheritance == MSInheritanceModel::Unspecified;
367 }
368 
369 // Only member pointers to functions need a this adjustment, since it can be
370 // combined with the field offset for data pointers.
371 inline bool inheritanceModelHasNVOffsetField(bool IsMemberFunction,
372  MSInheritanceModel Inheritance) {
373  return IsMemberFunction && Inheritance >= MSInheritanceModel::Multiple;
374 }
375 
376 inline bool
378  return Inheritance >= MSInheritanceModel::Virtual;
379 }
380 
381 inline bool inheritanceModelHasOnlyOneField(bool IsMemberFunction,
382  MSInheritanceModel Inheritance) {
383  if (IsMemberFunction)
384  return Inheritance <= MSInheritanceModel::Single;
385  return Inheritance <= MSInheritanceModel::Multiple;
386 }
387 
388 } // namespace clang
389 
390 #endif // LLVM_CLANG_AST_CXXINHERITANCE_H
clang::CXXBasePaths::clear
void clear()
Clear the base-paths results.
Definition: CXXInheritance.cpp:47
clang::CXXBasePaths::getOrigin
const CXXRecordDecl * getOrigin() const
Retrieve the type from which this base-paths search began.
Definition: CXXInheritance.h:217
Specifiers.h
clang::CXXFinalOverriderMap
A mapping from each virtual member function to its set of final overriders.
Definition: CXXInheritance.h:357
clang::MSInheritanceModel::Multiple
@ Multiple
clang::CXXBasePaths::swap
void swap(CXXBasePaths &Other)
Swap this data structure's contents with another CXXBasePaths object.
Definition: CXXInheritance.cpp:57
clang::CXXBasePath::Decls
DeclContext::lookup_iterator Decls
The declarations found inside this base class subobject.
Definition: CXXInheritance.h:80
llvm::SmallVector
Definition: LLVM.h:38
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:249
clang::CXXBasePaths::isDetectingVirtual
bool isDetectingVirtual() const
Whether we are detecting virtual bases.
Definition: CXXInheritance.h:207
clang::DeclListNode::iterator
Definition: DeclBase.h:1244
DeclCXX.h
clang::UniqueVirtualMethod::operator!=
friend bool operator!=(const UniqueVirtualMethod &X, const UniqueVirtualMethod &Y)
Definition: CXXInheritance.h:256
llvm::SmallPtrSet
Definition: ASTContext.h:82
clang::OverridingMethods::size
unsigned size() const
Definition: CXXInheritance.h:284
clang::OverridingMethods::const_iterator
MapType::const_iterator const_iterator
Definition: CXXInheritance.h:278
clang::CXXBasePathElement::SubobjectNumber
int SubobjectNumber
Identifies which base class subobject (of type Base->getType()) this base path element refers to.
Definition: CXXInheritance.h:59
clang::tooling::X
static ToolExecutorPluginRegistry::Add< AllTUsToolExecutorPlugin > X("all-TUs", "Runs FrontendActions on all TUs in the compilation database. " "Tool results are stored in memory.")
clang::CXXBasePaths::setRecordingPaths
void setRecordingPaths(bool RP)
Specify whether we should be recording paths or not.
Definition: CXXInheritance.h:204
clang::UniqueVirtualMethod::Method
CXXMethodDecl * Method
The overriding virtual method.
Definition: CXXInheritance.h:232
clang::OverridingMethods
The set of methods that override a given virtual method in each subobject where it occurs.
Definition: CXXInheritance.h:269
clang::CXXBasePaths::const_paths_iterator
std::list< CXXBasePath >::const_iterator const_paths_iterator
Definition: CXXInheritance.h:172
clang::MSInheritanceModel::Unspecified
@ Unspecified
clang::CXXBasePaths::begin
const_paths_iterator begin() const
Definition: CXXInheritance.h:184
clang::CXXBasePaths::setOrigin
void setOrigin(const CXXRecordDecl *Rec)
Definition: CXXInheritance.h:218
clang::RecordType
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:4613
clang::OverridingMethods::iterator
MapType::iterator iterator
Definition: CXXInheritance.h:277
clang::OverridingMethods::begin
const_iterator begin() const
Definition: CXXInheritance.h:281
DeclBase.h
clang::inheritanceModelHasVBTableOffsetField
bool inheritanceModelHasVBTableOffsetField(MSInheritanceModel Inheritance)
Definition: CXXInheritance.h:377
clang::AS_public
@ AS_public
Definition: Specifiers.h:109
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:212
clang::CXXBasePaths::isAmbiguous
bool isAmbiguous(CanQualType BaseType)
Determine whether the path from the most-derived type to the given base type is ambiguous (i....
Definition: CXXInheritance.cpp:40
clang::CXXBasePaths::getDetectedVirtual
const RecordType * getDetectedVirtual() const
The virtual base discovered on the path (if we are merely detecting virtuals).
Definition: CXXInheritance.h:211
clang::CXXBasePaths::front
CXXBasePath & front()
Definition: CXXInheritance.h:187
clang::OverridingMethods::replaceAll
void replaceAll(UniqueVirtualMethod Overriding)
Definition: CXXInheritance.cpp:482
clang::MSInheritanceModel::Single
@ Single
Type.h
clang::CXXBasePathElement
Represents an element in a path from a derived class to a base class.
Definition: CXXInheritance.h:44
clang::UniqueVirtualMethod::UniqueVirtualMethod
UniqueVirtualMethod(CXXMethodDecl *Method, unsigned Subobject, const CXXRecordDecl *InVirtualSubobject)
Definition: CXXInheritance.h:245
clang::CXXIndirectPrimaryBaseSet
A set of all the primary bases for a class.
Definition: CXXInheritance.h:361
clang::UniqueVirtualMethod
Uniquely identifies a virtual method within a class hierarchy by the method itself and a class subobj...
Definition: CXXInheritance.h:230
clang::OverridingMethods::overriding_iterator
SmallVectorImpl< UniqueVirtualMethod >::iterator overriding_iterator
Definition: CXXInheritance.h:289
clang::CanQual< Type >
clang::OverridingMethods::end
iterator end()
Definition: CXXInheritance.h:282
clang::CXXBasePaths::paths_iterator
std::list< CXXBasePath >::iterator paths_iterator
Definition: CXXInheritance.h:171
clang::CXXBasePaths::decl_range
llvm::iterator_range< decl_iterator > decl_range
Definition: CXXInheritance.h:190
clang::CXXBasePaths::end
paths_iterator end()
Definition: CXXInheritance.h:183
clang::AccessSpecifier
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:108
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:255
clang::inheritanceModelHasNVOffsetField
bool inheritanceModelHasNVOffsetField(bool IsMemberFunction, MSInheritanceModel Inheritance)
Definition: CXXInheritance.h:371
clang::OverridingMethods::end
const_iterator end() const
Definition: CXXInheritance.h:283
TypeOrdering.h
clang::CXXBasePath::clear
void clear()
Definition: CXXInheritance.h:82
clang::inheritanceModelHasVBPtrOffsetField
bool inheritanceModelHasVBPtrOffsetField(MSInheritanceModel Inheritance)
Definition: CXXInheritance.h:365
clang::CXXBasePaths::CXXBasePaths
CXXBasePaths(bool FindAmbiguities=true, bool RecordPaths=true, bool DetectVirtual=true)
BasePaths - Construct a new BasePaths structure to record the paths for a derived-to-base search.
Definition: CXXInheritance.h:177
clang::MSInheritanceModel::Virtual
@ Virtual
clang::inheritanceModelHasOnlyOneField
bool inheritanceModelHasOnlyOneField(bool IsMemberFunction, MSInheritanceModel Inheritance)
Definition: CXXInheritance.h:381
DeclarationName.h
clang::CXXBasePath
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
Definition: CXXInheritance.h:70
clang::UniqueVirtualMethod::operator==
friend bool operator==(const UniqueVirtualMethod &X, const UniqueVirtualMethod &Y)
Definition: CXXInheritance.h:250
clang
Definition: CalledOnceCheck.h:17
clang::UniqueVirtualMethod::Subobject
unsigned Subobject
The subobject in which the overriding virtual method resides.
Definition: CXXInheritance.h:236
clang::CXXBasePaths::isRecordingPaths
bool isRecordingPaths() const
Whether we are recording paths.
Definition: CXXInheritance.h:201
clang::CXXBaseSpecifier
Represents a base class of a C++ class.
Definition: DeclCXX.h:147
clang::CXXBasePathElement::Base
const CXXBaseSpecifier * Base
The base specifier that states the link from a derived class to a base class, which will be followed ...
Definition: CXXInheritance.h:48
clang::MSInheritanceModel
MSInheritanceModel
Assigned inheritance model for a class in the MS C++ ABI.
Definition: Specifiers.h:369
clang::CXXBasePath::Access
AccessSpecifier Access
The access along this inheritance path.
Definition: CXXInheritance.h:75
clang::OverridingMethods::begin
iterator begin()
Definition: CXXInheritance.h:280
clang::CXXBasePaths::end
const_paths_iterator end() const
Definition: CXXInheritance.h:185
clang::CXXBasePaths
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
Definition: CXXInheritance.h:117
clang::CXXBasePaths::front
const CXXBasePath & front() const
Definition: CXXInheritance.h:188
clang::OverridingMethods::add
void add(unsigned OverriddenSubobject, UniqueVirtualMethod Overriding)
Definition: CXXInheritance.cpp:464
llvm::SmallVectorImpl
Definition: LLVM.h:39
clang::CXXBasePaths::begin
paths_iterator begin()
Definition: CXXInheritance.h:182
clang::CXXRecordDecl::BaseMatchesCallback
llvm::function_ref< bool(const CXXBaseSpecifier *Specifier, CXXBasePath &Path)> BaseMatchesCallback
Function type used by lookupInBases() to determine whether a specific base class subobject matches th...
Definition: DeclCXX.h:1582
clang::OverridingMethods::overriding_const_iterator
SmallVectorImpl< UniqueVirtualMethod >::const_iterator overriding_const_iterator
Definition: CXXInheritance.h:291
clang::CXXBasePath::CXXBasePath
CXXBasePath()=default
clang::UniqueVirtualMethod::UniqueVirtualMethod
UniqueVirtualMethod()=default
clang::CXXBasePaths::isFindingAmbiguities
bool isFindingAmbiguities() const
Whether we are finding multiple paths to detect ambiguities.
Definition: CXXInheritance.h:198
clang::UniqueVirtualMethod::InVirtualSubobject
const CXXRecordDecl * InVirtualSubobject
The virtual base class subobject of which this overridden virtual method is a part.
Definition: CXXInheritance.h:241
clang::CXXBasePathElement::Class
const CXXRecordDecl * Class
The record decl of the class that the base is a base of.
Definition: CXXInheritance.h:51
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1948