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