Clang Project

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