clang 8.0.0

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