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