clang  6.0.0svn
DeclCXX.h
Go to the documentation of this file.
1 //===-- DeclCXX.h - Classes for representing C++ declarations -*- C++ -*-=====//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// \brief Defines the C++ Decl subclasses, other than those for templates
12 /// (found in DeclTemplate.h) and friends (in DeclFriend.h).
13 ///
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_CLANG_AST_DECLCXX_H
17 #define LLVM_CLANG_AST_DECLCXX_H
18 
19 #include "clang/AST/ASTContext.h"
21 #include "clang/AST/Attr.h"
22 #include "clang/AST/Decl.h"
23 #include "clang/AST/Expr.h"
25 #include "llvm/ADT/DenseMap.h"
26 #include "llvm/ADT/PointerIntPair.h"
27 #include "llvm/Support/Compiler.h"
28 
29 namespace clang {
30 
31 class ClassTemplateDecl;
32 class ClassTemplateSpecializationDecl;
33 class ConstructorUsingShadowDecl;
34 class CXXBasePath;
35 class CXXBasePaths;
36 class CXXConstructorDecl;
37 class CXXConversionDecl;
38 class CXXDestructorDecl;
39 class CXXMethodDecl;
40 class CXXRecordDecl;
41 class CXXMemberLookupCriteria;
42 class CXXFinalOverriderMap;
43 class CXXIndirectPrimaryBaseSet;
44 class FriendDecl;
45 class LambdaExpr;
46 class UsingDecl;
47 
48 /// \brief Represents any kind of function declaration, whether it is a
49 /// concrete function or a function template.
51  NamedDecl *Function;
52 
53  AnyFunctionDecl(NamedDecl *ND) : Function(ND) { }
54 
55 public:
56  AnyFunctionDecl(FunctionDecl *FD) : Function(FD) { }
58 
59  /// \brief Implicily converts any function or function template into a
60  /// named declaration.
61  operator NamedDecl *() const { return Function; }
62 
63  /// \brief Retrieve the underlying function or function template.
64  NamedDecl *get() const { return Function; }
65 
67  return AnyFunctionDecl(ND);
68  }
69 };
70 
71 } // end namespace clang
72 
73 namespace llvm {
74  // Provide PointerLikeTypeTraits for non-cvr pointers.
75  template<>
77  static inline void *getAsVoidPointer(::clang::AnyFunctionDecl F) {
78  return F.get();
79  }
80  static inline ::clang::AnyFunctionDecl getFromVoidPointer(void *P) {
81  return ::clang::AnyFunctionDecl::getFromNamedDecl(
82  static_cast< ::clang::NamedDecl*>(P));
83  }
84 
85  enum { NumLowBitsAvailable = 2 };
86  };
87 
88 } // end namespace llvm
89 
90 namespace clang {
91 
92 /// \brief Represents an access specifier followed by colon ':'.
93 ///
94 /// An objects of this class represents sugar for the syntactic occurrence
95 /// of an access specifier followed by a colon in the list of member
96 /// specifiers of a C++ class definition.
97 ///
98 /// Note that they do not represent other uses of access specifiers,
99 /// such as those occurring in a list of base specifiers.
100 /// Also note that this class has nothing to do with so-called
101 /// "access declarations" (C++98 11.3 [class.access.dcl]).
102 class AccessSpecDecl : public Decl {
103  virtual void anchor();
104  /// \brief The location of the ':'.
106 
108  SourceLocation ASLoc, SourceLocation ColonLoc)
109  : Decl(AccessSpec, DC, ASLoc), ColonLoc(ColonLoc) {
110  setAccess(AS);
111  }
113  : Decl(AccessSpec, Empty) { }
114 public:
115  /// \brief The location of the access specifier.
116  SourceLocation getAccessSpecifierLoc() const { return getLocation(); }
117  /// \brief Sets the location of the access specifier.
118  void setAccessSpecifierLoc(SourceLocation ASLoc) { setLocation(ASLoc); }
119 
120  /// \brief The location of the colon following the access specifier.
121  SourceLocation getColonLoc() const { return ColonLoc; }
122  /// \brief Sets the location of the colon.
123  void setColonLoc(SourceLocation CLoc) { ColonLoc = CLoc; }
124 
125  SourceRange getSourceRange() const override LLVM_READONLY {
126  return SourceRange(getAccessSpecifierLoc(), getColonLoc());
127  }
128 
130  DeclContext *DC, SourceLocation ASLoc,
131  SourceLocation ColonLoc) {
132  return new (C, DC) AccessSpecDecl(AS, DC, ASLoc, ColonLoc);
133  }
134  static AccessSpecDecl *CreateDeserialized(ASTContext &C, unsigned ID);
135 
136  // Implement isa/cast/dyncast/etc.
137  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
138  static bool classofKind(Kind K) { return K == AccessSpec; }
139 };
140 
141 /// \brief Represents a base class of a C++ class.
142 ///
143 /// Each CXXBaseSpecifier represents a single, direct base class (or
144 /// struct) of a C++ class (or struct). It specifies the type of that
145 /// base class, whether it is a virtual or non-virtual base, and what
146 /// level of access (public, protected, private) is used for the
147 /// derivation. For example:
148 ///
149 /// \code
150 /// class A { };
151 /// class B { };
152 /// class C : public virtual A, protected B { };
153 /// \endcode
154 ///
155 /// In this code, C will have two CXXBaseSpecifiers, one for "public
156 /// virtual A" and the other for "protected B".
158  /// \brief The source code range that covers the full base
159  /// specifier, including the "virtual" (if present) and access
160  /// specifier (if present).
161  SourceRange Range;
162 
163  /// \brief The source location of the ellipsis, if this is a pack
164  /// expansion.
165  SourceLocation EllipsisLoc;
166 
167  /// \brief Whether this is a virtual base class or not.
168  unsigned Virtual : 1;
169 
170  /// \brief Whether this is the base of a class (true) or of a struct (false).
171  ///
172  /// This determines the mapping from the access specifier as written in the
173  /// source code to the access specifier used for semantic analysis.
174  unsigned BaseOfClass : 1;
175 
176  /// \brief Access specifier as written in the source code (may be AS_none).
177  ///
178  /// The actual type of data stored here is an AccessSpecifier, but we use
179  /// "unsigned" here to work around a VC++ bug.
180  unsigned Access : 2;
181 
182  /// \brief Whether the class contains a using declaration
183  /// to inherit the named class's constructors.
184  unsigned InheritConstructors : 1;
185 
186  /// \brief The type of the base class.
187  ///
188  /// This will be a class or struct (or a typedef of such). The source code
189  /// range does not include the \c virtual or the access specifier.
190  TypeSourceInfo *BaseTypeInfo;
191 
192 public:
194 
196  TypeSourceInfo *TInfo, SourceLocation EllipsisLoc)
197  : Range(R), EllipsisLoc(EllipsisLoc), Virtual(V), BaseOfClass(BC),
198  Access(A), InheritConstructors(false), BaseTypeInfo(TInfo) { }
199 
200  /// \brief Retrieves the source range that contains the entire base specifier.
201  SourceRange getSourceRange() const LLVM_READONLY { return Range; }
202  SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
203  SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
204 
205  /// \brief Get the location at which the base class type was written.
206  SourceLocation getBaseTypeLoc() const LLVM_READONLY {
207  return BaseTypeInfo->getTypeLoc().getLocStart();
208  }
209 
210  /// \brief Determines whether the base class is a virtual base class (or not).
211  bool isVirtual() const { return Virtual; }
212 
213  /// \brief Determine whether this base class is a base of a class declared
214  /// with the 'class' keyword (vs. one declared with the 'struct' keyword).
215  bool isBaseOfClass() const { return BaseOfClass; }
216 
217  /// \brief Determine whether this base specifier is a pack expansion.
218  bool isPackExpansion() const { return EllipsisLoc.isValid(); }
219 
220  /// \brief Determine whether this base class's constructors get inherited.
221  bool getInheritConstructors() const { return InheritConstructors; }
222 
223  /// \brief Set that this base class's constructors should be inherited.
224  void setInheritConstructors(bool Inherit = true) {
225  InheritConstructors = Inherit;
226  }
227 
228  /// \brief For a pack expansion, determine the location of the ellipsis.
230  return EllipsisLoc;
231  }
232 
233  /// \brief Returns the access specifier for this base specifier.
234  ///
235  /// This is the actual base specifier as used for semantic analysis, so
236  /// the result can never be AS_none. To retrieve the access specifier as
237  /// written in the source code, use getAccessSpecifierAsWritten().
239  if ((AccessSpecifier)Access == AS_none)
240  return BaseOfClass? AS_private : AS_public;
241  else
242  return (AccessSpecifier)Access;
243  }
244 
245  /// \brief Retrieves the access specifier as written in the source code
246  /// (which may mean that no access specifier was explicitly written).
247  ///
248  /// Use getAccessSpecifier() to retrieve the access specifier for use in
249  /// semantic analysis.
251  return (AccessSpecifier)Access;
252  }
253 
254  /// \brief Retrieves the type of the base class.
255  ///
256  /// This type will always be an unqualified class type.
257  QualType getType() const {
258  return BaseTypeInfo->getType().getUnqualifiedType();
259  }
260 
261  /// \brief Retrieves the type and source location of the base class.
262  TypeSourceInfo *getTypeSourceInfo() const { return BaseTypeInfo; }
263 };
264 
265 /// \brief Represents a C++ struct/union/class.
266 class CXXRecordDecl : public RecordDecl {
267 
268  friend void TagDecl::startDefinition();
269 
270  /// Values used in DefinitionData fields to represent special members.
271  enum SpecialMemberFlags {
272  SMF_DefaultConstructor = 0x1,
273  SMF_CopyConstructor = 0x2,
274  SMF_MoveConstructor = 0x4,
275  SMF_CopyAssignment = 0x8,
276  SMF_MoveAssignment = 0x10,
277  SMF_Destructor = 0x20,
278  SMF_All = 0x3f
279  };
280 
281  struct DefinitionData {
282  DefinitionData(CXXRecordDecl *D);
283 
284  /// \brief True if this class has any user-declared constructors.
285  unsigned UserDeclaredConstructor : 1;
286 
287  /// \brief The user-declared special members which this class has.
288  unsigned UserDeclaredSpecialMembers : 6;
289 
290  /// \brief True when this class is an aggregate.
291  unsigned Aggregate : 1;
292 
293  /// \brief True when this class is a POD-type.
294  unsigned PlainOldData : 1;
295 
296  /// true when this class is empty for traits purposes,
297  /// i.e. has no data members other than 0-width bit-fields, has no
298  /// virtual function/base, and doesn't inherit from a non-empty
299  /// class. Doesn't take union-ness into account.
300  unsigned Empty : 1;
301 
302  /// \brief True when this class is polymorphic, i.e., has at
303  /// least one virtual member or derives from a polymorphic class.
304  unsigned Polymorphic : 1;
305 
306  /// \brief True when this class is abstract, i.e., has at least
307  /// one pure virtual function, (that can come from a base class).
308  unsigned Abstract : 1;
309 
310  /// \brief True when this class has standard layout.
311  ///
312  /// C++11 [class]p7. A standard-layout class is a class that:
313  /// * has no non-static data members of type non-standard-layout class (or
314  /// array of such types) or reference,
315  /// * has no virtual functions (10.3) and no virtual base classes (10.1),
316  /// * has the same access control (Clause 11) for all non-static data
317  /// members
318  /// * has no non-standard-layout base classes,
319  /// * either has no non-static data members in the most derived class and at
320  /// most one base class with non-static data members, or has no base
321  /// classes with non-static data members, and
322  /// * has no base classes of the same type as the first non-static data
323  /// member.
324  unsigned IsStandardLayout : 1;
325 
326  /// \brief True when there are no non-empty base classes.
327  ///
328  /// This is a helper bit of state used to implement IsStandardLayout more
329  /// efficiently.
330  unsigned HasNoNonEmptyBases : 1;
331 
332  /// \brief True when there are private non-static data members.
333  unsigned HasPrivateFields : 1;
334 
335  /// \brief True when there are protected non-static data members.
336  unsigned HasProtectedFields : 1;
337 
338  /// \brief True when there are private non-static data members.
339  unsigned HasPublicFields : 1;
340 
341  /// \brief True if this class (or any subobject) has mutable fields.
342  unsigned HasMutableFields : 1;
343 
344  /// \brief True if this class (or any nested anonymous struct or union)
345  /// has variant members.
346  unsigned HasVariantMembers : 1;
347 
348  /// \brief True if there no non-field members declared by the user.
349  unsigned HasOnlyCMembers : 1;
350 
351  /// \brief True if any field has an in-class initializer, including those
352  /// within anonymous unions or structs.
353  unsigned HasInClassInitializer : 1;
354 
355  /// \brief True if any field is of reference type, and does not have an
356  /// in-class initializer.
357  ///
358  /// In this case, value-initialization of this class is illegal in C++98
359  /// even if the class has a trivial default constructor.
360  unsigned HasUninitializedReferenceMember : 1;
361 
362  /// \brief True if any non-mutable field whose type doesn't have a user-
363  /// provided default ctor also doesn't have an in-class initializer.
364  unsigned HasUninitializedFields : 1;
365 
366  /// \brief True if there are any member using-declarations that inherit
367  /// constructors from a base class.
368  unsigned HasInheritedConstructor : 1;
369 
370  /// \brief True if there are any member using-declarations named
371  /// 'operator='.
372  unsigned HasInheritedAssignment : 1;
373 
374  /// \brief These flags are \c true if a defaulted corresponding special
375  /// member can't be fully analyzed without performing overload resolution.
376  /// @{
377  unsigned NeedOverloadResolutionForCopyConstructor : 1;
378  unsigned NeedOverloadResolutionForMoveConstructor : 1;
379  unsigned NeedOverloadResolutionForMoveAssignment : 1;
380  unsigned NeedOverloadResolutionForDestructor : 1;
381  /// @}
382 
383  /// \brief These flags are \c true if an implicit defaulted corresponding
384  /// special member would be defined as deleted.
385  /// @{
386  unsigned DefaultedCopyConstructorIsDeleted : 1;
387  unsigned DefaultedMoveConstructorIsDeleted : 1;
388  unsigned DefaultedMoveAssignmentIsDeleted : 1;
389  unsigned DefaultedDestructorIsDeleted : 1;
390  /// @}
391 
392  /// \brief The trivial special members which this class has, per
393  /// C++11 [class.ctor]p5, C++11 [class.copy]p12, C++11 [class.copy]p25,
394  /// C++11 [class.dtor]p5, or would have if the member were not suppressed.
395  ///
396  /// This excludes any user-declared but not user-provided special members
397  /// which have been declared but not yet defined.
398  unsigned HasTrivialSpecialMembers : 6;
399 
400  /// \brief The declared special members of this class which are known to be
401  /// non-trivial.
402  ///
403  /// This excludes any user-declared but not user-provided special members
404  /// which have been declared but not yet defined, and any implicit special
405  /// members which have not yet been declared.
406  unsigned DeclaredNonTrivialSpecialMembers : 6;
407 
408  /// \brief True when this class has a destructor with no semantic effect.
409  unsigned HasIrrelevantDestructor : 1;
410 
411  /// \brief True when this class has at least one user-declared constexpr
412  /// constructor which is neither the copy nor move constructor.
413  unsigned HasConstexprNonCopyMoveConstructor : 1;
414 
415  /// \brief True if this class has a (possibly implicit) defaulted default
416  /// constructor.
417  unsigned HasDefaultedDefaultConstructor : 1;
418 
419  /// \brief True if this class can be passed in a non-address-preserving
420  /// fashion (such as in registers) according to the C++ language rules.
421  /// This does not imply anything about how the ABI in use will actually
422  /// pass an object of this class.
423  unsigned CanPassInRegisters : 1;
424 
425  /// \brief True if a defaulted default constructor for this class would
426  /// be constexpr.
427  unsigned DefaultedDefaultConstructorIsConstexpr : 1;
428 
429  /// \brief True if this class has a constexpr default constructor.
430  ///
431  /// This is true for either a user-declared constexpr default constructor
432  /// or an implicitly declared constexpr default constructor.
433  unsigned HasConstexprDefaultConstructor : 1;
434 
435  /// \brief True when this class contains at least one non-static data
436  /// member or base class of non-literal or volatile type.
437  unsigned HasNonLiteralTypeFieldsOrBases : 1;
438 
439  /// \brief True when visible conversion functions are already computed
440  /// and are available.
441  unsigned ComputedVisibleConversions : 1;
442 
443  /// \brief Whether we have a C++11 user-provided default constructor (not
444  /// explicitly deleted or defaulted).
445  unsigned UserProvidedDefaultConstructor : 1;
446 
447  /// \brief The special members which have been declared for this class,
448  /// either by the user or implicitly.
449  unsigned DeclaredSpecialMembers : 6;
450 
451  /// \brief Whether an implicit copy constructor could have a const-qualified
452  /// parameter, for initializing virtual bases and for other subobjects.
453  unsigned ImplicitCopyConstructorCanHaveConstParamForVBase : 1;
454  unsigned ImplicitCopyConstructorCanHaveConstParamForNonVBase : 1;
455 
456  /// \brief Whether an implicit copy assignment operator would have a
457  /// const-qualified parameter.
458  unsigned ImplicitCopyAssignmentHasConstParam : 1;
459 
460  /// \brief Whether any declared copy constructor has a const-qualified
461  /// parameter.
462  unsigned HasDeclaredCopyConstructorWithConstParam : 1;
463 
464  /// \brief Whether any declared copy assignment operator has either a
465  /// const-qualified reference parameter or a non-reference parameter.
466  unsigned HasDeclaredCopyAssignmentWithConstParam : 1;
467 
468  /// \brief Whether this class describes a C++ lambda.
469  unsigned IsLambda : 1;
470 
471  /// \brief Whether we are currently parsing base specifiers.
472  unsigned IsParsingBaseSpecifiers : 1;
473 
474  unsigned HasODRHash : 1;
475 
476  /// \brief A hash of parts of the class to help in ODR checking.
477  unsigned ODRHash;
478 
479  /// \brief The number of base class specifiers in Bases.
480  unsigned NumBases;
481 
482  /// \brief The number of virtual base class specifiers in VBases.
483  unsigned NumVBases;
484 
485  /// \brief Base classes of this class.
486  ///
487  /// FIXME: This is wasted space for a union.
489 
490  /// \brief direct and indirect virtual base classes of this class.
492 
493  /// \brief The conversion functions of this C++ class (but not its
494  /// inherited conversion functions).
495  ///
496  /// Each of the entries in this overload set is a CXXConversionDecl.
497  LazyASTUnresolvedSet Conversions;
498 
499  /// \brief The conversion functions of this C++ class and all those
500  /// inherited conversion functions that are visible in this class.
501  ///
502  /// Each of the entries in this overload set is a CXXConversionDecl or a
503  /// FunctionTemplateDecl.
504  LazyASTUnresolvedSet VisibleConversions;
505 
506  /// \brief The declaration which defines this record.
507  CXXRecordDecl *Definition;
508 
509  /// \brief The first friend declaration in this class, or null if there
510  /// aren't any.
511  ///
512  /// This is actually currently stored in reverse order.
513  LazyDeclPtr FirstFriend;
514 
515  /// \brief Retrieve the set of direct base classes.
516  CXXBaseSpecifier *getBases() const {
517  if (!Bases.isOffset())
518  return Bases.get(nullptr);
519  return getBasesSlowCase();
520  }
521 
522  /// \brief Retrieve the set of virtual base classes.
523  CXXBaseSpecifier *getVBases() const {
524  if (!VBases.isOffset())
525  return VBases.get(nullptr);
526  return getVBasesSlowCase();
527  }
528 
529  ArrayRef<CXXBaseSpecifier> bases() const {
530  return llvm::makeArrayRef(getBases(), NumBases);
531  }
532  ArrayRef<CXXBaseSpecifier> vbases() const {
533  return llvm::makeArrayRef(getVBases(), NumVBases);
534  }
535 
536  private:
537  CXXBaseSpecifier *getBasesSlowCase() const;
538  CXXBaseSpecifier *getVBasesSlowCase() const;
539  };
540 
541  struct DefinitionData *DefinitionData;
542 
543  /// \brief Describes a C++ closure type (generated by a lambda expression).
544  struct LambdaDefinitionData : public DefinitionData {
545  typedef LambdaCapture Capture;
546 
547  LambdaDefinitionData(CXXRecordDecl *D, TypeSourceInfo *Info,
548  bool Dependent, bool IsGeneric,
549  LambdaCaptureDefault CaptureDefault)
550  : DefinitionData(D), Dependent(Dependent), IsGenericLambda(IsGeneric),
551  CaptureDefault(CaptureDefault), NumCaptures(0), NumExplicitCaptures(0),
552  ManglingNumber(0), ContextDecl(nullptr), Captures(nullptr),
553  MethodTyInfo(Info) {
554  IsLambda = true;
555 
556  // C++1z [expr.prim.lambda]p4:
557  // This class type is not an aggregate type.
558  Aggregate = false;
559  PlainOldData = false;
560  }
561 
562  /// \brief Whether this lambda is known to be dependent, even if its
563  /// context isn't dependent.
564  ///
565  /// A lambda with a non-dependent context can be dependent if it occurs
566  /// within the default argument of a function template, because the
567  /// lambda will have been created with the enclosing context as its
568  /// declaration context, rather than function. This is an unfortunate
569  /// artifact of having to parse the default arguments before.
570  unsigned Dependent : 1;
571 
572  /// \brief Whether this lambda is a generic lambda.
573  unsigned IsGenericLambda : 1;
574 
575  /// \brief The Default Capture.
576  unsigned CaptureDefault : 2;
577 
578  /// \brief The number of captures in this lambda is limited 2^NumCaptures.
579  unsigned NumCaptures : 15;
580 
581  /// \brief The number of explicit captures in this lambda.
582  unsigned NumExplicitCaptures : 13;
583 
584  /// \brief The number used to indicate this lambda expression for name
585  /// mangling in the Itanium C++ ABI.
586  unsigned ManglingNumber;
587 
588  /// \brief The declaration that provides context for this lambda, if the
589  /// actual DeclContext does not suffice. This is used for lambdas that
590  /// occur within default arguments of function parameters within the class
591  /// or within a data member initializer.
592  LazyDeclPtr ContextDecl;
593 
594  /// \brief The list of captures, both explicit and implicit, for this
595  /// lambda.
596  Capture *Captures;
597 
598  /// \brief The type of the call method.
599  TypeSourceInfo *MethodTyInfo;
600 
601  };
602 
603  struct DefinitionData *dataPtr() const {
604  // Complete the redecl chain (if necessary).
605  getMostRecentDecl();
606  return DefinitionData;
607  }
608 
609  struct DefinitionData &data() const {
610  auto *DD = dataPtr();
611  assert(DD && "queried property of class with no definition");
612  return *DD;
613  }
614 
615  struct LambdaDefinitionData &getLambdaData() const {
616  // No update required: a merged definition cannot change any lambda
617  // properties.
618  auto *DD = DefinitionData;
619  assert(DD && DD->IsLambda && "queried lambda property of non-lambda class");
620  return static_cast<LambdaDefinitionData&>(*DD);
621  }
622 
623  /// \brief The template or declaration that this declaration
624  /// describes or was instantiated from, respectively.
625  ///
626  /// For non-templates, this value will be null. For record
627  /// declarations that describe a class template, this will be a
628  /// pointer to a ClassTemplateDecl. For member
629  /// classes of class template specializations, this will be the
630  /// MemberSpecializationInfo referring to the member class that was
631  /// instantiated or specialized.
632  llvm::PointerUnion<ClassTemplateDecl*, MemberSpecializationInfo*>
633  TemplateOrInstantiation;
634 
635  friend class DeclContext;
636  friend class LambdaExpr;
637 
638  /// \brief Called from setBases and addedMember to notify the class that a
639  /// direct or virtual base class or a member of class type has been added.
640  void addedClassSubobject(CXXRecordDecl *Base);
641 
642  /// \brief Notify the class that member has been added.
643  ///
644  /// This routine helps maintain information about the class based on which
645  /// members have been added. It will be invoked by DeclContext::addDecl()
646  /// whenever a member is added to this record.
647  void addedMember(Decl *D);
648 
649  void markedVirtualFunctionPure();
650  friend void FunctionDecl::setPure(bool);
651 
652  friend class ASTNodeImporter;
653 
654  /// \brief Get the head of our list of friend declarations, possibly
655  /// deserializing the friends from an external AST source.
656  FriendDecl *getFirstFriend() const;
657 
658 protected:
659  CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC,
660  SourceLocation StartLoc, SourceLocation IdLoc,
661  IdentifierInfo *Id, CXXRecordDecl *PrevDecl);
662 
663 public:
664  /// \brief Iterator that traverses the base classes of a class.
666 
667  /// \brief Iterator that traverses the base classes of a class.
669 
671  return cast<CXXRecordDecl>(RecordDecl::getCanonicalDecl());
672  }
674  return const_cast<CXXRecordDecl*>(this)->getCanonicalDecl();
675  }
676 
678  return cast_or_null<CXXRecordDecl>(
679  static_cast<RecordDecl *>(this)->getPreviousDecl());
680  }
682  return const_cast<CXXRecordDecl*>(this)->getPreviousDecl();
683  }
684 
686  return cast<CXXRecordDecl>(
687  static_cast<RecordDecl *>(this)->getMostRecentDecl());
688  }
689 
691  return const_cast<CXXRecordDecl*>(this)->getMostRecentDecl();
692  }
693 
695  // We only need an update if we don't already know which
696  // declaration is the definition.
697  auto *DD = DefinitionData ? DefinitionData : dataPtr();
698  return DD ? DD->Definition : nullptr;
699  }
700 
701  bool hasDefinition() const { return DefinitionData || dataPtr(); }
702 
703  static CXXRecordDecl *Create(const ASTContext &C, TagKind TK, DeclContext *DC,
704  SourceLocation StartLoc, SourceLocation IdLoc,
706  CXXRecordDecl *PrevDecl = nullptr,
707  bool DelayTypeCreation = false);
708  static CXXRecordDecl *CreateLambda(const ASTContext &C, DeclContext *DC,
709  TypeSourceInfo *Info, SourceLocation Loc,
710  bool DependentLambda, bool IsGeneric,
711  LambdaCaptureDefault CaptureDefault);
712  static CXXRecordDecl *CreateDeserialized(const ASTContext &C, unsigned ID);
713 
714  bool isDynamicClass() const {
715  return data().Polymorphic || data().NumVBases != 0;
716  }
717 
718  void setIsParsingBaseSpecifiers() { data().IsParsingBaseSpecifiers = true; }
719 
720  bool isParsingBaseSpecifiers() const {
721  return data().IsParsingBaseSpecifiers;
722  }
723 
724  unsigned getODRHash() const;
725 
726  /// \brief Sets the base classes of this struct or class.
727  void setBases(CXXBaseSpecifier const * const *Bases, unsigned NumBases);
728 
729  /// \brief Retrieves the number of base classes of this class.
730  unsigned getNumBases() const { return data().NumBases; }
731 
732  typedef llvm::iterator_range<base_class_iterator> base_class_range;
733  typedef llvm::iterator_range<base_class_const_iterator>
735 
736  base_class_range bases() {
737  return base_class_range(bases_begin(), bases_end());
738  }
740  return base_class_const_range(bases_begin(), bases_end());
741  }
742 
743  base_class_iterator bases_begin() { return data().getBases(); }
744  base_class_const_iterator bases_begin() const { return data().getBases(); }
745  base_class_iterator bases_end() { return bases_begin() + data().NumBases; }
746  base_class_const_iterator bases_end() const {
747  return bases_begin() + data().NumBases;
748  }
749 
750  /// \brief Retrieves the number of virtual base classes of this class.
751  unsigned getNumVBases() const { return data().NumVBases; }
752 
753  base_class_range vbases() {
754  return base_class_range(vbases_begin(), vbases_end());
755  }
757  return base_class_const_range(vbases_begin(), vbases_end());
758  }
759 
760  base_class_iterator vbases_begin() { return data().getVBases(); }
761  base_class_const_iterator vbases_begin() const { return data().getVBases(); }
762  base_class_iterator vbases_end() { return vbases_begin() + data().NumVBases; }
763  base_class_const_iterator vbases_end() const {
764  return vbases_begin() + data().NumVBases;
765  }
766 
767  /// \brief Determine whether this class has any dependent base classes which
768  /// are not the current instantiation.
769  bool hasAnyDependentBases() const;
770 
771  /// Iterator access to method members. The method iterator visits
772  /// all method members of the class, including non-instance methods,
773  /// special methods, etc.
775  typedef llvm::iterator_range<specific_decl_iterator<CXXMethodDecl>>
777 
779  return method_range(method_begin(), method_end());
780  }
781 
782  /// \brief Method begin iterator. Iterates in the order the methods
783  /// were declared.
784  method_iterator method_begin() const {
785  return method_iterator(decls_begin());
786  }
787  /// \brief Method past-the-end iterator.
788  method_iterator method_end() const {
789  return method_iterator(decls_end());
790  }
791 
792  /// Iterator access to constructor members.
794  typedef llvm::iterator_range<specific_decl_iterator<CXXConstructorDecl>>
796 
797  ctor_range ctors() const { return ctor_range(ctor_begin(), ctor_end()); }
798 
799  ctor_iterator ctor_begin() const {
800  return ctor_iterator(decls_begin());
801  }
802  ctor_iterator ctor_end() const {
803  return ctor_iterator(decls_end());
804  }
805 
806  /// An iterator over friend declarations. All of these are defined
807  /// in DeclFriend.h.
809  typedef llvm::iterator_range<friend_iterator> friend_range;
810 
811  friend_range friends() const;
812  friend_iterator friend_begin() const;
813  friend_iterator friend_end() const;
814  void pushFriendDecl(FriendDecl *FD);
815 
816  /// Determines whether this record has any friends.
817  bool hasFriends() const {
818  return data().FirstFriend.isValid();
819  }
820 
821  /// \brief \c true if a defaulted copy constructor for this class would be
822  /// deleted.
824  assert((!needsOverloadResolutionForCopyConstructor() ||
825  (data().DeclaredSpecialMembers & SMF_CopyConstructor)) &&
826  "this property has not yet been computed by Sema");
827  return data().DefaultedCopyConstructorIsDeleted;
828  }
829 
830  /// \brief \c true if a defaulted move constructor for this class would be
831  /// deleted.
833  assert((!needsOverloadResolutionForMoveConstructor() ||
834  (data().DeclaredSpecialMembers & SMF_MoveConstructor)) &&
835  "this property has not yet been computed by Sema");
836  return data().DefaultedMoveConstructorIsDeleted;
837  }
838 
839  /// \brief \c true if a defaulted destructor for this class would be deleted.
841  assert((!needsOverloadResolutionForDestructor() ||
842  (data().DeclaredSpecialMembers & SMF_Destructor)) &&
843  "this property has not yet been computed by Sema");
844  return data().DefaultedDestructorIsDeleted;
845  }
846 
847  /// \brief \c true if we know for sure that this class has a single,
848  /// accessible, unambiguous copy constructor that is not deleted.
850  return !hasUserDeclaredCopyConstructor() &&
851  !data().DefaultedCopyConstructorIsDeleted;
852  }
853 
854  /// \brief \c true if we know for sure that this class has a single,
855  /// accessible, unambiguous move constructor that is not deleted.
857  return !hasUserDeclaredMoveConstructor() && hasMoveConstructor() &&
858  !data().DefaultedMoveConstructorIsDeleted;
859  }
860 
861  /// \brief \c true if we know for sure that this class has a single,
862  /// accessible, unambiguous move assignment operator that is not deleted.
863  bool hasSimpleMoveAssignment() const {
864  return !hasUserDeclaredMoveAssignment() && hasMoveAssignment() &&
865  !data().DefaultedMoveAssignmentIsDeleted;
866  }
867 
868  /// \brief \c true if we know for sure that this class has an accessible
869  /// destructor that is not deleted.
870  bool hasSimpleDestructor() const {
871  return !hasUserDeclaredDestructor() &&
872  !data().DefaultedDestructorIsDeleted;
873  }
874 
875  /// \brief Determine whether this class has any default constructors.
876  bool hasDefaultConstructor() const {
877  return (data().DeclaredSpecialMembers & SMF_DefaultConstructor) ||
878  needsImplicitDefaultConstructor();
879  }
880 
881  /// \brief Determine if we need to declare a default constructor for
882  /// this class.
883  ///
884  /// This value is used for lazy creation of default constructors.
886  return !data().UserDeclaredConstructor &&
887  !(data().DeclaredSpecialMembers & SMF_DefaultConstructor) &&
888  // C++14 [expr.prim.lambda]p20:
889  // The closure type associated with a lambda-expression has no
890  // default constructor.
891  !isLambda();
892  }
893 
894  /// \brief Determine whether this class has any user-declared constructors.
895  ///
896  /// When true, a default constructor will not be implicitly declared.
898  return data().UserDeclaredConstructor;
899  }
900 
901  /// \brief Whether this class has a user-provided default constructor
902  /// per C++11.
904  return data().UserProvidedDefaultConstructor;
905  }
906 
907  /// \brief Determine whether this class has a user-declared copy constructor.
908  ///
909  /// When false, a copy constructor will be implicitly declared.
911  return data().UserDeclaredSpecialMembers & SMF_CopyConstructor;
912  }
913 
914  /// \brief Determine whether this class needs an implicit copy
915  /// constructor to be lazily declared.
917  return !(data().DeclaredSpecialMembers & SMF_CopyConstructor);
918  }
919 
920  /// \brief Determine whether we need to eagerly declare a defaulted copy
921  /// constructor for this class.
923  // C++17 [class.copy.ctor]p6:
924  // If the class definition declares a move constructor or move assignment
925  // operator, the implicitly declared copy constructor is defined as
926  // deleted.
927  // In MSVC mode, sometimes a declared move assignment does not delete an
928  // implicit copy constructor, so defer this choice to Sema.
929  if (data().UserDeclaredSpecialMembers &
930  (SMF_MoveConstructor | SMF_MoveAssignment))
931  return true;
932  return data().NeedOverloadResolutionForCopyConstructor;
933  }
934 
935  /// \brief Determine whether an implicit copy constructor for this type
936  /// would have a parameter with a const-qualified reference type.
938  return data().ImplicitCopyConstructorCanHaveConstParamForNonVBase &&
939  (isAbstract() ||
940  data().ImplicitCopyConstructorCanHaveConstParamForVBase);
941  }
942 
943  /// \brief Determine whether this class has a copy constructor with
944  /// a parameter type which is a reference to a const-qualified type.
946  return data().HasDeclaredCopyConstructorWithConstParam ||
947  (needsImplicitCopyConstructor() &&
948  implicitCopyConstructorHasConstParam());
949  }
950 
951  /// \brief Whether this class has a user-declared move constructor or
952  /// assignment operator.
953  ///
954  /// When false, a move constructor and assignment operator may be
955  /// implicitly declared.
957  return data().UserDeclaredSpecialMembers &
958  (SMF_MoveConstructor | SMF_MoveAssignment);
959  }
960 
961  /// \brief Determine whether this class has had a move constructor
962  /// declared by the user.
964  return data().UserDeclaredSpecialMembers & SMF_MoveConstructor;
965  }
966 
967  /// \brief Determine whether this class has a move constructor.
968  bool hasMoveConstructor() const {
969  return (data().DeclaredSpecialMembers & SMF_MoveConstructor) ||
970  needsImplicitMoveConstructor();
971  }
972 
973  /// \brief Set that we attempted to declare an implicit copy
974  /// constructor, but overload resolution failed so we deleted it.
976  assert((data().DefaultedCopyConstructorIsDeleted ||
977  needsOverloadResolutionForCopyConstructor()) &&
978  "Copy constructor should not be deleted");
979  data().DefaultedCopyConstructorIsDeleted = true;
980  }
981 
982  /// \brief Set that we attempted to declare an implicit move
983  /// constructor, but overload resolution failed so we deleted it.
985  assert((data().DefaultedMoveConstructorIsDeleted ||
986  needsOverloadResolutionForMoveConstructor()) &&
987  "move constructor should not be deleted");
988  data().DefaultedMoveConstructorIsDeleted = true;
989  }
990 
991  /// \brief Set that we attempted to declare an implicit destructor,
992  /// but overload resolution failed so we deleted it.
994  assert((data().DefaultedDestructorIsDeleted ||
995  needsOverloadResolutionForDestructor()) &&
996  "destructor should not be deleted");
997  data().DefaultedDestructorIsDeleted = true;
998  }
999 
1000  /// \brief Determine whether this class should get an implicit move
1001  /// constructor or if any existing special member function inhibits this.
1003  return !(data().DeclaredSpecialMembers & SMF_MoveConstructor) &&
1004  !hasUserDeclaredCopyConstructor() &&
1005  !hasUserDeclaredCopyAssignment() &&
1006  !hasUserDeclaredMoveAssignment() &&
1007  !hasUserDeclaredDestructor();
1008  }
1009 
1010  /// \brief Determine whether we need to eagerly declare a defaulted move
1011  /// constructor for this class.
1013  return data().NeedOverloadResolutionForMoveConstructor;
1014  }
1015 
1016  /// \brief Determine whether this class has a user-declared copy assignment
1017  /// operator.
1018  ///
1019  /// When false, a copy assigment operator will be implicitly declared.
1021  return data().UserDeclaredSpecialMembers & SMF_CopyAssignment;
1022  }
1023 
1024  /// \brief Determine whether this class needs an implicit copy
1025  /// assignment operator to be lazily declared.
1027  return !(data().DeclaredSpecialMembers & SMF_CopyAssignment);
1028  }
1029 
1030  /// \brief Determine whether we need to eagerly declare a defaulted copy
1031  /// assignment operator for this class.
1033  return data().HasMutableFields;
1034  }
1035 
1036  /// \brief Determine whether an implicit copy assignment operator for this
1037  /// type would have a parameter with a const-qualified reference type.
1039  return data().ImplicitCopyAssignmentHasConstParam;
1040  }
1041 
1042  /// \brief Determine whether this class has a copy assignment operator with
1043  /// a parameter type which is a reference to a const-qualified type or is not
1044  /// a reference.
1046  return data().HasDeclaredCopyAssignmentWithConstParam ||
1047  (needsImplicitCopyAssignment() &&
1048  implicitCopyAssignmentHasConstParam());
1049  }
1050 
1051  /// \brief Determine whether this class has had a move assignment
1052  /// declared by the user.
1054  return data().UserDeclaredSpecialMembers & SMF_MoveAssignment;
1055  }
1056 
1057  /// \brief Determine whether this class has a move assignment operator.
1058  bool hasMoveAssignment() const {
1059  return (data().DeclaredSpecialMembers & SMF_MoveAssignment) ||
1060  needsImplicitMoveAssignment();
1061  }
1062 
1063  /// \brief Set that we attempted to declare an implicit move assignment
1064  /// operator, but overload resolution failed so we deleted it.
1066  assert((data().DefaultedMoveAssignmentIsDeleted ||
1067  needsOverloadResolutionForMoveAssignment()) &&
1068  "move assignment should not be deleted");
1069  data().DefaultedMoveAssignmentIsDeleted = true;
1070  }
1071 
1072  /// \brief Determine whether this class should get an implicit move
1073  /// assignment operator or if any existing special member function inhibits
1074  /// this.
1076  return !(data().DeclaredSpecialMembers & SMF_MoveAssignment) &&
1077  !hasUserDeclaredCopyConstructor() &&
1078  !hasUserDeclaredCopyAssignment() &&
1079  !hasUserDeclaredMoveConstructor() &&
1080  !hasUserDeclaredDestructor() &&
1081  // C++1z [expr.prim.lambda]p21: "the closure type has a deleted copy
1082  // assignment operator". The intent is that this counts as a user
1083  // declared copy assignment, but we do not model it that way.
1084  !isLambda();
1085  }
1086 
1087  /// \brief Determine whether we need to eagerly declare a move assignment
1088  /// operator for this class.
1090  return data().NeedOverloadResolutionForMoveAssignment;
1091  }
1092 
1093  /// \brief Determine whether this class has a user-declared destructor.
1094  ///
1095  /// When false, a destructor will be implicitly declared.
1097  return data().UserDeclaredSpecialMembers & SMF_Destructor;
1098  }
1099 
1100  /// \brief Determine whether this class needs an implicit destructor to
1101  /// be lazily declared.
1103  return !(data().DeclaredSpecialMembers & SMF_Destructor);
1104  }
1105 
1106  /// \brief Determine whether we need to eagerly declare a destructor for this
1107  /// class.
1109  return data().NeedOverloadResolutionForDestructor;
1110  }
1111 
1112  /// \brief Determine whether this class describes a lambda function object.
1113  bool isLambda() const {
1114  // An update record can't turn a non-lambda into a lambda.
1115  auto *DD = DefinitionData;
1116  return DD && DD->IsLambda;
1117  }
1118 
1119  /// \brief Determine whether this class describes a generic
1120  /// lambda function object (i.e. function call operator is
1121  /// a template).
1122  bool isGenericLambda() const;
1123 
1124  /// \brief Retrieve the lambda call operator of the closure type
1125  /// if this is a closure type.
1126  CXXMethodDecl *getLambdaCallOperator() const;
1127 
1128  /// \brief Retrieve the lambda static invoker, the address of which
1129  /// is returned by the conversion operator, and the body of which
1130  /// is forwarded to the lambda call operator.
1131  CXXMethodDecl *getLambdaStaticInvoker() const;
1132 
1133  /// \brief Retrieve the generic lambda's template parameter list.
1134  /// Returns null if the class does not represent a lambda or a generic
1135  /// lambda.
1137 
1139  assert(isLambda());
1140  return static_cast<LambdaCaptureDefault>(getLambdaData().CaptureDefault);
1141  }
1142 
1143  /// \brief For a closure type, retrieve the mapping from captured
1144  /// variables and \c this to the non-static data members that store the
1145  /// values or references of the captures.
1146  ///
1147  /// \param Captures Will be populated with the mapping from captured
1148  /// variables to the corresponding fields.
1149  ///
1150  /// \param ThisCapture Will be set to the field declaration for the
1151  /// \c this capture.
1152  ///
1153  /// \note No entries will be added for init-captures, as they do not capture
1154  /// variables.
1155  void getCaptureFields(llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures,
1156  FieldDecl *&ThisCapture) const;
1157 
1159  typedef llvm::iterator_range<capture_const_iterator> capture_const_range;
1160 
1161  capture_const_range captures() const {
1162  return capture_const_range(captures_begin(), captures_end());
1163  }
1164  capture_const_iterator captures_begin() const {
1165  return isLambda() ? getLambdaData().Captures : nullptr;
1166  }
1167  capture_const_iterator captures_end() const {
1168  return isLambda() ? captures_begin() + getLambdaData().NumCaptures
1169  : nullptr;
1170  }
1171 
1173  conversion_iterator conversion_begin() const {
1174  return data().Conversions.get(getASTContext()).begin();
1175  }
1176  conversion_iterator conversion_end() const {
1177  return data().Conversions.get(getASTContext()).end();
1178  }
1179 
1180  /// Removes a conversion function from this class. The conversion
1181  /// function must currently be a member of this class. Furthermore,
1182  /// this class must currently be in the process of being defined.
1183  void removeConversion(const NamedDecl *Old);
1184 
1185  /// \brief Get all conversion functions visible in current class,
1186  /// including conversion function templates.
1187  llvm::iterator_range<conversion_iterator> getVisibleConversionFunctions();
1188 
1189  /// Determine whether this class is an aggregate (C++ [dcl.init.aggr]),
1190  /// which is a class with no user-declared constructors, no private
1191  /// or protected non-static data members, no base classes, and no virtual
1192  /// functions (C++ [dcl.init.aggr]p1).
1193  bool isAggregate() const { return data().Aggregate; }
1194 
1195  /// \brief Whether this class has any in-class initializers
1196  /// for non-static data members (including those in anonymous unions or
1197  /// structs).
1198  bool hasInClassInitializer() const { return data().HasInClassInitializer; }
1199 
1200  /// \brief Whether this class or any of its subobjects has any members of
1201  /// reference type which would make value-initialization ill-formed.
1202  ///
1203  /// Per C++03 [dcl.init]p5:
1204  /// - if T is a non-union class type without a user-declared constructor,
1205  /// then every non-static data member and base-class component of T is
1206  /// value-initialized [...] A program that calls for [...]
1207  /// value-initialization of an entity of reference type is ill-formed.
1209  return !isUnion() && !hasUserDeclaredConstructor() &&
1210  data().HasUninitializedReferenceMember;
1211  }
1212 
1213  /// \brief Whether this class is a POD-type (C++ [class]p4)
1214  ///
1215  /// For purposes of this function a class is POD if it is an aggregate
1216  /// that has no non-static non-POD data members, no reference data
1217  /// members, no user-defined copy assignment operator and no
1218  /// user-defined destructor.
1219  ///
1220  /// Note that this is the C++ TR1 definition of POD.
1221  bool isPOD() const { return data().PlainOldData; }
1222 
1223  /// \brief True if this class is C-like, without C++-specific features, e.g.
1224  /// it contains only public fields, no bases, tag kind is not 'class', etc.
1225  bool isCLike() const;
1226 
1227  /// \brief Determine whether this is an empty class in the sense of
1228  /// (C++11 [meta.unary.prop]).
1229  ///
1230  /// The CXXRecordDecl is a class type, but not a union type,
1231  /// with no non-static data members other than bit-fields of length 0,
1232  /// no virtual member functions, no virtual base classes,
1233  /// and no base class B for which is_empty<B>::value is false.
1234  ///
1235  /// \note This does NOT include a check for union-ness.
1236  bool isEmpty() const { return data().Empty; }
1237 
1238  /// \brief Determine whether this class has direct non-static data members.
1239  bool hasDirectFields() const {
1240  auto &D = data();
1241  return D.HasPublicFields || D.HasProtectedFields || D.HasPrivateFields;
1242  }
1243 
1244  /// Whether this class is polymorphic (C++ [class.virtual]),
1245  /// which means that the class contains or inherits a virtual function.
1246  bool isPolymorphic() const { return data().Polymorphic; }
1247 
1248  /// \brief Determine whether this class has a pure virtual function.
1249  ///
1250  /// The class is is abstract per (C++ [class.abstract]p2) if it declares
1251  /// a pure virtual function or inherits a pure virtual function that is
1252  /// not overridden.
1253  bool isAbstract() const { return data().Abstract; }
1254 
1255  /// \brief Determine whether this class has standard layout per
1256  /// (C++ [class]p7)
1257  bool isStandardLayout() const { return data().IsStandardLayout; }
1258 
1259  /// \brief Determine whether this class, or any of its class subobjects,
1260  /// contains a mutable field.
1261  bool hasMutableFields() const { return data().HasMutableFields; }
1262 
1263  /// \brief Determine whether this class has any variant members.
1264  bool hasVariantMembers() const { return data().HasVariantMembers; }
1265 
1266  /// \brief Determine whether this class has a trivial default constructor
1267  /// (C++11 [class.ctor]p5).
1269  return hasDefaultConstructor() &&
1270  (data().HasTrivialSpecialMembers & SMF_DefaultConstructor);
1271  }
1272 
1273  /// \brief Determine whether this class has a non-trivial default constructor
1274  /// (C++11 [class.ctor]p5).
1276  return (data().DeclaredNonTrivialSpecialMembers & SMF_DefaultConstructor) ||
1277  (needsImplicitDefaultConstructor() &&
1278  !(data().HasTrivialSpecialMembers & SMF_DefaultConstructor));
1279  }
1280 
1281  /// \brief Determine whether this class has at least one constexpr constructor
1282  /// other than the copy or move constructors.
1284  return data().HasConstexprNonCopyMoveConstructor ||
1285  (needsImplicitDefaultConstructor() &&
1286  defaultedDefaultConstructorIsConstexpr());
1287  }
1288 
1289  /// \brief Determine whether a defaulted default constructor for this class
1290  /// would be constexpr.
1292  return data().DefaultedDefaultConstructorIsConstexpr &&
1293  (!isUnion() || hasInClassInitializer() || !hasVariantMembers());
1294  }
1295 
1296  /// \brief Determine whether this class has a constexpr default constructor.
1298  return data().HasConstexprDefaultConstructor ||
1299  (needsImplicitDefaultConstructor() &&
1300  defaultedDefaultConstructorIsConstexpr());
1301  }
1302 
1303  /// \brief Determine whether this class has a trivial copy constructor
1304  /// (C++ [class.copy]p6, C++11 [class.copy]p12)
1306  return data().HasTrivialSpecialMembers & SMF_CopyConstructor;
1307  }
1308 
1309  /// \brief Determine whether this class has a non-trivial copy constructor
1310  /// (C++ [class.copy]p6, C++11 [class.copy]p12)
1312  return data().DeclaredNonTrivialSpecialMembers & SMF_CopyConstructor ||
1313  !hasTrivialCopyConstructor();
1314  }
1315 
1316  /// \brief Determine whether this class has a trivial move constructor
1317  /// (C++11 [class.copy]p12)
1319  return hasMoveConstructor() &&
1320  (data().HasTrivialSpecialMembers & SMF_MoveConstructor);
1321  }
1322 
1323  /// \brief Determine whether this class has a non-trivial move constructor
1324  /// (C++11 [class.copy]p12)
1326  return (data().DeclaredNonTrivialSpecialMembers & SMF_MoveConstructor) ||
1327  (needsImplicitMoveConstructor() &&
1328  !(data().HasTrivialSpecialMembers & SMF_MoveConstructor));
1329  }
1330 
1331  /// \brief Determine whether this class has a trivial copy assignment operator
1332  /// (C++ [class.copy]p11, C++11 [class.copy]p25)
1334  return data().HasTrivialSpecialMembers & SMF_CopyAssignment;
1335  }
1336 
1337  /// \brief Determine whether this class has a non-trivial copy assignment
1338  /// operator (C++ [class.copy]p11, C++11 [class.copy]p25)
1340  return data().DeclaredNonTrivialSpecialMembers & SMF_CopyAssignment ||
1341  !hasTrivialCopyAssignment();
1342  }
1343 
1344  /// \brief Determine whether this class has a trivial move assignment operator
1345  /// (C++11 [class.copy]p25)
1347  return hasMoveAssignment() &&
1348  (data().HasTrivialSpecialMembers & SMF_MoveAssignment);
1349  }
1350 
1351  /// \brief Determine whether this class has a non-trivial move assignment
1352  /// operator (C++11 [class.copy]p25)
1354  return (data().DeclaredNonTrivialSpecialMembers & SMF_MoveAssignment) ||
1355  (needsImplicitMoveAssignment() &&
1356  !(data().HasTrivialSpecialMembers & SMF_MoveAssignment));
1357  }
1358 
1359  /// \brief Determine whether this class has a trivial destructor
1360  /// (C++ [class.dtor]p3)
1361  bool hasTrivialDestructor() const {
1362  return data().HasTrivialSpecialMembers & SMF_Destructor;
1363  }
1364 
1365  /// \brief Determine whether this class has a non-trivial destructor
1366  /// (C++ [class.dtor]p3)
1368  return !(data().HasTrivialSpecialMembers & SMF_Destructor);
1369  }
1370 
1371  /// \brief Determine whether declaring a const variable with this type is ok
1372  /// per core issue 253.
1373  bool allowConstDefaultInit() const {
1374  return !data().HasUninitializedFields ||
1375  !(data().HasDefaultedDefaultConstructor ||
1376  needsImplicitDefaultConstructor());
1377  }
1378 
1379  /// \brief Determine whether this class has a destructor which has no
1380  /// semantic effect.
1381  ///
1382  /// Any such destructor will be trivial, public, defaulted and not deleted,
1383  /// and will call only irrelevant destructors.
1385  return data().HasIrrelevantDestructor;
1386  }
1387 
1388  /// \brief Determine whether this class has at least one trivial, non-deleted
1389  /// copy or move constructor.
1390  bool canPassInRegisters() const {
1391  return data().CanPassInRegisters;
1392  }
1393 
1394  /// \brief Set that we can pass this RecordDecl in registers.
1395  // FIXME: This should be set as part of completeDefinition.
1396  void setCanPassInRegisters(bool CanPass) {
1397  data().CanPassInRegisters = CanPass;
1398  }
1399 
1400  /// \brief Determine whether this class has a non-literal or/ volatile type
1401  /// non-static data member or base class.
1403  return data().HasNonLiteralTypeFieldsOrBases;
1404  }
1405 
1406  /// \brief Determine whether this class has a using-declaration that names
1407  /// a user-declared base class constructor.
1409  return data().HasInheritedConstructor;
1410  }
1411 
1412  /// \brief Determine whether this class has a using-declaration that names
1413  /// a base class assignment operator.
1414  bool hasInheritedAssignment() const {
1415  return data().HasInheritedAssignment;
1416  }
1417 
1418  /// \brief Determine whether this class is considered trivially copyable per
1419  /// (C++11 [class]p6).
1420  bool isTriviallyCopyable() const;
1421 
1422  /// \brief Determine whether this class is considered trivial.
1423  ///
1424  /// C++11 [class]p6:
1425  /// "A trivial class is a class that has a trivial default constructor and
1426  /// is trivially copiable."
1427  bool isTrivial() const {
1428  return isTriviallyCopyable() && hasTrivialDefaultConstructor();
1429  }
1430 
1431  /// \brief Determine whether this class is a literal type.
1432  ///
1433  /// C++11 [basic.types]p10:
1434  /// A class type that has all the following properties:
1435  /// - it has a trivial destructor
1436  /// - every constructor call and full-expression in the
1437  /// brace-or-equal-intializers for non-static data members (if any) is
1438  /// a constant expression.
1439  /// - it is an aggregate type or has at least one constexpr constructor
1440  /// or constructor template that is not a copy or move constructor, and
1441  /// - all of its non-static data members and base classes are of literal
1442  /// types
1443  ///
1444  /// We resolve DR1361 by ignoring the second bullet. We resolve DR1452 by
1445  /// treating types with trivial default constructors as literal types.
1446  ///
1447  /// Only in C++1z and beyond, are lambdas literal types.
1448  bool isLiteral() const {
1449  return hasTrivialDestructor() &&
1450  (!isLambda() || getASTContext().getLangOpts().CPlusPlus1z) &&
1451  !hasNonLiteralTypeFieldsOrBases() &&
1452  (isAggregate() || isLambda() ||
1453  hasConstexprNonCopyMoveConstructor() ||
1454  hasTrivialDefaultConstructor());
1455  }
1456 
1457  /// \brief If this record is an instantiation of a member class,
1458  /// retrieves the member class from which it was instantiated.
1459  ///
1460  /// This routine will return non-null for (non-templated) member
1461  /// classes of class templates. For example, given:
1462  ///
1463  /// \code
1464  /// template<typename T>
1465  /// struct X {
1466  /// struct A { };
1467  /// };
1468  /// \endcode
1469  ///
1470  /// The declaration for X<int>::A is a (non-templated) CXXRecordDecl
1471  /// whose parent is the class template specialization X<int>. For
1472  /// this declaration, getInstantiatedFromMemberClass() will return
1473  /// the CXXRecordDecl X<T>::A. When a complete definition of
1474  /// X<int>::A is required, it will be instantiated from the
1475  /// declaration returned by getInstantiatedFromMemberClass().
1476  CXXRecordDecl *getInstantiatedFromMemberClass() const;
1477 
1478  /// \brief If this class is an instantiation of a member class of a
1479  /// class template specialization, retrieves the member specialization
1480  /// information.
1481  MemberSpecializationInfo *getMemberSpecializationInfo() const;
1482 
1483  /// \brief Specify that this record is an instantiation of the
1484  /// member class \p RD.
1485  void setInstantiationOfMemberClass(CXXRecordDecl *RD,
1487 
1488  /// \brief Retrieves the class template that is described by this
1489  /// class declaration.
1490  ///
1491  /// Every class template is represented as a ClassTemplateDecl and a
1492  /// CXXRecordDecl. The former contains template properties (such as
1493  /// the template parameter lists) while the latter contains the
1494  /// actual description of the template's
1495  /// contents. ClassTemplateDecl::getTemplatedDecl() retrieves the
1496  /// CXXRecordDecl that from a ClassTemplateDecl, while
1497  /// getDescribedClassTemplate() retrieves the ClassTemplateDecl from
1498  /// a CXXRecordDecl.
1499  ClassTemplateDecl *getDescribedClassTemplate() const;
1500 
1501  void setDescribedClassTemplate(ClassTemplateDecl *Template);
1502 
1503  /// \brief Determine whether this particular class is a specialization or
1504  /// instantiation of a class template or member class of a class template,
1505  /// and how it was instantiated or specialized.
1507 
1508  /// \brief Set the kind of specialization or template instantiation this is.
1509  void setTemplateSpecializationKind(TemplateSpecializationKind TSK);
1510 
1511  /// \brief Retrieve the record declaration from which this record could be
1512  /// instantiated. Returns null if this class is not a template instantiation.
1513  const CXXRecordDecl *getTemplateInstantiationPattern() const;
1514 
1516  return const_cast<CXXRecordDecl *>(const_cast<const CXXRecordDecl *>(this)
1517  ->getTemplateInstantiationPattern());
1518  }
1519 
1520  /// \brief Returns the destructor decl for this class.
1521  CXXDestructorDecl *getDestructor() const;
1522 
1523  /// \brief Returns true if the class destructor, or any implicitly invoked
1524  /// destructors are marked noreturn.
1525  bool isAnyDestructorNoReturn() const;
1526 
1527  /// \brief If the class is a local class [class.local], returns
1528  /// the enclosing function declaration.
1529  const FunctionDecl *isLocalClass() const {
1530  if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(getDeclContext()))
1531  return RD->isLocalClass();
1532 
1533  return dyn_cast<FunctionDecl>(getDeclContext());
1534  }
1535 
1537  return const_cast<FunctionDecl*>(
1538  const_cast<const CXXRecordDecl*>(this)->isLocalClass());
1539  }
1540 
1541  /// \brief Determine whether this dependent class is a current instantiation,
1542  /// when viewed from within the given context.
1543  bool isCurrentInstantiation(const DeclContext *CurContext) const;
1544 
1545  /// \brief Determine whether this class is derived from the class \p Base.
1546  ///
1547  /// This routine only determines whether this class is derived from \p Base,
1548  /// but does not account for factors that may make a Derived -> Base class
1549  /// ill-formed, such as private/protected inheritance or multiple, ambiguous
1550  /// base class subobjects.
1551  ///
1552  /// \param Base the base class we are searching for.
1553  ///
1554  /// \returns true if this class is derived from Base, false otherwise.
1555  bool isDerivedFrom(const CXXRecordDecl *Base) const;
1556 
1557  /// \brief Determine whether this class is derived from the type \p Base.
1558  ///
1559  /// This routine only determines whether this class is derived from \p Base,
1560  /// but does not account for factors that may make a Derived -> Base class
1561  /// ill-formed, such as private/protected inheritance or multiple, ambiguous
1562  /// base class subobjects.
1563  ///
1564  /// \param Base the base class we are searching for.
1565  ///
1566  /// \param Paths will contain the paths taken from the current class to the
1567  /// given \p Base class.
1568  ///
1569  /// \returns true if this class is derived from \p Base, false otherwise.
1570  ///
1571  /// \todo add a separate parameter to configure IsDerivedFrom, rather than
1572  /// tangling input and output in \p Paths
1573  bool isDerivedFrom(const CXXRecordDecl *Base, CXXBasePaths &Paths) const;
1574 
1575  /// \brief Determine whether this class is virtually derived from
1576  /// the class \p Base.
1577  ///
1578  /// This routine only determines whether this class is virtually
1579  /// derived from \p Base, but does not account for factors that may
1580  /// make a Derived -> Base class ill-formed, such as
1581  /// private/protected inheritance or multiple, ambiguous base class
1582  /// subobjects.
1583  ///
1584  /// \param Base the base class we are searching for.
1585  ///
1586  /// \returns true if this class is virtually derived from Base,
1587  /// false otherwise.
1588  bool isVirtuallyDerivedFrom(const CXXRecordDecl *Base) const;
1589 
1590  /// \brief Determine whether this class is provably not derived from
1591  /// the type \p Base.
1592  bool isProvablyNotDerivedFrom(const CXXRecordDecl *Base) const;
1593 
1594  /// \brief Function type used by forallBases() as a callback.
1595  ///
1596  /// \param BaseDefinition the definition of the base class
1597  ///
1598  /// \returns true if this base matched the search criteria
1599  typedef llvm::function_ref<bool(const CXXRecordDecl *BaseDefinition)>
1601 
1602  /// \brief Determines if the given callback holds for all the direct
1603  /// or indirect base classes of this type.
1604  ///
1605  /// The class itself does not count as a base class. This routine
1606  /// returns false if the class has non-computable base classes.
1607  ///
1608  /// \param BaseMatches Callback invoked for each (direct or indirect) base
1609  /// class of this type, or if \p AllowShortCircuit is true then until a call
1610  /// returns false.
1611  ///
1612  /// \param AllowShortCircuit if false, forces the callback to be called
1613  /// for every base class, even if a dependent or non-matching base was
1614  /// found.
1615  bool forallBases(ForallBasesCallback BaseMatches,
1616  bool AllowShortCircuit = true) const;
1617 
1618  /// \brief Function type used by lookupInBases() to determine whether a
1619  /// specific base class subobject matches the lookup criteria.
1620  ///
1621  /// \param Specifier the base-class specifier that describes the inheritance
1622  /// from the base class we are trying to match.
1623  ///
1624  /// \param Path the current path, from the most-derived class down to the
1625  /// base named by the \p Specifier.
1626  ///
1627  /// \returns true if this base matched the search criteria, false otherwise.
1628  typedef llvm::function_ref<bool(const CXXBaseSpecifier *Specifier,
1630 
1631  /// \brief Look for entities within the base classes of this C++ class,
1632  /// transitively searching all base class subobjects.
1633  ///
1634  /// This routine uses the callback function \p BaseMatches to find base
1635  /// classes meeting some search criteria, walking all base class subobjects
1636  /// and populating the given \p Paths structure with the paths through the
1637  /// inheritance hierarchy that resulted in a match. On a successful search,
1638  /// the \p Paths structure can be queried to retrieve the matching paths and
1639  /// to determine if there were any ambiguities.
1640  ///
1641  /// \param BaseMatches callback function used to determine whether a given
1642  /// base matches the user-defined search criteria.
1643  ///
1644  /// \param Paths used to record the paths from this class to its base class
1645  /// subobjects that match the search criteria.
1646  ///
1647  /// \param LookupInDependent can be set to true to extend the search to
1648  /// dependent base classes.
1649  ///
1650  /// \returns true if there exists any path from this class to a base class
1651  /// subobject that matches the search criteria.
1652  bool lookupInBases(BaseMatchesCallback BaseMatches, CXXBasePaths &Paths,
1653  bool LookupInDependent = false) const;
1654 
1655  /// \brief Base-class lookup callback that determines whether the given
1656  /// base class specifier refers to a specific class declaration.
1657  ///
1658  /// This callback can be used with \c lookupInBases() to determine whether
1659  /// a given derived class has is a base class subobject of a particular type.
1660  /// The base record pointer should refer to the canonical CXXRecordDecl of the
1661  /// base class that we are searching for.
1662  static bool FindBaseClass(const CXXBaseSpecifier *Specifier,
1663  CXXBasePath &Path, const CXXRecordDecl *BaseRecord);
1664 
1665  /// \brief Base-class lookup callback that determines whether the
1666  /// given base class specifier refers to a specific class
1667  /// declaration and describes virtual derivation.
1668  ///
1669  /// This callback can be used with \c lookupInBases() to determine
1670  /// whether a given derived class has is a virtual base class
1671  /// subobject of a particular type. The base record pointer should
1672  /// refer to the canonical CXXRecordDecl of the base class that we
1673  /// are searching for.
1674  static bool FindVirtualBaseClass(const CXXBaseSpecifier *Specifier,
1675  CXXBasePath &Path,
1676  const CXXRecordDecl *BaseRecord);
1677 
1678  /// \brief Base-class lookup callback that determines whether there exists
1679  /// a tag with the given name.
1680  ///
1681  /// This callback can be used with \c lookupInBases() to find tag members
1682  /// of the given name within a C++ class hierarchy.
1683  static bool FindTagMember(const CXXBaseSpecifier *Specifier,
1684  CXXBasePath &Path, DeclarationName Name);
1685 
1686  /// \brief Base-class lookup callback that determines whether there exists
1687  /// a member with the given name.
1688  ///
1689  /// This callback can be used with \c lookupInBases() to find members
1690  /// of the given name within a C++ class hierarchy.
1691  static bool FindOrdinaryMember(const CXXBaseSpecifier *Specifier,
1692  CXXBasePath &Path, DeclarationName Name);
1693 
1694  /// \brief Base-class lookup callback that determines whether there exists
1695  /// a member with the given name.
1696  ///
1697  /// This callback can be used with \c lookupInBases() to find members
1698  /// of the given name within a C++ class hierarchy, including dependent
1699  /// classes.
1700  static bool
1701  FindOrdinaryMemberInDependentClasses(const CXXBaseSpecifier *Specifier,
1702  CXXBasePath &Path, DeclarationName Name);
1703 
1704  /// \brief Base-class lookup callback that determines whether there exists
1705  /// an OpenMP declare reduction member with the given name.
1706  ///
1707  /// This callback can be used with \c lookupInBases() to find members
1708  /// of the given name within a C++ class hierarchy.
1709  static bool FindOMPReductionMember(const CXXBaseSpecifier *Specifier,
1710  CXXBasePath &Path, DeclarationName Name);
1711 
1712  /// \brief Base-class lookup callback that determines whether there exists
1713  /// a member with the given name that can be used in a nested-name-specifier.
1714  ///
1715  /// This callback can be used with \c lookupInBases() to find members of
1716  /// the given name within a C++ class hierarchy that can occur within
1717  /// nested-name-specifiers.
1718  static bool FindNestedNameSpecifierMember(const CXXBaseSpecifier *Specifier,
1719  CXXBasePath &Path,
1720  DeclarationName Name);
1721 
1722  /// \brief Retrieve the final overriders for each virtual member
1723  /// function in the class hierarchy where this class is the
1724  /// most-derived class in the class hierarchy.
1725  void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const;
1726 
1727  /// \brief Get the indirect primary bases for this class.
1728  void getIndirectPrimaryBases(CXXIndirectPrimaryBaseSet& Bases) const;
1729 
1730  /// Performs an imprecise lookup of a dependent name in this class.
1731  ///
1732  /// This function does not follow strict semantic rules and should be used
1733  /// only when lookup rules can be relaxed, e.g. indexing.
1734  std::vector<const NamedDecl *>
1735  lookupDependentName(const DeclarationName &Name,
1736  llvm::function_ref<bool(const NamedDecl *ND)> Filter);
1737 
1738  /// Renders and displays an inheritance diagram
1739  /// for this C++ class and all of its base classes (transitively) using
1740  /// GraphViz.
1741  void viewInheritance(ASTContext& Context) const;
1742 
1743  /// \brief Calculates the access of a decl that is reached
1744  /// along a path.
1746  AccessSpecifier DeclAccess) {
1747  assert(DeclAccess != AS_none);
1748  if (DeclAccess == AS_private) return AS_none;
1749  return (PathAccess > DeclAccess ? PathAccess : DeclAccess);
1750  }
1751 
1752  /// \brief Indicates that the declaration of a defaulted or deleted special
1753  /// member function is now complete.
1754  void finishedDefaultedOrDeletedMember(CXXMethodDecl *MD);
1755 
1756  /// \brief Indicates that the definition of this class is now complete.
1757  void completeDefinition() override;
1758 
1759  /// \brief Indicates that the definition of this class is now complete,
1760  /// and provides a final overrider map to help determine
1761  ///
1762  /// \param FinalOverriders The final overrider map for this class, which can
1763  /// be provided as an optimization for abstract-class checking. If NULL,
1764  /// final overriders will be computed if they are needed to complete the
1765  /// definition.
1766  void completeDefinition(CXXFinalOverriderMap *FinalOverriders);
1767 
1768  /// \brief Determine whether this class may end up being abstract, even though
1769  /// it is not yet known to be abstract.
1770  ///
1771  /// \returns true if this class is not known to be abstract but has any
1772  /// base classes that are abstract. In this case, \c completeDefinition()
1773  /// will need to compute final overriders to determine whether the class is
1774  /// actually abstract.
1775  bool mayBeAbstract() const;
1776 
1777  /// \brief If this is the closure type of a lambda expression, retrieve the
1778  /// number to be used for name mangling in the Itanium C++ ABI.
1779  ///
1780  /// Zero indicates that this closure type has internal linkage, so the
1781  /// mangling number does not matter, while a non-zero value indicates which
1782  /// lambda expression this is in this particular context.
1783  unsigned getLambdaManglingNumber() const {
1784  assert(isLambda() && "Not a lambda closure type!");
1785  return getLambdaData().ManglingNumber;
1786  }
1787 
1788  /// \brief Retrieve the declaration that provides additional context for a
1789  /// lambda, when the normal declaration context is not specific enough.
1790  ///
1791  /// Certain contexts (default arguments of in-class function parameters and
1792  /// the initializers of data members) have separate name mangling rules for
1793  /// lambdas within the Itanium C++ ABI. For these cases, this routine provides
1794  /// the declaration in which the lambda occurs, e.g., the function parameter
1795  /// or the non-static data member. Otherwise, it returns NULL to imply that
1796  /// the declaration context suffices.
1797  Decl *getLambdaContextDecl() const;
1798 
1799  /// \brief Set the mangling number and context declaration for a lambda
1800  /// class.
1801  void setLambdaMangling(unsigned ManglingNumber, Decl *ContextDecl) {
1802  getLambdaData().ManglingNumber = ManglingNumber;
1803  getLambdaData().ContextDecl = ContextDecl;
1804  }
1805 
1806  /// \brief Returns the inheritance model used for this record.
1807  MSInheritanceAttr::Spelling getMSInheritanceModel() const;
1808  /// \brief Calculate what the inheritance model would be for this class.
1809  MSInheritanceAttr::Spelling calculateInheritanceModel() const;
1810 
1811  /// In the Microsoft C++ ABI, use zero for the field offset of a null data
1812  /// member pointer if we can guarantee that zero is not a valid field offset,
1813  /// or if the member pointer has multiple fields. Polymorphic classes have a
1814  /// vfptr at offset zero, so we can use zero for null. If there are multiple
1815  /// fields, we can use zero even if it is a valid field offset because
1816  /// null-ness testing will check the other fields.
1817  bool nullFieldOffsetIsZero() const {
1818  return !MSInheritanceAttr::hasOnlyOneField(/*IsMemberFunction=*/false,
1819  getMSInheritanceModel()) ||
1820  (hasDefinition() && isPolymorphic());
1821  }
1822 
1823  /// \brief Controls when vtordisps will be emitted if this record is used as a
1824  /// virtual base.
1825  MSVtorDispAttr::Mode getMSVtorDispMode() const;
1826 
1827  /// \brief Determine whether this lambda expression was known to be dependent
1828  /// at the time it was created, even if its context does not appear to be
1829  /// dependent.
1830  ///
1831  /// This flag is a workaround for an issue with parsing, where default
1832  /// arguments are parsed before their enclosing function declarations have
1833  /// been created. This means that any lambda expressions within those
1834  /// default arguments will have as their DeclContext the context enclosing
1835  /// the function declaration, which may be non-dependent even when the
1836  /// function declaration itself is dependent. This flag indicates when we
1837  /// know that the lambda is dependent despite that.
1838  bool isDependentLambda() const {
1839  return isLambda() && getLambdaData().Dependent;
1840  }
1841 
1843  return getLambdaData().MethodTyInfo;
1844  }
1845 
1846  // \brief Determine whether this type is an Interface Like type for
1847  // __interface inheritence purposes.
1848  bool isInterfaceLike() const;
1849 
1850  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1851  static bool classofKind(Kind K) {
1852  return K >= firstCXXRecord && K <= lastCXXRecord;
1853  }
1854 
1855  friend class ASTDeclReader;
1856  friend class ASTDeclWriter;
1857  friend class ASTRecordWriter;
1858  friend class ASTReader;
1859  friend class ASTWriter;
1860 };
1861 
1862 /// \brief Represents a C++ deduction guide declaration.
1863 ///
1864 /// \code
1865 /// template<typename T> struct A { A(); A(T); };
1866 /// A() -> A<int>;
1867 /// \endcode
1868 ///
1869 /// In this example, there will be an explicit deduction guide from the
1870 /// second line, and implicit deduction guide templates synthesized from
1871 /// the constructors of \c A.
1873  void anchor() override;
1874 private:
1876  bool IsExplicit, const DeclarationNameInfo &NameInfo,
1877  QualType T, TypeSourceInfo *TInfo,
1878  SourceLocation EndLocation)
1879  : FunctionDecl(CXXDeductionGuide, C, DC, StartLoc, NameInfo, T, TInfo,
1880  SC_None, false, false) {
1881  if (EndLocation.isValid())
1882  setRangeEnd(EndLocation);
1883  IsExplicitSpecified = IsExplicit;
1884  }
1885 
1886 public:
1888  SourceLocation StartLoc, bool IsExplicit,
1889  const DeclarationNameInfo &NameInfo,
1890  QualType T, TypeSourceInfo *TInfo,
1891  SourceLocation EndLocation);
1892 
1893  static CXXDeductionGuideDecl *CreateDeserialized(ASTContext &C, unsigned ID);
1894 
1895  /// Whether this deduction guide is explicit.
1896  bool isExplicit() const { return IsExplicitSpecified; }
1897 
1898  /// Whether this deduction guide was declared with the 'explicit' specifier.
1899  bool isExplicitSpecified() const { return IsExplicitSpecified; }
1900 
1901  /// Get the template for which this guide performs deduction.
1903  return getDeclName().getCXXDeductionGuideTemplate();
1904  }
1905 
1906  // Implement isa/cast/dyncast/etc.
1907  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1908  static bool classofKind(Kind K) { return K == CXXDeductionGuide; }
1909 
1910  friend class ASTDeclReader;
1911  friend class ASTDeclWriter;
1912 };
1913 
1914 /// \brief Represents a static or instance method of a struct/union/class.
1915 ///
1916 /// In the terminology of the C++ Standard, these are the (static and
1917 /// non-static) member functions, whether virtual or not.
1918 class CXXMethodDecl : public FunctionDecl {
1919  void anchor() override;
1920 protected:
1922  SourceLocation StartLoc, const DeclarationNameInfo &NameInfo,
1923  QualType T, TypeSourceInfo *TInfo,
1924  StorageClass SC, bool isInline,
1925  bool isConstexpr, SourceLocation EndLocation)
1926  : FunctionDecl(DK, C, RD, StartLoc, NameInfo, T, TInfo,
1927  SC, isInline, isConstexpr) {
1928  if (EndLocation.isValid())
1929  setRangeEnd(EndLocation);
1930  }
1931 
1932 public:
1933  static CXXMethodDecl *Create(ASTContext &C, CXXRecordDecl *RD,
1934  SourceLocation StartLoc,
1935  const DeclarationNameInfo &NameInfo,
1936  QualType T, TypeSourceInfo *TInfo,
1937  StorageClass SC,
1938  bool isInline,
1939  bool isConstexpr,
1940  SourceLocation EndLocation);
1941 
1942  static CXXMethodDecl *CreateDeserialized(ASTContext &C, unsigned ID);
1943 
1944  bool isStatic() const;
1945  bool isInstance() const { return !isStatic(); }
1946 
1947  /// Returns true if the given operator is implicitly static in a record
1948  /// context.
1950  // [class.free]p1:
1951  // Any allocation function for a class T is a static member
1952  // (even if not explicitly declared static).
1953  // [class.free]p6 Any deallocation function for a class X is a static member
1954  // (even if not explicitly declared static).
1955  return OOK == OO_New || OOK == OO_Array_New || OOK == OO_Delete ||
1956  OOK == OO_Array_Delete;
1957  }
1958 
1959  bool isConst() const { return getType()->castAs<FunctionType>()->isConst(); }
1960  bool isVolatile() const { return getType()->castAs<FunctionType>()->isVolatile(); }
1961 
1962  bool isVirtual() const {
1963  CXXMethodDecl *CD =
1964  cast<CXXMethodDecl>(const_cast<CXXMethodDecl*>(this)->getCanonicalDecl());
1965 
1966  // Member function is virtual if it is marked explicitly so, or if it is
1967  // declared in __interface -- then it is automatically pure virtual.
1968  if (CD->isVirtualAsWritten() || CD->isPure())
1969  return true;
1970 
1971  return (CD->begin_overridden_methods() != CD->end_overridden_methods());
1972  }
1973 
1974  /// If it's possible to devirtualize a call to this method, return the called
1975  /// function. Otherwise, return null.
1976 
1977  /// \param Base The object on which this virtual function is called.
1978  /// \param IsAppleKext True if we are compiling for Apple kext.
1979  CXXMethodDecl *getDevirtualizedMethod(const Expr *Base, bool IsAppleKext);
1980 
1982  bool IsAppleKext) const {
1983  return const_cast<CXXMethodDecl *>(this)->getDevirtualizedMethod(
1984  Base, IsAppleKext);
1985  }
1986 
1987  /// \brief Determine whether this is a usual deallocation function
1988  /// (C++ [basic.stc.dynamic.deallocation]p2), which is an overloaded
1989  /// delete or delete[] operator with a particular signature.
1990  bool isUsualDeallocationFunction() const;
1991 
1992  /// \brief Determine whether this is a copy-assignment operator, regardless
1993  /// of whether it was declared implicitly or explicitly.
1994  bool isCopyAssignmentOperator() const;
1995 
1996  /// \brief Determine whether this is a move assignment operator.
1997  bool isMoveAssignmentOperator() const;
1998 
2000  return cast<CXXMethodDecl>(FunctionDecl::getCanonicalDecl());
2001  }
2003  return const_cast<CXXMethodDecl*>(this)->getCanonicalDecl();
2004  }
2005 
2007  return cast<CXXMethodDecl>(
2008  static_cast<FunctionDecl *>(this)->getMostRecentDecl());
2009  }
2011  return const_cast<CXXMethodDecl*>(this)->getMostRecentDecl();
2012  }
2013 
2014  /// True if this method is user-declared and was not
2015  /// deleted or defaulted on its first declaration.
2016  bool isUserProvided() const {
2017  return !(isDeleted() || getCanonicalDecl()->isDefaulted());
2018  }
2019 
2020  ///
2021  void addOverriddenMethod(const CXXMethodDecl *MD);
2022 
2023  typedef const CXXMethodDecl *const* method_iterator;
2024 
2025  method_iterator begin_overridden_methods() const;
2026  method_iterator end_overridden_methods() const;
2027  unsigned size_overridden_methods() const;
2029  overridden_method_range overridden_methods() const;
2030 
2031  /// Returns the parent of this method declaration, which
2032  /// is the class in which this method is defined.
2033  const CXXRecordDecl *getParent() const {
2034  return cast<CXXRecordDecl>(FunctionDecl::getParent());
2035  }
2036 
2037  /// Returns the parent of this method declaration, which
2038  /// is the class in which this method is defined.
2040  return const_cast<CXXRecordDecl *>(
2041  cast<CXXRecordDecl>(FunctionDecl::getParent()));
2042  }
2043 
2044  /// \brief Returns the type of the \c this pointer.
2045  ///
2046  /// Should only be called for instance (i.e., non-static) methods. Note
2047  /// that for the call operator of a lambda closure type, this returns the
2048  /// desugared 'this' type (a pointer to the closure type), not the captured
2049  /// 'this' type.
2050  QualType getThisType(ASTContext &C) const;
2051 
2052  unsigned getTypeQualifiers() const {
2053  return getType()->getAs<FunctionProtoType>()->getTypeQuals();
2054  }
2055 
2056  /// \brief Retrieve the ref-qualifier associated with this method.
2057  ///
2058  /// In the following example, \c f() has an lvalue ref-qualifier, \c g()
2059  /// has an rvalue ref-qualifier, and \c h() has no ref-qualifier.
2060  /// @code
2061  /// struct X {
2062  /// void f() &;
2063  /// void g() &&;
2064  /// void h();
2065  /// };
2066  /// @endcode
2068  return getType()->getAs<FunctionProtoType>()->getRefQualifier();
2069  }
2070 
2071  bool hasInlineBody() const;
2072 
2073  /// \brief Determine whether this is a lambda closure type's static member
2074  /// function that is used for the result of the lambda's conversion to
2075  /// function pointer (for a lambda with no captures).
2076  ///
2077  /// The function itself, if used, will have a placeholder body that will be
2078  /// supplied by IR generation to either forward to the function call operator
2079  /// or clone the function call operator.
2080  bool isLambdaStaticInvoker() const;
2081 
2082  /// \brief Find the method in \p RD that corresponds to this one.
2083  ///
2084  /// Find if \p RD or one of the classes it inherits from override this method.
2085  /// If so, return it. \p RD is assumed to be a subclass of the class defining
2086  /// this method (or be the class itself), unless \p MayBeBase is set to true.
2087  CXXMethodDecl *
2088  getCorrespondingMethodInClass(const CXXRecordDecl *RD,
2089  bool MayBeBase = false);
2090 
2091  const CXXMethodDecl *
2093  bool MayBeBase = false) const {
2094  return const_cast<CXXMethodDecl *>(this)
2095  ->getCorrespondingMethodInClass(RD, MayBeBase);
2096  }
2097 
2098  // Implement isa/cast/dyncast/etc.
2099  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2100  static bool classofKind(Kind K) {
2101  return K >= firstCXXMethod && K <= lastCXXMethod;
2102  }
2103 };
2104 
2105 /// \brief Represents a C++ base or member initializer.
2106 ///
2107 /// This is part of a constructor initializer that
2108 /// initializes one non-static member variable or one base class. For
2109 /// example, in the following, both 'A(a)' and 'f(3.14159)' are member
2110 /// initializers:
2111 ///
2112 /// \code
2113 /// class A { };
2114 /// class B : public A {
2115 /// float f;
2116 /// public:
2117 /// B(A& a) : A(a), f(3.14159) { }
2118 /// };
2119 /// \endcode
2120 class CXXCtorInitializer final {
2121  /// \brief Either the base class name/delegating constructor type (stored as
2122  /// a TypeSourceInfo*), an normal field (FieldDecl), or an anonymous field
2123  /// (IndirectFieldDecl*) being initialized.
2124  llvm::PointerUnion3<TypeSourceInfo *, FieldDecl *, IndirectFieldDecl *>
2125  Initializee;
2126 
2127  /// \brief The source location for the field name or, for a base initializer
2128  /// pack expansion, the location of the ellipsis.
2129  ///
2130  /// In the case of a delegating
2131  /// constructor, it will still include the type's source location as the
2132  /// Initializee points to the CXXConstructorDecl (to allow loop detection).
2133  SourceLocation MemberOrEllipsisLocation;
2134 
2135  /// \brief The argument used to initialize the base or member, which may
2136  /// end up constructing an object (when multiple arguments are involved).
2137  Stmt *Init;
2138 
2139  /// \brief Location of the left paren of the ctor-initializer.
2140  SourceLocation LParenLoc;
2141 
2142  /// \brief Location of the right paren of the ctor-initializer.
2143  SourceLocation RParenLoc;
2144 
2145  /// \brief If the initializee is a type, whether that type makes this
2146  /// a delegating initialization.
2147  unsigned IsDelegating : 1;
2148 
2149  /// \brief If the initializer is a base initializer, this keeps track
2150  /// of whether the base is virtual or not.
2151  unsigned IsVirtual : 1;
2152 
2153  /// \brief Whether or not the initializer is explicitly written
2154  /// in the sources.
2155  unsigned IsWritten : 1;
2156 
2157  /// If IsWritten is true, then this number keeps track of the textual order
2158  /// of this initializer in the original sources, counting from 0.
2159  unsigned SourceOrder : 13;
2160 
2161 public:
2162  /// \brief Creates a new base-class initializer.
2163  explicit
2164  CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual,
2165  SourceLocation L, Expr *Init, SourceLocation R,
2166  SourceLocation EllipsisLoc);
2167 
2168  /// \brief Creates a new member initializer.
2169  explicit
2170  CXXCtorInitializer(ASTContext &Context, FieldDecl *Member,
2171  SourceLocation MemberLoc, SourceLocation L, Expr *Init,
2172  SourceLocation R);
2173 
2174  /// \brief Creates a new anonymous field initializer.
2175  explicit
2177  SourceLocation MemberLoc, SourceLocation L, Expr *Init,
2178  SourceLocation R);
2179 
2180  /// \brief Creates a new delegating initializer.
2181  explicit
2182  CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo,
2183  SourceLocation L, Expr *Init, SourceLocation R);
2184 
2185  /// \brief Determine whether this initializer is initializing a base class.
2186  bool isBaseInitializer() const {
2187  return Initializee.is<TypeSourceInfo*>() && !IsDelegating;
2188  }
2189 
2190  /// \brief Determine whether this initializer is initializing a non-static
2191  /// data member.
2192  bool isMemberInitializer() const { return Initializee.is<FieldDecl*>(); }
2193 
2194  bool isAnyMemberInitializer() const {
2195  return isMemberInitializer() || isIndirectMemberInitializer();
2196  }
2197 
2199  return Initializee.is<IndirectFieldDecl*>();
2200  }
2201 
2202  /// \brief Determine whether this initializer is an implicit initializer
2203  /// generated for a field with an initializer defined on the member
2204  /// declaration.
2205  ///
2206  /// In-class member initializers (also known as "non-static data member
2207  /// initializations", NSDMIs) were introduced in C++11.
2209  return Init->getStmtClass() == Stmt::CXXDefaultInitExprClass;
2210  }
2211 
2212  /// \brief Determine whether this initializer is creating a delegating
2213  /// constructor.
2215  return Initializee.is<TypeSourceInfo*>() && IsDelegating;
2216  }
2217 
2218  /// \brief Determine whether this initializer is a pack expansion.
2219  bool isPackExpansion() const {
2220  return isBaseInitializer() && MemberOrEllipsisLocation.isValid();
2221  }
2222 
2223  // \brief For a pack expansion, returns the location of the ellipsis.
2225  assert(isPackExpansion() && "Initializer is not a pack expansion");
2226  return MemberOrEllipsisLocation;
2227  }
2228 
2229  /// If this is a base class initializer, returns the type of the
2230  /// base class with location information. Otherwise, returns an NULL
2231  /// type location.
2232  TypeLoc getBaseClassLoc() const;
2233 
2234  /// If this is a base class initializer, returns the type of the base class.
2235  /// Otherwise, returns null.
2236  const Type *getBaseClass() const;
2237 
2238  /// Returns whether the base is virtual or not.
2239  bool isBaseVirtual() const {
2240  assert(isBaseInitializer() && "Must call this on base initializer!");
2241 
2242  return IsVirtual;
2243  }
2244 
2245  /// \brief Returns the declarator information for a base class or delegating
2246  /// initializer.
2248  return Initializee.dyn_cast<TypeSourceInfo *>();
2249  }
2250 
2251  /// \brief If this is a member initializer, returns the declaration of the
2252  /// non-static data member being initialized. Otherwise, returns null.
2254  if (isMemberInitializer())
2255  return Initializee.get<FieldDecl*>();
2256  return nullptr;
2257  }
2259  if (isMemberInitializer())
2260  return Initializee.get<FieldDecl*>();
2261  if (isIndirectMemberInitializer())
2262  return Initializee.get<IndirectFieldDecl*>()->getAnonField();
2263  return nullptr;
2264  }
2265 
2267  if (isIndirectMemberInitializer())
2268  return Initializee.get<IndirectFieldDecl*>();
2269  return nullptr;
2270  }
2271 
2273  return MemberOrEllipsisLocation;
2274  }
2275 
2276  /// \brief Determine the source location of the initializer.
2277  SourceLocation getSourceLocation() const;
2278 
2279  /// \brief Determine the source range covering the entire initializer.
2280  SourceRange getSourceRange() const LLVM_READONLY;
2281 
2282  /// \brief Determine whether this initializer is explicitly written
2283  /// in the source code.
2284  bool isWritten() const { return IsWritten; }
2285 
2286  /// \brief Return the source position of the initializer, counting from 0.
2287  /// If the initializer was implicit, -1 is returned.
2288  int getSourceOrder() const {
2289  return IsWritten ? static_cast<int>(SourceOrder) : -1;
2290  }
2291 
2292  /// \brief Set the source order of this initializer.
2293  ///
2294  /// This can only be called once for each initializer; it cannot be called
2295  /// on an initializer having a positive number of (implicit) array indices.
2296  ///
2297  /// This assumes that the initializer was written in the source code, and
2298  /// ensures that isWritten() returns true.
2299  void setSourceOrder(int Pos) {
2300  assert(!IsWritten &&
2301  "setSourceOrder() used on implicit initializer");
2302  assert(SourceOrder == 0 &&
2303  "calling twice setSourceOrder() on the same initializer");
2304  assert(Pos >= 0 &&
2305  "setSourceOrder() used to make an initializer implicit");
2306  IsWritten = true;
2307  SourceOrder = static_cast<unsigned>(Pos);
2308  }
2309 
2310  SourceLocation getLParenLoc() const { return LParenLoc; }
2311  SourceLocation getRParenLoc() const { return RParenLoc; }
2312 
2313  /// \brief Get the initializer.
2314  Expr *getInit() const { return static_cast<Expr*>(Init); }
2315 };
2316 
2317 /// Description of a constructor that was inherited from a base class.
2320  CXXConstructorDecl *BaseCtor;
2321 
2322 public:
2323  InheritedConstructor() : Shadow(), BaseCtor() {}
2325  CXXConstructorDecl *BaseCtor)
2326  : Shadow(Shadow), BaseCtor(BaseCtor) {}
2327 
2328  explicit operator bool() const { return Shadow; }
2329 
2330  ConstructorUsingShadowDecl *getShadowDecl() const { return Shadow; }
2331  CXXConstructorDecl *getConstructor() const { return BaseCtor; }
2332 };
2333 
2334 /// \brief Represents a C++ constructor within a class.
2335 ///
2336 /// For example:
2337 ///
2338 /// \code
2339 /// class X {
2340 /// public:
2341 /// explicit X(int); // represented by a CXXConstructorDecl.
2342 /// };
2343 /// \endcode
2345  : public CXXMethodDecl,
2346  private llvm::TrailingObjects<CXXConstructorDecl, InheritedConstructor> {
2347  void anchor() override;
2348 
2349  /// \name Support for base and member initializers.
2350  /// \{
2351  /// \brief The arguments used to initialize the base or member.
2352  LazyCXXCtorInitializersPtr CtorInitializers;
2353  unsigned NumCtorInitializers : 31;
2354  /// \}
2355 
2356  /// \brief Whether this constructor declaration is an implicitly-declared
2357  /// inheriting constructor.
2358  unsigned IsInheritingConstructor : 1;
2359 
2361  const DeclarationNameInfo &NameInfo,
2362  QualType T, TypeSourceInfo *TInfo,
2363  bool isExplicitSpecified, bool isInline,
2364  bool isImplicitlyDeclared, bool isConstexpr,
2365  InheritedConstructor Inherited)
2366  : CXXMethodDecl(CXXConstructor, C, RD, StartLoc, NameInfo, T, TInfo,
2367  SC_None, isInline, isConstexpr, SourceLocation()),
2368  CtorInitializers(nullptr), NumCtorInitializers(0),
2369  IsInheritingConstructor((bool)Inherited) {
2370  setImplicit(isImplicitlyDeclared);
2371  if (Inherited)
2372  *getTrailingObjects<InheritedConstructor>() = Inherited;
2373  IsExplicitSpecified = isExplicitSpecified;
2374  }
2375 
2376 public:
2377  static CXXConstructorDecl *CreateDeserialized(ASTContext &C, unsigned ID,
2378  bool InheritsConstructor);
2379  static CXXConstructorDecl *
2380  Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc,
2381  const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo,
2382  bool isExplicit, bool isInline, bool isImplicitlyDeclared,
2383  bool isConstexpr,
2385 
2386  /// \brief Iterates through the member/base initializer list.
2388 
2389  /// \brief Iterates through the member/base initializer list.
2391 
2392  typedef llvm::iterator_range<init_iterator> init_range;
2393  typedef llvm::iterator_range<init_const_iterator> init_const_range;
2394 
2395  init_range inits() { return init_range(init_begin(), init_end()); }
2396  init_const_range inits() const {
2397  return init_const_range(init_begin(), init_end());
2398  }
2399 
2400  /// \brief Retrieve an iterator to the first initializer.
2401  init_iterator init_begin() {
2402  const auto *ConstThis = this;
2403  return const_cast<init_iterator>(ConstThis->init_begin());
2404  }
2405  /// \brief Retrieve an iterator to the first initializer.
2406  init_const_iterator init_begin() const;
2407 
2408  /// \brief Retrieve an iterator past the last initializer.
2409  init_iterator init_end() {
2410  return init_begin() + NumCtorInitializers;
2411  }
2412  /// \brief Retrieve an iterator past the last initializer.
2413  init_const_iterator init_end() const {
2414  return init_begin() + NumCtorInitializers;
2415  }
2416 
2417  typedef std::reverse_iterator<init_iterator> init_reverse_iterator;
2418  typedef std::reverse_iterator<init_const_iterator>
2420 
2421  init_reverse_iterator init_rbegin() {
2422  return init_reverse_iterator(init_end());
2423  }
2425  return init_const_reverse_iterator(init_end());
2426  }
2427 
2428  init_reverse_iterator init_rend() {
2429  return init_reverse_iterator(init_begin());
2430  }
2432  return init_const_reverse_iterator(init_begin());
2433  }
2434 
2435  /// \brief Determine the number of arguments used to initialize the member
2436  /// or base.
2437  unsigned getNumCtorInitializers() const {
2438  return NumCtorInitializers;
2439  }
2440 
2441  void setNumCtorInitializers(unsigned numCtorInitializers) {
2442  NumCtorInitializers = numCtorInitializers;
2443  }
2444 
2446  CtorInitializers = Initializers;
2447  }
2448 
2449  /// Whether this function is marked as explicit explicitly.
2450  bool isExplicitSpecified() const { return IsExplicitSpecified; }
2451 
2452  /// Whether this function is explicit.
2453  bool isExplicit() const {
2454  return getCanonicalDecl()->isExplicitSpecified();
2455  }
2456 
2457  /// \brief Determine whether this constructor is a delegating constructor.
2459  return (getNumCtorInitializers() == 1) &&
2460  init_begin()[0]->isDelegatingInitializer();
2461  }
2462 
2463  /// \brief When this constructor delegates to another, retrieve the target.
2464  CXXConstructorDecl *getTargetConstructor() const;
2465 
2466  /// Whether this constructor is a default
2467  /// constructor (C++ [class.ctor]p5), which can be used to
2468  /// default-initialize a class of this type.
2469  bool isDefaultConstructor() const;
2470 
2471  /// \brief Whether this constructor is a copy constructor (C++ [class.copy]p2,
2472  /// which can be used to copy the class.
2473  ///
2474  /// \p TypeQuals will be set to the qualifiers on the
2475  /// argument type. For example, \p TypeQuals would be set to \c
2476  /// Qualifiers::Const for the following copy constructor:
2477  ///
2478  /// \code
2479  /// class X {
2480  /// public:
2481  /// X(const X&);
2482  /// };
2483  /// \endcode
2484  bool isCopyConstructor(unsigned &TypeQuals) const;
2485 
2486  /// Whether this constructor is a copy
2487  /// constructor (C++ [class.copy]p2, which can be used to copy the
2488  /// class.
2489  bool isCopyConstructor() const {
2490  unsigned TypeQuals = 0;
2491  return isCopyConstructor(TypeQuals);
2492  }
2493 
2494  /// \brief Determine whether this constructor is a move constructor
2495  /// (C++11 [class.copy]p3), which can be used to move values of the class.
2496  ///
2497  /// \param TypeQuals If this constructor is a move constructor, will be set
2498  /// to the type qualifiers on the referent of the first parameter's type.
2499  bool isMoveConstructor(unsigned &TypeQuals) const;
2500 
2501  /// \brief Determine whether this constructor is a move constructor
2502  /// (C++11 [class.copy]p3), which can be used to move values of the class.
2503  bool isMoveConstructor() const {
2504  unsigned TypeQuals = 0;
2505  return isMoveConstructor(TypeQuals);
2506  }
2507 
2508  /// \brief Determine whether this is a copy or move constructor.
2509  ///
2510  /// \param TypeQuals Will be set to the type qualifiers on the reference
2511  /// parameter, if in fact this is a copy or move constructor.
2512  bool isCopyOrMoveConstructor(unsigned &TypeQuals) const;
2513 
2514  /// \brief Determine whether this a copy or move constructor.
2516  unsigned Quals;
2517  return isCopyOrMoveConstructor(Quals);
2518  }
2519 
2520  /// Whether this constructor is a
2521  /// converting constructor (C++ [class.conv.ctor]), which can be
2522  /// used for user-defined conversions.
2523  bool isConvertingConstructor(bool AllowExplicit) const;
2524 
2525  /// \brief Determine whether this is a member template specialization that
2526  /// would copy the object to itself. Such constructors are never used to copy
2527  /// an object.
2528  bool isSpecializationCopyingObject() const;
2529 
2530  /// \brief Determine whether this is an implicit constructor synthesized to
2531  /// model a call to a constructor inherited from a base class.
2532  bool isInheritingConstructor() const { return IsInheritingConstructor; }
2533 
2534  /// \brief Get the constructor that this inheriting constructor is based on.
2536  return IsInheritingConstructor ? *getTrailingObjects<InheritedConstructor>()
2538  }
2539 
2541  return cast<CXXConstructorDecl>(FunctionDecl::getCanonicalDecl());
2542  }
2544  return const_cast<CXXConstructorDecl*>(this)->getCanonicalDecl();
2545  }
2546 
2547  // Implement isa/cast/dyncast/etc.
2548  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2549  static bool classofKind(Kind K) { return K == CXXConstructor; }
2550 
2551  friend class ASTDeclReader;
2552  friend class ASTDeclWriter;
2554 };
2555 
2556 /// \brief Represents a C++ destructor within a class.
2557 ///
2558 /// For example:
2559 ///
2560 /// \code
2561 /// class X {
2562 /// public:
2563 /// ~X(); // represented by a CXXDestructorDecl.
2564 /// };
2565 /// \endcode
2567  void anchor() override;
2568 
2569  FunctionDecl *OperatorDelete;
2570 
2572  const DeclarationNameInfo &NameInfo,
2573  QualType T, TypeSourceInfo *TInfo,
2574  bool isInline, bool isImplicitlyDeclared)
2575  : CXXMethodDecl(CXXDestructor, C, RD, StartLoc, NameInfo, T, TInfo,
2576  SC_None, isInline, /*isConstexpr=*/false, SourceLocation()),
2577  OperatorDelete(nullptr) {
2578  setImplicit(isImplicitlyDeclared);
2579  }
2580 
2581 public:
2583  SourceLocation StartLoc,
2584  const DeclarationNameInfo &NameInfo,
2585  QualType T, TypeSourceInfo* TInfo,
2586  bool isInline,
2587  bool isImplicitlyDeclared);
2588  static CXXDestructorDecl *CreateDeserialized(ASTContext & C, unsigned ID);
2589 
2590  void setOperatorDelete(FunctionDecl *OD);
2592  return getCanonicalDecl()->OperatorDelete;
2593  }
2594 
2596  return cast<CXXDestructorDecl>(FunctionDecl::getCanonicalDecl());
2597  }
2599  return const_cast<CXXDestructorDecl*>(this)->getCanonicalDecl();
2600  }
2601 
2602  // Implement isa/cast/dyncast/etc.
2603  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2604  static bool classofKind(Kind K) { return K == CXXDestructor; }
2605 
2606  friend class ASTDeclReader;
2607  friend class ASTDeclWriter;
2608 };
2609 
2610 /// \brief Represents a C++ conversion function within a class.
2611 ///
2612 /// For example:
2613 ///
2614 /// \code
2615 /// class X {
2616 /// public:
2617 /// operator bool();
2618 /// };
2619 /// \endcode
2621  void anchor() override;
2622 
2624  const DeclarationNameInfo &NameInfo, QualType T,
2625  TypeSourceInfo *TInfo, bool isInline,
2626  bool isExplicitSpecified, bool isConstexpr,
2627  SourceLocation EndLocation)
2628  : CXXMethodDecl(CXXConversion, C, RD, StartLoc, NameInfo, T, TInfo,
2629  SC_None, isInline, isConstexpr, EndLocation) {
2630  IsExplicitSpecified = isExplicitSpecified;
2631  }
2632 
2633 public:
2635  SourceLocation StartLoc,
2636  const DeclarationNameInfo &NameInfo,
2637  QualType T, TypeSourceInfo *TInfo,
2638  bool isInline, bool isExplicit,
2639  bool isConstexpr,
2640  SourceLocation EndLocation);
2641  static CXXConversionDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2642 
2643  /// Whether this function is marked as explicit explicitly.
2644  bool isExplicitSpecified() const { return IsExplicitSpecified; }
2645 
2646  /// Whether this function is explicit.
2647  bool isExplicit() const {
2648  return getCanonicalDecl()->isExplicitSpecified();
2649  }
2650 
2651  /// \brief Returns the type that this conversion function is converting to.
2653  return getType()->getAs<FunctionType>()->getReturnType();
2654  }
2655 
2656  /// \brief Determine whether this conversion function is a conversion from
2657  /// a lambda closure type to a block pointer.
2658  bool isLambdaToBlockPointerConversion() const;
2659 
2661  return cast<CXXConversionDecl>(FunctionDecl::getCanonicalDecl());
2662  }
2664  return const_cast<CXXConversionDecl*>(this)->getCanonicalDecl();
2665  }
2666 
2667  // Implement isa/cast/dyncast/etc.
2668  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2669  static bool classofKind(Kind K) { return K == CXXConversion; }
2670 
2671  friend class ASTDeclReader;
2672  friend class ASTDeclWriter;
2673 };
2674 
2675 /// \brief Represents a linkage specification.
2676 ///
2677 /// For example:
2678 /// \code
2679 /// extern "C" void foo();
2680 /// \endcode
2681 class LinkageSpecDecl : public Decl, public DeclContext {
2682  virtual void anchor();
2683 public:
2684  /// \brief Represents the language in a linkage specification.
2685  ///
2686  /// The values are part of the serialization ABI for
2687  /// ASTs and cannot be changed without altering that ABI. To help
2688  /// ensure a stable ABI for this, we choose the DW_LANG_ encodings
2689  /// from the dwarf standard.
2691  lang_c = /* DW_LANG_C */ 0x0002,
2692  lang_cxx = /* DW_LANG_C_plus_plus */ 0x0004
2693  };
2694 private:
2695  /// \brief The language for this linkage specification.
2696  unsigned Language : 3;
2697  /// \brief True if this linkage spec has braces.
2698  ///
2699  /// This is needed so that hasBraces() returns the correct result while the
2700  /// linkage spec body is being parsed. Once RBraceLoc has been set this is
2701  /// not used, so it doesn't need to be serialized.
2702  unsigned HasBraces : 1;
2703  /// \brief The source location for the extern keyword.
2704  SourceLocation ExternLoc;
2705  /// \brief The source location for the right brace (if valid).
2706  SourceLocation RBraceLoc;
2707 
2709  SourceLocation LangLoc, LanguageIDs lang, bool HasBraces)
2710  : Decl(LinkageSpec, DC, LangLoc), DeclContext(LinkageSpec),
2711  Language(lang), HasBraces(HasBraces), ExternLoc(ExternLoc),
2712  RBraceLoc(SourceLocation()) { }
2713 
2714 public:
2715  static LinkageSpecDecl *Create(ASTContext &C, DeclContext *DC,
2716  SourceLocation ExternLoc,
2717  SourceLocation LangLoc, LanguageIDs Lang,
2718  bool HasBraces);
2719  static LinkageSpecDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2720 
2721  /// \brief Return the language specified by this linkage specification.
2722  LanguageIDs getLanguage() const { return LanguageIDs(Language); }
2723  /// \brief Set the language specified by this linkage specification.
2724  void setLanguage(LanguageIDs L) { Language = L; }
2725 
2726  /// \brief Determines whether this linkage specification had braces in
2727  /// its syntactic form.
2728  bool hasBraces() const {
2729  assert(!RBraceLoc.isValid() || HasBraces);
2730  return HasBraces;
2731  }
2732 
2733  SourceLocation getExternLoc() const { return ExternLoc; }
2734  SourceLocation getRBraceLoc() const { return RBraceLoc; }
2735  void setExternLoc(SourceLocation L) { ExternLoc = L; }
2737  RBraceLoc = L;
2738  HasBraces = RBraceLoc.isValid();
2739  }
2740 
2741  SourceLocation getLocEnd() const LLVM_READONLY {
2742  if (hasBraces())
2743  return getRBraceLoc();
2744  // No braces: get the end location of the (only) declaration in context
2745  // (if present).
2746  return decls_empty() ? getLocation() : decls_begin()->getLocEnd();
2747  }
2748 
2749  SourceRange getSourceRange() const override LLVM_READONLY {
2750  return SourceRange(ExternLoc, getLocEnd());
2751  }
2752 
2753  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2754  static bool classofKind(Kind K) { return K == LinkageSpec; }
2756  return static_cast<DeclContext *>(const_cast<LinkageSpecDecl*>(D));
2757  }
2759  return static_cast<LinkageSpecDecl *>(const_cast<DeclContext*>(DC));
2760  }
2761 };
2762 
2763 /// \brief Represents C++ using-directive.
2764 ///
2765 /// For example:
2766 /// \code
2767 /// using namespace std;
2768 /// \endcode
2769 ///
2770 /// \note UsingDirectiveDecl should be Decl not NamedDecl, but we provide
2771 /// artificial names for all using-directives in order to store
2772 /// them in DeclContext effectively.
2774  void anchor() override;
2775  /// \brief The location of the \c using keyword.
2776  SourceLocation UsingLoc;
2777 
2778  /// \brief The location of the \c namespace keyword.
2779  SourceLocation NamespaceLoc;
2780 
2781  /// \brief The nested-name-specifier that precedes the namespace.
2782  NestedNameSpecifierLoc QualifierLoc;
2783 
2784  /// \brief The namespace nominated by this using-directive.
2785  NamedDecl *NominatedNamespace;
2786 
2787  /// Enclosing context containing both using-directive and nominated
2788  /// namespace.
2789  DeclContext *CommonAncestor;
2790 
2791  /// \brief Returns special DeclarationName used by using-directives.
2792  ///
2793  /// This is only used by DeclContext for storing UsingDirectiveDecls in
2794  /// its lookup structure.
2795  static DeclarationName getName() {
2797  }
2798 
2800  SourceLocation NamespcLoc,
2801  NestedNameSpecifierLoc QualifierLoc,
2802  SourceLocation IdentLoc,
2803  NamedDecl *Nominated,
2804  DeclContext *CommonAncestor)
2805  : NamedDecl(UsingDirective, DC, IdentLoc, getName()), UsingLoc(UsingLoc),
2806  NamespaceLoc(NamespcLoc), QualifierLoc(QualifierLoc),
2807  NominatedNamespace(Nominated), CommonAncestor(CommonAncestor) { }
2808 
2809 public:
2810  /// \brief Retrieve the nested-name-specifier that qualifies the
2811  /// name of the namespace, with source-location information.
2812  NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
2813 
2814  /// \brief Retrieve the nested-name-specifier that qualifies the
2815  /// name of the namespace.
2817  return QualifierLoc.getNestedNameSpecifier();
2818  }
2819 
2820  NamedDecl *getNominatedNamespaceAsWritten() { return NominatedNamespace; }
2822  return NominatedNamespace;
2823  }
2824 
2825  /// \brief Returns the namespace nominated by this using-directive.
2826  NamespaceDecl *getNominatedNamespace();
2827 
2829  return const_cast<UsingDirectiveDecl*>(this)->getNominatedNamespace();
2830  }
2831 
2832  /// \brief Returns the common ancestor context of this using-directive and
2833  /// its nominated namespace.
2834  DeclContext *getCommonAncestor() { return CommonAncestor; }
2835  const DeclContext *getCommonAncestor() const { return CommonAncestor; }
2836 
2837  /// \brief Return the location of the \c using keyword.
2838  SourceLocation getUsingLoc() const { return UsingLoc; }
2839 
2840  // FIXME: Could omit 'Key' in name.
2841  /// \brief Returns the location of the \c namespace keyword.
2842  SourceLocation getNamespaceKeyLocation() const { return NamespaceLoc; }
2843 
2844  /// \brief Returns the location of this using declaration's identifier.
2845  SourceLocation getIdentLocation() const { return getLocation(); }
2846 
2848  SourceLocation UsingLoc,
2849  SourceLocation NamespaceLoc,
2850  NestedNameSpecifierLoc QualifierLoc,
2851  SourceLocation IdentLoc,
2852  NamedDecl *Nominated,
2853  DeclContext *CommonAncestor);
2854  static UsingDirectiveDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2855 
2856  SourceRange getSourceRange() const override LLVM_READONLY {
2857  return SourceRange(UsingLoc, getLocation());
2858  }
2859 
2860  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2861  static bool classofKind(Kind K) { return K == UsingDirective; }
2862 
2863  // Friend for getUsingDirectiveName.
2864  friend class DeclContext;
2865 
2866  friend class ASTDeclReader;
2867 };
2868 
2869 /// \brief Represents a C++ namespace alias.
2870 ///
2871 /// For example:
2872 ///
2873 /// \code
2874 /// namespace Foo = Bar;
2875 /// \endcode
2877  public Redeclarable<NamespaceAliasDecl> {
2878  void anchor() override;
2879 
2880  /// \brief The location of the \c namespace keyword.
2881  SourceLocation NamespaceLoc;
2882 
2883  /// \brief The location of the namespace's identifier.
2884  ///
2885  /// This is accessed by TargetNameLoc.
2886  SourceLocation IdentLoc;
2887 
2888  /// \brief The nested-name-specifier that precedes the namespace.
2889  NestedNameSpecifierLoc QualifierLoc;
2890 
2891  /// \brief The Decl that this alias points to, either a NamespaceDecl or
2892  /// a NamespaceAliasDecl.
2893  NamedDecl *Namespace;
2894 
2896  SourceLocation NamespaceLoc, SourceLocation AliasLoc,
2897  IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc,
2898  SourceLocation IdentLoc, NamedDecl *Namespace)
2899  : NamedDecl(NamespaceAlias, DC, AliasLoc, Alias), redeclarable_base(C),
2900  NamespaceLoc(NamespaceLoc), IdentLoc(IdentLoc),
2901  QualifierLoc(QualifierLoc), Namespace(Namespace) {}
2902 
2904  NamespaceAliasDecl *getNextRedeclarationImpl() override;
2905  NamespaceAliasDecl *getPreviousDeclImpl() override;
2906  NamespaceAliasDecl *getMostRecentDeclImpl() override;
2907 
2908  friend class ASTDeclReader;
2909 
2910 public:
2912  SourceLocation NamespaceLoc,
2913  SourceLocation AliasLoc,
2914  IdentifierInfo *Alias,
2915  NestedNameSpecifierLoc QualifierLoc,
2916  SourceLocation IdentLoc,
2917  NamedDecl *Namespace);
2918 
2919  static NamespaceAliasDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2920 
2922  typedef redeclarable_base::redecl_iterator redecl_iterator;
2923  using redeclarable_base::redecls_begin;
2924  using redeclarable_base::redecls_end;
2925  using redeclarable_base::redecls;
2926  using redeclarable_base::getPreviousDecl;
2927  using redeclarable_base::getMostRecentDecl;
2928 
2930  return getFirstDecl();
2931  }
2933  return getFirstDecl();
2934  }
2935 
2936  /// \brief Retrieve the nested-name-specifier that qualifies the
2937  /// name of the namespace, with source-location information.
2938  NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
2939 
2940  /// \brief Retrieve the nested-name-specifier that qualifies the
2941  /// name of the namespace.
2943  return QualifierLoc.getNestedNameSpecifier();
2944  }
2945 
2946  /// \brief Retrieve the namespace declaration aliased by this directive.
2948  if (NamespaceAliasDecl *AD = dyn_cast<NamespaceAliasDecl>(Namespace))
2949  return AD->getNamespace();
2950 
2951  return cast<NamespaceDecl>(Namespace);
2952  }
2953 
2954  const NamespaceDecl *getNamespace() const {
2955  return const_cast<NamespaceAliasDecl*>(this)->getNamespace();
2956  }
2957 
2958  /// Returns the location of the alias name, i.e. 'foo' in
2959  /// "namespace foo = ns::bar;".
2960  SourceLocation getAliasLoc() const { return getLocation(); }
2961 
2962  /// Returns the location of the \c namespace keyword.
2963  SourceLocation getNamespaceLoc() const { return NamespaceLoc; }
2964 
2965  /// Returns the location of the identifier in the named namespace.
2966  SourceLocation getTargetNameLoc() const { return IdentLoc; }
2967 
2968  /// \brief Retrieve the namespace that this alias refers to, which
2969  /// may either be a NamespaceDecl or a NamespaceAliasDecl.
2970  NamedDecl *getAliasedNamespace() const { return Namespace; }
2971 
2972  SourceRange getSourceRange() const override LLVM_READONLY {
2973  return SourceRange(NamespaceLoc, IdentLoc);
2974  }
2975 
2976  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2977  static bool classofKind(Kind K) { return K == NamespaceAlias; }
2978 };
2979 
2980 /// \brief Represents a shadow declaration introduced into a scope by a
2981 /// (resolved) using declaration.
2982 ///
2983 /// For example,
2984 /// \code
2985 /// namespace A {
2986 /// void foo();
2987 /// }
2988 /// namespace B {
2989 /// using A::foo; // <- a UsingDecl
2990 /// // Also creates a UsingShadowDecl for A::foo() in B
2991 /// }
2992 /// \endcode
2993 class UsingShadowDecl : public NamedDecl, public Redeclarable<UsingShadowDecl> {
2994  void anchor() override;
2995 
2996  /// The referenced declaration.
2997  NamedDecl *Underlying;
2998 
2999  /// \brief The using declaration which introduced this decl or the next using
3000  /// shadow declaration contained in the aforementioned using declaration.
3001  NamedDecl *UsingOrNextShadow;
3002  friend class UsingDecl;
3003 
3005  UsingShadowDecl *getNextRedeclarationImpl() override {
3006  return getNextRedeclaration();
3007  }
3008  UsingShadowDecl *getPreviousDeclImpl() override {
3009  return getPreviousDecl();
3010  }
3011  UsingShadowDecl *getMostRecentDeclImpl() override {
3012  return getMostRecentDecl();
3013  }
3014 
3015 protected:
3017  UsingDecl *Using, NamedDecl *Target);
3019 
3020 public:
3022  SourceLocation Loc, UsingDecl *Using,
3023  NamedDecl *Target) {
3024  return new (C, DC) UsingShadowDecl(UsingShadow, C, DC, Loc, Using, Target);
3025  }
3026 
3027  static UsingShadowDecl *CreateDeserialized(ASTContext &C, unsigned ID);
3028 
3030  typedef redeclarable_base::redecl_iterator redecl_iterator;
3031  using redeclarable_base::redecls_begin;
3032  using redeclarable_base::redecls_end;
3033  using redeclarable_base::redecls;
3034  using redeclarable_base::getPreviousDecl;
3035  using redeclarable_base::getMostRecentDecl;
3036  using redeclarable_base::isFirstDecl;
3037 
3039  return getFirstDecl();
3040  }
3042  return getFirstDecl();
3043  }
3044 
3045  /// \brief Gets the underlying declaration which has been brought into the
3046  /// local scope.
3047  NamedDecl *getTargetDecl() const { return Underlying; }
3048 
3049  /// \brief Sets the underlying declaration which has been brought into the
3050  /// local scope.
3052  assert(ND && "Target decl is null!");
3053  Underlying = ND;
3055  }
3056 
3057  /// \brief Gets the using declaration to which this declaration is tied.
3058  UsingDecl *getUsingDecl() const;
3059 
3060  /// \brief The next using shadow declaration contained in the shadow decl
3061  /// chain of the using declaration which introduced this decl.
3063  return dyn_cast_or_null<UsingShadowDecl>(UsingOrNextShadow);
3064  }
3065 
3066  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3067  static bool classofKind(Kind K) {
3068  return K == Decl::UsingShadow || K == Decl::ConstructorUsingShadow;
3069  }
3070 
3071  friend class ASTDeclReader;
3072  friend class ASTDeclWriter;
3073 };
3074 
3075 /// \brief Represents a shadow constructor declaration introduced into a
3076 /// class by a C++11 using-declaration that names a constructor.
3077 ///
3078 /// For example:
3079 /// \code
3080 /// struct Base { Base(int); };
3081 /// struct Derived {
3082 /// using Base::Base; // creates a UsingDecl and a ConstructorUsingShadowDecl
3083 /// };
3084 /// \endcode
3086  void anchor() override;
3087 
3088  /// \brief If this constructor using declaration inherted the constructor
3089  /// from an indirect base class, this is the ConstructorUsingShadowDecl
3090  /// in the named direct base class from which the declaration was inherited.
3091  ConstructorUsingShadowDecl *NominatedBaseClassShadowDecl;
3092 
3093  /// \brief If this constructor using declaration inherted the constructor
3094  /// from an indirect base class, this is the ConstructorUsingShadowDecl
3095  /// that will be used to construct the unique direct or virtual base class
3096  /// that receives the constructor arguments.
3097  ConstructorUsingShadowDecl *ConstructedBaseClassShadowDecl;
3098 
3099  /// \brief \c true if the constructor ultimately named by this using shadow
3100  /// declaration is within a virtual base class subobject of the class that
3101  /// contains this declaration.
3102  unsigned IsVirtual : 1;
3103 
3105  UsingDecl *Using, NamedDecl *Target,
3106  bool TargetInVirtualBase)
3107  : UsingShadowDecl(ConstructorUsingShadow, C, DC, Loc, Using,
3108  Target->getUnderlyingDecl()),
3109  NominatedBaseClassShadowDecl(
3110  dyn_cast<ConstructorUsingShadowDecl>(Target)),
3111  ConstructedBaseClassShadowDecl(NominatedBaseClassShadowDecl),
3112  IsVirtual(TargetInVirtualBase) {
3113  // If we found a constructor that chains to a constructor for a virtual
3114  // base, we should directly call that virtual base constructor instead.
3115  // FIXME: This logic belongs in Sema.
3116  if (NominatedBaseClassShadowDecl &&
3117  NominatedBaseClassShadowDecl->constructsVirtualBase()) {
3118  ConstructedBaseClassShadowDecl =
3119  NominatedBaseClassShadowDecl->ConstructedBaseClassShadowDecl;
3120  IsVirtual = true;
3121  }
3122  }
3124  : UsingShadowDecl(ConstructorUsingShadow, C, Empty),
3125  NominatedBaseClassShadowDecl(), ConstructedBaseClassShadowDecl(),
3126  IsVirtual(false) {}
3127 
3128 public:
3130  SourceLocation Loc,
3131  UsingDecl *Using, NamedDecl *Target,
3132  bool IsVirtual);
3133  static ConstructorUsingShadowDecl *CreateDeserialized(ASTContext &C,
3134  unsigned ID);
3135 
3136  /// Returns the parent of this using shadow declaration, which
3137  /// is the class in which this is declared.
3138  //@{
3139  const CXXRecordDecl *getParent() const {
3140  return cast<CXXRecordDecl>(getDeclContext());
3141  }
3143  return cast<CXXRecordDecl>(getDeclContext());
3144  }
3145  //@}
3146 
3147  /// \brief Get the inheriting constructor declaration for the direct base
3148  /// class from which this using shadow declaration was inherited, if there is
3149  /// one. This can be different for each redeclaration of the same shadow decl.
3151  return NominatedBaseClassShadowDecl;
3152  }
3153 
3154  /// \brief Get the inheriting constructor declaration for the base class
3155  /// for which we don't have an explicit initializer, if there is one.
3157  return ConstructedBaseClassShadowDecl;
3158  }
3159 
3160  /// \brief Get the base class that was named in the using declaration. This
3161  /// can be different for each redeclaration of this same shadow decl.
3162  CXXRecordDecl *getNominatedBaseClass() const;
3163 
3164  /// \brief Get the base class whose constructor or constructor shadow
3165  /// declaration is passed the constructor arguments.
3167  return cast<CXXRecordDecl>((ConstructedBaseClassShadowDecl
3168  ? ConstructedBaseClassShadowDecl
3169  : getTargetDecl())
3170  ->getDeclContext());
3171  }
3172 
3173  /// \brief Returns \c true if the constructed base class is a virtual base
3174  /// class subobject of this declaration's class.
3175  bool constructsVirtualBase() const {
3176  return IsVirtual;
3177  }
3178 
3179  /// \brief Get the constructor or constructor template in the derived class
3180  /// correspnding to this using shadow declaration, if it has been implicitly
3181  /// declared already.
3182  CXXConstructorDecl *getConstructor() const;
3183  void setConstructor(NamedDecl *Ctor);
3184 
3185  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3186  static bool classofKind(Kind K) { return K == ConstructorUsingShadow; }
3187 
3188  friend class ASTDeclReader;
3189  friend class ASTDeclWriter;
3190 };
3191 
3192 /// \brief Represents a C++ using-declaration.
3193 ///
3194 /// For example:
3195 /// \code
3196 /// using someNameSpace::someIdentifier;
3197 /// \endcode
3198 class UsingDecl : public NamedDecl, public Mergeable<UsingDecl> {
3199  void anchor() override;
3200 
3201  /// \brief The source location of the 'using' keyword itself.
3202  SourceLocation UsingLocation;
3203 
3204  /// \brief The nested-name-specifier that precedes the name.
3205  NestedNameSpecifierLoc QualifierLoc;
3206 
3207  /// \brief Provides source/type location info for the declaration name
3208  /// embedded in the ValueDecl base class.
3209  DeclarationNameLoc DNLoc;
3210 
3211  /// \brief The first shadow declaration of the shadow decl chain associated
3212  /// with this using declaration.
3213  ///
3214  /// The bool member of the pair store whether this decl has the \c typename
3215  /// keyword.
3216  llvm::PointerIntPair<UsingShadowDecl *, 1, bool> FirstUsingShadow;
3217 
3219  NestedNameSpecifierLoc QualifierLoc,
3220  const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
3221  : NamedDecl(Using, DC, NameInfo.getLoc(), NameInfo.getName()),
3222  UsingLocation(UL), QualifierLoc(QualifierLoc),
3223  DNLoc(NameInfo.getInfo()), FirstUsingShadow(nullptr, HasTypenameKeyword) {
3224  }
3225 
3226 public:
3227  /// \brief Return the source location of the 'using' keyword.
3228  SourceLocation getUsingLoc() const { return UsingLocation; }
3229 
3230  /// \brief Set the source location of the 'using' keyword.
3231  void setUsingLoc(SourceLocation L) { UsingLocation = L; }
3232 
3233  /// \brief Retrieve the nested-name-specifier that qualifies the name,
3234  /// with source-location information.
3235  NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
3236 
3237  /// \brief Retrieve the nested-name-specifier that qualifies the name.
3239  return QualifierLoc.getNestedNameSpecifier();
3240  }
3241 
3243  return DeclarationNameInfo(getDeclName(), getLocation(), DNLoc);
3244  }
3245 
3246  /// \brief Return true if it is a C++03 access declaration (no 'using').
3247  bool isAccessDeclaration() const { return UsingLocation.isInvalid(); }
3248 
3249  /// \brief Return true if the using declaration has 'typename'.
3250  bool hasTypename() const { return FirstUsingShadow.getInt(); }
3251 
3252  /// \brief Sets whether the using declaration has 'typename'.
3253  void setTypename(bool TN) { FirstUsingShadow.setInt(TN); }
3254 
3255  /// \brief Iterates through the using shadow declarations associated with
3256  /// this using declaration.
3258  /// \brief The current using shadow declaration.
3259  UsingShadowDecl *Current;
3260 
3261  public:
3265  typedef std::forward_iterator_tag iterator_category;
3267 
3268  shadow_iterator() : Current(nullptr) { }
3269  explicit shadow_iterator(UsingShadowDecl *C) : Current(C) { }
3270 
3271  reference operator*() const { return Current; }
3272  pointer operator->() const { return Current; }
3273 
3275  Current = Current->getNextUsingShadowDecl();
3276  return *this;
3277  }
3278 
3280  shadow_iterator tmp(*this);
3281  ++(*this);
3282  return tmp;
3283  }
3284 
3286  return x.Current == y.Current;
3287  }
3289  return x.Current != y.Current;
3290  }
3291  };
3292 
3293  typedef llvm::iterator_range<shadow_iterator> shadow_range;
3294 
3295  shadow_range shadows() const {
3296  return shadow_range(shadow_begin(), shadow_end());
3297  }
3299  return shadow_iterator(FirstUsingShadow.getPointer());
3300  }
3302 
3303  /// \brief Return the number of shadowed declarations associated with this
3304  /// using declaration.
3305  unsigned shadow_size() const {
3306  return std::distance(shadow_begin(), shadow_end());
3307  }
3308 
3309  void addShadowDecl(UsingShadowDecl *S);
3310  void removeShadowDecl(UsingShadowDecl *S);
3311 
3312  static UsingDecl *Create(ASTContext &C, DeclContext *DC,
3313  SourceLocation UsingL,
3314  NestedNameSpecifierLoc QualifierLoc,
3315  const DeclarationNameInfo &NameInfo,
3316  bool HasTypenameKeyword);
3317 
3318  static UsingDecl *CreateDeserialized(ASTContext &C, unsigned ID);
3319 
3320  SourceRange getSourceRange() const override LLVM_READONLY;
3321 
3322  /// Retrieves the canonical declaration of this declaration.
3323  UsingDecl *getCanonicalDecl() override { return getFirstDecl(); }
3324  const UsingDecl *getCanonicalDecl() const { return getFirstDecl(); }
3325 
3326  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3327  static bool classofKind(Kind K) { return K == Using; }
3328 
3329  friend class ASTDeclReader;
3330  friend class ASTDeclWriter;
3331 };
3332 
3333 /// Represents a pack of using declarations that a single
3334 /// using-declarator pack-expanded into.
3335 ///
3336 /// \code
3337 /// template<typename ...T> struct X : T... {
3338 /// using T::operator()...;
3339 /// using T::operator T...;
3340 /// };
3341 /// \endcode
3342 ///
3343 /// In the second case above, the UsingPackDecl will have the name
3344 /// 'operator T' (which contains an unexpanded pack), but the individual
3345 /// UsingDecls and UsingShadowDecls will have more reasonable names.
3346 class UsingPackDecl final
3347  : public NamedDecl, public Mergeable<UsingPackDecl>,
3348  private llvm::TrailingObjects<UsingPackDecl, NamedDecl *> {
3349  void anchor() override;
3350 
3351  /// The UnresolvedUsingValueDecl or UnresolvedUsingTypenameDecl from
3352  /// which this waas instantiated.
3353  NamedDecl *InstantiatedFrom;
3354 
3355  /// The number of using-declarations created by this pack expansion.
3356  unsigned NumExpansions;
3357 
3358  UsingPackDecl(DeclContext *DC, NamedDecl *InstantiatedFrom,
3359  ArrayRef<NamedDecl *> UsingDecls)
3360  : NamedDecl(UsingPack, DC,
3361  InstantiatedFrom ? InstantiatedFrom->getLocation()
3362  : SourceLocation(),
3363  InstantiatedFrom ? InstantiatedFrom->getDeclName()
3364  : DeclarationName()),
3365  InstantiatedFrom(InstantiatedFrom), NumExpansions(UsingDecls.size()) {
3366  std::uninitialized_copy(UsingDecls.begin(), UsingDecls.end(),
3367  getTrailingObjects<NamedDecl *>());
3368  }
3369 
3370 public:
3371  /// Get the using declaration from which this was instantiated. This will
3372  /// always be an UnresolvedUsingValueDecl or an UnresolvedUsingTypenameDecl
3373  /// that is a pack expansion.
3374  NamedDecl *getInstantiatedFromUsingDecl() const { return InstantiatedFrom; }
3375 
3376  /// Get the set of using declarations that this pack expanded into. Note that
3377  /// some of these may still be unresolved.
3379  return llvm::makeArrayRef(getTrailingObjects<NamedDecl *>(), NumExpansions);
3380  }
3381 
3382  static UsingPackDecl *Create(ASTContext &C, DeclContext *DC,
3383  NamedDecl *InstantiatedFrom,
3384  ArrayRef<NamedDecl *> UsingDecls);
3385 
3386  static UsingPackDecl *CreateDeserialized(ASTContext &C, unsigned ID,
3387  unsigned NumExpansions);
3388 
3389  SourceRange getSourceRange() const override LLVM_READONLY {
3390  return InstantiatedFrom->getSourceRange();
3391  }
3392 
3393  UsingPackDecl *getCanonicalDecl() override { return getFirstDecl(); }
3394  const UsingPackDecl *getCanonicalDecl() const { return getFirstDecl(); }
3395 
3396  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3397  static bool classofKind(Kind K) { return K == UsingPack; }
3398 
3399  friend class ASTDeclReader;
3400  friend class ASTDeclWriter;
3402 };
3403 
3404 /// \brief Represents a dependent using declaration which was not marked with
3405 /// \c typename.
3406 ///
3407 /// Unlike non-dependent using declarations, these *only* bring through
3408 /// non-types; otherwise they would break two-phase lookup.
3409 ///
3410 /// \code
3411 /// template <class T> class A : public Base<T> {
3412 /// using Base<T>::foo;
3413 /// };
3414 /// \endcode
3416  public Mergeable<UnresolvedUsingValueDecl> {
3417  void anchor() override;
3418 
3419  /// \brief The source location of the 'using' keyword
3420  SourceLocation UsingLocation;
3421 
3422  /// \brief If this is a pack expansion, the location of the '...'.
3423  SourceLocation EllipsisLoc;
3424 
3425  /// \brief The nested-name-specifier that precedes the name.
3426  NestedNameSpecifierLoc QualifierLoc;
3427 
3428  /// \brief Provides source/type location info for the declaration name
3429  /// embedded in the ValueDecl base class.
3430  DeclarationNameLoc DNLoc;
3431 
3433  SourceLocation UsingLoc,
3434  NestedNameSpecifierLoc QualifierLoc,
3435  const DeclarationNameInfo &NameInfo,
3436  SourceLocation EllipsisLoc)
3437  : ValueDecl(UnresolvedUsingValue, DC,
3438  NameInfo.getLoc(), NameInfo.getName(), Ty),
3439  UsingLocation(UsingLoc), EllipsisLoc(EllipsisLoc),
3440  QualifierLoc(QualifierLoc), DNLoc(NameInfo.getInfo())
3441  { }
3442 
3443 public:
3444  /// \brief Returns the source location of the 'using' keyword.
3445  SourceLocation getUsingLoc() const { return UsingLocation; }
3446 
3447  /// \brief Set the source location of the 'using' keyword.
3448  void setUsingLoc(SourceLocation L) { UsingLocation = L; }
3449 
3450  /// \brief Return true if it is a C++03 access declaration (no 'using').
3451  bool isAccessDeclaration() const { return UsingLocation.isInvalid(); }
3452 
3453  /// \brief Retrieve the nested-name-specifier that qualifies the name,
3454  /// with source-location information.
3455  NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
3456 
3457  /// \brief Retrieve the nested-name-specifier that qualifies the name.
3459  return QualifierLoc.getNestedNameSpecifier();
3460  }
3461 
3463  return DeclarationNameInfo(getDeclName(), getLocation(), DNLoc);
3464  }
3465 
3466  /// \brief Determine whether this is a pack expansion.
3467  bool isPackExpansion() const {
3468  return EllipsisLoc.isValid();
3469  }
3470 
3471  /// \brief Get the location of the ellipsis if this is a pack expansion.
3473  return EllipsisLoc;
3474  }
3475 
3476  static UnresolvedUsingValueDecl *
3477  Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc,
3478  NestedNameSpecifierLoc QualifierLoc,
3479  const DeclarationNameInfo &NameInfo, SourceLocation EllipsisLoc);
3480 
3481  static UnresolvedUsingValueDecl *
3482  CreateDeserialized(ASTContext &C, unsigned ID);
3483 
3484  SourceRange getSourceRange() const override LLVM_READONLY;
3485 
3486  /// Retrieves the canonical declaration of this declaration.
3488  return getFirstDecl();
3489  }
3491  return getFirstDecl();
3492  }
3493 
3494  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3495  static bool classofKind(Kind K) { return K == UnresolvedUsingValue; }
3496 
3497  friend class ASTDeclReader;
3498  friend class ASTDeclWriter;
3499 };
3500 
3501 /// \brief Represents a dependent using declaration which was marked with
3502 /// \c typename.
3503 ///
3504 /// \code
3505 /// template <class T> class A : public Base<T> {
3506 /// using typename Base<T>::foo;
3507 /// };
3508 /// \endcode
3509 ///
3510 /// The type associated with an unresolved using typename decl is
3511 /// currently always a typename type.
3513  : public TypeDecl,
3514  public Mergeable<UnresolvedUsingTypenameDecl> {
3515  void anchor() override;
3516 
3517  /// \brief The source location of the 'typename' keyword
3518  SourceLocation TypenameLocation;
3519 
3520  /// \brief If this is a pack expansion, the location of the '...'.
3521  SourceLocation EllipsisLoc;
3522 
3523  /// \brief The nested-name-specifier that precedes the name.
3524  NestedNameSpecifierLoc QualifierLoc;
3525 
3527  SourceLocation TypenameLoc,
3528  NestedNameSpecifierLoc QualifierLoc,
3529  SourceLocation TargetNameLoc,
3530  IdentifierInfo *TargetName,
3531  SourceLocation EllipsisLoc)
3532  : TypeDecl(UnresolvedUsingTypename, DC, TargetNameLoc, TargetName,
3533  UsingLoc),
3534  TypenameLocation(TypenameLoc), EllipsisLoc(EllipsisLoc),
3535  QualifierLoc(QualifierLoc) { }
3536 
3537  friend class ASTDeclReader;
3538 
3539 public:
3540  /// \brief Returns the source location of the 'using' keyword.
3541  SourceLocation getUsingLoc() const { return getLocStart(); }
3542 
3543  /// \brief Returns the source location of the 'typename' keyword.
3544  SourceLocation getTypenameLoc() const { return TypenameLocation; }
3545 
3546  /// \brief Retrieve the nested-name-specifier that qualifies the name,
3547  /// with source-location information.
3548  NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
3549 
3550  /// \brief Retrieve the nested-name-specifier that qualifies the name.
3552  return QualifierLoc.getNestedNameSpecifier();
3553  }
3554 
3556  return DeclarationNameInfo(getDeclName(), getLocation());
3557  }
3558 
3559  /// \brief Determine whether this is a pack expansion.
3560  bool isPackExpansion() const {
3561  return EllipsisLoc.isValid();
3562  }
3563 
3564  /// \brief Get the location of the ellipsis if this is a pack expansion.
3566  return EllipsisLoc;
3567  }
3568 
3570  Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc,
3571  SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc,
3572  SourceLocation TargetNameLoc, DeclarationName TargetName,
3573  SourceLocation EllipsisLoc);
3574 
3576  CreateDeserialized(ASTContext &C, unsigned ID);
3577 
3578  /// Retrieves the canonical declaration of this declaration.
3580  return getFirstDecl();
3581  }
3583  return getFirstDecl();
3584  }
3585 
3586  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3587  static bool classofKind(Kind K) { return K == UnresolvedUsingTypename; }
3588 };
3589 
3590 /// \brief Represents a C++11 static_assert declaration.
3591 class StaticAssertDecl : public Decl {
3592  virtual void anchor();
3593  llvm::PointerIntPair<Expr *, 1, bool> AssertExprAndFailed;
3594  StringLiteral *Message;
3595  SourceLocation RParenLoc;
3596 
3597  StaticAssertDecl(DeclContext *DC, SourceLocation StaticAssertLoc,
3598  Expr *AssertExpr, StringLiteral *Message,
3599  SourceLocation RParenLoc, bool Failed)
3600  : Decl(StaticAssert, DC, StaticAssertLoc),
3601  AssertExprAndFailed(AssertExpr, Failed), Message(Message),
3602  RParenLoc(RParenLoc) { }
3603 
3604 public:
3606  SourceLocation StaticAssertLoc,
3607  Expr *AssertExpr, StringLiteral *Message,
3608  SourceLocation RParenLoc, bool Failed);
3609  static StaticAssertDecl *CreateDeserialized(ASTContext &C, unsigned ID);
3610 
3611  Expr *getAssertExpr() { return AssertExprAndFailed.getPointer(); }
3612  const Expr *getAssertExpr() const { return AssertExprAndFailed.getPointer(); }
3613 
3614  StringLiteral *getMessage() { return Message; }
3615  const StringLiteral *getMessage() const { return Message; }
3616 
3617  bool isFailed() const { return AssertExprAndFailed.getInt(); }
3618 
3619  SourceLocation getRParenLoc() const { return RParenLoc; }
3620 
3621  SourceRange getSourceRange() const override LLVM_READONLY {
3622  return SourceRange(getLocation(), getRParenLoc());
3623  }
3624 
3625  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3626  static bool classofKind(Kind K) { return K == StaticAssert; }
3627 
3628  friend class ASTDeclReader;
3629 };
3630 
3631 /// A binding in a decomposition declaration. For instance, given:
3632 ///
3633 /// int n[3];
3634 /// auto &[a, b, c] = n;
3635 ///
3636 /// a, b, and c are BindingDecls, whose bindings are the expressions
3637 /// x[0], x[1], and x[2] respectively, where x is the implicit
3638 /// DecompositionDecl of type 'int (&)[3]'.
3639 class BindingDecl : public ValueDecl {
3640  void anchor() override;
3641 
3642  /// The binding represented by this declaration. References to this
3643  /// declaration are effectively equivalent to this expression (except
3644  /// that it is only evaluated once at the point of declaration of the
3645  /// binding).
3646  Expr *Binding;
3647 
3649  : ValueDecl(Decl::Binding, DC, IdLoc, Id, QualType()), Binding(nullptr) {}
3650 
3651 public:
3652  static BindingDecl *Create(ASTContext &C, DeclContext *DC,
3653  SourceLocation IdLoc, IdentifierInfo *Id);
3654  static BindingDecl *CreateDeserialized(ASTContext &C, unsigned ID);
3655 
3656  /// Get the expression to which this declaration is bound. This may be null
3657  /// in two different cases: while parsing the initializer for the
3658  /// decomposition declaration, and when the initializer is type-dependent.
3659  Expr *getBinding() const { return Binding; }
3660 
3661  /// Get the variable (if any) that holds the value of evaluating the binding.
3662  /// Only present for user-defined bindings for tuple-like types.
3663  VarDecl *getHoldingVar() const;
3664 
3665  /// Set the binding for this BindingDecl, along with its declared type (which
3666  /// should be a possibly-cv-qualified form of the type of the binding, or a
3667  /// reference to such a type).
3668  void setBinding(QualType DeclaredType, Expr *Binding) {
3669  setType(DeclaredType);
3670  this->Binding = Binding;
3671  }
3672 
3673  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3674  static bool classofKind(Kind K) { return K == Decl::Binding; }
3675 
3676  friend class ASTDeclReader;
3677 };
3678 
3679 /// A decomposition declaration. For instance, given:
3680 ///
3681 /// int n[3];
3682 /// auto &[a, b, c] = n;
3683 ///
3684 /// the second line declares a DecompositionDecl of type 'int (&)[3]', and
3685 /// three BindingDecls (named a, b, and c). An instance of this class is always
3686 /// unnamed, but behaves in almost all other respects like a VarDecl.
3688  : public VarDecl,
3689  private llvm::TrailingObjects<DecompositionDecl, BindingDecl *> {
3690  void anchor() override;
3691 
3692  /// The number of BindingDecl*s following this object.
3693  unsigned NumBindings;
3694 
3696  SourceLocation LSquareLoc, QualType T,
3697  TypeSourceInfo *TInfo, StorageClass SC,
3698  ArrayRef<BindingDecl *> Bindings)
3699  : VarDecl(Decomposition, C, DC, StartLoc, LSquareLoc, nullptr, T, TInfo,
3700  SC),
3701  NumBindings(Bindings.size()) {
3702  std::uninitialized_copy(Bindings.begin(), Bindings.end(),
3703  getTrailingObjects<BindingDecl *>());
3704  }
3705 
3706 public:
3708  SourceLocation StartLoc,
3709  SourceLocation LSquareLoc,
3710  QualType T, TypeSourceInfo *TInfo,
3711  StorageClass S,
3712  ArrayRef<BindingDecl *> Bindings);
3713  static DecompositionDecl *CreateDeserialized(ASTContext &C, unsigned ID,
3714  unsigned NumBindings);
3715 
3717  return llvm::makeArrayRef(getTrailingObjects<BindingDecl *>(), NumBindings);
3718  }
3719 
3720  void printName(raw_ostream &os) const override;
3721 
3722  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3723  static bool classofKind(Kind K) { return K == Decomposition; }
3724 
3726  friend class ASTDeclReader;
3727 };
3728 
3729 /// An instance of this class represents the declaration of a property
3730 /// member. This is a Microsoft extension to C++, first introduced in
3731 /// Visual Studio .NET 2003 as a parallel to similar features in C#
3732 /// and Managed C++.
3733 ///
3734 /// A property must always be a non-static class member.
3735 ///
3736 /// A property member superficially resembles a non-static data
3737 /// member, except preceded by a property attribute:
3738 /// __declspec(property(get=GetX, put=PutX)) int x;
3739 /// Either (but not both) of the 'get' and 'put' names may be omitted.
3740 ///
3741 /// A reference to a property is always an lvalue. If the lvalue
3742 /// undergoes lvalue-to-rvalue conversion, then a getter name is
3743 /// required, and that member is called with no arguments.
3744 /// If the lvalue is assigned into, then a setter name is required,
3745 /// and that member is called with one argument, the value assigned.
3746 /// Both operations are potentially overloaded. Compound assignments
3747 /// are permitted, as are the increment and decrement operators.
3748 ///
3749 /// The getter and putter methods are permitted to be overloaded,
3750 /// although their return and parameter types are subject to certain
3751 /// restrictions according to the type of the property.
3752 ///
3753 /// A property declared using an incomplete array type may
3754 /// additionally be subscripted, adding extra parameters to the getter
3755 /// and putter methods.
3757  IdentifierInfo *GetterId, *SetterId;
3758 
3760  QualType T, TypeSourceInfo *TInfo, SourceLocation StartL,
3761  IdentifierInfo *Getter, IdentifierInfo *Setter)
3762  : DeclaratorDecl(MSProperty, DC, L, N, T, TInfo, StartL),
3763  GetterId(Getter), SetterId(Setter) {}
3764 
3765 public:
3766  static MSPropertyDecl *Create(ASTContext &C, DeclContext *DC,
3768  TypeSourceInfo *TInfo, SourceLocation StartL,
3769  IdentifierInfo *Getter, IdentifierInfo *Setter);
3770  static MSPropertyDecl *CreateDeserialized(ASTContext &C, unsigned ID);
3771 
3772  static bool classof(const Decl *D) { return D->getKind() == MSProperty; }
3773 
3774  bool hasGetter() const { return GetterId != nullptr; }
3775  IdentifierInfo* getGetterId() const { return GetterId; }
3776  bool hasSetter() const { return SetterId != nullptr; }
3777  IdentifierInfo* getSetterId() const { return SetterId; }
3778 
3779  friend class ASTDeclReader;
3780 };
3781 
3782 /// Insertion operator for diagnostics. This allows sending an AccessSpecifier
3783 /// into a diagnostic with <<.
3785  AccessSpecifier AS);
3786 
3788  AccessSpecifier AS);
3789 
3790 } // end namespace clang
3791 
3792 #endif
const CXXRecordDecl * getPreviousDecl() const
Definition: DeclCXX.h:681
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
Definition: DeclCXX.h:2186
llvm::iterator_range< base_class_iterator > base_class_range
Definition: DeclCXX.h:732
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
void setSourceOrder(int Pos)
Set the source order of this initializer.
Definition: DeclCXX.h:2299
Defines the clang::ASTContext interface.
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3047
static const Decl * getCanonicalDecl(const Decl *D)
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
Definition: Decl.h:1629
Expr * getInit() const
Get the initializer.
Definition: DeclCXX.h:2314
A (possibly-)qualified type.
Definition: Type.h:614
unsigned getNumCtorInitializers() const
Determine the number of arguments used to initialize the member or base.
Definition: DeclCXX.h:2437
bool hasUninitializedReferenceMember() const
Whether this class or any of its subobjects has any members of reference type which would make value-...
Definition: DeclCXX.h:1208
bool isStandardLayout() const
Determine whether this class has standard layout per (C++ [class]p7)
Definition: DeclCXX.h:1257
base_class_range bases()
Definition: DeclCXX.h:736
static bool classof(const Decl *D)
Definition: DeclCXX.h:3494
const DeclarationNameLoc & getInfo() const
unsigned getNumBases() const
Retrieves the number of base classes of this class.
Definition: DeclCXX.h:730
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3472
SourceLocation getLParenLoc() const
Definition: DeclCXX.h:2310
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:26
static bool classof(const Decl *D)
Definition: DeclCXX.h:2753
Iterates through the using shadow declarations associated with this using declaration.
Definition: DeclCXX.h:3257
Stmt - This represents one statement.
Definition: Stmt.h:60
static bool classofKind(Kind K)
Definition: DeclCXX.h:3067
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:2920
redeclarable_base::redecl_iterator redecl_iterator
Definition: DeclCXX.h:2922
bool isInClassMemberInitializer() const
Determine whether this initializer is an implicit initializer generated for a field with an initializ...
Definition: DeclCXX.h:2208
static bool classof(const Decl *D)
Definition: DeclCXX.h:2668
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
Definition: DeclCXX.h:751
llvm::iterator_range< base_class_const_iterator > base_class_const_range
Definition: DeclCXX.h:734
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6, C++11 [class.copy]p12)
Definition: DeclCXX.h:1311
bool allowConstDefaultInit() const
Determine whether declaring a const variable with this type is ok per core issue 253.
Definition: DeclCXX.h:1373
static TemplateSpecializationKind getTemplateSpecializationKind(Decl *D)
Determine what kind of template specialization the given declaration is.
bool hasIrrelevantDestructor() const
Determine whether this class has a destructor which has no semantic effect.
Definition: DeclCXX.h:1384
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:81
bool needsOverloadResolutionForDestructor() const
Determine whether we need to eagerly declare a destructor for this class.
Definition: DeclCXX.h:1108
void setAccessSpecifierLoc(SourceLocation ASLoc)
Sets the location of the access specifier.
Definition: DeclCXX.h:118
IdentifierInfo * getGetterId() const
Definition: DeclCXX.h:3775
bool isVirtual() const
Definition: DeclCXX.h:1962
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
Definition: Lambda.h:23
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
Definition: DeclCXX.h:211
bool hasUserDeclaredCopyAssignment() const
Determine whether this class has a user-declared copy assignment operator.
Definition: DeclCXX.h:1020
init_const_reverse_iterator init_rend() const
Definition: DeclCXX.h:2431
shadow_iterator shadow_end() const
Definition: DeclCXX.h:3301
bool isPOD() const
Whether this class is a POD-type (C++ [class]p4)
Definition: DeclCXX.h:1221
bool isWritten() const
Determine whether this initializer is explicitly written in the source code.
Definition: DeclCXX.h:2284
StringRef P
void setPure(bool P=true)
Definition: Decl.cpp:2586
init_reverse_iterator init_rend()
Definition: DeclCXX.h:2428
bool isPackExpansion() const
Determine whether this is a pack expansion.
Definition: DeclCXX.h:3560
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
Definition: Attr.h:195
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
Definition: DeclCXX.h:121
The base class of the type hierarchy.
Definition: Type.h:1300
static bool classof(const Decl *D)
Definition: DeclCXX.h:3326
const CXXMethodDecl * getDevirtualizedMethod(const Expr *Base, bool IsAppleKext) const
Definition: DeclCXX.h:1981
NamespaceDecl - Represent a C++ namespace.
Definition: Decl.h:472
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of the namespace.
Definition: DeclCXX.h:2816
const NamedDecl * getNominatedNamespaceAsWritten() const
Definition: DeclCXX.h:2821
bool hasTrivialMoveConstructor() const
Determine whether this class has a trivial move constructor (C++11 [class.copy]p12) ...
Definition: DeclCXX.h:1318
specific_decl_iterator< CXXConstructorDecl > ctor_iterator
Iterator access to constructor members.
Definition: DeclCXX.h:793
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:95
const NestedNameSpecifier * Specifier
A container of type source information.
Definition: Decl.h:62
bool hasConstexprNonCopyMoveConstructor() const
Determine whether this class has at least one constexpr constructor other than the copy or move const...
Definition: DeclCXX.h:1283
capture_const_range captures() const
Definition: DeclCXX.h:1161
static bool classof(const Decl *D)
Definition: DeclCXX.h:1907
base_class_const_iterator vbases_end() const
Definition: DeclCXX.h:763
bool needsImplicitMoveAssignment() const
Determine whether this class should get an implicit move assignment operator or if any existing speci...
Definition: DeclCXX.h:1075
QualType getConversionType() const
Returns the type that this conversion function is converting to.
Definition: DeclCXX.h:2652
static bool classofKind(Kind K)
Definition: DeclCXX.h:2977
bool hasFriends() const
Determines whether this record has any friends.
Definition: DeclCXX.h:817
Describes the capture of a variable or of this, or of a C++1y init-capture.
Definition: LambdaCapture.h:26
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
bool hasUserDeclaredMoveOperation() const
Whether this class has a user-declared move constructor or assignment operator.
Definition: DeclCXX.h:956
unsigned getIdentifierNamespace() const
Definition: DeclBase.h:770
static bool classof(const Decl *D)
Definition: DeclCXX.h:3673
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2344
bool implicitCopyAssignmentHasConstParam() const
Determine whether an implicit copy assignment operator for this type would have a parameter with a co...
Definition: DeclCXX.h:1038
float __ovld __cnfn distance(float p0, float p1)
Returns the distance between p0 and p1.
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:1904
bool needsOverloadResolutionForCopyConstructor() const
Determine whether we need to eagerly declare a defaulted copy constructor for this class...
Definition: DeclCXX.h:922
bool isPackExpansion() const
Determine whether this initializer is a pack expansion.
Definition: DeclCXX.h:2219
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
Definition: DeclCXX.h:2966
friend bool operator!=(shadow_iterator x, shadow_iterator y)
Definition: DeclCXX.h:3288
bool isIndirectMemberInitializer() const
Definition: DeclCXX.h:2198
const Expr * getAssertExpr() const
Definition: DeclCXX.h:3612
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Definition: DeclFriend.h:40
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Definition: Decl.h:769
static bool classof(const Decl *D)
Definition: DeclCXX.h:1850
const T * getAs() const
Member-template getAs<specific type>&#39;.
Definition: Type.h:6052
llvm::iterator_range< capture_const_iterator > capture_const_range
Definition: DeclCXX.h:1159
bool needsImplicitCopyAssignment() const
Determine whether this class needs an implicit copy assignment operator to be lazily declared...
Definition: DeclCXX.h:1026
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
Definition: Decl.h:388
bool hasTrivialDefaultConstructor() const
Determine whether this class has a trivial default constructor (C++11 [class.ctor]p5).
Definition: DeclCXX.h:1268
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:50
bool isMemberInitializer() const
Determine whether this initializer is initializing a non-static data member.
Definition: DeclCXX.h:2192
SourceLocation getEllipsisLoc() const
Definition: DeclCXX.h:2224
llvm::iterator_range< friend_iterator > friend_range
Definition: DeclCXX.h:808
bool hasDefinition() const
Definition: DeclCXX.h:701
UsingShadowDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclCXX.h:3038
static AccessSpecDecl * Create(ASTContext &C, AccessSpecifier AS, DeclContext *DC, SourceLocation ASLoc, SourceLocation ColonLoc)
Definition: DeclCXX.h:129
Represents any kind of function declaration, whether it is a concrete function or a function template...
Definition: DeclCXX.h:50
DeclarationNameInfo getNameInfo() const
Definition: DeclCXX.h:3462
bool isExplicitSpecified() const
Whether this function is marked as explicit explicitly.
Definition: DeclCXX.h:2450
SourceLocation getRParenLoc() const
Definition: DeclCXX.h:2311
reference operator*() const
Definition: DeclCXX.h:3271
bool isExplicitSpecified() const
Whether this deduction guide was declared with the &#39;explicit&#39; specifier.
Definition: DeclCXX.h:1899
static bool classof(const Decl *D)
Definition: DeclCXX.h:3625
An UnresolvedSet-like class that might not have been loaded from the external AST source yet...
const FunctionDecl * isLocalClass() const
If the class is a local class [class.local], returns the enclosing function declaration.
Definition: DeclCXX.h:1529
bool hasNonTrivialDefaultConstructor() const
Determine whether this class has a non-trivial default constructor (C++11 [class.ctor]p5).
Definition: DeclCXX.h:1275
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:40
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3379
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2722
An iterator over the friend declarations of a class.
Definition: DeclFriend.h:175
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
Definition: DeclCXX.h:1236
Description of a constructor that was inherited from a base class.
Definition: DeclCXX.h:2318
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Definition: Decl.h:258
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:80
SourceLocation getLocEnd() const LLVM_READONLY
Definition: DeclCXX.h:2741
One of these records is kept for each identifier that is lexed.
CXXRecordDecl * getParent()
Returns the parent of this method declaration, which is the class in which this method is defined...
Definition: DeclCXX.h:2039
bool isConst() const
Definition: DeclCXX.h:1959
StringLiteral * getMessage()
Definition: DeclCXX.h:3614
static bool classof(const Decl *D)
Definition: DeclCXX.h:2860
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclCXX.h:2856
CXXRecordDecl * getPreviousDecl()
Definition: DeclCXX.h:677
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:128
A C++ nested-name-specifier augmented with source location information.
SourceLocation getColonLoc() const
Returns the location of &#39;:&#39;.
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Definition: DeclCXX.h:2947
static bool classofKind(Kind K)
Definition: DeclCXX.h:3495
bool defaultedDefaultConstructorIsConstexpr() const
Determine whether a defaulted default constructor for this class would be constexpr.
Definition: DeclCXX.h:1291
void setLanguage(LanguageIDs L)
Set the language specified by this linkage specification.
Definition: DeclCXX.h:2724
static bool classof(const Decl *D)
Definition: DeclCXX.h:3185
SourceLocation getLocStart() const LLVM_READONLY
Definition: DeclCXX.h:202
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
Definition: Decl.h:2377
bool isVolatile() const
Definition: DeclCXX.h:1960
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
Definition: DeclCXX.h:2247
UsingShadowDecl * reference
Definition: DeclCXX.h:3263
conversion_iterator conversion_end() const
Definition: DeclCXX.h:1176
void startDefinition()
Starts the definition of this tag declaration.
Definition: Decl.cpp:3640
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclCXX.h:1999
bool isCopyOrMoveConstructor() const
Determine whether this a copy or move constructor.
Definition: DeclCXX.h:2515
static bool classofKind(Kind K)
Definition: DeclCXX.h:3327
bool hasTrivialMoveAssignment() const
Determine whether this class has a trivial move assignment operator (C++11 [class.copy]p25)
Definition: DeclCXX.h:1346
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
Definition: DeclCXX.h:2535
The iterator over UnresolvedSets.
Definition: UnresolvedSet.h:27
static NamespaceDecl * getNamespace(const NestedNameSpecifier *X)
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
Definition: DeclBase.h:397
static bool classof(const Decl *D)
Definition: DeclCXX.h:2976
FieldDecl * getAnonField() const
Definition: Decl.h:2646
UsingShadowDecl * value_type
Definition: DeclCXX.h:3262
bool hasUserDeclaredDestructor() const
Determine whether this class has a user-declared destructor.
Definition: DeclCXX.h:1096
unsigned getTypeQualifiers() const
Definition: DeclCXX.h:2052
method_iterator method_begin() const
Method begin iterator.
Definition: DeclCXX.h:784
static bool classofKind(Kind K)
Definition: DeclCXX.h:3186
Represents an access specifier followed by colon &#39;:&#39;.
Definition: DeclCXX.h:102
bool hasGetter() const
Definition: DeclCXX.h:3774
TypeSourceInfo * getLambdaTypeInfo() const
Definition: DeclCXX.h:1842
NamespaceAliasDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclCXX.h:2929
CXXBaseSpecifier * base_class_iterator
Iterator that traverses the base classes of a class.
Definition: DeclCXX.h:665
void setImplicitCopyConstructorIsDeleted()
Set that we attempted to declare an implicit copy constructor, but overload resolution failed so we d...
Definition: DeclCXX.h:975
static bool classofKind(Kind K)
Definition: DeclCXX.h:3723
Represents a C++ using-declaration.
Definition: DeclCXX.h:3198
UnresolvedUsingValueDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this declaration.
Definition: DeclCXX.h:3487
void setUsingLoc(SourceLocation L)
Set the source location of the &#39;using&#39; keyword.
Definition: DeclCXX.h:3231
ArrayRef< BindingDecl * > bindings() const
Definition: DeclCXX.h:3716
bool hasNonLiteralTypeFieldsOrBases() const
Determine whether this class has a non-literal or/ volatile type non-static data member or base class...
Definition: DeclCXX.h:1402
friend TrailingObjects
Definition: DeclCXX.h:3401
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this method.
Definition: DeclCXX.h:2067
bool isDelegatingConstructor() const
Determine whether this constructor is a delegating constructor.
Definition: DeclCXX.h:2458
std::reverse_iterator< init_const_iterator > init_const_reverse_iterator
Definition: DeclCXX.h:2419
CXXMethodDecl(Kind DK, ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, bool isConstexpr, SourceLocation EndLocation)
Definition: DeclCXX.h:1921
bool isBaseVirtual() const
Returns whether the base is virtual or not.
Definition: DeclCXX.h:2239
bool hasMoveAssignment() const
Determine whether this class has a move assignment operator.
Definition: DeclCXX.h:1058
AccessSpecifier getAccessSpecifier() const
Returns the access specifier for this base specifier.
Definition: DeclCXX.h:238
bool getInheritConstructors() const
Determine whether this base class&#39;s constructors get inherited.
Definition: DeclCXX.h:221
bool needsOverloadResolutionForCopyAssignment() const
Determine whether we need to eagerly declare a defaulted copy assignment operator for this class...
Definition: DeclCXX.h:1032
NamedDecl * getNominatedNamespaceAsWritten()
Definition: DeclCXX.h:2820
FunctionDecl * isLocalClass()
Definition: DeclCXX.h:1536
static bool classof(const Decl *D)
Definition: DeclCXX.h:2603
TypeDecl - Represents a declaration of a type.
Definition: Decl.h:2667
void setLambdaMangling(unsigned ManglingNumber, Decl *ContextDecl)
Set the mangling number and context declaration for a lambda class.
Definition: DeclCXX.h:1801
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no &#39;using&#39;).
Definition: DeclCXX.h:3247
llvm::function_ref< bool(const CXXBaseSpecifier *Specifier, CXXBasePath &Path)> BaseMatchesCallback
Function type used by lookupInBases() to determine whether a specific base class subobject matches th...
Definition: DeclCXX.h:1629
bool isLambda() const
Determine whether this class describes a lambda function object.
Definition: DeclCXX.h:1113
static DeclContext * castToDeclContext(const LinkageSpecDecl *D)
Definition: DeclCXX.h:2755
base_class_const_iterator bases_begin() const
Definition: DeclCXX.h:744
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclCXX.h:670
CXXConversionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclCXX.h:2660
bool isAnyMemberInitializer() const
Definition: DeclCXX.h:2194
base_class_iterator bases_begin()
Definition: DeclCXX.h:743
SourceLocation getExternLoc() const
Definition: DeclCXX.h:2733
SourceLocation getLocEnd() const LLVM_READONLY
Definition: DeclCXX.h:203
void setNumCtorInitializers(unsigned numCtorInitializers)
Definition: DeclCXX.h:2441
FieldDecl * getAnyMember() const
Definition: DeclCXX.h:2258
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Definition: ExprCXX.h:1519
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
Definition: DeclCXX.h:1361
bool isInstance() const
Definition: DeclCXX.h:1945
bool hasSimpleCopyConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous copy constructor that ...
Definition: DeclCXX.h:849
FieldDecl * getMember() const
If this is a member initializer, returns the declaration of the non-static data member being initiali...
Definition: DeclCXX.h:2253
Represents a linkage specification.
Definition: DeclCXX.h:2681
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclCXX.h:3621
shadow_iterator shadow_begin() const
Definition: DeclCXX.h:3298
bool hasConstexprDefaultConstructor() const
Determine whether this class has a constexpr default constructor.
Definition: DeclCXX.h:1297
bool isAbstract() const
Determine whether this class has a pure virtual function.
Definition: DeclCXX.h:1253
A binding in a decomposition declaration.
Definition: DeclCXX.h:3639
init_iterator init_begin()
Retrieve an iterator to the first initializer.
Definition: DeclCXX.h:2401
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclCXX.h:3389
SourceLocation getRParenLoc() const
Definition: DeclCXX.h:3619
bool hasBraces() const
Determines whether this linkage specification had braces in its syntactic form.
Definition: DeclCXX.h:2728
llvm::iterator_range< redecl_iterator > redecl_range
Definition: Redeclarable.h:285
unsigned getLambdaManglingNumber() const
If this is the closure type of a lambda expression, retrieve the number to be used for name mangling ...
Definition: DeclCXX.h:1783
bool hasCopyAssignmentWithConstParam() const
Determine whether this class has a copy assignment operator with a parameter type which is a referenc...
Definition: DeclCXX.h:1045
CXXConstructorDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclCXX.h:2540
bool hasUserProvidedDefaultConstructor() const
Whether this class has a user-provided default constructor per C++11.
Definition: DeclCXX.h:903
llvm::iterator_range< shadow_iterator > shadow_range
Definition: DeclCXX.h:3293
InheritedConstructor(ConstructorUsingShadowDecl *Shadow, CXXConstructorDecl *BaseCtor)
Definition: DeclCXX.h:2324
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
Definition: DeclBase.h:97
CXXRecordDecl * getMostRecentDecl()
Definition: DeclCXX.h:685
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of the namespace.
Definition: DeclCXX.h:2942
A little helper class used to produce diagnostics.
Definition: Diagnostic.h:953
init_const_range inits() const
Definition: DeclCXX.h:2396
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3126
bool isDynamicClass() const
Definition: DeclCXX.h:714
CXXDestructorDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclCXX.h:2595
static bool classofKind(Kind K)
Definition: DeclCXX.h:3587
SourceLocation getTypenameLoc() const
Returns the source location of the &#39;typename&#39; keyword.
Definition: DeclCXX.h:3544
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:647
static bool classof(const Decl *D)
Definition: DeclCXX.h:3396
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
Definition: DeclCXX.h:2214
method_iterator end_overridden_methods() const
Definition: DeclCXX.cpp:1875
init_reverse_iterator init_rbegin()
Definition: DeclCXX.h:2421
ID
Defines the address space values used by the address space qualifier of QualType. ...
Definition: AddressSpaces.h:26
const CXXMethodDecl *const * method_iterator
Definition: DeclCXX.h:2023
bool isLiteral() const
Determine whether this class is a literal type.
Definition: DeclCXX.h:1448
const CXXRecordDecl * getParent() const
Returns the parent of this using shadow declaration, which is the class in which this is declared...
Definition: DeclCXX.h:3139
bool hasInheritedConstructor() const
Determine whether this class has a using-declaration that names a user-declared base class constructo...
Definition: DeclCXX.h:1408
capture_const_iterator captures_end() const
Definition: DeclCXX.h:1167
static bool classof(const Decl *D)
Definition: DeclCXX.h:3586
static bool classofKind(Kind K)
Definition: DeclCXX.h:2861
const UnresolvedUsingValueDecl * getCanonicalDecl() const
Definition: DeclCXX.h:3490
bool hasUserDeclaredCopyConstructor() const
Determine whether this class has a user-declared copy constructor.
Definition: DeclCXX.h:910
const LambdaCapture * capture_const_iterator
Definition: DeclCXX.h:1158
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3085
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Definition: Decl.h:591
Expr - This represents one expression.
Definition: Expr.h:106
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3235
const NamespaceDecl * getNominatedNamespace() const
Definition: DeclCXX.h:2828
SourceLocation getAliasLoc() const
Returns the location of the alias name, i.e.
Definition: DeclCXX.h:2960
ctor_iterator ctor_end() const
Definition: DeclCXX.h:802
const CXXConversionDecl * getCanonicalDecl() const
Definition: DeclCXX.h:2663
static bool classofKind(Kind K)
Definition: DeclCXX.h:2754
int Id
Definition: ASTDiff.cpp:191
base_class_const_range bases() const
Definition: DeclCXX.h:739
bool defaultedMoveConstructorIsDeleted() const
true if a defaulted move constructor for this class would be deleted.
Definition: DeclCXX.h:832
DeclarationNameInfo getNameInfo() const
Definition: DeclCXX.h:3242
CXXRecordDecl * getTemplateInstantiationPattern()
Definition: DeclCXX.h:1515
redeclarable_base::redecl_range redecl_range
Definition: DeclCXX.h:2921
const CXXBaseSpecifier * base_class_const_iterator
Iterator that traverses the base classes of a class.
Definition: DeclCXX.h:668
llvm::iterator_range< specific_decl_iterator< CXXConstructorDecl > > ctor_range
Definition: DeclCXX.h:795
const CXXRecordDecl * getCanonicalDecl() const
Definition: DeclCXX.h:673
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2566
init_const_reverse_iterator init_rbegin() const
Definition: DeclCXX.h:2424
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:2489
const UsingDecl * getCanonicalDecl() const
Definition: DeclCXX.h:3324
void setRBraceLoc(SourceLocation L)
Definition: DeclCXX.h:2736
bool hasUserDeclaredMoveAssignment() const
Determine whether this class has had a move assignment declared by the user.
Definition: DeclCXX.h:1053
#define bool
Definition: stdbool.h:31
bool isPackExpansion() const
Determine whether this is a pack expansion.
Definition: DeclCXX.h:3467
CXXRecordDecl * getDefinition() const
Definition: DeclCXX.h:694
bool isExplicit() const
Whether this deduction guide is explicit.
Definition: DeclCXX.h:1896
base_class_iterator vbases_end()
Definition: DeclCXX.h:762
static TemplateParameterList * getGenericLambdaTemplateParameterList(LambdaScopeInfo *LSI, Sema &SemaRef)
Definition: SemaLambda.cpp:228
ConstructorUsingShadowDecl * getNominatedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the direct base class from which this using shadow dec...
Definition: DeclCXX.h:3150
llvm::function_ref< bool(const CXXRecordDecl *BaseDefinition)> ForallBasesCallback
Function type used by forallBases() as a callback.
Definition: DeclCXX.h:1600
bool hasMoveConstructor() const
Determine whether this class has a move constructor.
Definition: DeclCXX.h:968
const CXXConstructorDecl * getCanonicalDecl() const
Definition: DeclCXX.h:2543
bool needsImplicitDestructor() const
Determine whether this class needs an implicit destructor to be lazily declared.
Definition: DeclCXX.h:1102
bool isTrivial() const
Determine whether this class is considered trivial.
Definition: DeclCXX.h:1427
init_const_iterator init_end() const
Retrieve an iterator past the last initializer.
Definition: DeclCXX.h:2413
CXXRecordDecl * getConstructedBaseClass() const
Get the base class whose constructor or constructor shadow declaration is passed the constructor argu...
Definition: DeclCXX.h:3166
bool isPolymorphic() const
Whether this class is polymorphic (C++ [class.virtual]), which means that the class contains or inher...
Definition: DeclCXX.h:1246
llvm::iterator_range< init_iterator > init_range
Definition: DeclCXX.h:2392
const CXXMethodDecl * getCanonicalDecl() const
Definition: DeclCXX.h:2002
void setInheritConstructors(bool Inherit=true)
Set that this base class&#39;s constructors should be inherited.
Definition: DeclCXX.h:224
StorageClass
Storage classes.
Definition: Specifiers.h:203
const UnresolvedUsingTypenameDecl * getCanonicalDecl() const
Definition: DeclCXX.h:3582
bool hasNonTrivialDestructor() const
Determine whether this class has a non-trivial destructor (C++ [class.dtor]p3)
Definition: DeclCXX.h:1367
std::reverse_iterator< init_iterator > init_reverse_iterator
Definition: DeclCXX.h:2417
IdentifierInfo * getSetterId() const
Definition: DeclCXX.h:3777
void setTypename(bool TN)
Sets whether the using declaration has &#39;typename&#39;.
Definition: DeclCXX.h:3253
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1296
method_iterator method_end() const
Method past-the-end iterator.
Definition: DeclCXX.h:788
SourceLocation getEnd() const
static bool hasDefinition(const ObjCObjectPointerType *ObjPtr)
bool isBaseOfClass() const
Determine whether this base class is a base of a class declared with the &#39;class&#39; keyword (vs...
Definition: DeclCXX.h:215
bool hasSimpleMoveConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous move constructor that ...
Definition: DeclCXX.h:856
bool hasTrivialCopyConstructor() const
Determine whether this class has a trivial copy constructor (C++ [class.copy]p6, C++11 [class...
Definition: DeclCXX.h:1305
Represents a C++ deduction guide declaration.
Definition: DeclCXX.h:1872
bool needsImplicitDefaultConstructor() const
Determine if we need to declare a default constructor for this class.
Definition: DeclCXX.h:885
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2620
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class.copy]p25)
Definition: DeclCXX.h:1353
bool nullFieldOffsetIsZero() const
In the Microsoft C++ ABI, use zero for the field offset of a null data member pointer if we can guara...
Definition: DeclCXX.h:1817
UsingPackDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclCXX.h:3393
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12) ...
Definition: DeclCXX.h:1325
CXXMethodDecl * getMostRecentDecl()
Definition: DeclCXX.h:2006
CXXCtorInitializer ** init_iterator
Iterates through the member/base initializer list.
Definition: DeclCXX.h:2387
const CXXRecordDecl * getMostRecentDecl() const
Definition: DeclCXX.h:690
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3551
bool hasVariantMembers() const
Determine whether this class has any variant members.
Definition: DeclCXX.h:1264
bool isExplicit() const
Whether this function is explicit.
Definition: DeclCXX.h:2647
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclCXX.h:2972
SourceLocation getUsingLoc() const
Return the location of the using keyword.
Definition: DeclCXX.h:2838
SourceLocation getUsingLoc() const
Returns the source location of the &#39;using&#39; keyword.
Definition: DeclCXX.h:3445
const UsingPackDecl * getCanonicalDecl() const
Definition: DeclCXX.h:3394
void setColonLoc(SourceLocation CLoc)
Sets the location of the colon.
Definition: DeclCXX.h:123
specific_decl_iterator< CXXMethodDecl > method_iterator
Iterator access to method members.
Definition: DeclCXX.h:774
#define false
Definition: stdbool.h:33
UnresolvedUsingTypenameDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this declaration.
Definition: DeclCXX.h:3579
const NamespaceAliasDecl * getCanonicalDecl() const
Definition: DeclCXX.h:2932
NamedDecl * getInstantiatedFromUsingDecl() const
Get the using declaration from which this was instantiated.
Definition: DeclCXX.h:3374
shadow_iterator(UsingShadowDecl *C)
Definition: DeclCXX.h:3269
bool hasTrivialCopyAssignment() const
Determine whether this class has a trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
Definition: DeclCXX.h:1333
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclCXX.h:2749
Encodes a location in the source.
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:1909
static bool classofKind(Kind K)
Definition: DeclCXX.h:2604
const CXXMethodDecl * getCorrespondingMethodInClass(const CXXRecordDecl *RD, bool MayBeBase=false) const
Definition: DeclCXX.h:2092
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3458
A set of all the primary bases for a class.
const StringLiteral * getMessage() const
Definition: DeclCXX.h:3615
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:2842
DeclarationName getName() const
getName - Returns the embedded declaration name.
SourceLocation getUsingLoc() const
Return the source location of the &#39;using&#39; keyword.
Definition: DeclCXX.h:3228
redeclarable_base::redecl_iterator redecl_iterator
Definition: DeclCXX.h:3030
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3415
TagDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: Decl.cpp:3629
init_iterator init_end()
Retrieve an iterator past the last initializer.
Definition: DeclCXX.h:2409
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3455
UnresolvedSetIterator conversion_iterator
Definition: DeclCXX.h:1172
void setCtorInitializers(CXXCtorInitializer **Initializers)
Definition: DeclCXX.h:2445
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1918
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
static bool classofKind(Kind K)
Definition: DeclCXX.h:3674
SourceLocation getIdentLocation() const
Returns the location of this using declaration&#39;s identifier.
Definition: DeclCXX.h:2845
bool isPackExpansion() const
Determine whether this base specifier is a pack expansion.
Definition: DeclCXX.h:218
void setImplicitMoveConstructorIsDeleted()
Set that we attempted to declare an implicit move constructor, but overload resolution failed so we d...
Definition: DeclCXX.h:984
static bool classofKind(Kind K)
Definition: DeclCXX.h:2100
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:2812
ASTContext::overridden_method_range overridden_method_range
Definition: DeclCXX.h:2028
UsingDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this declaration.
Definition: DeclCXX.h:3323
bool isExplicitSpecified() const
Whether this function is marked as explicit explicitly.
Definition: DeclCXX.h:2644
static bool classof(const Decl *D)
Definition: DeclCXX.h:137
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
Definition: Type.h:1255
static bool classof(const Decl *D)
Definition: DeclCXX.h:3066
ConstructorUsingShadowDecl * getConstructedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the base class for which we don&#39;t have an explicit ini...
Definition: DeclCXX.h:3156
void setIsParsingBaseSpecifiers()
Definition: DeclCXX.h:718
static void * getAsVoidPointer(::clang::AnyFunctionDecl F)
Definition: DeclCXX.h:77
void setImplicitDestructorIsDeleted()
Set that we attempted to declare an implicit destructor, but overload resolution failed so we deleted...
Definition: DeclCXX.h:993
const CXXDestructorDecl * getCanonicalDecl() const
Definition: DeclCXX.h:2598
SourceLocation getMemberLocation() const
Definition: DeclCXX.h:2272
Represents a C++11 static_assert declaration.
Definition: DeclCXX.h:3591
std::forward_iterator_tag iterator_category
Definition: DeclCXX.h:3265
SourceLocation getRBraceLoc() const
Definition: DeclCXX.h:2734
TypeSourceInfo * getTypeSourceInfo() const
Retrieves the type and source location of the base class.
Definition: DeclCXX.h:262
SourceLocation getAccessSpecifierLoc() const
The location of the access specifier.
Definition: DeclCXX.h:116
bool defaultedCopyConstructorIsDeleted() const
true if a defaulted copy constructor for this class would be deleted.
Definition: DeclCXX.h:823
__PTRDIFF_TYPE__ ptrdiff_t
A signed integer type that is the result of subtracting two pointers.
Definition: opencl-c.h:68
int getSourceOrder() const
Return the source position of the initializer, counting from 0.
Definition: DeclCXX.h:2288
bool hasSetter() const
Definition: DeclCXX.h:3776
CXXBaseSpecifier(SourceRange R, bool V, bool BC, AccessSpecifier A, TypeSourceInfo *TInfo, SourceLocation EllipsisLoc)
Definition: DeclCXX.h:195
bool hasInClassInitializer() const
Whether this class has any in-class initializers for non-static data members (including those in anon...
Definition: DeclCXX.h:1198
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
CXXConstructorDecl * getConstructor() const
Definition: DeclCXX.h:2331
bool hasSimpleDestructor() const
true if we know for sure that this class has an accessible destructor that is not deleted...
Definition: DeclCXX.h:870
TagTypeKind
The kind of a tag type.
Definition: Type.h:4498
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK)
Returns true if the given operator is implicitly static in a record context.
Definition: DeclCXX.h:1949
Dataflow Directional Tag Classes.
bool isExplicit() const
Whether this function is explicit.
Definition: DeclCXX.h:2453
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
bool isValid() const
Return true if this is a valid SourceLocation object.
static bool classof(const Decl *D)
Definition: DeclCXX.h:2099
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1217
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:378
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:22
method_iterator begin_overridden_methods() const
Definition: DeclCXX.cpp:1870
static AnyFunctionDecl getFromNamedDecl(NamedDecl *ND)
Definition: DeclCXX.h:66
llvm::iterator_range< init_const_iterator > init_const_range
Definition: DeclCXX.h:2393
SourceLocation getLocStart() const LLVM_READONLY
Definition: TypeLoc.h:137
SourceRange getSourceRange(const SourceRange &Range)
Returns the SourceRange of a SourceRange.
Definition: FixIt.h:34
base_class_const_range vbases() const
Definition: DeclCXX.h:756
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:328
SourceLocation getBaseTypeLoc() const LLVM_READONLY
Get the location at which the base class type was written.
Definition: DeclCXX.h:206
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no &#39;using&#39;).
Definition: DeclCXX.h:3451
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
Definition: Decl.h:2619
void setUsingLoc(SourceLocation L)
Set the source location of the &#39;using&#39; keyword.
Definition: DeclCXX.h:3448
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:2938
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
Definition: DeclCXX.h:2834
A decomposition declaration.
Definition: DeclCXX.h:3687
llvm::iterator_range< specific_decl_iterator< CXXMethodDecl > > method_range
Definition: DeclCXX.h:776
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
Definition: DeclCXX.h:897
IdentifierNamespace
IdentifierNamespace - The different namespaces in which declarations may appear.
Definition: DeclBase.h:110
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3512
conversion_iterator conversion_begin() const
Definition: DeclCXX.h:1173
DeclarationName - The name of a declaration.
StmtClass getStmtClass() const
Definition: Stmt.h:361
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
Definition: DeclCXX.h:2033
Kind getKind() const
Definition: DeclBase.h:410
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3548
DeclarationNameInfo getNameInfo() const
Definition: DeclCXX.h:3555
unsigned shadow_size() const
Return the number of shadowed declarations associated with this using declaration.
Definition: DeclCXX.h:3305
const NamespaceDecl * getNamespace() const
Definition: DeclCXX.h:2954
A mapping from each virtual member function to its set of final overriders.
base_class_const_iterator bases_end() const
Definition: DeclCXX.h:746
base_class_iterator vbases_begin()
Definition: DeclCXX.h:760
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition: Specifiers.h:143
void setExternLoc(SourceLocation L)
Definition: DeclCXX.h:2735
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration...
Definition: DeclCXX.h:2016
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer.
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
Definition: DeclBase.h:1559
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
Definition: DeclCXX.h:1339
bool isMoveConstructor() const
Determine whether this constructor is a move constructor (C++11 [class.copy]p3), which can be used to...
Definition: DeclCXX.h:2503
const FunctionDecl * getOperatorDelete() const
Definition: DeclCXX.h:2591
bool needsOverloadResolutionForMoveConstructor() const
Determine whether we need to eagerly declare a defaulted move constructor for this class...
Definition: DeclCXX.h:1012
static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, AccessSpecifier DeclAccess)
Calculates the access of a decl that is reached along a path.
Definition: DeclCXX.h:1745
Provides common interface for the Decls that cannot be redeclared, but can be merged if the same decl...
Definition: Redeclarable.h:310
static bool classofKind(Kind K)
Definition: DeclCXX.h:2549
static bool classof(const Decl *D)
Definition: DeclCXX.h:3722
const CXXMethodDecl * getMostRecentDecl() const
Definition: DeclCXX.h:2010
redeclarable_base::redecl_range redecl_range
Definition: DeclCXX.h:3029
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2120
bool isParsingBaseSpecifiers() const
Definition: DeclCXX.h:720
LanguageIDs
Represents the language in a linkage specification.
Definition: DeclCXX.h:2690
bool needsOverloadResolutionForMoveAssignment() const
Determine whether we need to eagerly declare a move assignment operator for this class.
Definition: DeclCXX.h:1089
IndirectFieldDecl * getIndirectMember() const
Definition: DeclCXX.h:2266
friend TrailingObjects
Definition: OpenMPClause.h:82
static bool classofKind(Kind K)
Definition: DeclCXX.h:3626
base_class_const_iterator vbases_begin() const
Definition: DeclCXX.h:761
static LinkageSpecDecl * castFromDeclContext(const DeclContext *DC)
Definition: DeclCXX.h:2758
static UsingShadowDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target)
Definition: DeclCXX.h:3021
const DeclContext * getCommonAncestor() const
Definition: DeclCXX.h:2835
static inline ::clang::AnyFunctionDecl getFromVoidPointer(void *P)
Definition: DeclCXX.h:80
AnyFunctionDecl(FunctionDecl *FD)
Definition: DeclCXX.h:56
Represents a base class of a C++ class.
Definition: DeclCXX.h:157
bool hasTypename() const
Return true if the using declaration has &#39;typename&#39;.
Definition: DeclCXX.h:3250
static bool classofKind(Kind K)
Definition: DeclCXX.h:1851
bool needsImplicitCopyConstructor() const
Determine whether this class needs an implicit copy constructor to be lazily declared.
Definition: DeclCXX.h:916
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
Definition: TypeLoc.h:222
bool hasMutableFields() const
Determine whether this class, or any of its class subobjects, contains a mutable field.
Definition: DeclCXX.h:1261
shadow_range shadows() const
Definition: DeclCXX.h:3295
static bool classofKind(Kind K)
Definition: DeclCXX.h:138
void setImplicitMoveAssignmentIsDeleted()
Set that we attempted to declare an implicit move assignment operator, but overload resolution failed...
Definition: DeclCXX.h:1065
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Definition: Type.h:5579
Represents a C++ struct/union/class.
Definition: DeclCXX.h:266
void setBinding(QualType DeclaredType, Expr *Binding)
Set the binding for this BindingDecl, along with its declared type (which should be a possibly-cv-qua...
Definition: DeclCXX.h:3668
bool hasUserDeclaredMoveConstructor() const
Determine whether this class has had a move constructor declared by the user.
Definition: DeclCXX.h:963
bool hasSimpleMoveAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous move assignment operat...
Definition: DeclCXX.h:863
static bool classof(const Decl *D)
Definition: DeclCXX.h:2548
SourceLocation getEllipsisLoc() const
For a pack expansion, determine the location of the ellipsis.
Definition: DeclCXX.h:229
UsingShadowDecl * getNextUsingShadowDecl() const
The next using shadow declaration contained in the shadow decl chain of the using declaration which i...
Definition: DeclCXX.h:3062
An object for streaming information to a record.
Definition: ASTWriter.h:719
static bool classofKind(Kind K)
Definition: DeclCXX.h:3397
Provides information a specialization of a member of a class template, which may be a member function...
Definition: DeclTemplate.h:595
LambdaCaptureDefault getLambdaCaptureDefault() const
Definition: DeclCXX.h:1138
bool isDependentLambda() const
Determine whether this lambda expression was known to be dependent at the time it was created...
Definition: DeclCXX.h:1838
base_class_iterator bases_end()
Definition: DeclCXX.h:745
friend bool operator==(shadow_iterator x, shadow_iterator y)
Definition: DeclCXX.h:3285
shadow_iterator & operator++()
Definition: DeclCXX.h:3274
bool isFailed() const
Definition: DeclCXX.h:3617
Declaration of a class template.
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:82
bool hasInheritedAssignment() const
Determine whether this class has a using-declaration that names a base class assignment operator...
Definition: DeclCXX.h:1414
bool isOffset() const
Whether this pointer is currently stored as an offset.
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1509
Kind
Lists the kind of concrete classes of Decl.
Definition: DeclBase.h:84
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3238
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3565
bool constructsVirtualBase() const
Returns true if the constructed base class is a virtual base class subobject of this declaration&#39;s cl...
Definition: DeclCXX.h:3175
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition: DeclCXX.h:3659
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
Definition: DeclCXX.h:2390
static bool classof(const Decl *D)
Definition: DeclCXX.h:3772
SourceLocation getUsingLoc() const
Returns the source location of the &#39;using&#39; keyword.
Definition: DeclCXX.h:3541
bool implicitCopyConstructorHasConstParam() const
Determine whether an implicit copy constructor for this type would have a parameter with a const-qual...
Definition: DeclCXX.h:937
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
void setCanPassInRegisters(bool CanPass)
Set that we can pass this RecordDecl in registers.
Definition: DeclCXX.h:1396
capture_const_iterator captures_begin() const
Definition: DeclCXX.h:1164
bool needsImplicitMoveConstructor() const
Determine whether this class should get an implicit move constructor or if any existing special membe...
Definition: DeclCXX.h:1002
bool hasDirectFields() const
Determine whether this class has direct non-static data members.
Definition: DeclCXX.h:1239
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:3756
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:2963
AccessSpecifier getAccessSpecifierAsWritten() const
Retrieves the access specifier as written in the source code (which may mean that no access specifier...
Definition: DeclCXX.h:250
shadow_iterator operator++(int)
Definition: DeclCXX.h:3279
NamedDecl * get() const
Retrieve the underlying function or function template.
Definition: DeclCXX.h:64
A trivial tuple used to represent a source range.
static bool classofKind(Kind K)
Definition: DeclCXX.h:2669
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: Decl.cpp:2785
static bool classofKind(Kind K)
Definition: DeclCXX.h:1908
NamedDecl - This represents a decl with a name.
Definition: Decl.h:213
bool hasCopyConstructorWithConstParam() const
Determine whether this class has a copy constructor with a parameter type which is a reference to a c...
Definition: DeclCXX.h:945
static DeclarationName getUsingDirectiveName()
getUsingDirectiveName - Return name for all using-directives.
Represents a C++ namespace alias.
Definition: DeclCXX.h:2876
SourceRange getSourceRange() const LLVM_READONLY
Retrieves the source range that contains the entire base specifier.
Definition: DeclCXX.h:201
ArrayRef< NamedDecl * > expansions() const
Get the set of using declarations that this pack expanded into.
Definition: DeclCXX.h:3378
Represents C++ using-directive.
Definition: DeclCXX.h:2773
bool isAggregate() const
Determine whether this class is an aggregate (C++ [dcl.init.aggr]), which is a class with no user-dec...
Definition: DeclCXX.h:1193
ctor_range ctors() const
Definition: DeclCXX.h:797
SourceLocation getBegin() const
llvm::iterator_range< overridden_cxx_method_iterator > overridden_method_range
Definition: ASTContext.h:888
SourceLocation ColonLoc
Location of &#39;:&#39;.
Definition: OpenMPClause.h:90
TemplateDecl * getDeducedTemplate() const
Get the template for which this guide performs deduction.
Definition: DeclCXX.h:1902
bool hasDefaultConstructor() const
Determine whether this class has any default constructors.
Definition: DeclCXX.h:876
ctor_iterator ctor_begin() const
Definition: DeclCXX.h:799
base_class_range vbases()
Definition: DeclCXX.h:753
Declaration of a template function.
Definition: DeclTemplate.h:939
void setTargetDecl(NamedDecl *ND)
Sets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3051
bool canPassInRegisters() const
Determine whether this class has at least one trivial, non-deleted copy or move constructor.
Definition: DeclCXX.h:1390
SourceLocation getLocation() const
Definition: DeclBase.h:407
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:2993
Represents a pack of using declarations that a single using-declarator pack-expanded into...
Definition: DeclCXX.h:3346
QualType getType() const
Return the type wrapped by this type source info.
Definition: Decl.h:70
static bool isProvablyNotDerivedFrom(Sema &SemaRef, CXXRecordDecl *Record, const BaseSet &Bases)
Determines if the given class is provably not derived from all of the prospective base classes...
const UsingShadowDecl * getCanonicalDecl() const
Definition: DeclCXX.h:3041
ConstructorUsingShadowDecl * getShadowDecl() const
Definition: DeclCXX.h:2330
Defines the LambdaCapture class.
NamedDecl * getAliasedNamespace() const
Retrieve the namespace that this alias refers to, which may either be a NamespaceDecl or a NamespaceA...
Definition: DeclCXX.h:2970
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclCXX.h:125
CXXRecordDecl * getParent()
Definition: DeclCXX.h:3142
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
bool isInheritingConstructor() const
Determine whether this is an implicit constructor synthesized to model a call to a constructor inheri...
Definition: DeclCXX.h:2532
method_range methods() const
Definition: DeclCXX.h:778
QualType getType() const
Retrieves the type of the base class.
Definition: DeclCXX.h:257
bool defaultedDestructorIsDeleted() const
true if a defaulted destructor for this class would be deleted.
Definition: DeclCXX.h:840