clang  16.0.0git
DeclCXX.cpp
Go to the documentation of this file.
1 //===- DeclCXX.cpp - C++ Declaration AST Node Implementation --------------===//
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 implements the C++ related Decl classes.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "clang/AST/DeclCXX.h"
14 #include "clang/AST/ASTContext.h"
15 #include "clang/AST/ASTLambda.h"
18 #include "clang/AST/Attr.h"
20 #include "clang/AST/DeclBase.h"
21 #include "clang/AST/DeclTemplate.h"
23 #include "clang/AST/Expr.h"
24 #include "clang/AST/ExprCXX.h"
27 #include "clang/AST/ODRHash.h"
28 #include "clang/AST/Type.h"
29 #include "clang/AST/TypeLoc.h"
31 #include "clang/Basic/Diagnostic.h"
33 #include "clang/Basic/LLVM.h"
38 #include "clang/Basic/Specifiers.h"
39 #include "clang/Basic/TargetInfo.h"
40 #include "llvm/ADT/None.h"
41 #include "llvm/ADT/SmallPtrSet.h"
42 #include "llvm/ADT/SmallVector.h"
43 #include "llvm/ADT/iterator_range.h"
44 #include "llvm/Support/Casting.h"
45 #include "llvm/Support/ErrorHandling.h"
46 #include "llvm/Support/Format.h"
47 #include "llvm/Support/raw_ostream.h"
48 #include <algorithm>
49 #include <cassert>
50 #include <cstddef>
51 #include <cstdint>
52 
53 using namespace clang;
54 
55 //===----------------------------------------------------------------------===//
56 // Decl Allocation/Deallocation Method Implementations
57 //===----------------------------------------------------------------------===//
58 
59 void AccessSpecDecl::anchor() {}
60 
62  return new (C, ID) AccessSpecDecl(EmptyShell());
63 }
64 
65 void LazyASTUnresolvedSet::getFromExternalSource(ASTContext &C) const {
66  ExternalASTSource *Source = C.getExternalSource();
67  assert(Impl.Decls.isLazy() && "getFromExternalSource for non-lazy set");
68  assert(Source && "getFromExternalSource with no external source");
69 
70  for (ASTUnresolvedSet::iterator I = Impl.begin(); I != Impl.end(); ++I)
71  I.setDecl(cast<NamedDecl>(Source->GetExternalDecl(
72  reinterpret_cast<uintptr_t>(I.getDecl()) >> 2)));
73  Impl.Decls.setLazy(false);
74 }
75 
76 CXXRecordDecl::DefinitionData::DefinitionData(CXXRecordDecl *D)
77  : UserDeclaredConstructor(false), UserDeclaredSpecialMembers(0),
78  Aggregate(true), PlainOldData(true), Empty(true), Polymorphic(false),
79  Abstract(false), IsStandardLayout(true), IsCXX11StandardLayout(true),
80  HasBasesWithFields(false), HasBasesWithNonStaticDataMembers(false),
81  HasPrivateFields(false), HasProtectedFields(false),
82  HasPublicFields(false), HasMutableFields(false), HasVariantMembers(false),
83  HasOnlyCMembers(true), HasInitMethod(false), HasInClassInitializer(false),
84  HasUninitializedReferenceMember(false), HasUninitializedFields(false),
85  HasInheritedConstructor(false), HasInheritedDefaultConstructor(false),
86  HasInheritedAssignment(false),
87  NeedOverloadResolutionForCopyConstructor(false),
88  NeedOverloadResolutionForMoveConstructor(false),
89  NeedOverloadResolutionForCopyAssignment(false),
90  NeedOverloadResolutionForMoveAssignment(false),
91  NeedOverloadResolutionForDestructor(false),
92  DefaultedCopyConstructorIsDeleted(false),
93  DefaultedMoveConstructorIsDeleted(false),
94  DefaultedCopyAssignmentIsDeleted(false),
95  DefaultedMoveAssignmentIsDeleted(false),
96  DefaultedDestructorIsDeleted(false), HasTrivialSpecialMembers(SMF_All),
97  HasTrivialSpecialMembersForCall(SMF_All),
98  DeclaredNonTrivialSpecialMembers(0),
99  DeclaredNonTrivialSpecialMembersForCall(0), HasIrrelevantDestructor(true),
100  HasConstexprNonCopyMoveConstructor(false),
101  HasDefaultedDefaultConstructor(false),
102  DefaultedDefaultConstructorIsConstexpr(true),
103  HasConstexprDefaultConstructor(false),
104  DefaultedDestructorIsConstexpr(true),
105  HasNonLiteralTypeFieldsOrBases(false), StructuralIfLiteral(true),
106  UserProvidedDefaultConstructor(false), DeclaredSpecialMembers(0),
107  ImplicitCopyConstructorCanHaveConstParamForVBase(true),
108  ImplicitCopyConstructorCanHaveConstParamForNonVBase(true),
109  ImplicitCopyAssignmentHasConstParam(true),
110  HasDeclaredCopyConstructorWithConstParam(false),
111  HasDeclaredCopyAssignmentWithConstParam(false),
112  IsAnyDestructorNoReturn(false), IsLambda(false),
113  IsParsingBaseSpecifiers(false), ComputedVisibleConversions(false),
114  HasODRHash(false), Definition(D) {}
115 
116 CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getBasesSlowCase() const {
117  return Bases.get(Definition->getASTContext().getExternalSource());
118 }
119 
120 CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getVBasesSlowCase() const {
121  return VBases.get(Definition->getASTContext().getExternalSource());
122 }
123 
125  DeclContext *DC, SourceLocation StartLoc,
127  CXXRecordDecl *PrevDecl)
128  : RecordDecl(K, TK, C, DC, StartLoc, IdLoc, Id, PrevDecl),
129  DefinitionData(PrevDecl ? PrevDecl->DefinitionData
130  : nullptr) {}
131 
133  DeclContext *DC, SourceLocation StartLoc,
135  CXXRecordDecl *PrevDecl,
136  bool DelayTypeCreation) {
137  auto *R = new (C, DC) CXXRecordDecl(CXXRecord, TK, C, DC, StartLoc, IdLoc, Id,
138  PrevDecl);
139  R->setMayHaveOutOfDateDef(C.getLangOpts().Modules);
140 
141  // FIXME: DelayTypeCreation seems like such a hack
142  if (!DelayTypeCreation)
143  C.getTypeDeclType(R, PrevDecl);
144  return R;
145 }
146 
149  TypeSourceInfo *Info, SourceLocation Loc,
150  unsigned DependencyKind, bool IsGeneric,
151  LambdaCaptureDefault CaptureDefault) {
152  auto *R = new (C, DC) CXXRecordDecl(CXXRecord, TTK_Class, C, DC, Loc, Loc,
153  nullptr, nullptr);
154  R->setBeingDefined(true);
155  R->DefinitionData = new (C) struct LambdaDefinitionData(
156  R, Info, DependencyKind, IsGeneric, CaptureDefault);
157  R->setMayHaveOutOfDateDef(false);
158  R->setImplicit(true);
159 
160  C.getTypeDeclType(R, /*PrevDecl=*/nullptr);
161  return R;
162 }
163 
166  auto *R = new (C, ID) CXXRecordDecl(
167  CXXRecord, TTK_Struct, C, nullptr, SourceLocation(), SourceLocation(),
168  nullptr, nullptr);
169  R->setMayHaveOutOfDateDef(false);
170  return R;
171 }
172 
173 /// Determine whether a class has a repeated base class. This is intended for
174 /// use when determining if a class is standard-layout, so makes no attempt to
175 /// handle virtual bases.
176 static bool hasRepeatedBaseClass(const CXXRecordDecl *StartRD) {
178  SmallVector<const CXXRecordDecl*, 8> WorkList = {StartRD};
179  while (!WorkList.empty()) {
180  const CXXRecordDecl *RD = WorkList.pop_back_val();
181  if (RD->getTypeForDecl()->isDependentType())
182  continue;
183  for (const CXXBaseSpecifier &BaseSpec : RD->bases()) {
184  if (const CXXRecordDecl *B = BaseSpec.getType()->getAsCXXRecordDecl()) {
185  if (!SeenBaseTypes.insert(B).second)
186  return true;
187  WorkList.push_back(B);
188  }
189  }
190  }
191  return false;
192 }
193 
194 void
196  unsigned NumBases) {
197  ASTContext &C = getASTContext();
198 
199  if (!data().Bases.isOffset() && data().NumBases > 0)
200  C.Deallocate(data().getBases());
201 
202  if (NumBases) {
203  if (!C.getLangOpts().CPlusPlus17) {
204  // C++ [dcl.init.aggr]p1:
205  // An aggregate is [...] a class with [...] no base classes [...].
206  data().Aggregate = false;
207  }
208 
209  // C++ [class]p4:
210  // A POD-struct is an aggregate class...
211  data().PlainOldData = false;
212  }
213 
214  // The set of seen virtual base types.
215  llvm::SmallPtrSet<CanQualType, 8> SeenVBaseTypes;
216 
217  // The virtual bases of this class.
219 
220  data().Bases = new(C) CXXBaseSpecifier [NumBases];
221  data().NumBases = NumBases;
222  for (unsigned i = 0; i < NumBases; ++i) {
223  data().getBases()[i] = *Bases[i];
224  // Keep track of inherited vbases for this base class.
225  const CXXBaseSpecifier *Base = Bases[i];
226  QualType BaseType = Base->getType();
227  // Skip dependent types; we can't do any checking on them now.
228  if (BaseType->isDependentType())
229  continue;
230  auto *BaseClassDecl =
231  cast<CXXRecordDecl>(BaseType->castAs<RecordType>()->getDecl());
232 
233  // C++2a [class]p7:
234  // A standard-layout class is a class that:
235  // [...]
236  // -- has all non-static data members and bit-fields in the class and
237  // its base classes first declared in the same class
238  if (BaseClassDecl->data().HasBasesWithFields ||
239  !BaseClassDecl->field_empty()) {
240  if (data().HasBasesWithFields)
241  // Two bases have members or bit-fields: not standard-layout.
242  data().IsStandardLayout = false;
243  data().HasBasesWithFields = true;
244  }
245 
246  // C++11 [class]p7:
247  // A standard-layout class is a class that:
248  // -- [...] has [...] at most one base class with non-static data
249  // members
250  if (BaseClassDecl->data().HasBasesWithNonStaticDataMembers ||
251  BaseClassDecl->hasDirectFields()) {
252  if (data().HasBasesWithNonStaticDataMembers)
253  data().IsCXX11StandardLayout = false;
254  data().HasBasesWithNonStaticDataMembers = true;
255  }
256 
257  if (!BaseClassDecl->isEmpty()) {
258  // C++14 [meta.unary.prop]p4:
259  // T is a class type [...] with [...] no base class B for which
260  // is_empty<B>::value is false.
261  data().Empty = false;
262  }
263 
264  // C++1z [dcl.init.agg]p1:
265  // An aggregate is a class with [...] no private or protected base classes
266  if (Base->getAccessSpecifier() != AS_public) {
267  data().Aggregate = false;
268 
269  // C++20 [temp.param]p7:
270  // A structural type is [...] a literal class type with [...] all base
271  // classes [...] public
272  data().StructuralIfLiteral = false;
273  }
274 
275  // C++ [class.virtual]p1:
276  // A class that declares or inherits a virtual function is called a
277  // polymorphic class.
278  if (BaseClassDecl->isPolymorphic()) {
279  data().Polymorphic = true;
280 
281  // An aggregate is a class with [...] no virtual functions.
282  data().Aggregate = false;
283  }
284 
285  // C++0x [class]p7:
286  // A standard-layout class is a class that: [...]
287  // -- has no non-standard-layout base classes
288  if (!BaseClassDecl->isStandardLayout())
289  data().IsStandardLayout = false;
290  if (!BaseClassDecl->isCXX11StandardLayout())
291  data().IsCXX11StandardLayout = false;
292 
293  // Record if this base is the first non-literal field or base.
294  if (!hasNonLiteralTypeFieldsOrBases() && !BaseType->isLiteralType(C))
295  data().HasNonLiteralTypeFieldsOrBases = true;
296 
297  // Now go through all virtual bases of this base and add them.
298  for (const auto &VBase : BaseClassDecl->vbases()) {
299  // Add this base if it's not already in the list.
300  if (SeenVBaseTypes.insert(C.getCanonicalType(VBase.getType())).second) {
301  VBases.push_back(&VBase);
302 
303  // C++11 [class.copy]p8:
304  // The implicitly-declared copy constructor for a class X will have
305  // the form 'X::X(const X&)' if each [...] virtual base class B of X
306  // has a copy constructor whose first parameter is of type
307  // 'const B&' or 'const volatile B&' [...]
308  if (CXXRecordDecl *VBaseDecl = VBase.getType()->getAsCXXRecordDecl())
309  if (!VBaseDecl->hasCopyConstructorWithConstParam())
310  data().ImplicitCopyConstructorCanHaveConstParamForVBase = false;
311 
312  // C++1z [dcl.init.agg]p1:
313  // An aggregate is a class with [...] no virtual base classes
314  data().Aggregate = false;
315  }
316  }
317 
318  if (Base->isVirtual()) {
319  // Add this base if it's not already in the list.
320  if (SeenVBaseTypes.insert(C.getCanonicalType(BaseType)).second)
321  VBases.push_back(Base);
322 
323  // C++14 [meta.unary.prop] is_empty:
324  // T is a class type, but not a union type, with ... no virtual base
325  // classes
326  data().Empty = false;
327 
328  // C++1z [dcl.init.agg]p1:
329  // An aggregate is a class with [...] no virtual base classes
330  data().Aggregate = false;
331 
332  // C++11 [class.ctor]p5, C++11 [class.copy]p12, C++11 [class.copy]p25:
333  // A [default constructor, copy/move constructor, or copy/move assignment
334  // operator for a class X] is trivial [...] if:
335  // -- class X has [...] no virtual base classes
336  data().HasTrivialSpecialMembers &= SMF_Destructor;
337  data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
338 
339  // C++0x [class]p7:
340  // A standard-layout class is a class that: [...]
341  // -- has [...] no virtual base classes
342  data().IsStandardLayout = false;
343  data().IsCXX11StandardLayout = false;
344 
345  // C++20 [dcl.constexpr]p3:
346  // In the definition of a constexpr function [...]
347  // -- if the function is a constructor or destructor,
348  // its class shall not have any virtual base classes
349  data().DefaultedDefaultConstructorIsConstexpr = false;
350  data().DefaultedDestructorIsConstexpr = false;
351 
352  // C++1z [class.copy]p8:
353  // The implicitly-declared copy constructor for a class X will have
354  // the form 'X::X(const X&)' if each potentially constructed subobject
355  // has a copy constructor whose first parameter is of type
356  // 'const B&' or 'const volatile B&' [...]
357  if (!BaseClassDecl->hasCopyConstructorWithConstParam())
358  data().ImplicitCopyConstructorCanHaveConstParamForVBase = false;
359  } else {
360  // C++ [class.ctor]p5:
361  // A default constructor is trivial [...] if:
362  // -- all the direct base classes of its class have trivial default
363  // constructors.
364  if (!BaseClassDecl->hasTrivialDefaultConstructor())
365  data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
366 
367  // C++0x [class.copy]p13:
368  // A copy/move constructor for class X is trivial if [...]
369  // [...]
370  // -- the constructor selected to copy/move each direct base class
371  // subobject is trivial, and
372  if (!BaseClassDecl->hasTrivialCopyConstructor())
373  data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
374 
375  if (!BaseClassDecl->hasTrivialCopyConstructorForCall())
376  data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
377 
378  // If the base class doesn't have a simple move constructor, we'll eagerly
379  // declare it and perform overload resolution to determine which function
380  // it actually calls. If it does have a simple move constructor, this
381  // check is correct.
382  if (!BaseClassDecl->hasTrivialMoveConstructor())
383  data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
384 
385  if (!BaseClassDecl->hasTrivialMoveConstructorForCall())
386  data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
387 
388  // C++0x [class.copy]p27:
389  // A copy/move assignment operator for class X is trivial if [...]
390  // [...]
391  // -- the assignment operator selected to copy/move each direct base
392  // class subobject is trivial, and
393  if (!BaseClassDecl->hasTrivialCopyAssignment())
394  data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
395  // If the base class doesn't have a simple move assignment, we'll eagerly
396  // declare it and perform overload resolution to determine which function
397  // it actually calls. If it does have a simple move assignment, this
398  // check is correct.
399  if (!BaseClassDecl->hasTrivialMoveAssignment())
400  data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
401 
402  // C++11 [class.ctor]p6:
403  // If that user-written default constructor would satisfy the
404  // requirements of a constexpr constructor, the implicitly-defined
405  // default constructor is constexpr.
406  if (!BaseClassDecl->hasConstexprDefaultConstructor())
407  data().DefaultedDefaultConstructorIsConstexpr = false;
408 
409  // C++1z [class.copy]p8:
410  // The implicitly-declared copy constructor for a class X will have
411  // the form 'X::X(const X&)' if each potentially constructed subobject
412  // has a copy constructor whose first parameter is of type
413  // 'const B&' or 'const volatile B&' [...]
414  if (!BaseClassDecl->hasCopyConstructorWithConstParam())
415  data().ImplicitCopyConstructorCanHaveConstParamForNonVBase = false;
416  }
417 
418  // C++ [class.ctor]p3:
419  // A destructor is trivial if all the direct base classes of its class
420  // have trivial destructors.
421  if (!BaseClassDecl->hasTrivialDestructor())
422  data().HasTrivialSpecialMembers &= ~SMF_Destructor;
423 
424  if (!BaseClassDecl->hasTrivialDestructorForCall())
425  data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
426 
427  if (!BaseClassDecl->hasIrrelevantDestructor())
428  data().HasIrrelevantDestructor = false;
429 
430  if (BaseClassDecl->isAnyDestructorNoReturn())
431  data().IsAnyDestructorNoReturn = true;
432 
433  // C++11 [class.copy]p18:
434  // The implicitly-declared copy assignment operator for a class X will
435  // have the form 'X& X::operator=(const X&)' if each direct base class B
436  // of X has a copy assignment operator whose parameter is of type 'const
437  // B&', 'const volatile B&', or 'B' [...]
438  if (!BaseClassDecl->hasCopyAssignmentWithConstParam())
439  data().ImplicitCopyAssignmentHasConstParam = false;
440 
441  // A class has an Objective-C object member if... or any of its bases
442  // has an Objective-C object member.
443  if (BaseClassDecl->hasObjectMember())
444  setHasObjectMember(true);
445 
446  if (BaseClassDecl->hasVolatileMember())
447  setHasVolatileMember(true);
448 
449  if (BaseClassDecl->getArgPassingRestrictions() ==
452 
453  // Keep track of the presence of mutable fields.
454  if (BaseClassDecl->hasMutableFields())
455  data().HasMutableFields = true;
456 
457  if (BaseClassDecl->hasUninitializedReferenceMember())
458  data().HasUninitializedReferenceMember = true;
459 
460  if (!BaseClassDecl->allowConstDefaultInit())
461  data().HasUninitializedFields = true;
462 
463  addedClassSubobject(BaseClassDecl);
464  }
465 
466  // C++2a [class]p7:
467  // A class S is a standard-layout class if it:
468  // -- has at most one base class subobject of any given type
469  //
470  // Note that we only need to check this for classes with more than one base
471  // class. If there's only one base class, and it's standard layout, then
472  // we know there are no repeated base classes.
473  if (data().IsStandardLayout && NumBases > 1 && hasRepeatedBaseClass(this))
474  data().IsStandardLayout = false;
475 
476  if (VBases.empty()) {
477  data().IsParsingBaseSpecifiers = false;
478  return;
479  }
480 
481  // Create base specifier for any direct or indirect virtual bases.
482  data().VBases = new (C) CXXBaseSpecifier[VBases.size()];
483  data().NumVBases = VBases.size();
484  for (int I = 0, E = VBases.size(); I != E; ++I) {
485  QualType Type = VBases[I]->getType();
486  if (!Type->isDependentType())
487  addedClassSubobject(Type->getAsCXXRecordDecl());
488  data().getVBases()[I] = *VBases[I];
489  }
490 
491  data().IsParsingBaseSpecifiers = false;
492 }
493 
494 unsigned CXXRecordDecl::getODRHash() const {
495  assert(hasDefinition() && "ODRHash only for records with definitions");
496 
497  // Previously calculated hash is stored in DefinitionData.
498  if (DefinitionData->HasODRHash)
499  return DefinitionData->ODRHash;
500 
501  // Only calculate hash on first call of getODRHash per record.
502  ODRHash Hash;
504  DefinitionData->HasODRHash = true;
505  DefinitionData->ODRHash = Hash.CalculateHash();
506 
507  return DefinitionData->ODRHash;
508 }
509 
510 void CXXRecordDecl::addedClassSubobject(CXXRecordDecl *Subobj) {
511  // C++11 [class.copy]p11:
512  // A defaulted copy/move constructor for a class X is defined as
513  // deleted if X has:
514  // -- a direct or virtual base class B that cannot be copied/moved [...]
515  // -- a non-static data member of class type M (or array thereof)
516  // that cannot be copied or moved [...]
517  if (!Subobj->hasSimpleCopyConstructor())
518  data().NeedOverloadResolutionForCopyConstructor = true;
519  if (!Subobj->hasSimpleMoveConstructor())
520  data().NeedOverloadResolutionForMoveConstructor = true;
521 
522  // C++11 [class.copy]p23:
523  // A defaulted copy/move assignment operator for a class X is defined as
524  // deleted if X has:
525  // -- a direct or virtual base class B that cannot be copied/moved [...]
526  // -- a non-static data member of class type M (or array thereof)
527  // that cannot be copied or moved [...]
528  if (!Subobj->hasSimpleCopyAssignment())
529  data().NeedOverloadResolutionForCopyAssignment = true;
530  if (!Subobj->hasSimpleMoveAssignment())
531  data().NeedOverloadResolutionForMoveAssignment = true;
532 
533  // C++11 [class.ctor]p5, C++11 [class.copy]p11, C++11 [class.dtor]p5:
534  // A defaulted [ctor or dtor] for a class X is defined as
535  // deleted if X has:
536  // -- any direct or virtual base class [...] has a type with a destructor
537  // that is deleted or inaccessible from the defaulted [ctor or dtor].
538  // -- any non-static data member has a type with a destructor
539  // that is deleted or inaccessible from the defaulted [ctor or dtor].
540  if (!Subobj->hasSimpleDestructor()) {
541  data().NeedOverloadResolutionForCopyConstructor = true;
542  data().NeedOverloadResolutionForMoveConstructor = true;
543  data().NeedOverloadResolutionForDestructor = true;
544  }
545 
546  // C++2a [dcl.constexpr]p4:
547  // The definition of a constexpr destructor [shall] satisfy the
548  // following requirement:
549  // -- for every subobject of class type or (possibly multi-dimensional)
550  // array thereof, that class type shall have a constexpr destructor
551  if (!Subobj->hasConstexprDestructor())
552  data().DefaultedDestructorIsConstexpr = false;
553 
554  // C++20 [temp.param]p7:
555  // A structural type is [...] a literal class type [for which] the types
556  // of all base classes and non-static data members are structural types or
557  // (possibly multi-dimensional) array thereof
558  if (!Subobj->data().StructuralIfLiteral)
559  data().StructuralIfLiteral = false;
560 }
561 
563  auto *Dtor = getDestructor();
564  return Dtor ? Dtor->isConstexpr() : defaultedDestructorIsConstexpr();
565 }
566 
568  if (!isDependentContext())
569  return false;
570 
571  return !forallBases([](const CXXRecordDecl *) { return true; });
572 }
573 
575  // C++0x [class]p5:
576  // A trivially copyable class is a class that:
577  // -- has no non-trivial copy constructors,
578  if (hasNonTrivialCopyConstructor()) return false;
579  // -- has no non-trivial move constructors,
580  if (hasNonTrivialMoveConstructor()) return false;
581  // -- has no non-trivial copy assignment operators,
582  if (hasNonTrivialCopyAssignment()) return false;
583  // -- has no non-trivial move assignment operators, and
584  if (hasNonTrivialMoveAssignment()) return false;
585  // -- has a trivial destructor.
586  if (!hasTrivialDestructor()) return false;
587 
588  return true;
589 }
590 
591 void CXXRecordDecl::markedVirtualFunctionPure() {
592  // C++ [class.abstract]p2:
593  // A class is abstract if it has at least one pure virtual function.
594  data().Abstract = true;
595 }
596 
597 bool CXXRecordDecl::hasSubobjectAtOffsetZeroOfEmptyBaseType(
598  ASTContext &Ctx, const CXXRecordDecl *XFirst) {
599  if (!getNumBases())
600  return false;
601 
605 
606  // Visit a type that we have determined is an element of M(S).
607  auto Visit = [&](const CXXRecordDecl *RD) -> bool {
608  RD = RD->getCanonicalDecl();
609 
610  // C++2a [class]p8:
611  // A class S is a standard-layout class if it [...] has no element of the
612  // set M(S) of types as a base class.
613  //
614  // If we find a subobject of an empty type, it might also be a base class,
615  // so we'll need to walk the base classes to check.
616  if (!RD->data().HasBasesWithFields) {
617  // Walk the bases the first time, stopping if we find the type. Build a
618  // set of them so we don't need to walk them again.
619  if (Bases.empty()) {
620  bool RDIsBase = !forallBases([&](const CXXRecordDecl *Base) -> bool {
621  Base = Base->getCanonicalDecl();
622  if (RD == Base)
623  return false;
624  Bases.insert(Base);
625  return true;
626  });
627  if (RDIsBase)
628  return true;
629  } else {
630  if (Bases.count(RD))
631  return true;
632  }
633  }
634 
635  if (M.insert(RD).second)
636  WorkList.push_back(RD);
637  return false;
638  };
639 
640  if (Visit(XFirst))
641  return true;
642 
643  while (!WorkList.empty()) {
644  const CXXRecordDecl *X = WorkList.pop_back_val();
645 
646  // FIXME: We don't check the bases of X. That matches the standard, but
647  // that sure looks like a wording bug.
648 
649  // -- If X is a non-union class type with a non-static data member
650  // [recurse to each field] that is either of zero size or is the
651  // first non-static data member of X
652  // -- If X is a union type, [recurse to union members]
653  bool IsFirstField = true;
654  for (auto *FD : X->fields()) {
655  // FIXME: Should we really care about the type of the first non-static
656  // data member of a non-union if there are preceding unnamed bit-fields?
657  if (FD->isUnnamedBitfield())
658  continue;
659 
660  if (!IsFirstField && !FD->isZeroSize(Ctx))
661  continue;
662 
663  // -- If X is n array type, [visit the element type]
664  QualType T = Ctx.getBaseElementType(FD->getType());
665  if (auto *RD = T->getAsCXXRecordDecl())
666  if (Visit(RD))
667  return true;
668 
669  if (!X->isUnion())
670  IsFirstField = false;
671  }
672  }
673 
674  return false;
675 }
676 
678  assert(isLambda() && "not a lambda");
679 
680  // C++2a [expr.prim.lambda.capture]p11:
681  // The closure type associated with a lambda-expression has no default
682  // constructor if the lambda-expression has a lambda-capture and a
683  // defaulted default constructor otherwise. It has a deleted copy
684  // assignment operator if the lambda-expression has a lambda-capture and
685  // defaulted copy and move assignment operators otherwise.
686  //
687  // C++17 [expr.prim.lambda]p21:
688  // The closure type associated with a lambda-expression has no default
689  // constructor and a deleted copy assignment operator.
690  if (getLambdaCaptureDefault() != LCD_None || capture_size() != 0)
691  return false;
692  return getASTContext().getLangOpts().CPlusPlus20;
693 }
694 
695 void CXXRecordDecl::addedMember(Decl *D) {
696  if (!D->isImplicit() &&
697  !isa<FieldDecl>(D) &&
698  !isa<IndirectFieldDecl>(D) &&
699  (!isa<TagDecl>(D) || cast<TagDecl>(D)->getTagKind() == TTK_Class ||
700  cast<TagDecl>(D)->getTagKind() == TTK_Interface))
701  data().HasOnlyCMembers = false;
702 
703  // Ignore friends and invalid declarations.
704  if (D->getFriendObjectKind() || D->isInvalidDecl())
705  return;
706 
707  auto *FunTmpl = dyn_cast<FunctionTemplateDecl>(D);
708  if (FunTmpl)
709  D = FunTmpl->getTemplatedDecl();
710 
711  // FIXME: Pass NamedDecl* to addedMember?
712  Decl *DUnderlying = D;
713  if (auto *ND = dyn_cast<NamedDecl>(DUnderlying)) {
714  DUnderlying = ND->getUnderlyingDecl();
715  if (auto *UnderlyingFunTmpl = dyn_cast<FunctionTemplateDecl>(DUnderlying))
716  DUnderlying = UnderlyingFunTmpl->getTemplatedDecl();
717  }
718 
719  if (const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
720  if (Method->isVirtual()) {
721  // C++ [dcl.init.aggr]p1:
722  // An aggregate is an array or a class with [...] no virtual functions.
723  data().Aggregate = false;
724 
725  // C++ [class]p4:
726  // A POD-struct is an aggregate class...
727  data().PlainOldData = false;
728 
729  // C++14 [meta.unary.prop]p4:
730  // T is a class type [...] with [...] no virtual member functions...
731  data().Empty = false;
732 
733  // C++ [class.virtual]p1:
734  // A class that declares or inherits a virtual function is called a
735  // polymorphic class.
736  data().Polymorphic = true;
737 
738  // C++11 [class.ctor]p5, C++11 [class.copy]p12, C++11 [class.copy]p25:
739  // A [default constructor, copy/move constructor, or copy/move
740  // assignment operator for a class X] is trivial [...] if:
741  // -- class X has no virtual functions [...]
742  data().HasTrivialSpecialMembers &= SMF_Destructor;
743  data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
744 
745  // C++0x [class]p7:
746  // A standard-layout class is a class that: [...]
747  // -- has no virtual functions
748  data().IsStandardLayout = false;
749  data().IsCXX11StandardLayout = false;
750  }
751  }
752 
753  // Notify the listener if an implicit member was added after the definition
754  // was completed.
755  if (!isBeingDefined() && D->isImplicit())
757  L->AddedCXXImplicitMember(data().Definition, D);
758 
759  // The kind of special member this declaration is, if any.
760  unsigned SMKind = 0;
761 
762  // Handle constructors.
763  if (const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
764  if (Constructor->isInheritingConstructor()) {
765  // Ignore constructor shadow declarations. They are lazily created and
766  // so shouldn't affect any properties of the class.
767  } else {
768  if (!Constructor->isImplicit()) {
769  // Note that we have a user-declared constructor.
770  data().UserDeclaredConstructor = true;
771 
772  const TargetInfo &TI = getASTContext().getTargetInfo();
773  if ((!Constructor->isDeleted() && !Constructor->isDefaulted()) ||
775  // C++ [class]p4:
776  // A POD-struct is an aggregate class [...]
777  // Since the POD bit is meant to be C++03 POD-ness, clear it even if
778  // the type is technically an aggregate in C++0x since it wouldn't be
779  // in 03.
780  data().PlainOldData = false;
781  }
782  }
783 
784  if (Constructor->isDefaultConstructor()) {
785  SMKind |= SMF_DefaultConstructor;
786 
787  if (Constructor->isUserProvided())
788  data().UserProvidedDefaultConstructor = true;
789  if (Constructor->isConstexpr())
790  data().HasConstexprDefaultConstructor = true;
791  if (Constructor->isDefaulted())
792  data().HasDefaultedDefaultConstructor = true;
793  }
794 
795  if (!FunTmpl) {
796  unsigned Quals;
797  if (Constructor->isCopyConstructor(Quals)) {
798  SMKind |= SMF_CopyConstructor;
799 
800  if (Quals & Qualifiers::Const)
801  data().HasDeclaredCopyConstructorWithConstParam = true;
802  } else if (Constructor->isMoveConstructor())
803  SMKind |= SMF_MoveConstructor;
804  }
805 
806  // C++11 [dcl.init.aggr]p1: DR1518
807  // An aggregate is an array or a class with no user-provided [or]
808  // explicit [...] constructors
809  // C++20 [dcl.init.aggr]p1:
810  // An aggregate is an array or a class with no user-declared [...]
811  // constructors
813  ? !Constructor->isImplicit()
814  : (Constructor->isUserProvided() || Constructor->isExplicit()))
815  data().Aggregate = false;
816  }
817  }
818 
819  // Handle constructors, including those inherited from base classes.
820  if (const auto *Constructor = dyn_cast<CXXConstructorDecl>(DUnderlying)) {
821  // Record if we see any constexpr constructors which are neither copy
822  // nor move constructors.
823  // C++1z [basic.types]p10:
824  // [...] has at least one constexpr constructor or constructor template
825  // (possibly inherited from a base class) that is not a copy or move
826  // constructor [...]
827  if (Constructor->isConstexpr() && !Constructor->isCopyOrMoveConstructor())
828  data().HasConstexprNonCopyMoveConstructor = true;
829  if (!isa<CXXConstructorDecl>(D) && Constructor->isDefaultConstructor())
830  data().HasInheritedDefaultConstructor = true;
831  }
832 
833  // Handle member functions.
834  if (const auto *Method = dyn_cast<CXXMethodDecl>(D)) {
835  if (isa<CXXDestructorDecl>(D))
836  SMKind |= SMF_Destructor;
837 
838  if (Method->isCopyAssignmentOperator()) {
839  SMKind |= SMF_CopyAssignment;
840 
841  const auto *ParamTy =
842  Method->getParamDecl(0)->getType()->getAs<ReferenceType>();
843  if (!ParamTy || ParamTy->getPointeeType().isConstQualified())
844  data().HasDeclaredCopyAssignmentWithConstParam = true;
845  }
846 
847  if (Method->isMoveAssignmentOperator())
848  SMKind |= SMF_MoveAssignment;
849 
850  // Keep the list of conversion functions up-to-date.
851  if (auto *Conversion = dyn_cast<CXXConversionDecl>(D)) {
852  // FIXME: We use the 'unsafe' accessor for the access specifier here,
853  // because Sema may not have set it yet. That's really just a misdesign
854  // in Sema. However, LLDB *will* have set the access specifier correctly,
855  // and adds declarations after the class is technically completed,
856  // so completeDefinition()'s overriding of the access specifiers doesn't
857  // work.
858  AccessSpecifier AS = Conversion->getAccessUnsafe();
859 
860  if (Conversion->getPrimaryTemplate()) {
861  // We don't record specializations.
862  } else {
863  ASTContext &Ctx = getASTContext();
864  ASTUnresolvedSet &Conversions = data().Conversions.get(Ctx);
865  NamedDecl *Primary =
866  FunTmpl ? cast<NamedDecl>(FunTmpl) : cast<NamedDecl>(Conversion);
867  if (Primary->getPreviousDecl())
868  Conversions.replace(cast<NamedDecl>(Primary->getPreviousDecl()),
869  Primary, AS);
870  else
871  Conversions.addDecl(Ctx, Primary, AS);
872  }
873  }
874 
875  if (SMKind) {
876  // If this is the first declaration of a special member, we no longer have
877  // an implicit trivial special member.
878  data().HasTrivialSpecialMembers &=
879  data().DeclaredSpecialMembers | ~SMKind;
880  data().HasTrivialSpecialMembersForCall &=
881  data().DeclaredSpecialMembers | ~SMKind;
882 
883  // Note when we have declared a declared special member, and suppress the
884  // implicit declaration of this special member.
885  data().DeclaredSpecialMembers |= SMKind;
886  if (!Method->isImplicit()) {
887  data().UserDeclaredSpecialMembers |= SMKind;
888 
889  const TargetInfo &TI = getASTContext().getTargetInfo();
890  if ((!Method->isDeleted() && !Method->isDefaulted() &&
891  SMKind != SMF_MoveAssignment) ||
893  // C++03 [class]p4:
894  // A POD-struct is an aggregate class that has [...] no user-defined
895  // copy assignment operator and no user-defined destructor.
896  //
897  // Since the POD bit is meant to be C++03 POD-ness, and in C++03,
898  // aggregates could not have any constructors, clear it even for an
899  // explicitly defaulted or deleted constructor.
900  // type is technically an aggregate in C++0x since it wouldn't be in
901  // 03.
902  //
903  // Also, a user-declared move assignment operator makes a class
904  // non-POD. This is an extension in C++03.
905  data().PlainOldData = false;
906  }
907  }
908  // When instantiating a class, we delay updating the destructor and
909  // triviality properties of the class until selecting a destructor and
910  // computing the eligibility of its special member functions. This is
911  // because there might be function constraints that we need to evaluate
912  // and compare later in the instantiation.
913  if (!Method->isIneligibleOrNotSelected()) {
914  addedEligibleSpecialMemberFunction(Method, SMKind);
915  }
916  }
917 
918  return;
919  }
920 
921  // Handle non-static data members.
922  if (const auto *Field = dyn_cast<FieldDecl>(D)) {
923  ASTContext &Context = getASTContext();
924 
925  // C++2a [class]p7:
926  // A standard-layout class is a class that:
927  // [...]
928  // -- has all non-static data members and bit-fields in the class and
929  // its base classes first declared in the same class
930  if (data().HasBasesWithFields)
931  data().IsStandardLayout = false;
932 
933  // C++ [class.bit]p2:
934  // A declaration for a bit-field that omits the identifier declares an
935  // unnamed bit-field. Unnamed bit-fields are not members and cannot be
936  // initialized.
937  if (Field->isUnnamedBitfield()) {
938  // C++ [meta.unary.prop]p4: [LWG2358]
939  // T is a class type [...] with [...] no unnamed bit-fields of non-zero
940  // length
941  if (data().Empty && !Field->isZeroLengthBitField(Context) &&
942  Context.getLangOpts().getClangABICompat() >
944  data().Empty = false;
945  return;
946  }
947 
948  // C++11 [class]p7:
949  // A standard-layout class is a class that:
950  // -- either has no non-static data members in the most derived class
951  // [...] or has no base classes with non-static data members
952  if (data().HasBasesWithNonStaticDataMembers)
953  data().IsCXX11StandardLayout = false;
954 
955  // C++ [dcl.init.aggr]p1:
956  // An aggregate is an array or a class (clause 9) with [...] no
957  // private or protected non-static data members (clause 11).
958  //
959  // A POD must be an aggregate.
960  if (D->getAccess() == AS_private || D->getAccess() == AS_protected) {
961  data().Aggregate = false;
962  data().PlainOldData = false;
963 
964  // C++20 [temp.param]p7:
965  // A structural type is [...] a literal class type [for which] all
966  // non-static data members are public
967  data().StructuralIfLiteral = false;
968  }
969 
970  // Track whether this is the first field. We use this when checking
971  // whether the class is standard-layout below.
972  bool IsFirstField = !data().HasPrivateFields &&
973  !data().HasProtectedFields && !data().HasPublicFields;
974 
975  // C++0x [class]p7:
976  // A standard-layout class is a class that:
977  // [...]
978  // -- has the same access control for all non-static data members,
979  switch (D->getAccess()) {
980  case AS_private: data().HasPrivateFields = true; break;
981  case AS_protected: data().HasProtectedFields = true; break;
982  case AS_public: data().HasPublicFields = true; break;
983  case AS_none: llvm_unreachable("Invalid access specifier");
984  };
985  if ((data().HasPrivateFields + data().HasProtectedFields +
986  data().HasPublicFields) > 1) {
987  data().IsStandardLayout = false;
988  data().IsCXX11StandardLayout = false;
989  }
990 
991  // Keep track of the presence of mutable fields.
992  if (Field->isMutable()) {
993  data().HasMutableFields = true;
994 
995  // C++20 [temp.param]p7:
996  // A structural type is [...] a literal class type [for which] all
997  // non-static data members are public
998  data().StructuralIfLiteral = false;
999  }
1000 
1001  // C++11 [class.union]p8, DR1460:
1002  // If X is a union, a non-static data member of X that is not an anonymous
1003  // union is a variant member of X.
1004  if (isUnion() && !Field->isAnonymousStructOrUnion())
1005  data().HasVariantMembers = true;
1006 
1007  // C++0x [class]p9:
1008  // A POD struct is a class that is both a trivial class and a
1009  // standard-layout class, and has no non-static data members of type
1010  // non-POD struct, non-POD union (or array of such types).
1011  //
1012  // Automatic Reference Counting: the presence of a member of Objective-C pointer type
1013  // that does not explicitly have no lifetime makes the class a non-POD.
1014  QualType T = Context.getBaseElementType(Field->getType());
1015  if (T->isObjCRetainableType() || T.isObjCGCStrong()) {
1016  if (T.hasNonTrivialObjCLifetime()) {
1017  // Objective-C Automatic Reference Counting:
1018  // If a class has a non-static data member of Objective-C pointer
1019  // type (or array thereof), it is a non-POD type and its
1020  // default constructor (if any), copy constructor, move constructor,
1021  // copy assignment operator, move assignment operator, and destructor are
1022  // non-trivial.
1023  setHasObjectMember(true);
1024  struct DefinitionData &Data = data();
1025  Data.PlainOldData = false;
1026  Data.HasTrivialSpecialMembers = 0;
1027 
1028  // __strong or __weak fields do not make special functions non-trivial
1029  // for the purpose of calls.
1032  data().HasTrivialSpecialMembersForCall = 0;
1033 
1034  // Structs with __weak fields should never be passed directly.
1035  if (LT == Qualifiers::OCL_Weak)
1037 
1038  Data.HasIrrelevantDestructor = false;
1039 
1040  if (isUnion()) {
1041  data().DefaultedCopyConstructorIsDeleted = true;
1042  data().DefaultedMoveConstructorIsDeleted = true;
1043  data().DefaultedCopyAssignmentIsDeleted = true;
1044  data().DefaultedMoveAssignmentIsDeleted = true;
1045  data().DefaultedDestructorIsDeleted = true;
1046  data().NeedOverloadResolutionForCopyConstructor = true;
1047  data().NeedOverloadResolutionForMoveConstructor = true;
1048  data().NeedOverloadResolutionForCopyAssignment = true;
1049  data().NeedOverloadResolutionForMoveAssignment = true;
1050  data().NeedOverloadResolutionForDestructor = true;
1051  }
1052  } else if (!Context.getLangOpts().ObjCAutoRefCount) {
1053  setHasObjectMember(true);
1054  }
1055  } else if (!T.isCXX98PODType(Context))
1056  data().PlainOldData = false;
1057 
1058  if (T->isReferenceType()) {
1059  if (!Field->hasInClassInitializer())
1060  data().HasUninitializedReferenceMember = true;
1061 
1062  // C++0x [class]p7:
1063  // A standard-layout class is a class that:
1064  // -- has no non-static data members of type [...] reference,
1065  data().IsStandardLayout = false;
1066  data().IsCXX11StandardLayout = false;
1067 
1068  // C++1z [class.copy.ctor]p10:
1069  // A defaulted copy constructor for a class X is defined as deleted if X has:
1070  // -- a non-static data member of rvalue reference type
1071  if (T->isRValueReferenceType())
1072  data().DefaultedCopyConstructorIsDeleted = true;
1073  }
1074 
1075  if (!Field->hasInClassInitializer() && !Field->isMutable()) {
1076  if (CXXRecordDecl *FieldType = T->getAsCXXRecordDecl()) {
1077  if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
1078  data().HasUninitializedFields = true;
1079  } else {
1080  data().HasUninitializedFields = true;
1081  }
1082  }
1083 
1084  // Record if this field is the first non-literal or volatile field or base.
1085  if (!T->isLiteralType(Context) || T.isVolatileQualified())
1086  data().HasNonLiteralTypeFieldsOrBases = true;
1087 
1088  if (Field->hasInClassInitializer() ||
1089  (Field->isAnonymousStructOrUnion() &&
1090  Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
1091  data().HasInClassInitializer = true;
1092 
1093  // C++11 [class]p5:
1094  // A default constructor is trivial if [...] no non-static data member
1095  // of its class has a brace-or-equal-initializer.
1096  data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1097 
1098  // C++11 [dcl.init.aggr]p1:
1099  // An aggregate is a [...] class with [...] no
1100  // brace-or-equal-initializers for non-static data members.
1101  //
1102  // This rule was removed in C++14.
1104  data().Aggregate = false;
1105 
1106  // C++11 [class]p10:
1107  // A POD struct is [...] a trivial class.
1108  data().PlainOldData = false;
1109  }
1110 
1111  // C++11 [class.copy]p23:
1112  // A defaulted copy/move assignment operator for a class X is defined
1113  // as deleted if X has:
1114  // -- a non-static data member of reference type
1115  if (T->isReferenceType()) {
1116  data().DefaultedCopyAssignmentIsDeleted = true;
1117  data().DefaultedMoveAssignmentIsDeleted = true;
1118  }
1119 
1120  // Bitfields of length 0 are also zero-sized, but we already bailed out for
1121  // those because they are always unnamed.
1122  bool IsZeroSize = Field->isZeroSize(Context);
1123 
1124  if (const auto *RecordTy = T->getAs<RecordType>()) {
1125  auto *FieldRec = cast<CXXRecordDecl>(RecordTy->getDecl());
1126  if (FieldRec->getDefinition()) {
1127  addedClassSubobject(FieldRec);
1128 
1129  // We may need to perform overload resolution to determine whether a
1130  // field can be moved if it's const or volatile qualified.
1132  // We need to care about 'const' for the copy constructor because an
1133  // implicit copy constructor might be declared with a non-const
1134  // parameter.
1135  data().NeedOverloadResolutionForCopyConstructor = true;
1136  data().NeedOverloadResolutionForMoveConstructor = true;
1137  data().NeedOverloadResolutionForCopyAssignment = true;
1138  data().NeedOverloadResolutionForMoveAssignment = true;
1139  }
1140 
1141  // C++11 [class.ctor]p5, C++11 [class.copy]p11:
1142  // A defaulted [special member] for a class X is defined as
1143  // deleted if:
1144  // -- X is a union-like class that has a variant member with a
1145  // non-trivial [corresponding special member]
1146  if (isUnion()) {
1147  if (FieldRec->hasNonTrivialCopyConstructor())
1148  data().DefaultedCopyConstructorIsDeleted = true;
1149  if (FieldRec->hasNonTrivialMoveConstructor())
1150  data().DefaultedMoveConstructorIsDeleted = true;
1151  if (FieldRec->hasNonTrivialCopyAssignment())
1152  data().DefaultedCopyAssignmentIsDeleted = true;
1153  if (FieldRec->hasNonTrivialMoveAssignment())
1154  data().DefaultedMoveAssignmentIsDeleted = true;
1155  if (FieldRec->hasNonTrivialDestructor())
1156  data().DefaultedDestructorIsDeleted = true;
1157  }
1158 
1159  // For an anonymous union member, our overload resolution will perform
1160  // overload resolution for its members.
1161  if (Field->isAnonymousStructOrUnion()) {
1162  data().NeedOverloadResolutionForCopyConstructor |=
1163  FieldRec->data().NeedOverloadResolutionForCopyConstructor;
1164  data().NeedOverloadResolutionForMoveConstructor |=
1165  FieldRec->data().NeedOverloadResolutionForMoveConstructor;
1166  data().NeedOverloadResolutionForCopyAssignment |=
1167  FieldRec->data().NeedOverloadResolutionForCopyAssignment;
1168  data().NeedOverloadResolutionForMoveAssignment |=
1169  FieldRec->data().NeedOverloadResolutionForMoveAssignment;
1170  data().NeedOverloadResolutionForDestructor |=
1171  FieldRec->data().NeedOverloadResolutionForDestructor;
1172  }
1173 
1174  // C++0x [class.ctor]p5:
1175  // A default constructor is trivial [...] if:
1176  // -- for all the non-static data members of its class that are of
1177  // class type (or array thereof), each such class has a trivial
1178  // default constructor.
1179  if (!FieldRec->hasTrivialDefaultConstructor())
1180  data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1181 
1182  // C++0x [class.copy]p13:
1183  // A copy/move constructor for class X is trivial if [...]
1184  // [...]
1185  // -- for each non-static data member of X that is of class type (or
1186  // an array thereof), the constructor selected to copy/move that
1187  // member is trivial;
1188  if (!FieldRec->hasTrivialCopyConstructor())
1189  data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
1190 
1191  if (!FieldRec->hasTrivialCopyConstructorForCall())
1192  data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
1193 
1194  // If the field doesn't have a simple move constructor, we'll eagerly
1195  // declare the move constructor for this class and we'll decide whether
1196  // it's trivial then.
1197  if (!FieldRec->hasTrivialMoveConstructor())
1198  data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
1199 
1200  if (!FieldRec->hasTrivialMoveConstructorForCall())
1201  data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
1202 
1203  // C++0x [class.copy]p27:
1204  // A copy/move assignment operator for class X is trivial if [...]
1205  // [...]
1206  // -- for each non-static data member of X that is of class type (or
1207  // an array thereof), the assignment operator selected to
1208  // copy/move that member is trivial;
1209  if (!FieldRec->hasTrivialCopyAssignment())
1210  data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
1211  // If the field doesn't have a simple move assignment, we'll eagerly
1212  // declare the move assignment for this class and we'll decide whether
1213  // it's trivial then.
1214  if (!FieldRec->hasTrivialMoveAssignment())
1215  data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
1216 
1217  if (!FieldRec->hasTrivialDestructor())
1218  data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1219  if (!FieldRec->hasTrivialDestructorForCall())
1220  data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1221  if (!FieldRec->hasIrrelevantDestructor())
1222  data().HasIrrelevantDestructor = false;
1223  if (FieldRec->isAnyDestructorNoReturn())
1224  data().IsAnyDestructorNoReturn = true;
1225  if (FieldRec->hasObjectMember())
1226  setHasObjectMember(true);
1227  if (FieldRec->hasVolatileMember())
1228  setHasVolatileMember(true);
1229  if (FieldRec->getArgPassingRestrictions() ==
1232 
1233  // C++0x [class]p7:
1234  // A standard-layout class is a class that:
1235  // -- has no non-static data members of type non-standard-layout
1236  // class (or array of such types) [...]
1237  if (!FieldRec->isStandardLayout())
1238  data().IsStandardLayout = false;
1239  if (!FieldRec->isCXX11StandardLayout())
1240  data().IsCXX11StandardLayout = false;
1241 
1242  // C++2a [class]p7:
1243  // A standard-layout class is a class that:
1244  // [...]
1245  // -- has no element of the set M(S) of types as a base class.
1246  if (data().IsStandardLayout &&
1247  (isUnion() || IsFirstField || IsZeroSize) &&
1248  hasSubobjectAtOffsetZeroOfEmptyBaseType(Context, FieldRec))
1249  data().IsStandardLayout = false;
1250 
1251  // C++11 [class]p7:
1252  // A standard-layout class is a class that:
1253  // -- has no base classes of the same type as the first non-static
1254  // data member
1255  if (data().IsCXX11StandardLayout && IsFirstField) {
1256  // FIXME: We should check all base classes here, not just direct
1257  // base classes.
1258  for (const auto &BI : bases()) {
1259  if (Context.hasSameUnqualifiedType(BI.getType(), T)) {
1260  data().IsCXX11StandardLayout = false;
1261  break;
1262  }
1263  }
1264  }
1265 
1266  // Keep track of the presence of mutable fields.
1267  if (FieldRec->hasMutableFields())
1268  data().HasMutableFields = true;
1269 
1270  if (Field->isMutable()) {
1271  // Our copy constructor/assignment might call something other than
1272  // the subobject's copy constructor/assignment if it's mutable and of
1273  // class type.
1274  data().NeedOverloadResolutionForCopyConstructor = true;
1275  data().NeedOverloadResolutionForCopyAssignment = true;
1276  }
1277 
1278  // C++11 [class.copy]p13:
1279  // If the implicitly-defined constructor would satisfy the
1280  // requirements of a constexpr constructor, the implicitly-defined
1281  // constructor is constexpr.
1282  // C++11 [dcl.constexpr]p4:
1283  // -- every constructor involved in initializing non-static data
1284  // members [...] shall be a constexpr constructor
1285  if (!Field->hasInClassInitializer() &&
1286  !FieldRec->hasConstexprDefaultConstructor() && !isUnion())
1287  // The standard requires any in-class initializer to be a constant
1288  // expression. We consider this to be a defect.
1289  data().DefaultedDefaultConstructorIsConstexpr = false;
1290 
1291  // C++11 [class.copy]p8:
1292  // The implicitly-declared copy constructor for a class X will have
1293  // the form 'X::X(const X&)' if each potentially constructed subobject
1294  // of a class type M (or array thereof) has a copy constructor whose
1295  // first parameter is of type 'const M&' or 'const volatile M&'.
1296  if (!FieldRec->hasCopyConstructorWithConstParam())
1297  data().ImplicitCopyConstructorCanHaveConstParamForNonVBase = false;
1298 
1299  // C++11 [class.copy]p18:
1300  // The implicitly-declared copy assignment oeprator for a class X will
1301  // have the form 'X& X::operator=(const X&)' if [...] for all the
1302  // non-static data members of X that are of a class type M (or array
1303  // thereof), each such class type has a copy assignment operator whose
1304  // parameter is of type 'const M&', 'const volatile M&' or 'M'.
1305  if (!FieldRec->hasCopyAssignmentWithConstParam())
1306  data().ImplicitCopyAssignmentHasConstParam = false;
1307 
1308  if (FieldRec->hasUninitializedReferenceMember() &&
1309  !Field->hasInClassInitializer())
1310  data().HasUninitializedReferenceMember = true;
1311 
1312  // C++11 [class.union]p8, DR1460:
1313  // a non-static data member of an anonymous union that is a member of
1314  // X is also a variant member of X.
1315  if (FieldRec->hasVariantMembers() &&
1316  Field->isAnonymousStructOrUnion())
1317  data().HasVariantMembers = true;
1318  }
1319  } else {
1320  // Base element type of field is a non-class type.
1321  if (!T->isLiteralType(Context) ||
1322  (!Field->hasInClassInitializer() && !isUnion() &&
1323  !Context.getLangOpts().CPlusPlus20))
1324  data().DefaultedDefaultConstructorIsConstexpr = false;
1325 
1326  // C++11 [class.copy]p23:
1327  // A defaulted copy/move assignment operator for a class X is defined
1328  // as deleted if X has:
1329  // -- a non-static data member of const non-class type (or array
1330  // thereof)
1331  if (T.isConstQualified()) {
1332  data().DefaultedCopyAssignmentIsDeleted = true;
1333  data().DefaultedMoveAssignmentIsDeleted = true;
1334  }
1335 
1336  // C++20 [temp.param]p7:
1337  // A structural type is [...] a literal class type [for which] the
1338  // types of all non-static data members are structural types or
1339  // (possibly multidimensional) array thereof
1340  // We deal with class types elsewhere.
1341  if (!T->isStructuralType())
1342  data().StructuralIfLiteral = false;
1343  }
1344 
1345  // C++14 [meta.unary.prop]p4:
1346  // T is a class type [...] with [...] no non-static data members other
1347  // than subobjects of zero size
1348  if (data().Empty && !IsZeroSize)
1349  data().Empty = false;
1350  }
1351 
1352  // Handle using declarations of conversion functions.
1353  if (auto *Shadow = dyn_cast<UsingShadowDecl>(D)) {
1354  if (Shadow->getDeclName().getNameKind()
1356  ASTContext &Ctx = getASTContext();
1357  data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1358  }
1359  }
1360 
1361  if (const auto *Using = dyn_cast<UsingDecl>(D)) {
1362  if (Using->getDeclName().getNameKind() ==
1364  data().HasInheritedConstructor = true;
1365  // C++1z [dcl.init.aggr]p1:
1366  // An aggregate is [...] a class [...] with no inherited constructors
1367  data().Aggregate = false;
1368  }
1369 
1370  if (Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1371  data().HasInheritedAssignment = true;
1372  }
1373 }
1374 
1376  DD->setIneligibleOrNotSelected(false);
1377  addedEligibleSpecialMemberFunction(DD, SMF_Destructor);
1378 }
1379 
1381  unsigned SMKind) {
1382  if (const auto *DD = dyn_cast<CXXDestructorDecl>(MD)) {
1383  if (DD->isUserProvided())
1384  data().HasIrrelevantDestructor = false;
1385  // If the destructor is explicitly defaulted and not trivial or not public
1386  // or if the destructor is deleted, we clear HasIrrelevantDestructor in
1387  // finishedDefaultedOrDeletedMember.
1388 
1389  // C++11 [class.dtor]p5:
1390  // A destructor is trivial if [...] the destructor is not virtual.
1391  if (DD->isVirtual()) {
1392  data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1393  data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1394  }
1395 
1396  if (DD->isNoReturn())
1397  data().IsAnyDestructorNoReturn = true;
1398  }
1399 
1400  if (!MD->isImplicit() && !MD->isUserProvided()) {
1401  // This method is user-declared but not user-provided. We can't work
1402  // out whether it's trivial yet (not until we get to the end of the
1403  // class). We'll handle this method in
1404  // finishedDefaultedOrDeletedMember.
1405  } else if (MD->isTrivial()) {
1406  data().HasTrivialSpecialMembers |= SMKind;
1407  data().HasTrivialSpecialMembersForCall |= SMKind;
1408  } else if (MD->isTrivialForCall()) {
1409  data().HasTrivialSpecialMembersForCall |= SMKind;
1410  data().DeclaredNonTrivialSpecialMembers |= SMKind;
1411  } else {
1412  data().DeclaredNonTrivialSpecialMembers |= SMKind;
1413  // If this is a user-provided function, do not set
1414  // DeclaredNonTrivialSpecialMembersForCall here since we don't know
1415  // yet whether the method would be considered non-trivial for the
1416  // purpose of calls (attribute "trivial_abi" can be dropped from the
1417  // class later, which can change the special method's triviality).
1418  if (!MD->isUserProvided())
1419  data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1420  }
1421 }
1422 
1424  assert(!D->isImplicit() && !D->isUserProvided());
1425 
1426  // The kind of special member this declaration is, if any.
1427  unsigned SMKind = 0;
1428 
1429  if (const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1430  if (Constructor->isDefaultConstructor()) {
1431  SMKind |= SMF_DefaultConstructor;
1432  if (Constructor->isConstexpr())
1433  data().HasConstexprDefaultConstructor = true;
1434  }
1435  if (Constructor->isCopyConstructor())
1436  SMKind |= SMF_CopyConstructor;
1437  else if (Constructor->isMoveConstructor())
1438  SMKind |= SMF_MoveConstructor;
1439  else if (Constructor->isConstexpr())
1440  // We may now know that the constructor is constexpr.
1441  data().HasConstexprNonCopyMoveConstructor = true;
1442  } else if (isa<CXXDestructorDecl>(D)) {
1443  SMKind |= SMF_Destructor;
1444  if (!D->isTrivial() || D->getAccess() != AS_public || D->isDeleted())
1445  data().HasIrrelevantDestructor = false;
1446  } else if (D->isCopyAssignmentOperator())
1447  SMKind |= SMF_CopyAssignment;
1448  else if (D->isMoveAssignmentOperator())
1449  SMKind |= SMF_MoveAssignment;
1450 
1451  // Update which trivial / non-trivial special members we have.
1452  // addedMember will have skipped this step for this member.
1453  if (!D->isIneligibleOrNotSelected()) {
1454  if (D->isTrivial())
1455  data().HasTrivialSpecialMembers |= SMKind;
1456  else
1457  data().DeclaredNonTrivialSpecialMembers |= SMKind;
1458  }
1459 }
1460 
1462  ArrayRef<LambdaCapture> Captures) {
1463  CXXRecordDecl::LambdaDefinitionData &Data = getLambdaData();
1464 
1465  // Copy captures.
1466  Data.NumCaptures = Captures.size();
1467  Data.NumExplicitCaptures = 0;
1468  Data.Captures = (LambdaCapture *)Context.Allocate(sizeof(LambdaCapture) *
1469  Captures.size());
1470  LambdaCapture *ToCapture = Data.Captures;
1471  for (unsigned I = 0, N = Captures.size(); I != N; ++I) {
1472  if (Captures[I].isExplicit())
1473  ++Data.NumExplicitCaptures;
1474 
1475  *ToCapture++ = Captures[I];
1476  }
1477 
1479  Data.DefaultedCopyAssignmentIsDeleted = true;
1480 }
1481 
1483  unsigned SMKind = 0;
1484 
1485  if (const auto *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
1486  if (Constructor->isCopyConstructor())
1487  SMKind = SMF_CopyConstructor;
1488  else if (Constructor->isMoveConstructor())
1489  SMKind = SMF_MoveConstructor;
1490  } else if (isa<CXXDestructorDecl>(D))
1491  SMKind = SMF_Destructor;
1492 
1493  if (D->isTrivialForCall())
1494  data().HasTrivialSpecialMembersForCall |= SMKind;
1495  else
1496  data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1497 }
1498 
1500  if (getTagKind() == TTK_Class || getTagKind() == TTK_Interface ||
1501  !TemplateOrInstantiation.isNull())
1502  return false;
1503  if (!hasDefinition())
1504  return true;
1505 
1506  return isPOD() && data().HasOnlyCMembers;
1507 }
1508 
1510  if (!isLambda()) return false;
1511  return getLambdaData().IsGenericLambda;
1512 }
1513 
1514 #ifndef NDEBUG
1516  for (auto *D : R)
1517  if (!declaresSameEntity(D, R.front()))
1518  return false;
1519  return true;
1520 }
1521 #endif
1522 
1524  if (!RD.isLambda()) return nullptr;
1525  DeclarationName Name =
1527  DeclContext::lookup_result Calls = RD.lookup(Name);
1528 
1529  assert(!Calls.empty() && "Missing lambda call operator!");
1530  assert(allLookupResultsAreTheSame(Calls) &&
1531  "More than one lambda call operator!");
1532  return Calls.front();
1533 }
1534 
1536  NamedDecl *CallOp = getLambdaCallOperatorHelper(*this);
1537  return dyn_cast_or_null<FunctionTemplateDecl>(CallOp);
1538 }
1539 
1541  NamedDecl *CallOp = getLambdaCallOperatorHelper(*this);
1542 
1543  if (CallOp == nullptr)
1544  return nullptr;
1545 
1546  if (const auto *CallOpTmpl = dyn_cast<FunctionTemplateDecl>(CallOp))
1547  return cast<CXXMethodDecl>(CallOpTmpl->getTemplatedDecl());
1548 
1549  return cast<CXXMethodDecl>(CallOp);
1550 }
1551 
1554  CallingConv CC = CallOp->getType()->castAs<FunctionType>()->getCallConv();
1555  return getLambdaStaticInvoker(CC);
1556 }
1557 
1560  assert(RD.isLambda() && "Must be a lambda");
1561  DeclarationName Name =
1563  return RD.lookup(Name);
1564 }
1565 
1567  if (const auto *InvokerTemplate = dyn_cast<FunctionTemplateDecl>(ND))
1568  return cast<CXXMethodDecl>(InvokerTemplate->getTemplatedDecl());
1569  return cast<CXXMethodDecl>(ND);
1570 }
1571 
1573  if (!isLambda())
1574  return nullptr;
1576 
1577  for (NamedDecl *ND : Invoker) {
1578  const auto *FTy =
1579  cast<ValueDecl>(ND->getAsFunction())->getType()->castAs<FunctionType>();
1580  if (FTy->getCallConv() == CC)
1581  return getInvokerAsMethod(ND);
1582  }
1583 
1584  return nullptr;
1585 }
1586 
1588  llvm::DenseMap<const ValueDecl *, FieldDecl *> &Captures,
1589  FieldDecl *&ThisCapture) const {
1590  Captures.clear();
1591  ThisCapture = nullptr;
1592 
1593  LambdaDefinitionData &Lambda = getLambdaData();
1595  for (const LambdaCapture *C = Lambda.Captures, *CEnd = C + Lambda.NumCaptures;
1596  C != CEnd; ++C, ++Field) {
1597  if (C->capturesThis())
1598  ThisCapture = *Field;
1599  else if (C->capturesVariable())
1600  Captures[C->getCapturedVar()] = *Field;
1601  }
1602  assert(Field == field_end());
1603 }
1604 
1607  if (!isGenericLambda()) return nullptr;
1609  if (FunctionTemplateDecl *Tmpl = CallOp->getDescribedFunctionTemplate())
1610  return Tmpl->getTemplateParameters();
1611  return nullptr;
1612 }
1613 
1617  if (!List)
1618  return {};
1619 
1620  assert(std::is_partitioned(List->begin(), List->end(),
1621  [](const NamedDecl *D) { return !D->isImplicit(); })
1622  && "Explicit template params should be ordered before implicit ones");
1623 
1624  const auto ExplicitEnd = llvm::partition_point(
1625  *List, [](const NamedDecl *D) { return !D->isImplicit(); });
1626  return llvm::makeArrayRef(List->begin(), ExplicitEnd);
1627 }
1628 
1630  assert(isLambda() && "Not a lambda closure type!");
1632  return getLambdaData().ContextDecl.get(Source);
1633 }
1634 
1636  assert(isLambda() && "Not a lambda closure type!");
1637  if (Num)
1638  getASTContext().DeviceLambdaManglingNumbers[this] = Num;
1639 }
1640 
1642  assert(isLambda() && "Not a lambda closure type!");
1643  auto I = getASTContext().DeviceLambdaManglingNumbers.find(this);
1644  if (I != getASTContext().DeviceLambdaManglingNumbers.end())
1645  return I->second;
1646  return 0;
1647 }
1648 
1650  QualType T =
1651  cast<CXXConversionDecl>(Conv->getUnderlyingDecl()->getAsFunction())
1652  ->getConversionType();
1653  return Context.getCanonicalType(T);
1654 }
1655 
1656 /// Collect the visible conversions of a base class.
1657 ///
1658 /// \param Record a base class of the class we're considering
1659 /// \param InVirtual whether this base class is a virtual base (or a base
1660 /// of a virtual base)
1661 /// \param Access the access along the inheritance path to this base
1662 /// \param ParentHiddenTypes the conversions provided by the inheritors
1663 /// of this base
1664 /// \param Output the set to which to add conversions from non-virtual bases
1665 /// \param VOutput the set to which to add conversions from virtual bases
1666 /// \param HiddenVBaseCs the set of conversions which were hidden in a
1667 /// virtual base along some inheritance path
1669  ASTContext &Context, const CXXRecordDecl *Record, bool InVirtual,
1670  AccessSpecifier Access,
1671  const llvm::SmallPtrSet<CanQualType, 8> &ParentHiddenTypes,
1672  ASTUnresolvedSet &Output, UnresolvedSetImpl &VOutput,
1673  llvm::SmallPtrSet<NamedDecl *, 8> &HiddenVBaseCs) {
1674  // The set of types which have conversions in this class or its
1675  // subclasses. As an optimization, we don't copy the derived set
1676  // unless it might change.
1677  const llvm::SmallPtrSet<CanQualType, 8> *HiddenTypes = &ParentHiddenTypes;
1678  llvm::SmallPtrSet<CanQualType, 8> HiddenTypesBuffer;
1679 
1680  // Collect the direct conversions and figure out which conversions
1681  // will be hidden in the subclasses.
1684  if (ConvI != ConvE) {
1685  HiddenTypesBuffer = ParentHiddenTypes;
1686  HiddenTypes = &HiddenTypesBuffer;
1687 
1688  for (CXXRecordDecl::conversion_iterator I = ConvI; I != ConvE; ++I) {
1689  CanQualType ConvType(GetConversionType(Context, I.getDecl()));
1690  bool Hidden = ParentHiddenTypes.count(ConvType);
1691  if (!Hidden)
1692  HiddenTypesBuffer.insert(ConvType);
1693 
1694  // If this conversion is hidden and we're in a virtual base,
1695  // remember that it's hidden along some inheritance path.
1696  if (Hidden && InVirtual)
1697  HiddenVBaseCs.insert(cast<NamedDecl>(I.getDecl()->getCanonicalDecl()));
1698 
1699  // If this conversion isn't hidden, add it to the appropriate output.
1700  else if (!Hidden) {
1701  AccessSpecifier IAccess
1702  = CXXRecordDecl::MergeAccess(Access, I.getAccess());
1703 
1704  if (InVirtual)
1705  VOutput.addDecl(I.getDecl(), IAccess);
1706  else
1707  Output.addDecl(Context, I.getDecl(), IAccess);
1708  }
1709  }
1710  }
1711 
1712  // Collect information recursively from any base classes.
1713  for (const auto &I : Record->bases()) {
1714  const auto *RT = I.getType()->getAs<RecordType>();
1715  if (!RT) continue;
1716 
1717  AccessSpecifier BaseAccess
1718  = CXXRecordDecl::MergeAccess(Access, I.getAccessSpecifier());
1719  bool BaseInVirtual = InVirtual || I.isVirtual();
1720 
1721  auto *Base = cast<CXXRecordDecl>(RT->getDecl());
1722  CollectVisibleConversions(Context, Base, BaseInVirtual, BaseAccess,
1723  *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1724  }
1725 }
1726 
1727 /// Collect the visible conversions of a class.
1728 ///
1729 /// This would be extremely straightforward if it weren't for virtual
1730 /// bases. It might be worth special-casing that, really.
1732  const CXXRecordDecl *Record,
1733  ASTUnresolvedSet &Output) {
1734  // The collection of all conversions in virtual bases that we've
1735  // found. These will be added to the output as long as they don't
1736  // appear in the hidden-conversions set.
1737  UnresolvedSet<8> VBaseCs;
1738 
1739  // The set of conversions in virtual bases that we've determined to
1740  // be hidden.
1741  llvm::SmallPtrSet<NamedDecl*, 8> HiddenVBaseCs;
1742 
1743  // The set of types hidden by classes derived from this one.
1745 
1746  // Go ahead and collect the direct conversions and add them to the
1747  // hidden-types set.
1750  Output.append(Context, ConvI, ConvE);
1751  for (; ConvI != ConvE; ++ConvI)
1752  HiddenTypes.insert(GetConversionType(Context, ConvI.getDecl()));
1753 
1754  // Recursively collect conversions from base classes.
1755  for (const auto &I : Record->bases()) {
1756  const auto *RT = I.getType()->getAs<RecordType>();
1757  if (!RT) continue;
1758 
1759  CollectVisibleConversions(Context, cast<CXXRecordDecl>(RT->getDecl()),
1760  I.isVirtual(), I.getAccessSpecifier(),
1761  HiddenTypes, Output, VBaseCs, HiddenVBaseCs);
1762  }
1763 
1764  // Add any unhidden conversions provided by virtual bases.
1765  for (UnresolvedSetIterator I = VBaseCs.begin(), E = VBaseCs.end();
1766  I != E; ++I) {
1767  if (!HiddenVBaseCs.count(cast<NamedDecl>(I.getDecl()->getCanonicalDecl())))
1768  Output.addDecl(Context, I.getDecl(), I.getAccess());
1769  }
1770 }
1771 
1772 /// getVisibleConversionFunctions - get all conversion functions visible
1773 /// in current class; including conversion function templates.
1774 llvm::iterator_range<CXXRecordDecl::conversion_iterator>
1776  ASTContext &Ctx = getASTContext();
1777 
1778  ASTUnresolvedSet *Set;
1779  if (bases_begin() == bases_end()) {
1780  // If root class, all conversions are visible.
1781  Set = &data().Conversions.get(Ctx);
1782  } else {
1783  Set = &data().VisibleConversions.get(Ctx);
1784  // If visible conversion list is not evaluated, evaluate it.
1785  if (!data().ComputedVisibleConversions) {
1786  CollectVisibleConversions(Ctx, this, *Set);
1787  data().ComputedVisibleConversions = true;
1788  }
1789  }
1790  return llvm::make_range(Set->begin(), Set->end());
1791 }
1792 
1794  // This operation is O(N) but extremely rare. Sema only uses it to
1795  // remove UsingShadowDecls in a class that were followed by a direct
1796  // declaration, e.g.:
1797  // class A : B {
1798  // using B::operator int;
1799  // operator int();
1800  // };
1801  // This is uncommon by itself and even more uncommon in conjunction
1802  // with sufficiently large numbers of directly-declared conversions
1803  // that asymptotic behavior matters.
1804 
1805  ASTUnresolvedSet &Convs = data().Conversions.get(getASTContext());
1806  for (unsigned I = 0, E = Convs.size(); I != E; ++I) {
1807  if (Convs[I].getDecl() == ConvDecl) {
1808  Convs.erase(I);
1809  assert(!llvm::is_contained(Convs, ConvDecl) &&
1810  "conversion was found multiple times in unresolved set");
1811  return;
1812  }
1813  }
1814 
1815  llvm_unreachable("conversion not found in set!");
1816 }
1817 
1820  return cast<CXXRecordDecl>(MSInfo->getInstantiatedFrom());
1821 
1822  return nullptr;
1823 }
1824 
1826  return TemplateOrInstantiation.dyn_cast<MemberSpecializationInfo *>();
1827 }
1828 
1829 void
1832  assert(TemplateOrInstantiation.isNull() &&
1833  "Previous template or instantiation?");
1834  assert(!isa<ClassTemplatePartialSpecializationDecl>(this));
1835  TemplateOrInstantiation
1836  = new (getASTContext()) MemberSpecializationInfo(RD, TSK);
1837 }
1838 
1840  return TemplateOrInstantiation.dyn_cast<ClassTemplateDecl *>();
1841 }
1842 
1844  TemplateOrInstantiation = Template;
1845 }
1846 
1848  if (const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(this))
1849  return Spec->getSpecializationKind();
1850 
1852  return MSInfo->getTemplateSpecializationKind();
1853 
1854  return TSK_Undeclared;
1855 }
1856 
1857 void
1859  if (auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(this)) {
1860  Spec->setSpecializationKind(TSK);
1861  return;
1862  }
1863 
1865  MSInfo->setTemplateSpecializationKind(TSK);
1866  return;
1867  }
1868 
1869  llvm_unreachable("Not a class template or member class specialization");
1870 }
1871 
1873  auto GetDefinitionOrSelf =
1874  [](const CXXRecordDecl *D) -> const CXXRecordDecl * {
1875  if (auto *Def = D->getDefinition())
1876  return Def;
1877  return D;
1878  };
1879 
1880  // If it's a class template specialization, find the template or partial
1881  // specialization from which it was instantiated.
1882  if (auto *TD = dyn_cast<ClassTemplateSpecializationDecl>(this)) {
1883  auto From = TD->getInstantiatedFrom();
1884  if (auto *CTD = From.dyn_cast<ClassTemplateDecl *>()) {
1885  while (auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
1886  if (NewCTD->isMemberSpecialization())
1887  break;
1888  CTD = NewCTD;
1889  }
1890  return GetDefinitionOrSelf(CTD->getTemplatedDecl());
1891  }
1892  if (auto *CTPSD =
1893  From.dyn_cast<ClassTemplatePartialSpecializationDecl *>()) {
1894  while (auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
1895  if (NewCTPSD->isMemberSpecialization())
1896  break;
1897  CTPSD = NewCTPSD;
1898  }
1899  return GetDefinitionOrSelf(CTPSD);
1900  }
1901  }
1902 
1904  if (isTemplateInstantiation(MSInfo->getTemplateSpecializationKind())) {
1905  const CXXRecordDecl *RD = this;
1906  while (auto *NewRD = RD->getInstantiatedFromMemberClass())
1907  RD = NewRD;
1908  return GetDefinitionOrSelf(RD);
1909  }
1910  }
1911 
1913  "couldn't find pattern for class template instantiation");
1914  return nullptr;
1915 }
1916 
1918  ASTContext &Context = getASTContext();
1919  QualType ClassType = Context.getTypeDeclType(this);
1920 
1921  DeclarationName Name
1923  Context.getCanonicalType(ClassType));
1924 
1926 
1927  // If a destructor was marked as not selected, we skip it. We don't always
1928  // have a selected destructor: dependent types, unnamed structs.
1929  for (auto *Decl : R) {
1930  auto* DD = dyn_cast<CXXDestructorDecl>(Decl);
1931  if (DD && !DD->isIneligibleOrNotSelected())
1932  return DD;
1933  }
1934  return nullptr;
1935 }
1936 
1937 static bool isDeclContextInNamespace(const DeclContext *DC) {
1938  while (!DC->isTranslationUnit()) {
1939  if (DC->isNamespace())
1940  return true;
1941  DC = DC->getParent();
1942  }
1943  return false;
1944 }
1945 
1947  assert(hasDefinition() && "checking for interface-like without a definition");
1948  // All __interfaces are inheritently interface-like.
1949  if (isInterface())
1950  return true;
1951 
1952  // Interface-like types cannot have a user declared constructor, destructor,
1953  // friends, VBases, conversion functions, or fields. Additionally, lambdas
1954  // cannot be interface types.
1955  if (isLambda() || hasUserDeclaredConstructor() ||
1957  getNumVBases() > 0 || conversion_end() - conversion_begin() > 0)
1958  return false;
1959 
1960  // No interface-like type can have a method with a definition.
1961  for (const auto *const Method : methods())
1962  if (Method->isDefined() && !Method->isImplicit())
1963  return false;
1964 
1965  // Check "Special" types.
1966  const auto *Uuid = getAttr<UuidAttr>();
1967  // MS SDK declares IUnknown/IDispatch both in the root of a TU, or in an
1968  // extern C++ block directly in the TU. These are only valid if in one
1969  // of these two situations.
1970  if (Uuid && isStruct() && !getDeclContext()->isExternCContext() &&
1972  ((getName() == "IUnknown" &&
1973  Uuid->getGuid() == "00000000-0000-0000-C000-000000000046") ||
1974  (getName() == "IDispatch" &&
1975  Uuid->getGuid() == "00020400-0000-0000-C000-000000000046"))) {
1976  if (getNumBases() > 0)
1977  return false;
1978  return true;
1979  }
1980 
1981  // FIXME: Any access specifiers is supposed to make this no longer interface
1982  // like.
1983 
1984  // If this isn't a 'special' type, it must have a single interface-like base.
1985  if (getNumBases() != 1)
1986  return false;
1987 
1988  const auto BaseSpec = *bases_begin();
1989  if (BaseSpec.isVirtual() || BaseSpec.getAccessSpecifier() != AS_public)
1990  return false;
1991  const auto *Base = BaseSpec.getType()->getAsCXXRecordDecl();
1992  if (Base->isInterface() || !Base->isInterfaceLike())
1993  return false;
1994  return true;
1995 }
1996 
1998  completeDefinition(nullptr);
1999 }
2000 
2003 
2004  // If the class may be abstract (but hasn't been marked as such), check for
2005  // any pure final overriders.
2006  if (mayBeAbstract()) {
2007  CXXFinalOverriderMap MyFinalOverriders;
2008  if (!FinalOverriders) {
2009  getFinalOverriders(MyFinalOverriders);
2010  FinalOverriders = &MyFinalOverriders;
2011  }
2012 
2013  bool Done = false;
2014  for (CXXFinalOverriderMap::iterator M = FinalOverriders->begin(),
2015  MEnd = FinalOverriders->end();
2016  M != MEnd && !Done; ++M) {
2017  for (OverridingMethods::iterator SO = M->second.begin(),
2018  SOEnd = M->second.end();
2019  SO != SOEnd && !Done; ++SO) {
2020  assert(SO->second.size() > 0 &&
2021  "All virtual functions have overriding virtual functions");
2022 
2023  // C++ [class.abstract]p4:
2024  // A class is abstract if it contains or inherits at least one
2025  // pure virtual function for which the final overrider is pure
2026  // virtual.
2027  if (SO->second.front().Method->isPure()) {
2028  data().Abstract = true;
2029  Done = true;
2030  break;
2031  }
2032  }
2033  }
2034  }
2035 
2036  // Set access bits correctly on the directly-declared conversions.
2038  I != E; ++I)
2039  I.setAccess((*I)->getAccess());
2040 }
2041 
2043  if (data().Abstract || isInvalidDecl() || !data().Polymorphic ||
2045  return false;
2046 
2047  for (const auto &B : bases()) {
2048  const auto *BaseDecl =
2049  cast<CXXRecordDecl>(B.getType()->castAs<RecordType>()->getDecl());
2050  if (BaseDecl->isAbstract())
2051  return true;
2052  }
2053 
2054  return false;
2055 }
2056 
2058  auto *Def = getDefinition();
2059  if (!Def)
2060  return false;
2061  if (Def->hasAttr<FinalAttr>())
2062  return true;
2063  if (const auto *Dtor = Def->getDestructor())
2064  if (Dtor->hasAttr<FinalAttr>())
2065  return true;
2066  return false;
2067 }
2068 
2069 void CXXDeductionGuideDecl::anchor() {}
2070 
2072  if ((getKind() != Other.getKind() ||
2076  ODRHash SelfHash, OtherHash;
2077  SelfHash.AddStmt(getExpr());
2078  OtherHash.AddStmt(Other.getExpr());
2079  return SelfHash.CalculateHash() == OtherHash.CalculateHash();
2080  } else
2081  return false;
2082  }
2083  return true;
2084 }
2085 
2087  switch (Function->getDeclKind()) {
2088  case Decl::Kind::CXXConstructor:
2089  return cast<CXXConstructorDecl>(Function)->getExplicitSpecifier();
2090  case Decl::Kind::CXXConversion:
2091  return cast<CXXConversionDecl>(Function)->getExplicitSpecifier();
2092  case Decl::Kind::CXXDeductionGuide:
2093  return cast<CXXDeductionGuideDecl>(Function)->getExplicitSpecifier();
2094  default:
2095  return {};
2096  }
2097 }
2098 
2101  SourceLocation StartLoc, ExplicitSpecifier ES,
2102  const DeclarationNameInfo &NameInfo, QualType T,
2103  TypeSourceInfo *TInfo, SourceLocation EndLocation,
2104  CXXConstructorDecl *Ctor) {
2105  return new (C, DC) CXXDeductionGuideDecl(C, DC, StartLoc, ES, NameInfo, T,
2106  TInfo, EndLocation, Ctor);
2107 }
2108 
2110  unsigned ID) {
2111  return new (C, ID) CXXDeductionGuideDecl(
2113  QualType(), nullptr, SourceLocation(), nullptr);
2114 }
2115 
2117  ASTContext &C, DeclContext *DC, SourceLocation StartLoc) {
2118  return new (C, DC) RequiresExprBodyDecl(C, DC, StartLoc);
2119 }
2120 
2122  unsigned ID) {
2123  return new (C, ID) RequiresExprBodyDecl(C, nullptr, SourceLocation());
2124 }
2125 
2126 void CXXMethodDecl::anchor() {}
2127 
2129  const CXXMethodDecl *MD = getCanonicalDecl();
2130 
2131  if (MD->getStorageClass() == SC_Static)
2132  return true;
2133 
2135  return isStaticOverloadedOperator(OOK);
2136 }
2137 
2138 static bool recursivelyOverrides(const CXXMethodDecl *DerivedMD,
2139  const CXXMethodDecl *BaseMD) {
2140  for (const CXXMethodDecl *MD : DerivedMD->overridden_methods()) {
2141  if (MD->getCanonicalDecl() == BaseMD->getCanonicalDecl())
2142  return true;
2143  if (recursivelyOverrides(MD, BaseMD))
2144  return true;
2145  }
2146  return false;
2147 }
2148 
2149 CXXMethodDecl *
2151  bool MayBeBase) {
2152  if (this->getParent()->getCanonicalDecl() == RD->getCanonicalDecl())
2153  return this;
2154 
2155  // Lookup doesn't work for destructors, so handle them separately.
2156  if (isa<CXXDestructorDecl>(this)) {
2157  CXXMethodDecl *MD = RD->getDestructor();
2158  if (MD) {
2159  if (recursivelyOverrides(MD, this))
2160  return MD;
2161  if (MayBeBase && recursivelyOverrides(this, MD))
2162  return MD;
2163  }
2164  return nullptr;
2165  }
2166 
2167  for (auto *ND : RD->lookup(getDeclName())) {
2168  auto *MD = dyn_cast<CXXMethodDecl>(ND);
2169  if (!MD)
2170  continue;
2171  if (recursivelyOverrides(MD, this))
2172  return MD;
2173  if (MayBeBase && recursivelyOverrides(this, MD))
2174  return MD;
2175  }
2176 
2177  return nullptr;
2178 }
2179 
2180 CXXMethodDecl *
2182  bool MayBeBase) {
2183  if (auto *MD = getCorrespondingMethodDeclaredInClass(RD, MayBeBase))
2184  return MD;
2185 
2186  llvm::SmallVector<CXXMethodDecl*, 4> FinalOverriders;
2187  auto AddFinalOverrider = [&](CXXMethodDecl *D) {
2188  // If this function is overridden by a candidate final overrider, it is not
2189  // a final overrider.
2190  for (CXXMethodDecl *OtherD : FinalOverriders) {
2191  if (declaresSameEntity(D, OtherD) || recursivelyOverrides(OtherD, D))
2192  return;
2193  }
2194 
2195  // Other candidate final overriders might be overridden by this function.
2196  llvm::erase_if(FinalOverriders, [&](CXXMethodDecl *OtherD) {
2197  return recursivelyOverrides(D, OtherD);
2198  });
2199 
2200  FinalOverriders.push_back(D);
2201  };
2202 
2203  for (const auto &I : RD->bases()) {
2204  const RecordType *RT = I.getType()->getAs<RecordType>();
2205  if (!RT)
2206  continue;
2207  const auto *Base = cast<CXXRecordDecl>(RT->getDecl());
2208  if (CXXMethodDecl *D = this->getCorrespondingMethodInClass(Base))
2209  AddFinalOverrider(D);
2210  }
2211 
2212  return FinalOverriders.size() == 1 ? FinalOverriders.front() : nullptr;
2213 }
2214 
2215 CXXMethodDecl *
2217  const DeclarationNameInfo &NameInfo, QualType T,
2218  TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin,
2219  bool isInline, ConstexprSpecKind ConstexprKind,
2220  SourceLocation EndLocation,
2221  Expr *TrailingRequiresClause) {
2222  return new (C, RD) CXXMethodDecl(
2223  CXXMethod, C, RD, StartLoc, NameInfo, T, TInfo, SC, UsesFPIntrin,
2224  isInline, ConstexprKind, EndLocation, TrailingRequiresClause);
2225 }
2226 
2228  return new (C, ID) CXXMethodDecl(
2229  CXXMethod, C, nullptr, SourceLocation(), DeclarationNameInfo(),
2230  QualType(), nullptr, SC_None, false, false,
2232 }
2233 
2235  bool IsAppleKext) {
2236  assert(isVirtual() && "this method is expected to be virtual");
2237 
2238  // When building with -fapple-kext, all calls must go through the vtable since
2239  // the kernel linker can do runtime patching of vtables.
2240  if (IsAppleKext)
2241  return nullptr;
2242 
2243  // If the member function is marked 'final', we know that it can't be
2244  // overridden and can therefore devirtualize it unless it's pure virtual.
2245  if (hasAttr<FinalAttr>())
2246  return isPure() ? nullptr : this;
2247 
2248  // If Base is unknown, we cannot devirtualize.
2249  if (!Base)
2250  return nullptr;
2251 
2252  // If the base expression (after skipping derived-to-base conversions) is a
2253  // class prvalue, then we can devirtualize.
2254  Base = Base->getBestDynamicClassTypeExpr();
2255  if (Base->isPRValue() && Base->getType()->isRecordType())
2256  return this;
2257 
2258  // If we don't even know what we would call, we can't devirtualize.
2259  const CXXRecordDecl *BestDynamicDecl = Base->getBestDynamicClassType();
2260  if (!BestDynamicDecl)
2261  return nullptr;
2262 
2263  // There may be a method corresponding to MD in a derived class.
2264  CXXMethodDecl *DevirtualizedMethod =
2265  getCorrespondingMethodInClass(BestDynamicDecl);
2266 
2267  // If there final overrider in the dynamic type is ambiguous, we can't
2268  // devirtualize this call.
2269  if (!DevirtualizedMethod)
2270  return nullptr;
2271 
2272  // If that method is pure virtual, we can't devirtualize. If this code is
2273  // reached, the result would be UB, not a direct call to the derived class
2274  // function, and we can't assume the derived class function is defined.
2275  if (DevirtualizedMethod->isPure())
2276  return nullptr;
2277 
2278  // If that method is marked final, we can devirtualize it.
2279  if (DevirtualizedMethod->hasAttr<FinalAttr>())
2280  return DevirtualizedMethod;
2281 
2282  // Similarly, if the class itself or its destructor is marked 'final',
2283  // the class can't be derived from and we can therefore devirtualize the
2284  // member function call.
2285  if (BestDynamicDecl->isEffectivelyFinal())
2286  return DevirtualizedMethod;
2287 
2288  if (const auto *DRE = dyn_cast<DeclRefExpr>(Base)) {
2289  if (const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
2290  if (VD->getType()->isRecordType())
2291  // This is a record decl. We know the type and can devirtualize it.
2292  return DevirtualizedMethod;
2293 
2294  return nullptr;
2295  }
2296 
2297  // We can devirtualize calls on an object accessed by a class member access
2298  // expression, since by C++11 [basic.life]p6 we know that it can't refer to
2299  // a derived class object constructed in the same location.
2300  if (const auto *ME = dyn_cast<MemberExpr>(Base)) {
2301  const ValueDecl *VD = ME->getMemberDecl();
2302  return VD->getType()->isRecordType() ? DevirtualizedMethod : nullptr;
2303  }
2304 
2305  // Likewise for calls on an object accessed by a (non-reference) pointer to
2306  // member access.
2307  if (auto *BO = dyn_cast<BinaryOperator>(Base)) {
2308  if (BO->isPtrMemOp()) {
2309  auto *MPT = BO->getRHS()->getType()->castAs<MemberPointerType>();
2310  if (MPT->getPointeeType()->isRecordType())
2311  return DevirtualizedMethod;
2312  }
2313  }
2314 
2315  // We can't devirtualize the call.
2316  return nullptr;
2317 }
2318 
2320  SmallVectorImpl<const FunctionDecl *> &PreventedBy) const {
2321  assert(PreventedBy.empty() && "PreventedBy is expected to be empty");
2322  if (getOverloadedOperator() != OO_Delete &&
2323  getOverloadedOperator() != OO_Array_Delete)
2324  return false;
2325 
2326  // C++ [basic.stc.dynamic.deallocation]p2:
2327  // A template instance is never a usual deallocation function,
2328  // regardless of its signature.
2329  if (getPrimaryTemplate())
2330  return false;
2331 
2332  // C++ [basic.stc.dynamic.deallocation]p2:
2333  // If a class T has a member deallocation function named operator delete
2334  // with exactly one parameter, then that function is a usual (non-placement)
2335  // deallocation function. [...]
2336  if (getNumParams() == 1)
2337  return true;
2338  unsigned UsualParams = 1;
2339 
2340  // C++ P0722:
2341  // A destroying operator delete is a usual deallocation function if
2342  // removing the std::destroying_delete_t parameter and changing the
2343  // first parameter type from T* to void* results in the signature of
2344  // a usual deallocation function.
2346  ++UsualParams;
2347 
2348  // C++ <=14 [basic.stc.dynamic.deallocation]p2:
2349  // [...] If class T does not declare such an operator delete but does
2350  // declare a member deallocation function named operator delete with
2351  // exactly two parameters, the second of which has type std::size_t (18.1),
2352  // then this function is a usual deallocation function.
2353  //
2354  // C++17 says a usual deallocation function is one with the signature
2355  // (void* [, size_t] [, std::align_val_t] [, ...])
2356  // and all such functions are usual deallocation functions. It's not clear
2357  // that allowing varargs functions was intentional.
2358  ASTContext &Context = getASTContext();
2359  if (UsualParams < getNumParams() &&
2360  Context.hasSameUnqualifiedType(getParamDecl(UsualParams)->getType(),
2361  Context.getSizeType()))
2362  ++UsualParams;
2363 
2364  if (UsualParams < getNumParams() &&
2365  getParamDecl(UsualParams)->getType()->isAlignValT())
2366  ++UsualParams;
2367 
2368  if (UsualParams != getNumParams())
2369  return false;
2370 
2371  // In C++17 onwards, all potential usual deallocation functions are actual
2372  // usual deallocation functions. Honor this behavior when post-C++14
2373  // deallocation functions are offered as extensions too.
2374  // FIXME(EricWF): Destroying Delete should be a language option. How do we
2375  // handle when destroying delete is used prior to C++17?
2376  if (Context.getLangOpts().CPlusPlus17 ||
2377  Context.getLangOpts().AlignedAllocation ||
2379  return true;
2380 
2381  // This function is a usual deallocation function if there are no
2382  // single-parameter deallocation functions of the same kind.
2384  bool Result = true;
2385  for (const auto *D : R) {
2386  if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
2387  if (FD->getNumParams() == 1) {
2388  PreventedBy.push_back(FD);
2389  Result = false;
2390  }
2391  }
2392  }
2393  return Result;
2394 }
2395 
2397  // C++0x [class.copy]p17:
2398  // A user-declared copy assignment operator X::operator= is a non-static
2399  // non-template member function of class X with exactly one parameter of
2400  // type X, X&, const X&, volatile X& or const volatile X&.
2401  if (/*operator=*/getOverloadedOperator() != OO_Equal ||
2402  /*non-static*/ isStatic() ||
2403  /*non-template*/getPrimaryTemplate() || getDescribedFunctionTemplate() ||
2404  getNumParams() != 1)
2405  return false;
2406 
2407  QualType ParamType = getParamDecl(0)->getType();
2408  if (const auto *Ref = ParamType->getAs<LValueReferenceType>())
2409  ParamType = Ref->getPointeeType();
2410 
2411  ASTContext &Context = getASTContext();
2412  QualType ClassType
2413  = Context.getCanonicalType(Context.getTypeDeclType(getParent()));
2414  return Context.hasSameUnqualifiedType(ClassType, ParamType);
2415 }
2416 
2418  // C++0x [class.copy]p19:
2419  // A user-declared move assignment operator X::operator= is a non-static
2420  // non-template member function of class X with exactly one parameter of type
2421  // X&&, const X&&, volatile X&&, or const volatile X&&.
2422  if (getOverloadedOperator() != OO_Equal || isStatic() ||
2424  getNumParams() != 1)
2425  return false;
2426 
2427  QualType ParamType = getParamDecl(0)->getType();
2428  if (!ParamType->isRValueReferenceType())
2429  return false;
2430  ParamType = ParamType->getPointeeType();
2431 
2432  ASTContext &Context = getASTContext();
2433  QualType ClassType
2434  = Context.getCanonicalType(Context.getTypeDeclType(getParent()));
2435  return Context.hasSameUnqualifiedType(ClassType, ParamType);
2436 }
2437 
2439  assert(MD->isCanonicalDecl() && "Method is not canonical!");
2440  assert(!MD->getParent()->isDependentContext() &&
2441  "Can't add an overridden method to a class template!");
2442  assert(MD->isVirtual() && "Method is not virtual!");
2443 
2444  getASTContext().addOverriddenMethod(this, MD);
2445 }
2446 
2448  if (isa<CXXConstructorDecl>(this)) return nullptr;
2449  return getASTContext().overridden_methods_begin(this);
2450 }
2451 
2453  if (isa<CXXConstructorDecl>(this)) return nullptr;
2454  return getASTContext().overridden_methods_end(this);
2455 }
2456 
2458  if (isa<CXXConstructorDecl>(this)) return 0;
2459  return getASTContext().overridden_methods_size(this);
2460 }
2461 
2464  if (isa<CXXConstructorDecl>(this))
2465  return overridden_method_range(nullptr, nullptr);
2466  return getASTContext().overridden_methods(this);
2467 }
2468 
2470  const CXXRecordDecl *Decl) {
2471  QualType ClassTy = C.getTypeDeclType(Decl);
2472  return C.getQualifiedType(ClassTy, FPT->getMethodQuals());
2473 }
2474 
2476  const CXXRecordDecl *Decl) {
2478  QualType ObjectTy = ::getThisObjectType(C, FPT, Decl);
2479  return C.getPointerType(ObjectTy);
2480 }
2481 
2483  const CXXRecordDecl *Decl) {
2486 }
2487 
2489  // C++ 9.3.2p1: The type of this in a member function of a class X is X*.
2490  // If the member function is declared const, the type of this is const X*,
2491  // if the member function is declared volatile, the type of this is
2492  // volatile X*, and if the member function is declared const volatile,
2493  // the type of this is const volatile X*.
2494  assert(isInstance() && "No 'this' for static methods!");
2495  return CXXMethodDecl::getThisType(getType()->castAs<FunctionProtoType>(),
2496  getParent());
2497 }
2498 
2500  // Ditto getThisType.
2501  assert(isInstance() && "No 'this' for static methods!");
2503  getType()->castAs<FunctionProtoType>(), getParent());
2504 }
2505 
2507  // If this function is a template instantiation, look at the template from
2508  // which it was instantiated.
2509  const FunctionDecl *CheckFn = getTemplateInstantiationPattern();
2510  if (!CheckFn)
2511  CheckFn = this;
2512 
2513  const FunctionDecl *fn;
2514  return CheckFn->isDefined(fn) && !fn->isOutOfLine() &&
2515  (fn->doesThisDeclarationHaveABody() || fn->willHaveBody());
2516 }
2517 
2519  const CXXRecordDecl *P = getParent();
2520  return P->isLambda() && getDeclName().isIdentifier() &&
2522 }
2523 
2525  TypeSourceInfo *TInfo, bool IsVirtual,
2526  SourceLocation L, Expr *Init,
2527  SourceLocation R,
2528  SourceLocation EllipsisLoc)
2529  : Initializee(TInfo), Init(Init), MemberOrEllipsisLocation(EllipsisLoc),
2530  LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(IsVirtual),
2531  IsWritten(false), SourceOrder(0) {}
2532 
2534  SourceLocation MemberLoc,
2535  SourceLocation L, Expr *Init,
2536  SourceLocation R)
2537  : Initializee(Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2538  LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(false),
2539  IsWritten(false), SourceOrder(0) {}
2540 
2542  IndirectFieldDecl *Member,
2543  SourceLocation MemberLoc,
2544  SourceLocation L, Expr *Init,
2545  SourceLocation R)
2546  : Initializee(Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2547  LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(false),
2548  IsWritten(false), SourceOrder(0) {}
2549 
2551  TypeSourceInfo *TInfo,
2552  SourceLocation L, Expr *Init,
2553  SourceLocation R)
2554  : Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R),
2555  IsDelegating(true), IsVirtual(false), IsWritten(false), SourceOrder(0) {}
2556 
2558  return Context.getAllocator()
2559  .identifyKnownAlignedObject<CXXCtorInitializer>(this);
2560 }
2561 
2563  if (isBaseInitializer())
2564  return Initializee.get<TypeSourceInfo*>()->getTypeLoc();
2565  else
2566  return {};
2567 }
2568 
2570  if (isBaseInitializer())
2571  return Initializee.get<TypeSourceInfo*>()->getType().getTypePtr();
2572  else
2573  return nullptr;
2574 }
2575 
2578  return getAnyMember()->getLocation();
2579 
2580  if (isAnyMemberInitializer())
2581  return getMemberLocation();
2582 
2583  if (const auto *TSInfo = Initializee.get<TypeSourceInfo *>())
2584  return TSInfo->getTypeLoc().getBeginLoc();
2585 
2586  return {};
2587 }
2588 
2591  FieldDecl *D = getAnyMember();
2592  if (Expr *I = D->getInClassInitializer())
2593  return I->getSourceRange();
2594  return {};
2595  }
2596 
2598 }
2599 
2600 CXXConstructorDecl::CXXConstructorDecl(
2601  ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc,
2602  const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo,
2603  ExplicitSpecifier ES, bool UsesFPIntrin, bool isInline,
2604  bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind,
2605  InheritedConstructor Inherited, Expr *TrailingRequiresClause)
2606  : CXXMethodDecl(CXXConstructor, C, RD, StartLoc, NameInfo, T, TInfo,
2607  SC_None, UsesFPIntrin, isInline, ConstexprKind,
2608  SourceLocation(), TrailingRequiresClause) {
2609  setNumCtorInitializers(0);
2610  setInheritingConstructor(static_cast<bool>(Inherited));
2611  setImplicit(isImplicitlyDeclared);
2612  CXXConstructorDeclBits.HasTrailingExplicitSpecifier = ES.getExpr() ? 1 : 0;
2613  if (Inherited)
2614  *getTrailingObjects<InheritedConstructor>() = Inherited;
2615  setExplicitSpecifier(ES);
2616 }
2617 
2618 void CXXConstructorDecl::anchor() {}
2619 
2621  unsigned ID,
2622  uint64_t AllocKind) {
2623  bool hasTrailingExplicit = static_cast<bool>(AllocKind & TAKHasTailExplicit);
2625  static_cast<bool>(AllocKind & TAKInheritsConstructor);
2626  unsigned Extra =
2627  additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2628  isInheritingConstructor, hasTrailingExplicit);
2629  auto *Result = new (C, ID, Extra) CXXConstructorDecl(
2630  C, nullptr, SourceLocation(), DeclarationNameInfo(), QualType(), nullptr,
2631  ExplicitSpecifier(), false, false, false, ConstexprSpecKind::Unspecified,
2632  InheritedConstructor(), nullptr);
2633  Result->setInheritingConstructor(isInheritingConstructor);
2634  Result->CXXConstructorDeclBits.HasTrailingExplicitSpecifier =
2635  hasTrailingExplicit;
2636  Result->setExplicitSpecifier(ExplicitSpecifier());
2637  return Result;
2638 }
2639 
2641  ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc,
2642  const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo,
2643  ExplicitSpecifier ES, bool UsesFPIntrin, bool isInline,
2644  bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind,
2645  InheritedConstructor Inherited, Expr *TrailingRequiresClause) {
2646  assert(NameInfo.getName().getNameKind()
2648  "Name must refer to a constructor");
2649  unsigned Extra =
2650  additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2651  Inherited ? 1 : 0, ES.getExpr() ? 1 : 0);
2652  return new (C, RD, Extra) CXXConstructorDecl(
2653  C, RD, StartLoc, NameInfo, T, TInfo, ES, UsesFPIntrin, isInline,
2654  isImplicitlyDeclared, ConstexprKind, Inherited, TrailingRequiresClause);
2655 }
2656 
2658  return CtorInitializers.get(getASTContext().getExternalSource());
2659 }
2660 
2662  assert(isDelegatingConstructor() && "Not a delegating constructor!");
2663  Expr *E = (*init_begin())->getInit()->IgnoreImplicit();
2664  if (const auto *Construct = dyn_cast<CXXConstructExpr>(E))
2665  return Construct->getConstructor();
2666 
2667  return nullptr;
2668 }
2669 
2671  // C++ [class.default.ctor]p1:
2672  // A default constructor for a class X is a constructor of class X for
2673  // which each parameter that is not a function parameter pack has a default
2674  // argument (including the case of a constructor with no parameters)
2675  return getMinRequiredArguments() == 0;
2676 }
2677 
2678 bool
2679 CXXConstructorDecl::isCopyConstructor(unsigned &TypeQuals) const {
2680  return isCopyOrMoveConstructor(TypeQuals) &&
2682 }
2683 
2684 bool CXXConstructorDecl::isMoveConstructor(unsigned &TypeQuals) const {
2685  return isCopyOrMoveConstructor(TypeQuals) &&
2687 }
2688 
2689 /// Determine whether this is a copy or move constructor.
2690 bool CXXConstructorDecl::isCopyOrMoveConstructor(unsigned &TypeQuals) const {
2691  // C++ [class.copy]p2:
2692  // A non-template constructor for class X is a copy constructor
2693  // if its first parameter is of type X&, const X&, volatile X& or
2694  // const volatile X&, and either there are no other parameters
2695  // or else all other parameters have default arguments (8.3.6).
2696  // C++0x [class.copy]p3:
2697  // A non-template constructor for class X is a move constructor if its
2698  // first parameter is of type X&&, const X&&, volatile X&&, or
2699  // const volatile X&&, and either there are no other parameters or else
2700  // all other parameters have default arguments.
2701  if (!hasOneParamOrDefaultArgs() || getPrimaryTemplate() != nullptr ||
2702  getDescribedFunctionTemplate() != nullptr)
2703  return false;
2704 
2705  const ParmVarDecl *Param = getParamDecl(0);
2706 
2707  // Do we have a reference type?
2708  const auto *ParamRefType = Param->getType()->getAs<ReferenceType>();
2709  if (!ParamRefType)
2710  return false;
2711 
2712  // Is it a reference to our class type?
2713  ASTContext &Context = getASTContext();
2714 
2715  CanQualType PointeeType
2716  = Context.getCanonicalType(ParamRefType->getPointeeType());
2717  CanQualType ClassTy
2718  = Context.getCanonicalType(Context.getTagDeclType(getParent()));
2719  if (PointeeType.getUnqualifiedType() != ClassTy)
2720  return false;
2721 
2722  // FIXME: other qualifiers?
2723 
2724  // We have a copy or move constructor.
2725  TypeQuals = PointeeType.getCVRQualifiers();
2726  return true;
2727 }
2728 
2729 bool CXXConstructorDecl::isConvertingConstructor(bool AllowExplicit) const {
2730  // C++ [class.conv.ctor]p1:
2731  // A constructor declared without the function-specifier explicit
2732  // that can be called with a single parameter specifies a
2733  // conversion from the type of its first parameter to the type of
2734  // its class. Such a constructor is called a converting
2735  // constructor.
2736  if (isExplicit() && !AllowExplicit)
2737  return false;
2738 
2739  // FIXME: This has nothing to do with the definition of converting
2740  // constructor, but is convenient for how we use this function in overload
2741  // resolution.
2742  return getNumParams() == 0
2744  : getMinRequiredArguments() <= 1;
2745 }
2746 
2749  return false;
2750 
2751  const ParmVarDecl *Param = getParamDecl(0);
2752 
2753  ASTContext &Context = getASTContext();
2754  CanQualType ParamType = Context.getCanonicalType(Param->getType());
2755 
2756  // Is it the same as our class type?
2757  CanQualType ClassTy
2758  = Context.getCanonicalType(Context.getTagDeclType(getParent()));
2759  if (ParamType.getUnqualifiedType() != ClassTy)
2760  return false;
2761 
2762  return true;
2763 }
2764 
2765 void CXXDestructorDecl::anchor() {}
2766 
2769  return new (C, ID) CXXDestructorDecl(
2770  C, nullptr, SourceLocation(), DeclarationNameInfo(), QualType(), nullptr,
2771  false, false, false, ConstexprSpecKind::Unspecified, nullptr);
2772 }
2773 
2775  ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc,
2776  const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo,
2777  bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared,
2778  ConstexprSpecKind ConstexprKind, Expr *TrailingRequiresClause) {
2779  assert(NameInfo.getName().getNameKind()
2781  "Name must refer to a destructor");
2782  return new (C, RD) CXXDestructorDecl(
2783  C, RD, StartLoc, NameInfo, T, TInfo, UsesFPIntrin, isInline,
2784  isImplicitlyDeclared, ConstexprKind, TrailingRequiresClause);
2785 }
2786 
2788  auto *First = cast<CXXDestructorDecl>(getFirstDecl());
2789  if (OD && !First->OperatorDelete) {
2790  First->OperatorDelete = OD;
2791  First->OperatorDeleteThisArg = ThisArg;
2792  if (auto *L = getASTMutationListener())
2793  L->ResolvedOperatorDelete(First, OD, ThisArg);
2794  }
2795 }
2796 
2797 void CXXConversionDecl::anchor() {}
2798 
2801  return new (C, ID) CXXConversionDecl(
2802  C, nullptr, SourceLocation(), DeclarationNameInfo(), QualType(), nullptr,
2804  SourceLocation(), nullptr);
2805 }
2806 
2808  ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc,
2809  const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo,
2810  bool UsesFPIntrin, bool isInline, ExplicitSpecifier ES,
2811  ConstexprSpecKind ConstexprKind, SourceLocation EndLocation,
2812  Expr *TrailingRequiresClause) {
2813  assert(NameInfo.getName().getNameKind()
2815  "Name must refer to a conversion function");
2816  return new (C, RD) CXXConversionDecl(
2817  C, RD, StartLoc, NameInfo, T, TInfo, UsesFPIntrin, isInline, ES,
2818  ConstexprKind, EndLocation, TrailingRequiresClause);
2819 }
2820 
2822  return isImplicit() && getParent()->isLambda() &&
2824 }
2825 
2826 LinkageSpecDecl::LinkageSpecDecl(DeclContext *DC, SourceLocation ExternLoc,
2827  SourceLocation LangLoc, LanguageIDs lang,
2828  bool HasBraces)
2829  : Decl(LinkageSpec, DC, LangLoc), DeclContext(LinkageSpec),
2830  ExternLoc(ExternLoc), RBraceLoc(SourceLocation()) {
2831  setLanguage(lang);
2832  LinkageSpecDeclBits.HasBraces = HasBraces;
2833 }
2834 
2835 void LinkageSpecDecl::anchor() {}
2836 
2838  DeclContext *DC,
2839  SourceLocation ExternLoc,
2840  SourceLocation LangLoc,
2841  LanguageIDs Lang,
2842  bool HasBraces) {
2843  return new (C, DC) LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
2844 }
2845 
2847  unsigned ID) {
2848  return new (C, ID) LinkageSpecDecl(nullptr, SourceLocation(),
2849  SourceLocation(), lang_c, false);
2850 }
2851 
2852 void UsingDirectiveDecl::anchor() {}
2853 
2855  SourceLocation L,
2856  SourceLocation NamespaceLoc,
2857  NestedNameSpecifierLoc QualifierLoc,
2858  SourceLocation IdentLoc,
2859  NamedDecl *Used,
2860  DeclContext *CommonAncestor) {
2861  if (auto *NS = dyn_cast_or_null<NamespaceDecl>(Used))
2862  Used = NS->getOriginalNamespace();
2863  return new (C, DC) UsingDirectiveDecl(DC, L, NamespaceLoc, QualifierLoc,
2864  IdentLoc, Used, CommonAncestor);
2865 }
2866 
2868  unsigned ID) {
2869  return new (C, ID) UsingDirectiveDecl(nullptr, SourceLocation(),
2870  SourceLocation(),
2872  SourceLocation(), nullptr, nullptr);
2873 }
2874 
2876  if (auto *NA = dyn_cast_or_null<NamespaceAliasDecl>(NominatedNamespace))
2877  return NA->getNamespace();
2878  return cast_or_null<NamespaceDecl>(NominatedNamespace);
2879 }
2880 
2881 NamespaceDecl::NamespaceDecl(ASTContext &C, DeclContext *DC, bool Inline,
2882  SourceLocation StartLoc, SourceLocation IdLoc,
2883  IdentifierInfo *Id, NamespaceDecl *PrevDecl,
2884  bool Nested)
2885  : NamedDecl(Namespace, DC, IdLoc, Id), DeclContext(Namespace),
2886  redeclarable_base(C), LocStart(StartLoc) {
2887  unsigned Flags = 0;
2888  if (Inline)
2889  Flags |= F_Inline;
2890  if (Nested)
2891  Flags |= F_Nested;
2892  AnonOrFirstNamespaceAndFlags = {nullptr, Flags};
2893  setPreviousDecl(PrevDecl);
2894 
2895  if (PrevDecl)
2896  AnonOrFirstNamespaceAndFlags.setPointer(PrevDecl->getOriginalNamespace());
2897 }
2898 
2900  bool Inline, SourceLocation StartLoc,
2902  NamespaceDecl *PrevDecl, bool Nested) {
2903  return new (C, DC)
2904  NamespaceDecl(C, DC, Inline, StartLoc, IdLoc, Id, PrevDecl, Nested);
2905 }
2906 
2908  return new (C, ID) NamespaceDecl(C, nullptr, false, SourceLocation(),
2909  SourceLocation(), nullptr, nullptr, false);
2910 }
2911 
2913  if (isFirstDecl())
2914  return this;
2915 
2916  return AnonOrFirstNamespaceAndFlags.getPointer();
2917 }
2918 
2920  if (isFirstDecl())
2921  return this;
2922 
2923  return AnonOrFirstNamespaceAndFlags.getPointer();
2924 }
2925 
2927 
2928 NamespaceDecl *NamespaceDecl::getNextRedeclarationImpl() {
2929  return getNextRedeclaration();
2930 }
2931 
2932 NamespaceDecl *NamespaceDecl::getPreviousDeclImpl() {
2933  return getPreviousDecl();
2934 }
2935 
2936 NamespaceDecl *NamespaceDecl::getMostRecentDeclImpl() {
2937  return getMostRecentDecl();
2938 }
2939 
2940 void NamespaceAliasDecl::anchor() {}
2941 
2942 NamespaceAliasDecl *NamespaceAliasDecl::getNextRedeclarationImpl() {
2943  return getNextRedeclaration();
2944 }
2945 
2946 NamespaceAliasDecl *NamespaceAliasDecl::getPreviousDeclImpl() {
2947  return getPreviousDecl();
2948 }
2949 
2950 NamespaceAliasDecl *NamespaceAliasDecl::getMostRecentDeclImpl() {
2951  return getMostRecentDecl();
2952 }
2953 
2955  SourceLocation UsingLoc,
2956  SourceLocation AliasLoc,
2957  IdentifierInfo *Alias,
2958  NestedNameSpecifierLoc QualifierLoc,
2959  SourceLocation IdentLoc,
2960  NamedDecl *Namespace) {
2961  // FIXME: Preserve the aliased namespace as written.
2962  if (auto *NS = dyn_cast_or_null<NamespaceDecl>(Namespace))
2963  Namespace = NS->getOriginalNamespace();
2964  return new (C, DC) NamespaceAliasDecl(C, DC, UsingLoc, AliasLoc, Alias,
2965  QualifierLoc, IdentLoc, Namespace);
2966 }
2967 
2970  return new (C, ID) NamespaceAliasDecl(C, nullptr, SourceLocation(),
2971  SourceLocation(), nullptr,
2973  SourceLocation(), nullptr);
2974 }
2975 
2976 void LifetimeExtendedTemporaryDecl::anchor() {}
2977 
2978 /// Retrieve the storage duration for the materialized temporary.
2980  const ValueDecl *ExtendingDecl = getExtendingDecl();
2981  if (!ExtendingDecl)
2982  return SD_FullExpression;
2983  // FIXME: This is not necessarily correct for a temporary materialized
2984  // within a default initializer.
2985  if (isa<FieldDecl>(ExtendingDecl))
2986  return SD_Automatic;
2987  // FIXME: This only works because storage class specifiers are not allowed
2988  // on decomposition declarations.
2989  if (isa<BindingDecl>(ExtendingDecl))
2990  return ExtendingDecl->getDeclContext()->isFunctionOrMethod() ? SD_Automatic
2991  : SD_Static;
2992  return cast<VarDecl>(ExtendingDecl)->getStorageDuration();
2993 }
2994 
2996  assert(getStorageDuration() == SD_Static &&
2997  "don't need to cache the computed value for this temporary");
2998  if (MayCreate && !Value) {
2999  Value = (new (getASTContext()) APValue);
3001  }
3002  assert(Value && "may not be null");
3003  return Value;
3004 }
3005 
3006 void UsingShadowDecl::anchor() {}
3007 
3009  SourceLocation Loc, DeclarationName Name,
3010  BaseUsingDecl *Introducer, NamedDecl *Target)
3011  : NamedDecl(K, DC, Loc, Name), redeclarable_base(C),
3012  UsingOrNextShadow(Introducer) {
3013  if (Target) {
3014  assert(!isa<UsingShadowDecl>(Target));
3016  }
3017  setImplicit();
3018 }
3019 
3021  : NamedDecl(K, nullptr, SourceLocation(), DeclarationName()),
3022  redeclarable_base(C) {}
3023 
3026  return new (C, ID) UsingShadowDecl(UsingShadow, C, EmptyShell());
3027 }
3028 
3030  const UsingShadowDecl *Shadow = this;
3031  while (const auto *NextShadow =
3032  dyn_cast<UsingShadowDecl>(Shadow->UsingOrNextShadow))
3033  Shadow = NextShadow;
3034  return cast<BaseUsingDecl>(Shadow->UsingOrNextShadow);
3035 }
3036 
3037 void ConstructorUsingShadowDecl::anchor() {}
3038 
3041  SourceLocation Loc, UsingDecl *Using,
3042  NamedDecl *Target, bool IsVirtual) {
3043  return new (C, DC) ConstructorUsingShadowDecl(C, DC, Loc, Using, Target,
3044  IsVirtual);
3045 }
3046 
3049  return new (C, ID) ConstructorUsingShadowDecl(C, EmptyShell());
3050 }
3051 
3054 }
3055 
3056 void BaseUsingDecl::anchor() {}
3057 
3059  assert(!llvm::is_contained(shadows(), S) && "declaration already in set");
3060  assert(S->getIntroducer() == this);
3061 
3062  if (FirstUsingShadow.getPointer())
3063  S->UsingOrNextShadow = FirstUsingShadow.getPointer();
3064  FirstUsingShadow.setPointer(S);
3065 }
3066 
3068  assert(llvm::is_contained(shadows(), S) && "declaration not in set");
3069  assert(S->getIntroducer() == this);
3070 
3071  // Remove S from the shadow decl chain. This is O(n) but hopefully rare.
3072 
3073  if (FirstUsingShadow.getPointer() == S) {
3074  FirstUsingShadow.setPointer(
3075  dyn_cast<UsingShadowDecl>(S->UsingOrNextShadow));
3076  S->UsingOrNextShadow = this;
3077  return;
3078  }
3079 
3080  UsingShadowDecl *Prev = FirstUsingShadow.getPointer();
3081  while (Prev->UsingOrNextShadow != S)
3082  Prev = cast<UsingShadowDecl>(Prev->UsingOrNextShadow);
3083  Prev->UsingOrNextShadow = S->UsingOrNextShadow;
3084  S->UsingOrNextShadow = this;
3085 }
3086 
3087 void UsingDecl::anchor() {}
3088 
3090  NestedNameSpecifierLoc QualifierLoc,
3091  const DeclarationNameInfo &NameInfo,
3092  bool HasTypename) {
3093  return new (C, DC) UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
3094 }
3095 
3097  return new (C, ID) UsingDecl(nullptr, SourceLocation(),
3099  false);
3100 }
3101 
3104  ? getQualifierLoc().getBeginLoc() : UsingLocation;
3105  return SourceRange(Begin, getNameInfo().getEndLoc());
3106 }
3107 
3108 void UsingEnumDecl::anchor() {}
3109 
3111  SourceLocation UL,
3112  SourceLocation EL,
3113  SourceLocation NL,
3115  assert(isa<EnumDecl>(EnumType->getType()->getAsTagDecl()));
3116  return new (C, DC)
3117  UsingEnumDecl(DC, EnumType->getType()->getAsTagDecl()->getDeclName(), UL, EL, NL, EnumType);
3118 }
3119 
3121  return new (C, ID)
3123  SourceLocation(), SourceLocation(), nullptr);
3124 }
3125 
3127  return SourceRange(UsingLocation, EnumType->getTypeLoc().getEndLoc());
3128 }
3129 
3130 void UsingPackDecl::anchor() {}
3131 
3133  NamedDecl *InstantiatedFrom,
3134  ArrayRef<NamedDecl *> UsingDecls) {
3135  size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
3136  return new (C, DC, Extra) UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
3137 }
3138 
3140  unsigned NumExpansions) {
3141  size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
3142  auto *Result = new (C, ID, Extra) UsingPackDecl(nullptr, nullptr, None);
3143  Result->NumExpansions = NumExpansions;
3144  auto *Trail = Result->getTrailingObjects<NamedDecl *>();
3145  for (unsigned I = 0; I != NumExpansions; ++I)
3146  new (Trail + I) NamedDecl*(nullptr);
3147  return Result;
3148 }
3149 
3150 void UnresolvedUsingValueDecl::anchor() {}
3151 
3154  SourceLocation UsingLoc,
3155  NestedNameSpecifierLoc QualifierLoc,
3156  const DeclarationNameInfo &NameInfo,
3157  SourceLocation EllipsisLoc) {
3158  return new (C, DC) UnresolvedUsingValueDecl(DC, C.DependentTy, UsingLoc,
3159  QualifierLoc, NameInfo,
3160  EllipsisLoc);
3161 }
3162 
3165  return new (C, ID) UnresolvedUsingValueDecl(nullptr, QualType(),
3166  SourceLocation(),
3169  SourceLocation());
3170 }
3171 
3174  ? getQualifierLoc().getBeginLoc() : UsingLocation;
3175  return SourceRange(Begin, getNameInfo().getEndLoc());
3176 }
3177 
3178 void UnresolvedUsingTypenameDecl::anchor() {}
3179 
3182  SourceLocation UsingLoc,
3183  SourceLocation TypenameLoc,
3184  NestedNameSpecifierLoc QualifierLoc,
3185  SourceLocation TargetNameLoc,
3186  DeclarationName TargetName,
3187  SourceLocation EllipsisLoc) {
3188  return new (C, DC) UnresolvedUsingTypenameDecl(
3189  DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
3190  TargetName.getAsIdentifierInfo(), EllipsisLoc);
3191 }
3192 
3195  return new (C, ID) UnresolvedUsingTypenameDecl(
3197  SourceLocation(), nullptr, SourceLocation());
3198 }
3199 
3202  SourceLocation Loc, DeclarationName Name) {
3203  return new (Ctx, DC) UnresolvedUsingIfExistsDecl(DC, Loc, Name);
3204 }
3205 
3208  return new (Ctx, ID)
3210 }
3211 
3212 UnresolvedUsingIfExistsDecl::UnresolvedUsingIfExistsDecl(DeclContext *DC,
3213  SourceLocation Loc,
3214  DeclarationName Name)
3215  : NamedDecl(Decl::UnresolvedUsingIfExists, DC, Loc, Name) {}
3216 
3217 void UnresolvedUsingIfExistsDecl::anchor() {}
3218 
3219 void StaticAssertDecl::anchor() {}
3220 
3222  SourceLocation StaticAssertLoc,
3223  Expr *AssertExpr,
3224  StringLiteral *Message,
3225  SourceLocation RParenLoc,
3226  bool Failed) {
3227  return new (C, DC) StaticAssertDecl(DC, StaticAssertLoc, AssertExpr, Message,
3228  RParenLoc, Failed);
3229 }
3230 
3232  unsigned ID) {
3233  return new (C, ID) StaticAssertDecl(nullptr, SourceLocation(), nullptr,
3234  nullptr, SourceLocation(), false);
3235 }
3236 
3237 void BindingDecl::anchor() {}
3238 
3240  SourceLocation IdLoc, IdentifierInfo *Id) {
3241  return new (C, DC) BindingDecl(DC, IdLoc, Id);
3242 }
3243 
3245  return new (C, ID) BindingDecl(nullptr, SourceLocation(), nullptr);
3246 }
3247 
3249  Expr *B = getBinding();
3250  if (!B)
3251  return nullptr;
3252  auto *DRE = dyn_cast<DeclRefExpr>(B->IgnoreImplicit());
3253  if (!DRE)
3254  return nullptr;
3255 
3256  auto *VD = cast<VarDecl>(DRE->getDecl());
3257  assert(VD->isImplicit() && "holding var for binding decl not implicit");
3258  return VD;
3259 }
3260 
3261 void DecompositionDecl::anchor() {}
3262 
3264  SourceLocation StartLoc,
3265  SourceLocation LSquareLoc,
3266  QualType T, TypeSourceInfo *TInfo,
3267  StorageClass SC,
3269  size_t Extra = additionalSizeToAlloc<BindingDecl *>(Bindings.size());
3270  return new (C, DC, Extra)
3271  DecompositionDecl(C, DC, StartLoc, LSquareLoc, T, TInfo, SC, Bindings);
3272 }
3273 
3275  unsigned ID,
3276  unsigned NumBindings) {
3277  size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
3278  auto *Result = new (C, ID, Extra)
3280  QualType(), nullptr, StorageClass(), None);
3281  // Set up and clean out the bindings array.
3282  Result->NumBindings = NumBindings;
3283  auto *Trail = Result->getTrailingObjects<BindingDecl *>();
3284  for (unsigned I = 0; I != NumBindings; ++I)
3285  new (Trail + I) BindingDecl*(nullptr);
3286  return Result;
3287 }
3288 
3289 void DecompositionDecl::printName(llvm::raw_ostream &OS,
3290  const PrintingPolicy &Policy) const {
3291  OS << '[';
3292  bool Comma = false;
3293  for (const auto *B : bindings()) {
3294  if (Comma)
3295  OS << ", ";
3296  B->printName(OS, Policy);
3297  Comma = true;
3298  }
3299  OS << ']';
3300 }
3301 
3302 void MSPropertyDecl::anchor() {}
3303 
3306  QualType T, TypeSourceInfo *TInfo,
3307  SourceLocation StartL,
3308  IdentifierInfo *Getter,
3309  IdentifierInfo *Setter) {
3310  return new (C, DC) MSPropertyDecl(DC, L, N, T, TInfo, StartL, Getter, Setter);
3311 }
3312 
3314  unsigned ID) {
3315  return new (C, ID) MSPropertyDecl(nullptr, SourceLocation(),
3316  DeclarationName(), QualType(), nullptr,
3317  SourceLocation(), nullptr, nullptr);
3318 }
3319 
3320 void MSGuidDecl::anchor() {}
3321 
3322 MSGuidDecl::MSGuidDecl(DeclContext *DC, QualType T, Parts P)
3323  : ValueDecl(Decl::MSGuid, DC, SourceLocation(), DeclarationName(), T),
3324  PartVal(P) {}
3325 
3326 MSGuidDecl *MSGuidDecl::Create(const ASTContext &C, QualType T, Parts P) {
3327  DeclContext *DC = C.getTranslationUnitDecl();
3328  return new (C, DC) MSGuidDecl(DC, T, P);
3329 }
3330 
3331 MSGuidDecl *MSGuidDecl::CreateDeserialized(ASTContext &C, unsigned ID) {
3332  return new (C, ID) MSGuidDecl(nullptr, QualType(), Parts());
3333 }
3334 
3335 void MSGuidDecl::printName(llvm::raw_ostream &OS,
3336  const PrintingPolicy &) const {
3337  OS << llvm::format("GUID{%08" PRIx32 "-%04" PRIx16 "-%04" PRIx16 "-",
3338  PartVal.Part1, PartVal.Part2, PartVal.Part3);
3339  unsigned I = 0;
3340  for (uint8_t Byte : PartVal.Part4And5) {
3341  OS << llvm::format("%02" PRIx8, Byte);
3342  if (++I == 2)
3343  OS << '-';
3344  }
3345  OS << '}';
3346 }
3347 
3348 /// Determine if T is a valid 'struct _GUID' of the shape that we expect.
3349 static bool isValidStructGUID(ASTContext &Ctx, QualType T) {
3350  // FIXME: We only need to check this once, not once each time we compute a
3351  // GUID APValue.
3352  using MatcherRef = llvm::function_ref<bool(QualType)>;
3353 
3354  auto IsInt = [&Ctx](unsigned N) {
3355  return [&Ctx, N](QualType T) {
3356  return T->isUnsignedIntegerOrEnumerationType() &&
3357  Ctx.getIntWidth(T) == N;
3358  };
3359  };
3360 
3361  auto IsArray = [&Ctx](MatcherRef Elem, unsigned N) {
3362  return [&Ctx, Elem, N](QualType T) {
3363  const ConstantArrayType *CAT = Ctx.getAsConstantArrayType(T);
3364  return CAT && CAT->getSize() == N && Elem(CAT->getElementType());
3365  };
3366  };
3367 
3368  auto IsStruct = [](std::initializer_list<MatcherRef> Fields) {
3369  return [Fields](QualType T) {
3370  const RecordDecl *RD = T->getAsRecordDecl();
3371  if (!RD || RD->isUnion())
3372  return false;
3373  RD = RD->getDefinition();
3374  if (!RD)
3375  return false;
3376  if (auto *CXXRD = dyn_cast<CXXRecordDecl>(RD))
3377  if (CXXRD->getNumBases())
3378  return false;
3379  auto MatcherIt = Fields.begin();
3380  for (const FieldDecl *FD : RD->fields()) {
3381  if (FD->isUnnamedBitfield()) continue;
3382  if (FD->isBitField() || MatcherIt == Fields.end() ||
3383  !(*MatcherIt)(FD->getType()))
3384  return false;
3385  ++MatcherIt;
3386  }
3387  return MatcherIt == Fields.end();
3388  };
3389  };
3390 
3391  // We expect an {i32, i16, i16, [8 x i8]}.
3392  return IsStruct({IsInt(32), IsInt(16), IsInt(16), IsArray(IsInt(8), 8)})(T);
3393 }
3394 
3396  if (APVal.isAbsent() && isValidStructGUID(getASTContext(), getType())) {
3397  using llvm::APInt;
3398  using llvm::APSInt;
3399  APVal = APValue(APValue::UninitStruct(), 0, 4);
3400  APVal.getStructField(0) = APValue(APSInt(APInt(32, PartVal.Part1), true));
3401  APVal.getStructField(1) = APValue(APSInt(APInt(16, PartVal.Part2), true));
3402  APVal.getStructField(2) = APValue(APSInt(APInt(16, PartVal.Part3), true));
3403  APValue &Arr = APVal.getStructField(3) =
3404  APValue(APValue::UninitArray(), 8, 8);
3405  for (unsigned I = 0; I != 8; ++I) {
3406  Arr.getArrayInitializedElt(I) =
3407  APValue(APSInt(APInt(8, PartVal.Part4And5[I]), true));
3408  }
3409  // Register this APValue to be destroyed if necessary. (Note that the
3410  // MSGuidDecl destructor is never run.)
3411  getASTContext().addDestruction(&APVal);
3412  }
3413 
3414  return APVal;
3415 }
3416 
3417 void UnnamedGlobalConstantDecl::anchor() {}
3418 
3419 UnnamedGlobalConstantDecl::UnnamedGlobalConstantDecl(const ASTContext &C,
3420  DeclContext *DC,
3421  QualType Ty,
3422  const APValue &Val)
3423  : ValueDecl(Decl::UnnamedGlobalConstant, DC, SourceLocation(),
3424  DeclarationName(), Ty),
3425  Value(Val) {
3426  // Cleanup the embedded APValue if required (note that our destructor is never
3427  // run)
3428  if (Value.needsCleanup())
3429  C.addDestruction(&Value);
3430 }
3431 
3433 UnnamedGlobalConstantDecl::Create(const ASTContext &C, QualType T,
3434  const APValue &Value) {
3435  DeclContext *DC = C.getTranslationUnitDecl();
3436  return new (C, DC) UnnamedGlobalConstantDecl(C, DC, T, Value);
3437 }
3438 
3440 UnnamedGlobalConstantDecl::CreateDeserialized(ASTContext &C, unsigned ID) {
3441  return new (C, ID)
3442  UnnamedGlobalConstantDecl(C, nullptr, QualType(), APValue());
3443 }
3444 
3445 void UnnamedGlobalConstantDecl::printName(llvm::raw_ostream &OS,
3446  const PrintingPolicy &) const {
3447  OS << "unnamed-global-constant";
3448 }
3449 
3450 static const char *getAccessName(AccessSpecifier AS) {
3451  switch (AS) {
3452  case AS_none:
3453  llvm_unreachable("Invalid access specifier!");
3454  case AS_public:
3455  return "public";
3456  case AS_private:
3457  return "private";
3458  case AS_protected:
3459  return "protected";
3460  }
3461  llvm_unreachable("Invalid access specifier!");
3462 }
3463 
3465  AccessSpecifier AS) {
3466  return DB << getAccessName(AS);
3467 }
clang::ExplicitSpecifier
Store information needed for an explicit specifier.
Definition: DeclCXX.h:1830
clang::CXXMethodDecl::getThisType
QualType getThisType() const
Return the type of the this pointer.
Definition: DeclCXX.cpp:2488
clang::CXXRecordDecl::hasSimpleCopyConstructor
bool hasSimpleCopyConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous copy constructor that ...
Definition: DeclCXX.h:712
clang::prec::Comma
@ Comma
Definition: OperatorPrecedence.h:28
clang::CXXCtorInitializer::getMemberLocation
SourceLocation getMemberLocation() const
Definition: DeclCXX.h:2364
clang::FunctionDecl::doesThisDeclarationHaveABody
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition: Decl.h:2217
clang::CXXCtorInitializer::getAnyMember
FieldDecl * getAnyMember() const
Definition: DeclCXX.h:2350
clang::Type::isRecordType
bool isRecordType() const
Definition: Type.h:6973
clang::RequiresExprBodyDecl::Create
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
Definition: DeclCXX.cpp:2116
clang::Decl::getASTContext
ASTContext & getASTContext() const LLVM_READONLY
Definition: DeclBase.cpp:428
clang::AccessSpecDecl
Represents an access specifier followed by colon ':'.
Definition: DeclCXX.h:86
clang::UnresolvedSetIterator::getDecl
NamedDecl * getDecl() const
Definition: UnresolvedSet.h:50
clang::QualType::getCVRQualifiers
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
Definition: Type.h:6668
clang::RecordDecl::field_begin
field_iterator field_begin() const
Definition: Decl.cpp:4754
clang::CXXRecordDecl::getDeviceLambdaManglingNumber
unsigned getDeviceLambdaManglingNumber() const
Retrieve the device side mangling number.
Definition: DeclCXX.cpp:1641
clang::CXXMethodDecl::getThisObjectType
QualType getThisObjectType() const
Return the type of the object pointed by this.
Definition: DeclCXX.cpp:2499
clang::CXXConstructorDecl
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2436
clang::NestedNameSpecifier::getAsRecordDecl
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
Definition: NestedNameSpecifier.cpp:185
clang::CXXMethodDecl::isLambdaStaticInvoker
bool isLambdaStaticInvoker() const
Determine whether this is a lambda closure type's static member function that is used for the result ...
Definition: DeclCXX.cpp:2518
clang::ASTContext::getTypeDeclType
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
Definition: ASTContext.h:1583
clang::CXXMethodDecl::isCopyAssignmentOperator
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
Definition: DeclCXX.cpp:2396
clang::DeclContext::getParentASTContext
ASTContext & getParentASTContext() const
Definition: DeclBase.h:1952
clang::CXXConversionDecl::isLambdaToBlockPointerConversion
bool isLambdaToBlockPointerConversion() const
Determine whether this conversion function is a conversion from a lambda closure type to a block poin...
Definition: DeclCXX.cpp:2821
clang::FunctionDecl::getNumParams
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
Definition: Decl.cpp:3466
clang::Type::isBlockPointerType
bool isBlockPointerType() const
Definition: Type.h:6891
clang::CXXRecordDecl::getDependentLambdaCallOperator
FunctionTemplateDecl * getDependentLambdaCallOperator() const
Retrieve the dependent lambda call operator of the closure type if this is a templated closure type.
Definition: DeclCXX.cpp:1535
clang::RecordDecl::setArgPassingRestrictions
void setArgPassingRestrictions(ArgPassingKind Kind)
Definition: Decl.h:4141
Specifiers.h
clang::CXXRecordDecl::hasAnyDependentBases
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation.
Definition: DeclCXX.cpp:567
clang::CXXRecordDecl::isTriviallyCopyable
bool isTriviallyCopyable() const
Determine whether this class is considered trivially copyable per (C++11 [class]p6).
Definition: DeclCXX.cpp:574
clang::interp::APInt
llvm::APInt APInt
Definition: Integral.h:27
clang::UsingDirectiveDecl::Create
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
Definition: DeclCXX.cpp:2854
LT
ASTImporterLookupTable & LT
Definition: ASTImporterLookupTable.cpp:24
clang::CXXRecordDecl::hasSimpleDestructor
bool hasSimpleDestructor() const
true if we know for sure that this class has an accessible destructor that is not deleted.
Definition: DeclCXX.h:740
clang::DeclContext::specific_decl_iterator
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
Definition: DeclBase.h:2198
clang::CXXCtorInitializer::getBaseClass
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
Definition: DeclCXX.cpp:2569
clang::CXXRecordDecl::isEffectivelyFinal
bool isEffectivelyFinal() const
Determine whether it's impossible for a class to be derived from this class.
Definition: DeclCXX.cpp:2057
clang::UsingPackDecl::CreateDeserialized
static UsingPackDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumExpansions)
Definition: DeclCXX.cpp:3139
clang::CXXMethodDecl::isStatic
bool isStatic() const
Definition: DeclCXX.cpp:2128
clang::CXXFinalOverriderMap
A mapping from each virtual member function to its set of final overriders.
Definition: CXXInheritance.h:357
clang::MemberSpecializationInfo
Provides information a specialization of a member of a class template, which may be a member function...
Definition: DeclTemplate.h:630
clang::UnresolvedSetImpl
A set of unresolved declarations.
Definition: UnresolvedSet.h:61
clang::ASTUnresolvedSet::size
unsigned size() const
Definition: ASTUnresolvedSet.h:82
clang::Decl::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclBase.h:428
clang::Type::isObjCRetainableType
bool isObjCRetainableType() const
Definition: Type.cpp:4385
clang::LinkageSpecDecl
Represents a linkage specification.
Definition: DeclCXX.h:2832
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:210
clang::DecompositionDecl::bindings
ArrayRef< BindingDecl * > bindings() const
Definition: DeclCXX.h:4099
clang::CXXRecordDecl::isCLike
bool isCLike() const
True if this class is C-like, without C++-specific features, e.g.
Definition: DeclCXX.cpp:1499
clang::DeclContext
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1389
clang::ASTUnresolvedSet::erase
void erase(unsigned I)
Definition: ASTUnresolvedSet.h:72
clang::BindingDecl::Create
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
Definition: DeclCXX.cpp:3239
clang::StaticAssertDecl::Create
static StaticAssertDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *Message, SourceLocation RParenLoc, bool Failed)
Definition: DeclCXX.cpp:3221
clang::ExplicitSpecKind::Unresolved
@ Unresolved
clang::LambdaCapture
Describes the capture of a variable or of this, or of a C++1y init-capture.
Definition: LambdaCapture.h:25
clang::CXXConversionDecl
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2766
clang::Decl::hasAttr
bool hasAttr() const
Definition: DeclBase.h:560
clang::Redeclarable< UsingShadowDecl >
clang::CXXRecordDecl::getMemberSpecializationInfo
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization,...
Definition: DeclCXX.cpp:1825
clang::NamespaceAliasDecl
Represents a C++ namespace alias.
Definition: DeclCXX.h:3021
clang::LifetimeExtendedTemporaryDecl::getOrCreateValue
APValue * getOrCreateValue(bool MayCreate) const
Get the storage for the constant value of a materialized temporary of static storage duration.
Definition: DeclCXX.cpp:2995
clang::DecompositionDecl::Create
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl * > Bindings)
Definition: DeclCXX.cpp:3263
clang::QualType::isConstQualified
bool isConstQualified() const
Determine whether this type is const-qualified.
Definition: Type.h:6694
clang::CXXRecordDecl::hasNonTrivialMoveConstructor
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12)
Definition: DeclCXX.h:1270
clang::ConstantArrayType
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:3058
clang::Decl::getAsFunction
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
Definition: DeclBase.cpp:227
Used
@ Used
Definition: ObjCUnusedIVarsChecker.cpp:29
clang::CXXRecordDecl::hasNonTrivialMoveAssignment
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class....
Definition: DeclCXX.h:1305
clang::FunctionDecl::isDeleted
bool isDeleted() const
Whether this function has been deleted.
Definition: Decl.h:2409
clang::UsingDecl::getQualifier
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3451
clang::Qualifiers::OCL_Weak
@ OCL_Weak
Reading or writing from this object requires a barrier call.
Definition: Type.h:178
clang::UsingDirectiveDecl
Represents C++ using-directive.
Definition: DeclCXX.h:2917
clang::ConstantArrayType::getSize
const llvm::APInt & getSize() const
Definition: Type.h:3081
clang::CXXDestructorDecl::setOperatorDelete
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg)
Definition: DeclCXX.cpp:2787
clang::Decl::getASTMutationListener
ASTMutationListener * getASTMutationListener() const
Definition: DeclBase.cpp:438
clang::BindingDecl
A binding in a decomposition declaration.
Definition: DeclCXX.h:4008
clang::Expr::IgnoreImplicit
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
Definition: Expr.cpp:3023
clang::DeclarationName::CXXConstructorName
@ CXXConstructorName
Definition: DeclarationName.h:212
clang::CXXRecordDecl::removeConversion
void removeConversion(const NamedDecl *Old)
Removes a conversion function from this class.
Definition: DeclCXX.cpp:1793
llvm::SmallVector
Definition: LLVM.h:38
clang::UsingDirectiveDecl::CreateDeserialized
static UsingDirectiveDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:2867
clang::IdentifierTable::get
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Definition: IdentifierTable.h:597
clang::RecordDecl::field_empty
bool field_empty() const
Definition: Decl.h:4217
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::CXXRecordDecl::conversion_begin
conversion_iterator conversion_begin() const
Definition: DeclCXX.h:1085
clang::QualType::getQualifiers
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Definition: Type.h:6662
clang::ASTContext::getIntWidth
unsigned getIntWidth(QualType T) const
Definition: ASTContext.cpp:10901
clang::TTK_Struct
@ TTK_Struct
The "struct" keyword.
Definition: Type.h:5535
clang::FunctionDecl::hasOneParamOrDefaultArgs
bool hasOneParamOrDefaultArgs() const
Determine whether this function has a single parameter, or multiple parameters where all but the firs...
Definition: Decl.cpp:3505
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:247
clang::AS_private
@ AS_private
Definition: Specifiers.h:114
clang::CXXConstructorDecl::isExplicit
bool isExplicit() const
Return true if the declaration is already resolved to be explicit.
Definition: DeclCXX.h:2518
TargetInfo.h
clang::NamedDecl::getUnderlyingDecl
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
Definition: Decl.h:459
clang::MultiVersionKind::Target
@ Target
CXXInheritance.h
clang::ASTContext::DeclarationNames
DeclarationNameTable DeclarationNames
Definition: ASTContext.h:664
clang::RecordDecl::setHasVolatileMember
void setHasVolatileMember(bool val)
Definition: Decl.h:4069
clang::CXXConstructorDecl::isDelegatingConstructor
bool isDelegatingConstructor() const
Determine whether this constructor is a delegating constructor.
Definition: DeclCXX.h:2591
clang::TSK_Undeclared
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
Definition: Specifiers.h:179
clang::CXXRecordDecl::getDefinition
CXXRecordDecl * getDefinition() const
Definition: DeclCXX.h:543
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:737
clang::TypeDecl::getTypeForDecl
const Type * getTypeForDecl() const
Definition: Decl.h:3257
Attr.h
clang::CXXRecordDecl::hasNonTrivialCopyAssignment
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class....
Definition: DeclCXX.h:1291
recursivelyOverrides
static bool recursivelyOverrides(const CXXMethodDecl *DerivedMD, const CXXMethodDecl *BaseMD)
Definition: DeclCXX.cpp:2138
clang::FunctionDecl::getParamDecl
const ParmVarDecl * getParamDecl(unsigned i) const
Definition: Decl.h:2594
AttributeLangSupport::C
@ C
Definition: SemaDeclAttr.cpp:56
isValidStructGUID
static bool isValidStructGUID(ASTContext &Ctx, QualType T)
Determine if T is a valid 'struct _GUID' of the shape that we expect.
Definition: DeclCXX.cpp:3349
clang::CXXRecordDecl::setCaptures
void setCaptures(ASTContext &Context, ArrayRef< LambdaCapture > Captures)
Set the captures for this lambda closure type.
Definition: DeclCXX.cpp:1461
clang::cast
U cast(CodeGen::Address addr)
Definition: Address.h:174
clang::FunctionDecl::willHaveBody
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
Definition: Decl.h:2502
clang::UnresolvedSetIterator
The iterator over UnresolvedSets.
Definition: UnresolvedSet.h:32
clang::CXXRecordDecl::MergeAccess
static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, AccessSpecifier DeclAccess)
Calculates the access of a decl that is reached along a path.
Definition: DeclCXX.h:1687
clang::FieldDecl
Represents a member of a struct/union/class.
Definition: Decl.h:2930
clang::ASTContext::getBaseElementType
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
Definition: ASTContext.cpp:6984
clang::FieldDecl::getInClassInitializer
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set.
Definition: Decl.h:3077
clang::UnresolvedUsingValueDecl::isAccessDeclaration
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
Definition: DeclCXX.h:3800
isDeclContextInNamespace
static bool isDeclContextInNamespace(const DeclContext *DC)
Definition: DeclCXX.cpp:1937
clang::index::SymbolRole::Definition
@ Definition
clang::ParmVarDecl
Represents a parameter to a function.
Definition: Decl.h:1712
clang::NamespaceAliasDecl::CreateDeserialized
static NamespaceAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:2969
clang::Redeclarable< FunctionDecl >::getFirstDecl
FunctionDecl * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:216
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:205
DeclCXX.h
clang::CXXMethodDecl::getCanonicalDecl
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclCXX.h:2068
clang::MSPropertyDecl::Create
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
Definition: DeclCXX.cpp:3304
clang::UnresolvedUsingValueDecl::getNameInfo
DeclarationNameInfo getNameInfo() const
Definition: DeclCXX.h:3811
clang::CXXCtorInitializer::isBaseInitializer
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
Definition: DeclCXX.h:2276
clang::UsingShadowDecl
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition: DeclCXX.h:3222
clang::DeclarationNameTable::getCXXDestructorName
DeclarationName getCXXDestructorName(CanQualType Ty)
Returns the name of a C++ destructor for the given Type.
Definition: DeclarationName.cpp:326
clang::FunctionDecl::getPrimaryTemplate
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
Definition: Decl.cpp:3916
clang::index::SymbolKind::Using
@ Using
clang::UsingEnumDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclCXX.cpp:3126
clang::CXXRecordDecl::Create
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
Definition: DeclCXX.cpp:132
clang::UnresolvedUsingValueDecl::CreateDeserialized
static UnresolvedUsingValueDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:3164
clang::RecordDecl::getDefinition
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
Definition: Decl.h:4194
clang::UnnamedGlobalConstantDecl::printName
void printName(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const override
Print this in a human-readable format.
Definition: DeclCXX.cpp:3445
llvm::SmallPtrSet
Definition: ASTContext.h:82
clang::FunctionDecl::UsesFPIntrin
bool UsesFPIntrin() const
Determine whether the function was declared in source context that requires constrained FP intrinsics...
Definition: Decl.h:2689
hasRepeatedBaseClass
static bool hasRepeatedBaseClass(const CXXRecordDecl *StartRD)
Determine whether a class has a repeated base class.
Definition: DeclCXX.cpp:176
clang::CXXRecordDecl::isGenericLambda
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e.
Definition: DeclCXX.cpp:1509
clang::FunctionDecl::isUserProvided
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration.
Definition: Decl.h:2294
clang::QualType::isVolatileQualified
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
Definition: Type.h:6705
clang::CXXRecordDecl::hasUserDeclaredConstructor
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
Definition: DeclCXX.h:769
clang::Decl::getLangOpts
const LangOptions & getLangOpts() const LLVM_READONLY
Helper to get the language options from the ASTContext.
Definition: DeclBase.cpp:434
clang::CPlusPlus14
@ CPlusPlus14
Definition: LangStandard.h:55
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::CXXCtorInitializer::isAnyMemberInitializer
bool isAnyMemberInitializer() const
Definition: DeclCXX.h:2284
clang::ClassTemplatePartialSpecializationDecl
Definition: DeclTemplate.h:2101
clang::PrintingPolicy
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:57
clang::UsingPackDecl
Represents a pack of using declarations that a single using-declarator pack-expanded into.
Definition: DeclCXX.h:3693
clang::RecordDecl::APK_CanNeverPassInRegs
@ APK_CanNeverPassInRegs
The argument of this type cannot be passed directly in registers.
Definition: Decl.h:4008
ASTLambda.h
clang::DeclarationName::getAsIdentifierInfo
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
Definition: DeclarationName.h:419
clang::MSGuidDeclParts::Part1
uint32_t Part1
{01234567-...
Definition: DeclCXX.h:4167
clang::Type::isRValueReferenceType
bool isRValueReferenceType() const
Definition: Type.h:6903
clang::FunctionType
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3675
clang::SD_Automatic
@ SD_Automatic
Automatic storage duration (most local variables).
Definition: Specifiers.h:313
clang::TTK_Interface
@ TTK_Interface
The "__interface" keyword.
Definition: Type.h:5538
clang::DeclarationName
The name of a declaration.
Definition: DeclarationName.h:144
clang::CXXRecordDecl::bases_end
base_class_iterator bases_end()
Definition: DeclCXX.h:606
clang::index::SymbolKind::Constructor
@ Constructor
clang::BindingDecl::getHoldingVar
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
Definition: DeclCXX.cpp:3248
clang::CXXRecordDecl::lambdaIsDefaultConstructibleAndAssignable
bool lambdaIsDefaultConstructibleAndAssignable() const
Determine whether this lambda should have an implicit default constructor and copy and move assignmen...
Definition: DeclCXX.cpp:677
clang::CXXRecordDecl::getLambdaContextDecl
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
Definition: DeclCXX.cpp:1629
clang::CXXMethodDecl::getCorrespondingMethodInClass
CXXMethodDecl * getCorrespondingMethodInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find the method in RD that corresponds to this one.
Definition: DeclCXX.cpp:2181
clang::CXXRecordDecl::getLambdaCallOperator
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
Definition: DeclCXX.cpp:1540
clang::CXXMethodDecl::isMoveAssignmentOperator
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
Definition: DeclCXX.cpp:2417
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1565
getLambdaStaticInvokers
static DeclContext::lookup_result getLambdaStaticInvokers(const CXXRecordDecl &RD)
Definition: DeclCXX.cpp:1559
clang::CXXCtorInitializer::getSourceLocation
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
Definition: DeclCXX.cpp:2576
clang::UsingEnumDecl::Create
static UsingEnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, SourceLocation EnumL, SourceLocation NameL, TypeSourceInfo *EnumType)
Definition: DeclCXX.cpp:3110
clang::StorageDuration
StorageDuration
The storage duration for an object (per C++ [basic.stc]).
Definition: Specifiers.h:311
clang::CXXMethodDecl::Create
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
Definition: DeclCXX.cpp:2216
clang::AS_none
@ AS_none
Definition: Specifiers.h:115
clang::NamespaceDecl::getOriginalNamespace
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
Definition: DeclCXX.cpp:2912
clang::LinkageSpecDecl::lang_c
@ lang_c
Definition: DeclCXX.h:2841
clang::CXXConstructorDecl::Create
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, ExplicitSpecifier ES, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, InheritedConstructor Inherited=InheritedConstructor(), Expr *TrailingRequiresClause=nullptr)
Definition: DeclCXX.cpp:2640
clang::RecordDecl::setHasObjectMember
void setHasObjectMember(bool val)
Definition: Decl.h:4065
clang::CXXRecordDecl::getDescribedClassTemplate
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
Definition: DeclCXX.cpp:1839
clang::CXXConstructorDecl::CreateDeserialized
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, unsigned ID, uint64_t AllocKind)
Definition: DeclCXX.cpp:2620
APSInt
llvm::APSInt APSInt
Definition: ByteCodeEmitter.cpp:19
clang::UsingDecl::isAccessDeclaration
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
Definition: DeclCXX.h:3460
clang::ASTContext::Allocate
void * Allocate(size_t Size, unsigned Align=8) const
Definition: ASTContext.h:734
clang::CXXRecordDecl::CreateLambda
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, unsigned DependencyKind, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
Definition: DeclCXX.cpp:148
clang::UnresolvedUsingTypenameDecl
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3858
clang::CXXCtorInitializer::isInClassMemberInitializer
bool isInClassMemberInitializer() const
Determine whether this initializer is an implicit initializer generated for a field with an initializ...
Definition: DeclCXX.h:2298
clang::Type::isLiteralType
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
Definition: Type.cpp:2585
clang::MSGuidDecl::printName
void printName(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const override
Print this UUID in a human-readable format.
Definition: DeclCXX.cpp:3335
clang::UnresolvedUsingValueDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclCXX.cpp:3172
clang::FunctionTemplateDecl
Declaration of a template function.
Definition: DeclTemplate.h:1006
clang::Type::isStructuralType
bool isStructuralType() const
Determine if this type is a structural type, per C++20 [temp.param]p7.
Definition: Type.cpp:2650
clang::CXXRecordDecl::getInstantiatedFromMemberClass
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
Definition: DeclCXX.cpp:1818
clang::Type::isReferenceType
bool isReferenceType() const
Definition: Type.h:6895
clang::UnresolvedUsingTypenameDecl::CreateDeserialized
static UnresolvedUsingTypenameDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:3194
clang::ASTContext::getExternalSource
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
Definition: ASTContext.h:1194
clang::QualType::hasNonTrivialObjCLifetime
bool hasNonTrivialObjCLifetime() const
Definition: Type.h:1197
clang::Decl::Kind
Kind
Lists the kind of concrete classes of Decl.
Definition: DeclBase.h:86
clang::CXXRecordDecl::getLambdaCaptureDefault
LambdaCaptureDefault getLambdaCaptureDefault() const
Definition: DeclCXX.h:1041
clang::RecordType
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:4816
clang::CXXMethodDecl::overridden_methods
overridden_method_range overridden_methods() const
Definition: DeclCXX.cpp:2463
clang::CXXCtorInitializer::getBaseClassLoc
TypeLoc getBaseClassLoc() const
If this is a base class initializer, returns the type of the base class with location information.
Definition: DeclCXX.cpp:2562
getAccessName
static const char * getAccessName(AccessSpecifier AS)
Definition: DeclCXX.cpp:3450
DeclTemplate.h
clang::DeclarationName::getCXXOverloadedOperator
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
Definition: DeclarationName.h:471
clang::NamespaceDecl::CreateDeserialized
static NamespaceDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:2907
clang::ASTUnresolvedSet
An UnresolvedSet-like class which uses the ASTContext's allocator.
Definition: ASTUnresolvedSet.h:29
clang::OverridingMethods::iterator
MapType::iterator iterator
Definition: CXXInheritance.h:277
clang::UsingShadowDecl::getIntroducer
BaseUsingDecl * getIntroducer() const
Gets the (written or instantiated) using declaration that introduced this declaration.
Definition: DeclCXX.cpp:3029
clang::RequiresExprBodyDecl
Represents the body of a requires-expression.
Definition: DeclCXX.h:1961
clang::CXXMethodDecl::isInstance
bool isInstance() const
Definition: DeclCXX.h:2010
clang::CXXRecordDecl::getCaptureFields
void getCaptureFields(llvm::DenseMap< const ValueDecl *, FieldDecl * > &Captures, FieldDecl *&ThisCapture) const
For a closure type, retrieve the mapping from captured variables and this to the non-static data memb...
Definition: DeclCXX.cpp:1587
clang::ASTContext::getAsConstantArrayType
const ConstantArrayType * getAsConstantArrayType(QualType T) const
Definition: ASTContext.h:2726
clang::Decl::getAccess
AccessSpecifier getAccess() const
Definition: DeclBase.h:491
clang::Type::getAsTagDecl
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
Definition: Type.cpp:1768
clang::CXXRecordDecl::methods
method_range methods() const
Definition: DeclCXX.h:639
clang::FunctionDecl::isTrivial
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition: Decl.h:2261
clang::ASTUnresolvedSet::append
void append(ASTContext &C, iterator I, iterator E)
Definition: ASTUnresolvedSet.h:88
clang::TagTypeKind
TagTypeKind
The kind of a tag type.
Definition: Type.h:5533
clang::QualType::isObjCGCStrong
bool isObjCGCStrong() const
true when Type is objc's strong.
Definition: Type.h:1188
Id
int Id
Definition: ASTDiff.cpp:189
DeclBase.h
clang::Qualifiers::OCL_Strong
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
Definition: Type.h:175
hlsl::uint64_t
unsigned long uint64_t
Definition: hlsl_basic_types.h:25
clang::FunctionDecl::getTemplateInstantiationPattern
FunctionDecl * getTemplateInstantiationPattern(bool ForDefinition=true) const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
Definition: Decl.cpp:3867
OperatorKinds.h
clang::DeclarationName::CXXDestructorName
@ CXXDestructorName
Definition: DeclarationName.h:213
clang::UsingDecl::CreateDeserialized
static UsingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:3096
clang::AS_public
@ AS_public
Definition: Specifiers.h:112
clang::CXXCtorInitializer::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Determine the source range covering the entire initializer.
Definition: DeclCXX.cpp:2589
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:209
clang::ASTContext::getSizeType
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
Definition: ASTContext.cpp:5933
clang::ASTContext::addOverriddenMethod
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
Definition: ASTContext.cpp:1663
clang::StreamingDiagnostic
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
Definition: Diagnostic.h:1110
clang::DeclContextLookupResult::front
reference front() const
Definition: DeclBase.h:1357
clang::DeclarationNameTable::getCXXOperatorName
DeclarationName getCXXOperatorName(OverloadedOperatorKind Op)
Get the name of the overloadable C++ operator corresponding to Op.
Definition: DeclarationName.h:648
clang::ConstructorUsingShadowDecl::CreateDeserialized
static ConstructorUsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:3048
NestedNameSpecifier.h
clang::DeclaratorContext::Member
@ Member
LangOptions.h
Diagnostic.h
clang::CXXRecordDecl::getLambdaStaticInvoker
CXXMethodDecl * getLambdaStaticInvoker() const
Retrieve the lambda static invoker, the address of which is returned by the conversion operator,...
Definition: DeclCXX.cpp:1552
clang::DecompositionDecl
A decomposition declaration.
Definition: DeclCXX.h:4065
clang::QualType::isCXX98PODType
bool isCXX98PODType(const ASTContext &Context) const
Return true if this is a POD type according to the rules of the C++98 standard, regardless of the cur...
Definition: Type.cpp:2369
clang::Type::getAs
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:7386
clang::CXXRecordDecl::getNumBases
unsigned getNumBases() const
Retrieves the number of base classes of this class.
Definition: DeclCXX.h:591
clang::CXXConversionDecl::CreateDeserialized
static CXXConversionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:2800
clang::Decl::isInvalidDecl
bool isInvalidDecl() const
Definition: DeclBase.h:571
clang::FunctionDecl::setIneligibleOrNotSelected
void setIneligibleOrNotSelected(bool II)
Definition: Decl.h:2305
clang::ASTMutationListener
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
Definition: ASTMutationListener.h:46
clang::NamespaceDecl::Create
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested)
Definition: DeclCXX.cpp:2899
clang::ConstructorUsingShadowDecl::getIntroducer
UsingDecl * getIntroducer() const
Override the UsingShadowDecl's getIntroducer, returning the UsingDecl that introduced this.
Definition: DeclCXX.h:3556
clang::RISCV::Policy
Policy
Definition: RISCVVIntrinsicUtils.h:96
clang::LambdaCaptureDefault
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
Definition: Lambda.h:22
clang::Qualifiers::Volatile
@ Volatile
Definition: Type.h:152
clang::Type::isLValueReferenceType
bool isLValueReferenceType() const
Definition: Type.h:6899
clang::index::SymbolKind::Field
@ Field
clang::MSGuidDecl
A global _GUID constant.
Definition: DeclCXX.h:4188
uintptr_t
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Definition: opencl-c-base.h:140
clang::CXXDestructorDecl
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2703
IdentifierTable.h
clang::DeclContext::isTranslationUnit
bool isTranslationUnit() const
Definition: DeclBase.h:1998
Type.h
clang::UsingDecl::Create
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
Definition: DeclCXX.cpp:3089
clang::BaseUsingDecl::shadows
shadow_range shadows() const
Definition: DeclCXX.h:3385
clang::CXXRecordDecl::isPOD
bool isPOD() const
Whether this class is a POD-type (C++ [class]p4)
Definition: DeclCXX.h:1135
clang::CPlusPlus20
@ CPlusPlus20
Definition: LangStandard.h:57
Expr.h
clang::CanQual::getCVRQualifiers
unsigned getCVRQualifiers() const
Retrieve the const/volatile/restrict qualifiers.
Definition: CanonicalType.h:132
bool
#define bool
Definition: stdbool.h:20
clang::BaseUsingDecl::removeShadowDecl
void removeShadowDecl(UsingShadowDecl *S)
Definition: DeclCXX.cpp:3067
clang::MSGuidDecl::getAsAPValue
APValue & getAsAPValue() const
Get the value of this MSGuidDecl as an APValue.
Definition: DeclCXX.cpp:3395
ASTContext.h
clang::UnresolvedSet< 8 >
clang::CallingConv
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:266
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:906
clang::UnresolvedUsingIfExistsDecl::CreateDeserialized
static UnresolvedUsingIfExistsDecl * CreateDeserialized(ASTContext &Ctx, unsigned ID)
Definition: DeclCXX.cpp:3207
clang::MSPropertyDecl::CreateDeserialized
static MSPropertyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:3313
clang::Type::getPointeeType
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Definition: Type.cpp:625
clang::TemplateParameterList
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:70
clang::ASTUnresolvedSet::replace
bool replace(const NamedDecl *Old, NamedDecl *New, AccessSpecifier AS)
Replaces the given declaration with the new one, once.
Definition: ASTUnresolvedSet.h:62
clang::CXXRecordDecl::hasConstexprDestructor
bool hasConstexprDestructor() const
Determine whether this class has a constexpr destructor.
Definition: DeclCXX.cpp:562
clang::StringLiteral
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1776
clang::SD_FullExpression
@ SD_FullExpression
Full-expression storage duration (for temporaries).
Definition: Specifiers.h:312
getLambdaCallOperatorHelper
static NamedDecl * getLambdaCallOperatorHelper(const CXXRecordDecl &RD)
Definition: DeclCXX.cpp:1523
clang::TTK_Class
@ TTK_Class
The "class" keyword.
Definition: Type.h:5544
clang::UsingShadowDecl::UsingShadowDecl
UsingShadowDecl(Kind K, ASTContext &C, DeclContext *DC, SourceLocation Loc, DeclarationName Name, BaseUsingDecl *Introducer, NamedDecl *Target)
Definition: DeclCXX.cpp:3008
clang::ASTContext::getCanonicalType
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
Definition: ASTContext.h:2528
clang::Type::getAsCXXRecordDecl
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Definition: Type.cpp:1760
clang::TagDecl::isUnion
bool isUnion() const
Definition: Decl.h:3629
clang::LinkageSpecDecl::LanguageIDs
LanguageIDs
Represents the language in a linkage specification.
Definition: DeclCXX.h:2841
clang::DeclContext::isNamespace
bool isNamespace() const
Definition: DeclBase.h:2007
clang::CXXRecordDecl::bases
base_class_range bases()
Definition: DeclCXX.h:597
clang::CXXRecordDecl::hasFriends
bool hasFriends() const
Determines whether this record has any friends.
Definition: DeclCXX.h:680
clang::ASTContext::addDestruction
void addDestruction(T *Ptr) const
If T isn't trivially destructible, calls AddDeallocation to register it for destruction.
Definition: ASTContext.h:3066
clang::CXXRecordDecl::setInstantiationOfMemberClass
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
Definition: DeclCXX.cpp:1830
clang::CXXDeductionGuideDecl::Create
static CXXDeductionGuideDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation, CXXConstructorDecl *Ctor=nullptr)
Definition: DeclCXX.cpp:2100
clang::CXXRecordDecl::forallBases
bool forallBases(ForallBasesCallback BaseMatches) const
Determines if the given callback holds for all the direct or indirect base classes of this type.
Definition: CXXInheritance.cpp:126
clang::NestedNameSpecifierLoc
A C++ nested-name-specifier augmented with source location information.
Definition: NestedNameSpecifier.h:243
clang::Redeclarable< NamespaceDecl >::getPreviousDecl
NamespaceDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:204
clang::FunctionDecl::getMinRequiredArguments
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to call this function.
Definition: Decl.cpp:3487
clang::CanQual< Type >
ExprCXX.h
clang::ExplicitSpecifier::getFromDecl
static ExplicitSpecifier getFromDecl(FunctionDecl *Function)
Definition: DeclCXX.cpp:2086
clang::MSGuidDecl::Parts
MSGuidDeclParts Parts
Definition: DeclCXX.h:4192
Base
clang::Type::isUnsignedIntegerOrEnumerationType
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
Definition: Type.cpp:2090
clang::LCD_None
@ LCD_None
Definition: Lambda.h:23
clang::FunctionDecl::getOverloadedOperator
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any.
Definition: Decl.cpp:3739
clang::UnresolvedUsingValueDecl
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3762
clang::Redeclarable< NamespaceDecl >::isFirstDecl
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
Definition: Redeclarable.h:223
clang::CXXConstructorDecl::isConvertingConstructor
bool isConvertingConstructor(bool AllowExplicit) const
Whether this constructor is a converting constructor (C++ [class.conv.ctor]), which can be used for u...
Definition: DeclCXX.cpp:2729
clang::CXXRecordDecl::hasSimpleMoveAssignment
bool hasSimpleMoveAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous move assignment operat...
Definition: DeclCXX.h:733
clang::APValue::getArrayInitializedElt
APValue & getArrayInitializedElt(unsigned I)
Definition: APValue.h:502
clang::operator<<
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
Definition: ASTContext.cpp:13400
clang::Decl::setImplicit
void setImplicit(bool I=true)
Definition: DeclBase.h:577
clang::NamespaceDecl::isOriginalNamespace
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Definition: DeclCXX.cpp:2926
clang::ConstructorUsingShadowDecl::Create
static ConstructorUsingShadowDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target, bool IsVirtual)
Definition: DeclCXX.cpp:3040
clang::Decl::isImplicit
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:576
clang::OverloadedOperatorKind
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:21
clang::CXXDestructorDecl::Create
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, Expr *TrailingRequiresClause=nullptr)
Definition: DeclCXX.cpp:2774
clang::Qualifiers::ObjCLifetime
ObjCLifetime
Definition: Type.h:162
clang::ODRHash
Definition: ODRHash.h:41
clang::SC_Static
@ SC_Static
Definition: Specifiers.h:240
clang::ExplicitSpecifier::isEquivalent
bool isEquivalent(const ExplicitSpecifier Other) const
Check for equivalence of explicit specifiers.
Definition: DeclCXX.cpp:2071
clang::CXXRecordDecl::getODRHash
unsigned getODRHash() const
Definition: DeclCXX.cpp:494
clang::UsingDecl
Represents a C++ using-declaration.
Definition: DeclCXX.h:3414
clang::DeclarationNameInfo::getName
DeclarationName getName() const
getName - Returns the embedded declaration name.
Definition: DeclarationName.h:790
clang::UsingEnumDecl::CreateDeserialized
static UsingEnumDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:3120
clang::NamedDecl::getMostRecentDecl
NamedDecl * getMostRecentDecl()
Definition: Decl.h:473
clang::CXXRecordDecl::addedSelectedDestructor
void addedSelectedDestructor(CXXDestructorDecl *DD)
Notify the class that this destructor is now selected.
Definition: DeclCXX.cpp:1375
clang::ASTUnresolvedSet::addDecl
void addDecl(ASTContext &C, NamedDecl *D, AccessSpecifier AS)
Definition: ASTUnresolvedSet.h:55
clang::CXXConstructorDecl::isDefaultConstructor
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
Definition: DeclCXX.cpp:2670
clang::DeclarationName::CXXConversionFunctionName
@ CXXConversionFunctionName
Definition: DeclarationName.h:214
clang::ExplicitSpecifier::getExpr
const Expr * getExpr() const
Definition: DeclCXX.h:1839
clang::FunctionDecl::isDestroyingOperatorDelete
bool isDestroyingOperatorDelete() const
Determine whether this is a destroying operator delete.
Definition: Decl.cpp:3285
clang::LinkageSpecDecl::CreateDeserialized
static LinkageSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:2846
clang::Type::castAs
const T * castAs() const
Member-template castAs<specific type>.
Definition: Type.h:7453
clang::ConstexprSpecKind
ConstexprSpecKind
Define the kind of constexpr specifier.
Definition: Specifiers.h:32
clang::CXXRecordDecl::addedEligibleSpecialMemberFunction
void addedEligibleSpecialMemberFunction(const CXXMethodDecl *MD, unsigned SMKind)
Notify the class that an eligible SMF has been added.
Definition: DeclCXX.cpp:1380
clang::AccessSpecifier
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:111
clang::CXXMethodDecl::end_overridden_methods
method_iterator end_overridden_methods() const
Definition: DeclCXX.cpp:2452
clang::TargetInfo::areDefaultedSMFStillPOD
virtual bool areDefaultedSMFStillPOD(const LangOptions &) const
Controls whether explicitly defaulted (= default) special member functions disqualify something from ...
Definition: TargetInfo.cpp:562
clang::LifetimeExtendedTemporaryDecl::getStorageDuration
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
Definition: DeclCXX.cpp:2979
clang::ASTContext::overridden_methods_end
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
Definition: ASTContext.cpp:1644
clang::UsingEnumDecl
Represents a C++ using-enum-declaration.
Definition: DeclCXX.h:3614
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
clang::ASTUnresolvedSet::begin
iterator begin()
Definition: ASTUnresolvedSet.h:49
clang::CXXMethodDecl::begin_overridden_methods
method_iterator begin_overridden_methods() const
Definition: DeclCXX.cpp:2447
clang::Redeclarable< FunctionDecl >::First
FunctionDecl * First
Definition: Redeclarable.h:187
SourceLocation.h
clang::DecompositionDecl::printName
void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override
Pretty-print the unqualified name of this declaration.
Definition: DeclCXX.cpp:3289
P
StringRef P
Definition: ASTMatchersInternal.cpp:563
clang::Type::isDependentType
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:2304
clang::TemplateSpecializationKind
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition: Specifiers.h:176
clang::CXXConstructorDecl::init_const_iterator
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
Definition: DeclCXX.h:2524
clang::CXXRecordDecl::conversion_end
conversion_iterator conversion_end() const
Definition: DeclCXX.h:1089
clang::CXXDeductionGuideDecl::CreateDeserialized
static CXXDeductionGuideDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:2109
clang::Decl::getPreviousDecl
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
Definition: DeclBase.h:1026
clang::Decl::getFriendObjectKind
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
Definition: DeclBase.h:1185
clang::CXXCtorInitializer::getRParenLoc
SourceLocation getRParenLoc() const
Definition: DeclCXX.h:2403
clang::DecompositionDecl::CreateDeserialized
static DecompositionDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumBindings)
Definition: DeclCXX.cpp:3274
clang::UsingPackDecl::Create
static UsingPackDecl * Create(ASTContext &C, DeclContext *DC, NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > UsingDecls)
Definition: DeclCXX.cpp:3132
clang::CXXMethodDecl::size_overridden_methods
unsigned size_overridden_methods() const
Definition: DeclCXX.cpp:2457
clang::DeclContext::LinkageSpecDeclBits
LinkageSpecDeclBitfields LinkageSpecDeclBits
Definition: DeclBase.h:1864
clang::BindingDecl::CreateDeserialized
static BindingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:3244
false
#define false
Definition: stdbool.h:22
clang::StaticAssertDecl
Represents a C++11 static_assert declaration.
Definition: DeclCXX.h:3959
clang::CXXRecordDecl::hasSimpleCopyAssignment
bool hasSimpleCopyAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous copy assignment operat...
Definition: DeclCXX.h:726
clang::CXXRecordDecl::getNumVBases
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
Definition: DeclCXX.h:612
clang::CXXRecordDecl::setDeviceLambdaManglingNumber
void setDeviceLambdaManglingNumber(unsigned Num) const
Set the device side mangling number.
Definition: DeclCXX.cpp:1635
clang::TagDecl::isBeingDefined
bool isBeingDefined() const
Return true if this decl is currently being defined.
Definition: Decl.h:3548
clang::CXXRecordDecl::hasNonTrivialCopyConstructor
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6,...
Definition: DeclCXX.h:1245
clang::ASTContext::overridden_methods
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
Definition: ASTContext.cpp:1655
clang::ClassTemplateDecl
Declaration of a class template.
Definition: DeclTemplate.h:2273
clang::ValueDecl
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:701
clang::AS_protected
@ AS_protected
Definition: Specifiers.h:113
clang::RecordDecl::completeDefinition
virtual void completeDefinition()
Note that the definition of this type is now complete.
Definition: Decl.cpp:4763
clang::ASTUnresolvedSet::end
iterator end()
Definition: ASTUnresolvedSet.h:50
clang::ASTContext::getTagDeclType
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
Definition: ASTContext.cpp:5923
clang::FunctionProtoType
Represents a prototype with parameter type info, e.g.
Definition: Type.h:4016
clang::ASTContext::Idents
IdentifierTable & Idents
Definition: ASTContext.h:660
clang::UnresolvedUsingIfExistsDecl::Create
static UnresolvedUsingIfExistsDecl * Create(ASTContext &Ctx, DeclContext *DC, SourceLocation Loc, DeclarationName Name)
Definition: DeclCXX.cpp:3201
clang::DeclContext::getParent
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1923
clang::Redeclarable< NamespaceDecl >::getNextRedeclaration
NamespaceDecl * getNextRedeclaration() const
Definition: Redeclarable.h:189
clang::RecordDecl::fields
field_range fields() const
Definition: Decl.h:4209
clang::CXXConversionDecl::getConversionType
QualType getConversionType() const
Returns the type that this conversion function is converting to.
Definition: DeclCXX.h:2806
clang::DeclarationName::isIdentifier
bool isIdentifier() const
Predicate functions for querying what type of name this is.
Definition: DeclarationName.h:384
clang::CXXConstructorDecl::getTargetConstructor
CXXConstructorDecl * getTargetConstructor() const
When this constructor delegates to another, retrieve the target.
Definition: DeclCXX.cpp:2661
Begin
SourceLocation Begin
Definition: USRLocFinder.cpp:165
llvm::ArrayRef
Definition: LLVM.h:34
clang::ASTContext::overridden_methods_size
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
Definition: ASTContext.cpp:1649
Value
Value
Definition: UninitializedValues.cpp:103
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
clang::MSGuidDeclParts::Part2
uint16_t Part2
...-89ab-...
Definition: DeclCXX.h:4169
clang::FunctionDecl::isPure
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:2244
clang::TypeLoc
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:58
clang::CXXConstructorDecl::isCopyOrMoveConstructor
bool isCopyOrMoveConstructor() const
Determine whether this a copy or move constructor.
Definition: DeclCXX.h:2648
clang::UsingDecl::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3448
clang::UsingDecl::getNameInfo
DeclarationNameInfo getNameInfo() const
Definition: DeclCXX.h:3455
clang::CXXRecordDecl::getLambdaExplicitTemplateParameters
ArrayRef< NamedDecl * > getLambdaExplicitTemplateParameters() const
Retrieve the lambda template parameters that were specified explicitly.
Definition: DeclCXX.cpp:1615
clang::TagDecl::isStruct
bool isStruct() const
Definition: Decl.h:3626
clang::APValue::isAbsent
bool isAbsent() const
Definition: APValue.h:389
clang::FunctionDecl::isTrivialForCall
bool isTrivialForCall() const
Definition: Decl.h:2264
ASTMutationListener.h
clang::CXXMethodDecl::method_iterator
const CXXMethodDecl *const * method_iterator
Definition: DeclCXX.h:2085
clang::SD_Static
@ SD_Static
Static storage duration.
Definition: Specifiers.h:315
clang::UnresolvedUsingValueDecl::getQualifierLoc
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3804
LLVM.h
clang::CXXCtorInitializer::CXXCtorInitializer
CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual, SourceLocation L, Expr *Init, SourceLocation R, SourceLocation EllipsisLoc)
Creates a new base-class initializer.
Definition: DeclCXX.cpp:2524
clang::CXXMethodDecl::isStaticOverloadedOperator
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK)
Returns true if the given operator is implicitly static in a record context.
Definition: DeclCXX.h:2014
clang::NamespaceAliasDecl::Create
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
Definition: DeclCXX.cpp:2954
clang::Type::getAsRecordDecl
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
Definition: Type.cpp:1764
clang::APValue::getStructField
APValue & getStructField(unsigned i)
Definition: APValue.h:543
clang::CXXConstructorDecl::init_begin
init_iterator init_begin()
Retrieve an iterator to the first initializer.
Definition: DeclCXX.h:2535
clang::CXXRecordDecl::capture_size
unsigned capture_size() const
Definition: DeclCXX.h:1081
clang::ODRHash::AddCXXRecordDecl
void AddCXXRecordDecl(const CXXRecordDecl *Record)
Definition: ODRHash.cpp:545
clang::CXXRecordDecl::mayBeAbstract
bool mayBeAbstract() const
Determine whether this class may end up being abstract, even though it is not yet known to be abstrac...
Definition: DeclCXX.cpp:2042
clang::TagDecl::isInterface
bool isInterface() const
Definition: Decl.h:3627
clang::CXXMethodDecl::overridden_method_range
llvm::iterator_range< llvm::TinyPtrVector< const CXXMethodDecl * >::const_iterator > overridden_method_range
Definition: DeclCXX.h:2092
clang::CXXRecordDecl::hasTrivialDestructor
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
Definition: DeclCXX.h:1323
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:85
clang::CXXRecordDecl::finishedDefaultedOrDeletedMember
void finishedDefaultedOrDeletedMember(CXXMethodDecl *MD)
Indicates that the declaration of a defaulted or deleted special member function is now complete.
Definition: DeclCXX.cpp:1423
clang::ASTContext::getTargetInfo
const TargetInfo & getTargetInfo() const
Definition: ASTContext.h:773
clang::RecordDecl::field_end
field_iterator field_end() const
Definition: Decl.h:4212
clang::CXXMethodDecl::getCorrespondingMethodDeclaredInClass
CXXMethodDecl * getCorrespondingMethodDeclaredInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find if RD declares a function that overrides this function, and if so, return it.
Definition: DeclCXX.cpp:2150
ODRHash.h
clang::FunctionProtoType::getMethodQuals
Qualifiers getMethodQuals() const
Definition: Type.h:4367
clang::CXXRecordDecl::getDestructor
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
Definition: DeclCXX.cpp:1917
clang::CXXRecordDecl::getGenericLambdaTemplateParameterList
TemplateParameterList * getGenericLambdaTemplateParameterList() const
Retrieve the generic lambda's template parameter list.
Definition: DeclCXX.cpp:1606
clang::MemberPointerType
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition: Type.h:2960
clang::CXXRecordDecl::setTemplateSpecializationKind
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
Definition: DeclCXX.cpp:1858
clang::BaseUsingDecl::addShadowDecl
void addShadowDecl(UsingShadowDecl *S)
Definition: DeclCXX.cpp:3058
clang::UnresolvedSetImpl::end
iterator end()
Definition: UnresolvedSet.h:84
clang::LazyOffsetPtr::get
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer points to.
Definition: ExternalASTSource.h:374
DeclarationName.h
clang::ODRHash::AddStmt
void AddStmt(const Stmt *S)
Definition: ODRHash.cpp:24
clang::CXXDeductionGuideDecl
Represents a C++ deduction guide declaration.
Definition: DeclCXX.h:1885
clang::CXXRecordDecl::hasNonLiteralTypeFieldsOrBases
bool hasNonLiteralTypeFieldsOrBases() const
Determine whether this class has a non-literal or/ volatile type non-static data member or base class...
Definition: DeclCXX.h:1365
clang::CXXRecordDecl::setBases
void setBases(CXXBaseSpecifier const *const *Bases, unsigned NumBases)
Sets the base classes of this struct or class.
Definition: DeclCXX.cpp:195
clang::UnresolvedUsingTypenameDecl::Create
static UnresolvedUsingTypenameDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TargetNameLoc, DeclarationName TargetName, SourceLocation EllipsisLoc)
Definition: DeclCXX.cpp:3181
clang::CanQual::getUnqualifiedType
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Definition: CanonicalType.h:619
clang::DeclarationName::getNameKind
NameKind getNameKind() const
Determine what kind of name this is.
Definition: DeclarationName.h:393
clang::CXXMethodDecl::addOverriddenMethod
void addOverriddenMethod(const CXXMethodDecl *MD)
Definition: DeclCXX.cpp:2438
clang::Builtin::ID
ID
Definition: Builtins.h:52
clang::LinkageSpecDecl::Create
static LinkageSpecDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation ExternLoc, SourceLocation LangLoc, LanguageIDs Lang, bool HasBraces)
Definition: DeclCXX.cpp:2837
PartialDiagnostic.h
clang::CXXRecordDecl::getTemplateSpecializationKind
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
Definition: DeclCXX.cpp:1847
clang
Definition: CalledOnceCheck.h:17
clang::IndirectFieldDecl
Represents a field injected from an anonymous union/struct into the parent scope.
Definition: Decl.h:3184
clang::DeclContext::lookup
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
Definition: DeclBase.cpp:1692
clang::CXXConstructorDecl::isSpecializationCopyingObject
bool isSpecializationCopyingObject() const
Determine whether this is a member template specialization that would copy the object to itself.
Definition: DeclCXX.cpp:2747
clang::FunctionDecl::isIneligibleOrNotSelected
bool isIneligibleOrNotSelected() const
Definition: Decl.h:2302
hlsl::int64_t
long int64_t
Definition: hlsl_basic_types.h:26
clang::MSGuidDeclParts::Part4And5
uint8_t Part4And5[8]
...-0123-456789abcdef}
Definition: DeclCXX.h:4173
UnresolvedSet.h
clang::UnresolvedSetImpl::addDecl
void addDecl(NamedDecl *D)
Definition: UnresolvedSet.h:91
clang::Qualifiers::getObjCLifetime
ObjCLifetime getObjCLifetime() const
Definition: Type.h:352
clang::RequiresExprBodyDecl::CreateDeserialized
static RequiresExprBodyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:2121
clang::CXXRecordDecl::CreateDeserialized
static CXXRecordDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:165
clang::MSPropertyDecl
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:4136
clang::CXXRecordDecl::getCanonicalDecl
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclCXX.h:502
clang::CXXCtorInitializer::getID
int64_t getID(const ASTContext &Context) const
Definition: DeclCXX.cpp:2557
clang::ConstructorUsingShadowDecl::getNominatedBaseClass
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
Definition: DeclCXX.cpp:3052
clang::CXXMethodDecl::hasInlineBody
bool hasInlineBody() const
Definition: DeclCXX.cpp:2506
clang::UnresolvedUsingValueDecl::Create
static UnresolvedUsingValueDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, SourceLocation EllipsisLoc)
Definition: DeclCXX.cpp:3153
clang::CXXRecordDecl::bases_begin
base_class_iterator bases_begin()
Definition: DeclCXX.h:604
clang::ASTContext::overridden_methods_begin
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
Definition: ASTContext.cpp:1639
clang::CXXRecordDecl::isInterfaceLike
bool isInterfaceLike() const
Definition: DeclCXX.cpp:1946
clang::MSGuidDeclParts::Part3
uint16_t Part3
...-cdef-...
Definition: DeclCXX.h:4171
clang::CXXBaseSpecifier
Represents a base class of a C++ class.
Definition: DeclCXX.h:146
clang::CXXRecordDecl::hasDefinition
bool hasDefinition() const
Definition: DeclCXX.h:550
clang::TypeSourceInfo
A container of type source information.
Definition: Type.h:6593
clang::NamedDecl::getDeclName
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:313
getInvokerAsMethod
static CXXMethodDecl * getInvokerAsMethod(NamedDecl *ND)
Definition: DeclCXX.cpp:1566
clang::Qualifiers::Const
@ Const
Definition: Type.h:150
clang::DeclContext::isDependentContext
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
Definition: DeclBase.cpp:1173
getThisObjectType
static QualType getThisObjectType(ASTContext &C, const FunctionProtoType *FPT, const CXXRecordDecl *Decl)
Definition: DeclCXX.cpp:2469
clang::CXXRecordDecl::getFinalOverriders
void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const
Retrieve the final overriders for each virtual member function in the class hierarchy where this clas...
Definition: CXXInheritance.cpp:641
clang::CXXMethodDecl::getDevirtualizedMethod
CXXMethodDecl * getDevirtualizedMethod(const Expr *Base, bool IsAppleKext)
If it's possible to devirtualize a call to this method, return the called function.
Definition: DeclCXX.cpp:2234
clang::FunctionDecl::isVariadic
bool isVariadic() const
Whether this function is variadic.
Definition: Decl.cpp:3004
clang::UnresolvedUsingIfExistsDecl
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
Definition: DeclCXX.h:3941
clang::LifetimeExtendedTemporaryDecl::getExtendingDecl
ValueDecl * getExtendingDecl()
Definition: DeclCXX.h:3166
clang::TagDecl::getTagKind
TagKind getTagKind() const
Definition: Decl.h:3620
allLookupResultsAreTheSame
static bool allLookupResultsAreTheSame(const DeclContext::lookup_result &R)
Definition: DeclCXX.cpp:1515
clang::CXXRecordDecl::completeDefinition
void completeDefinition() override
Indicates that the definition of this class is now complete.
Definition: DeclCXX.cpp:1997
clang::ExplicitSpecifier::getKind
ExplicitSpecKind getKind() const
Definition: DeclCXX.h:1838
clang::DeclContextLookupResult
The results of name lookup within a DeclContext.
Definition: DeclBase.h:1334
LambdaCapture.h
clang::CXXMethodDecl::isUsualDeallocationFunction
bool isUsualDeallocationFunction(SmallVectorImpl< const FunctionDecl * > &PreventedBy) const
Determine whether this is a usual deallocation function (C++ [basic.stc.dynamic.deallocation]p2),...
Definition: DeclCXX.cpp:2319
clang::RecordType::getDecl
RecordDecl * getDecl() const
Definition: Type.h:4826
clang::BindingDecl::getBinding
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition: DeclCXX.h:4032
clang::Decl::EmptyShell
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
Definition: DeclBase.h:99
clang::ReferenceType
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2880
clang::DeclContext::isExternCContext
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
Definition: DeclBase.cpp:1224
clang::InheritedConstructor
Description of a constructor that was inherited from a base class.
Definition: DeclCXX.h:2410
clang::ExternalASTSource::GetExternalDecl
virtual Decl * GetExternalDecl(uint32_t ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
Definition: ExternalASTSource.cpp:71
clang::CXXRecordDecl::isLambda
bool isLambda() const
Determine whether this class describes a lambda function object.
Definition: DeclCXX.h:1000
clang::CXXConstructorDecl::isCopyConstructor
bool isCopyConstructor() const
Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the cla...
Definition: DeclCXX.h:2622
clang::APValue
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition: APValue.h:122
clang::isTemplateInstantiation
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
Definition: Specifiers.h:200
clang::CXXRecordDecl::hasSimpleMoveConstructor
bool hasSimpleMoveConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous move constructor that ...
Definition: DeclCXX.h:719
clang::APValue::UninitArray
Definition: APValue.h:250
clang::ODRHash::CalculateHash
unsigned CalculateHash()
Definition: ODRHash.cpp:208
llvm::SmallVectorImpl
Definition: Randstruct.h:18
clang::CXXRecordDecl::hasUserDeclaredDestructor
bool hasUserDeclaredDestructor() const
Determine whether this class has a user-declared destructor.
Definition: DeclCXX.h:983
clang::SC_None
@ SC_None
Definition: Specifiers.h:238
clang::ValueDecl::getType
QualType getType() const
Definition: Decl.h:712
true
#define true
Definition: stdbool.h:21
clang::NestedNameSpecifierLoc::getBeginLoc
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
Definition: NestedNameSpecifier.h:299
clang::ASTContext::hasSameUnqualifiedType
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
Definition: ASTContext.h:2571
clang::ArrayType::getElementType
QualType getElementType() const
Definition: Type.h:3033
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::BaseUsingDecl
Represents a C++ declaration that introduces decls from somewhere else.
Definition: DeclCXX.h:3319
clang::UsingDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclCXX.cpp:3102
clang::CXXMethodDecl::CXXMethodDecl
CXXMethodDecl(Kind DK, ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
Definition: DeclCXX.h:1987
clang::FunctionDecl::getDescribedFunctionTemplate
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Definition: Decl.cpp:3802
clang::ConstructorUsingShadowDecl
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3500
clang::UsingShadowDecl::CreateDeserialized
static UsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:3025
clang::CXXRecordDecl::defaultedDestructorIsConstexpr
bool defaultedDestructorIsConstexpr() const
Determine whether a defaulted default constructor for this class would be constexpr.
Definition: DeclCXX.h:1313
clang::CXXCtorInitializer
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2207
clang::ExternalASTSource
Abstract interface for external sources of AST nodes.
Definition: ExternalASTSource.h:60
clang::EnumType
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
Definition: Type.h:4842
clang::StaticAssertDecl::CreateDeserialized
static StaticAssertDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:3231
clang::DeclContext::isFunctionOrMethod
bool isFunctionOrMethod() const
Definition: DeclBase.h:1975
clang::DeclarationNameInfo
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Definition: DeclarationName.h:767
clang::CXXDestructorDecl::CreateDeserialized
static CXXDestructorDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:2768
clang::Decl::getLocation
SourceLocation getLocation() const
Definition: DeclBase.h:432
clang::CXXRecordDecl::getTemplateInstantiationPattern
const CXXRecordDecl * getTemplateInstantiationPattern() const
Retrieve the record declaration from which this record could be instantiated.
Definition: DeclCXX.cpp:1872
clang::Decl::isCanonicalDecl
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition: DeclBase.h:949
GCCTypeClass::None
@ None
clang::NamespaceDecl
Represent a C++ namespace.
Definition: Decl.h:542
clang::DeclContextLookupResult::empty
bool empty() const
Definition: DeclBase.h:1355
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1904
ASTUnresolvedSet.h
clang::CXXMethodDecl::CreateDeserialized
static CXXMethodDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:2227
clang::CXXRecordDecl::CXXRecordDecl
CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl)
Definition: DeclCXX.cpp:124
clang::RecordDecl
Represents a struct/union/class.
Definition: Decl.h:3983
clang::CXXConstructorDecl::isMoveConstructor
bool isMoveConstructor() const
Determine whether this constructor is a move constructor (C++11 [class.copy]p3), which can be used to...
Definition: DeclCXX.h:2636
clang::FunctionDecl::getStorageClass
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2668
clang::AccessSpecDecl::CreateDeserialized
static AccessSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclCXX.cpp:61
clang::CXXConversionDecl::Create
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, ExplicitSpecifier ES, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
Definition: DeclCXX.cpp:2807
CollectVisibleConversions
static void CollectVisibleConversions(ASTContext &Context, const CXXRecordDecl *Record, bool InVirtual, AccessSpecifier Access, const llvm::SmallPtrSet< CanQualType, 8 > &ParentHiddenTypes, ASTUnresolvedSet &Output, UnresolvedSetImpl &VOutput, llvm::SmallPtrSet< NamedDecl *, 8 > &HiddenVBaseCs)
Collect the visible conversions of a base class.
Definition: DeclCXX.cpp:1668
clang::LangOptions::ClangABI::Ver6
@ Ver6
Attempt to be ABI-compatible with code generated by Clang 6.0.x (SVN r321711).
clang::getLambdaStaticInvokerName
StringRef getLambdaStaticInvokerName()
Definition: ASTLambda.h:22
clang::FunctionDecl::isDefined
bool isDefined(const FunctionDecl *&Definition, bool CheckForPendingFriendDefinition=false) const
Returns true if the function has a definition that does not need to be instantiated.
Definition: Decl.cpp:3083
clang::ASTContext::getLangOpts
const LangOptions & getLangOpts() const
Definition: ASTContext.h:791
clang::APValue::UninitStruct
Definition: APValue.h:251
clang::ASTContext::getAllocator
llvm::BumpPtrAllocator & getAllocator() const
Definition: ASTContext.h:730
clang::UsingDirectiveDecl::getNominatedNamespace
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2875
clang::UsingShadowDecl::setTargetDecl
void setTargetDecl(NamedDecl *ND)
Sets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3290
clang::UnnamedGlobalConstantDecl
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
Definition: DeclCXX.h:4245
clang::CXXConstructorDecl::isInheritingConstructor
bool isInheritingConstructor() const
Determine whether this is an implicit constructor synthesized to model a call to a constructor inheri...
Definition: DeclCXX.h:2665
clang::CXXRecordDecl::setTrivialForCallFlags
void setTrivialForCallFlags(CXXMethodDecl *MD)
Definition: DeclCXX.cpp:1482
clang::CXXMethodDecl::isVirtual
bool isVirtual() const
Definition: DeclCXX.h:2027
TypeLoc.h
clang::declaresSameEntity
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
Definition: DeclBase.h:1240
clang::UnresolvedSetImpl::begin
iterator begin()
Definition: UnresolvedSet.h:83
GetConversionType
static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv)
Definition: DeclCXX.cpp:1649
clang::CXXRecordDecl::setDescribedClassTemplate
void setDescribedClassTemplate(ClassTemplateDecl *Template)
Definition: DeclCXX.cpp:1843
clang::LValueReferenceType
An lvalue reference type, per C++11 [dcl.ref].
Definition: Type.h:2924
clang::CXXMethodDecl::getParent
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
Definition: DeclCXX.h:2098
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1983
clang::CXXRecordDecl::getVisibleConversionFunctions
llvm::iterator_range< conversion_iterator > getVisibleConversionFunctions() const
Get all conversion functions visible in current class, including conversion function templates.
Definition: DeclCXX.cpp:1775
clang::ConstexprSpecKind::Unspecified
@ Unspecified
clang::Decl::getDeclContext
DeclContext * getDeclContext()
Definition: DeclBase.h:441
clang::FunctionDecl::isOutOfLine
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function.
Definition: Decl.cpp:4108
clang::StorageClass
StorageClass
Storage classes.
Definition: Specifiers.h:236
clang::NamedDecl::getName
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:274