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