clang: lib/AST/DeclCXX.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
40#include "llvm/ADT/SmallPtrSet.h"
41#include "llvm/ADT/SmallVector.h"
42#include "llvm/ADT/iterator_range.h"
43#include "llvm/Support/Casting.h"
44#include "llvm/Support/ErrorHandling.h"
45#include "llvm/Support/Format.h"
46#include "llvm/Support/raw_ostream.h"
47#include
48#include
49#include
50#include
51
52using namespace clang;
53
54
55
56
57
58void AccessSpecDecl::anchor() {}
59
62 return new (C, ID) AccessSpecDecl(EmptyShell());
63}
64
65void LazyASTUnresolvedSet::getFromExternalSource(ASTContext &C) const {
67 assert(Impl.Decls.isLazy() && "getFromExternalSource for non-lazy set");
68 assert(Source && "getFromExternalSource with no external source");
69
71 I.setDecl(
73 Impl.Decls.setLazy(false);
74}
75
76CXXRecordDecl::DefinitionData::DefinitionData(CXXRecordDecl *D)
77 : UserDeclaredConstructor(false), UserDeclaredSpecialMembers(0),
79 Abstract(false), IsStandardLayout(true), IsCXX11StandardLayout(true),
80 HasBasesWithFields(false), HasBasesWithNonStaticDataMembers(false),
81 HasPrivateFields(false), HasProtectedFields(false),
82 HasPublicFields(false), HasMutableFields(false), HasVariantMembers(false),
83 HasOnlyCMembers(true), HasInitMethod(false), HasInClassInitializer(false),
84 HasUninitializedReferenceMember(false), HasUninitializedFields(false),
85 HasInheritedConstructor(false), HasInheritedDefaultConstructor(false),
86 HasInheritedAssignment(false),
87 NeedOverloadResolutionForCopyConstructor(false),
88 NeedOverloadResolutionForMoveConstructor(false),
89 NeedOverloadResolutionForCopyAssignment(false),
90 NeedOverloadResolutionForMoveAssignment(false),
91 NeedOverloadResolutionForDestructor(false),
92 DefaultedCopyConstructorIsDeleted(false),
93 DefaultedMoveConstructorIsDeleted(false),
94 DefaultedCopyAssignmentIsDeleted(false),
95 DefaultedMoveAssignmentIsDeleted(false),
96 DefaultedDestructorIsDeleted(false), HasTrivialSpecialMembers(SMF_All),
97 HasTrivialSpecialMembersForCall(SMF_All),
98 DeclaredNonTrivialSpecialMembers(0),
99 DeclaredNonTrivialSpecialMembersForCall(0), HasIrrelevantDestructor(true),
100 HasConstexprNonCopyMoveConstructor(false),
101 HasDefaultedDefaultConstructor(false),
102 DefaultedDefaultConstructorIsConstexpr(true),
103 HasConstexprDefaultConstructor(false),
104 DefaultedDestructorIsConstexpr(true),
105 HasNonLiteralTypeFieldsOrBases(false), StructuralIfLiteral(true),
106 UserProvidedDefaultConstructor(false), DeclaredSpecialMembers(0),
107 ImplicitCopyConstructorCanHaveConstParamForVBase(true),
108 ImplicitCopyConstructorCanHaveConstParamForNonVBase(true),
109 ImplicitCopyAssignmentHasConstParam(true),
110 HasDeclaredCopyConstructorWithConstParam(false),
111 HasDeclaredCopyAssignmentWithConstParam(false),
112 IsAnyDestructorNoReturn(false), IsHLSLIntangible(false), IsLambda(false),
113 IsParsingBaseSpecifiers(false), ComputedVisibleConversions(false),
115
116CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getBasesSlowCase() const {
117 return Bases.get(Definition->getASTContext().getExternalSource());
118}
119
120CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getVBasesSlowCase() const {
121 return VBases.get(Definition->getASTContext().getExternalSource());
122}
123
128 : RecordDecl(K, TK, C, DC, StartLoc, IdLoc, Id, PrevDecl),
129 DefinitionData(PrevDecl ? PrevDecl->DefinitionData
131
136 return new (C, DC)
137 CXXRecordDecl(CXXRecord, TK, C, DC, StartLoc, IdLoc, Id, PrevDecl);
138}
139
143 unsigned DependencyKind, bool IsGeneric,
146 Loc, nullptr, nullptr);
148 R->DefinitionData = new (C) struct LambdaDefinitionData(
149 R, Info, DependencyKind, IsGeneric, CaptureDefault);
150 R->setImplicit(true);
151 return R;
152}
153
156 auto *R = new (C, ID)
159 return R;
160}
161
162
163
164
168 while (!WorkList.empty()) {
169 const CXXRecordDecl *RD = WorkList.pop_back_val();
171 continue;
173 if (const CXXRecordDecl *B = BaseSpec.getType()->getAsCXXRecordDecl()) {
174 if (!SeenBaseTypes.insert(B).second)
175 return true;
176 WorkList.push_back(B);
177 }
178 }
179 }
180 return false;
181}
182
183void
185 unsigned NumBases) {
187
188 if (!data().Bases.isOffset() && data().NumBases > 0)
189 C.Deallocate(data().getBases());
190
191 if (NumBases) {
192 if (.getLangOpts().CPlusPlus17) {
193
194
195 data().Aggregate = false;
196 }
197
198
199
200 data().PlainOldData = false;
201 }
202
203
205
206
208
210 data().NumBases = NumBases;
211 for (unsigned i = 0; i < NumBases; ++i) {
212 data().getBases()[i] = *Bases[i];
213
216
217 if (BaseType->isDependentType())
218 continue;
219 auto *BaseClassDecl = BaseType->castAsCXXRecordDecl();
220
221
222
223
224
225
226 if (BaseClassDecl->data().HasBasesWithFields ||
227 !BaseClassDecl->field_empty()) {
228 if (data().HasBasesWithFields)
229
230 data().IsStandardLayout = false;
231 data().HasBasesWithFields = true;
232 }
233
234
235
236
237
238 if (BaseClassDecl->data().HasBasesWithNonStaticDataMembers ||
239 BaseClassDecl->hasDirectFields()) {
240 if (data().HasBasesWithNonStaticDataMembers)
241 data().IsCXX11StandardLayout = false;
242 data().HasBasesWithNonStaticDataMembers = true;
243 }
244
245 if (!BaseClassDecl->isEmpty()) {
246
247
248
249 data().Empty = false;
250 }
251
252
253
255 data().Aggregate = false;
256
257
258
259
260 data().StructuralIfLiteral = false;
261 }
262
263
264
265
266 if (BaseClassDecl->isPolymorphic()) {
267 data().Polymorphic = true;
268
269
270 data().Aggregate = false;
271 }
272
273
274
275
276 if (!BaseClassDecl->isStandardLayout())
277 data().IsStandardLayout = false;
278 if (!BaseClassDecl->isCXX11StandardLayout())
279 data().IsCXX11StandardLayout = false;
280
281
283 data().HasNonLiteralTypeFieldsOrBases = true;
284
285
286 for (const auto &VBase : BaseClassDecl->vbases()) {
287
288 if (SeenVBaseTypes.insert(C.getCanonicalType(VBase.getType())).second) {
289 VBases.push_back(&VBase);
290
291
292
293
294
295
296 if (CXXRecordDecl *VBaseDecl = VBase.getType()->getAsCXXRecordDecl())
297 if (!VBaseDecl->hasCopyConstructorWithConstParam())
298 data().ImplicitCopyConstructorCanHaveConstParamForVBase = false;
299
300
301
302 data().Aggregate = false;
303 }
304 }
305
306 if (Base->isVirtual()) {
307
308 if (SeenVBaseTypes.insert(C.getCanonicalType(BaseType)).second)
309 VBases.push_back(Base);
310
311
312
313
314 data().Empty = false;
315
316
317
318 data().Aggregate = false;
319
320
321
322
323
324 data().HasTrivialSpecialMembers &= SMF_Destructor;
325 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
326
327
328
329
330 data().IsStandardLayout = false;
331 data().IsCXX11StandardLayout = false;
332
333
334
335
336
337 data().DefaultedDefaultConstructorIsConstexpr = false;
338 data().DefaultedDestructorIsConstexpr = false;
339
340
341
342
343
344
345 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
346 data().ImplicitCopyConstructorCanHaveConstParamForVBase = false;
347 } else {
348
349
350
351
352 if (!BaseClassDecl->hasTrivialDefaultConstructor())
353 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
354
355
356
357
358
359
360 if (!BaseClassDecl->hasTrivialCopyConstructor())
361 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
362
363 if (!BaseClassDecl->hasTrivialCopyConstructorForCall())
364 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
365
366
367
368
369
370 if (!BaseClassDecl->hasTrivialMoveConstructor())
371 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
372
373 if (!BaseClassDecl->hasTrivialMoveConstructorForCall())
374 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
375
376
377
378
379
380
381 if (!BaseClassDecl->hasTrivialCopyAssignment())
382 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
383
384
385
386
387 if (!BaseClassDecl->hasTrivialMoveAssignment())
388 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
389
390
391
392
393
394 if (!BaseClassDecl->hasConstexprDefaultConstructor())
395 data().DefaultedDefaultConstructorIsConstexpr =
396 C.getLangOpts().CPlusPlus23;
397
398
399
400
401
402
403 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
404 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase = false;
405 }
406
407
408
409
410 if (!BaseClassDecl->hasTrivialDestructor())
411 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
412
413 if (!BaseClassDecl->hasTrivialDestructorForCall())
414 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
415
416 if (!BaseClassDecl->hasIrrelevantDestructor())
417 data().HasIrrelevantDestructor = false;
418
419 if (BaseClassDecl->isAnyDestructorNoReturn())
420 data().IsAnyDestructorNoReturn = true;
421
422 if (BaseClassDecl->isHLSLIntangible())
423 data().IsHLSLIntangible = true;
424
425
426
427
428
429
430 if (!BaseClassDecl->hasCopyAssignmentWithConstParam())
431 data().ImplicitCopyAssignmentHasConstParam = false;
432
433
434
435 if (BaseClassDecl->hasObjectMember())
437
438 if (BaseClassDecl->hasVolatileMember())
440
441 if (BaseClassDecl->getArgPassingRestrictions() ==
444
445
446 if (BaseClassDecl->hasMutableFields())
447 data().HasMutableFields = true;
448
449 if (BaseClassDecl->hasUninitializedExplicitInitFields() &&
450 BaseClassDecl->isAggregate())
452
453 if (BaseClassDecl->hasUninitializedReferenceMember())
454 data().HasUninitializedReferenceMember = true;
455
456 if (!BaseClassDecl->allowConstDefaultInit())
457 data().HasUninitializedFields = true;
458
459 addedClassSubobject(BaseClassDecl);
460 }
461
462
463
464
465
466
467
468
470 data().IsStandardLayout = false;
471
472 if (VBases.empty()) {
473 data().IsParsingBaseSpecifiers = false;
474 return;
475 }
476
477
479 data().NumVBases = VBases.size();
480 for (int I = 0, E = VBases.size(); I != E; ++I) {
484 data().getVBases()[I] = *VBases[I];
485 }
486
487 data().IsParsingBaseSpecifiers = false;
488}
489
491 assert(hasDefinition() && "ODRHash only for records with definitions");
492
493
494 if (DefinitionData->HasODRHash)
495 return DefinitionData->ODRHash;
496
497
500 DefinitionData->HasODRHash = true;
502
503 return DefinitionData->ODRHash;
504}
505
506void CXXRecordDecl::addedClassSubobject(CXXRecordDecl *Subobj) {
507
508
509
510
511
512
514 data().NeedOverloadResolutionForCopyConstructor = true;
516 data().NeedOverloadResolutionForMoveConstructor = true;
517
518
519
520
521
522
523
525 data().NeedOverloadResolutionForCopyAssignment = true;
527 data().NeedOverloadResolutionForMoveAssignment = true;
528
529
530
531
532
533
534
535
537 data().NeedOverloadResolutionForCopyConstructor = true;
538 data().NeedOverloadResolutionForMoveConstructor = true;
539 data().NeedOverloadResolutionForDestructor = true;
540 }
541
542
543
544
545
546
548 data().DefaultedDestructorIsConstexpr =
550
551
552
553
554
555 if (!Subobj->data().StructuralIfLiteral)
556 data().StructuralIfLiteral = false;
557}
558
560 assert(
562 "getStandardLayoutBaseWithFields called on a non-standard-layout type");
563#ifdef EXPENSIVE_CHECKS
564 {
565 unsigned NumberOfBasesWithFields = 0;
567 ++NumberOfBasesWithFields;
570 if (->field_empty())
571 ++NumberOfBasesWithFields;
572 assert(
573 UniqueBases.insert(Base->getCanonicalDecl()).second &&
574 "Standard layout struct has multiple base classes of the same type");
575 return true;
576 });
577 assert(NumberOfBasesWithFields <= 1 &&
578 "Standard layout struct has fields declared in more than one class");
579 }
580#endif
582 return this;
585 if (->field_empty()) {
586
588 return false;
589 }
590 return true;
591 });
593}
594
599
602 return false;
603
605}
606
608
609
610
612
614
616
618
620
621 return true;
622}
623
625
626
627
629 return false;
630
632 return false;
633
634 return true;
635}
636
637void CXXRecordDecl::markedVirtualFunctionPure() {
638
639
640 data().Abstract = true;
641}
642
643bool CXXRecordDecl::hasSubobjectAtOffsetZeroOfEmptyBaseType(
646 return false;
647
651
652
653 auto Visit = [&](const CXXRecordDecl *RD) -> bool {
654 RD = RD->getCanonicalDecl();
655
656
657
658
659
660
661
662 if (!RD->data().HasBasesWithFields) {
663
664
665 if (Bases.empty()) {
667 Base = Base->getCanonicalDecl();
668 if (RD == Base)
669 return false;
670 Bases.insert(Base);
671 return true;
672 });
673 if (RDIsBase)
674 return true;
675 } else {
676 if (Bases.count(RD))
677 return true;
678 }
679 }
680
681 if (M.insert(RD).second)
682 WorkList.push_back(RD);
683 return false;
684 };
685
686 if (Visit(XFirst))
687 return true;
688
689 while (!WorkList.empty()) {
691
692
693
694
695
696
697
698
699 bool IsFirstField = true;
700 for (auto *FD : X->fields()) {
701
702
703 if (FD->isUnnamedBitField())
704 continue;
705
706 if (!IsFirstField && !FD->isZeroSize(Ctx))
707 continue;
708
709 if (FD->isInvalidDecl())
710 continue;
711
712
715 if (Visit(RD))
716 return true;
717
718 if (->isUnion())
719 IsFirstField = false;
720 }
721 }
722
723 return false;
724}
725
727 assert(isLambda() && "not a lambda");
728
729
730
731
732
733
734
735
736
737
738
740 return false;
742}
743
744void CXXRecordDecl::addedMember(Decl *D) {
749 data().HasOnlyCMembers = false;
750
751
753 return;
754
755 auto *FunTmpl = dyn_cast(D);
756 if (FunTmpl)
757 D = FunTmpl->getTemplatedDecl();
758
759
760 Decl *DUnderlying = D;
761 if (auto *ND = dyn_cast(DUnderlying)) {
762 DUnderlying = ND->getUnderlyingDecl();
763 if (auto *UnderlyingFunTmpl = dyn_cast(DUnderlying))
764 DUnderlying = UnderlyingFunTmpl->getTemplatedDecl();
765 }
766
767 if (const auto *Method = dyn_cast(D)) {
768 if (Method->isVirtual()) {
769
770
771 data().Aggregate = false;
772
773
774
775 data().PlainOldData = false;
776
777
778
779 data().Empty = false;
780
781
782
783
784 data().Polymorphic = true;
785
786
787
788
789
790 data().HasTrivialSpecialMembers &= SMF_Destructor;
791 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
792
793
794
795
796 data().IsStandardLayout = false;
797 data().IsCXX11StandardLayout = false;
798 }
799 }
800
801
802
805 L->AddedCXXImplicitMember(data().Definition, D);
806
807
808 unsigned SMKind = 0;
809
810
811 if (const auto *Constructor = dyn_cast(D)) {
812 if (Constructor->isInheritingConstructor()) {
813
814
815 } else {
817
818 data().UserDeclaredConstructor = true;
819
823
824
825
826
827
828 data().PlainOldData = false;
829 }
830 }
831
832 if (Constructor->isDefaultConstructor()) {
833 SMKind |= SMF_DefaultConstructor;
834
836 data().UserProvidedDefaultConstructor = true;
838 data().HasConstexprDefaultConstructor = true;
840 data().HasDefaultedDefaultConstructor = true;
841 }
842
843 if (!FunTmpl) {
844 unsigned Quals;
845 if (Constructor->isCopyConstructor(Quals)) {
846 SMKind |= SMF_CopyConstructor;
847
849 data().HasDeclaredCopyConstructorWithConstParam = true;
850 } else if (Constructor->isMoveConstructor())
851 SMKind |= SMF_MoveConstructor;
852 }
853
854
855
856
857
858
859
863 data().Aggregate = false;
864 }
865 }
866
867
868 if (const auto *Constructor = dyn_cast(DUnderlying)) {
869
870
871
872
873
874
876 data().HasConstexprNonCopyMoveConstructor = true;
878 data().HasInheritedDefaultConstructor = true;
879 }
880
881
882 if (const auto *Method = dyn_cast(D)) {
884 SMKind |= SMF_Destructor;
885
886 if (Method->isCopyAssignmentOperator()) {
887 SMKind |= SMF_CopyAssignment;
888
889 const auto *ParamTy =
890 Method->getNonObjectParameter(0)->getType()->getAs();
891 if (!ParamTy || ParamTy->getPointeeType().isConstQualified())
892 data().HasDeclaredCopyAssignmentWithConstParam = true;
893 }
894
895 if (Method->isMoveAssignmentOperator())
896 SMKind |= SMF_MoveAssignment;
897
898
899 if (auto *Conversion = dyn_cast(D)) {
900
901
902
903
904
905
907
908 if (Conversion->getPrimaryTemplate()) {
909
910 } else {
912 ASTUnresolvedSet &Conversions = data().Conversions.get(Ctx);
917 Primary, AS);
918 else
919 Conversions.addDecl(Ctx, Primary, AS);
920 }
921 }
922
923 if (SMKind) {
924
925
926 data().HasTrivialSpecialMembers &=
927 data().DeclaredSpecialMembers | ~SMKind;
928 data().HasTrivialSpecialMembersForCall &=
929 data().DeclaredSpecialMembers | ~SMKind;
930
931
932
933 data().DeclaredSpecialMembers |= SMKind;
934 if (->isImplicit()) {
935 data().UserDeclaredSpecialMembers |= SMKind;
936
938 if ((->isDeleted() &&
->isDefaulted() &&
939 SMKind != SMF_MoveAssignment) ||
941
942
943
944
945
946
947
948
949
950
951
952
953 data().PlainOldData = false;
954 }
955 }
956
957
958
959
960
961 if (->isIneligibleOrNotSelected()) {
963 }
964 }
965
966 return;
967 }
968
969
970 if (const auto *Field = dyn_cast(D)) {
972
973
974
975
976
977
978 if (data().HasBasesWithFields)
979 data().IsStandardLayout = false;
980
981
982
983
984
985 if (Field->isUnnamedBitField()) {
986
987
988
989 if (data().Empty && ->isZeroLengthBitField() &&
990 Context.getLangOpts().getClangABICompat() >
991 LangOptions::ClangABI::Ver6)
992 data().Empty = false;
993 return;
994 }
995
996
997
998
999
1000 if (data().HasBasesWithNonStaticDataMembers)
1001 data().IsCXX11StandardLayout = false;
1002
1003
1004
1005
1006
1007
1009 data().Aggregate = false;
1010 data().PlainOldData = false;
1011
1012
1013
1014
1015 data().StructuralIfLiteral = false;
1016 }
1017
1018
1019
1020 bool IsFirstField = !data().HasPrivateFields &&
1021 !data().HasProtectedFields && !data().HasPublicFields;
1022
1023
1024
1025
1026
1028 case AS_private: data().HasPrivateFields = true; break;
1029 case AS_protected: data().HasProtectedFields = true; break;
1030 case AS_public: data().HasPublicFields = true; break;
1031 case AS_none: llvm_unreachable("Invalid access specifier");
1032 };
1033 if ((data().HasPrivateFields + data().HasProtectedFields +
1034 data().HasPublicFields) > 1) {
1035 data().IsStandardLayout = false;
1036 data().IsCXX11StandardLayout = false;
1037 }
1038
1039
1040 if (Field->isMutable()) {
1041 data().HasMutableFields = true;
1042
1043
1044
1045
1046 data().StructuralIfLiteral = false;
1047 }
1048
1049
1050
1051
1052 if (isUnion() && ->isAnonymousStructOrUnion())
1053 data().HasVariantMembers = true;
1054
1055 if (isUnion() && IsFirstField)
1056 data().HasUninitializedFields = true;
1057
1058
1059
1060
1061
1062
1063
1064
1067 if (T.hasNonTrivialObjCLifetime()) {
1068
1069
1070
1071
1072
1073
1075 struct DefinitionData &Data = data();
1076 Data.PlainOldData = false;
1077 Data.HasTrivialSpecialMembers = 0;
1078
1079
1080
1083 data().HasTrivialSpecialMembersForCall = 0;
1084
1085
1088
1089 Data.HasIrrelevantDestructor = false;
1090
1092 data().DefaultedCopyConstructorIsDeleted = true;
1093 data().DefaultedMoveConstructorIsDeleted = true;
1094 data().DefaultedCopyAssignmentIsDeleted = true;
1095 data().DefaultedMoveAssignmentIsDeleted = true;
1096 data().DefaultedDestructorIsDeleted = true;
1097 data().NeedOverloadResolutionForCopyConstructor = true;
1098 data().NeedOverloadResolutionForMoveConstructor = true;
1099 data().NeedOverloadResolutionForCopyAssignment = true;
1100 data().NeedOverloadResolutionForMoveAssignment = true;
1101 data().NeedOverloadResolutionForDestructor = true;
1102 }
1103 } else if (!Context.getLangOpts().ObjCAutoRefCount) {
1105 }
1106 } else if (.isCXX98PODType(Context))
1107 data().PlainOldData = false;
1108
1109
1110
1111
1112 if (PointerAuthQualifier Q = T.getPointerAuth()) {
1113 if (Q.isAddressDiscriminated()) {
1114 struct DefinitionData &Data = data();
1115 Data.PlainOldData = false;
1116 Data.HasTrivialSpecialMembers &=
1117 ~(SMF_CopyConstructor | SMF_MoveConstructor | SMF_CopyAssignment |
1118 SMF_MoveAssignment);
1120
1121
1122
1124 data().DefaultedCopyConstructorIsDeleted = true;
1125 data().DefaultedMoveConstructorIsDeleted = true;
1126 data().DefaultedCopyAssignmentIsDeleted = true;
1127 data().DefaultedMoveAssignmentIsDeleted = true;
1128 data().NeedOverloadResolutionForCopyConstructor = true;
1129 data().NeedOverloadResolutionForMoveConstructor = true;
1130 data().NeedOverloadResolutionForCopyAssignment = true;
1131 data().NeedOverloadResolutionForMoveAssignment = true;
1132 }
1133 }
1134 }
1135
1136 if (Field->hasAttr())
1138
1140 if (->hasInClassInitializer())
1141 data().HasUninitializedReferenceMember = true;
1142
1143
1144
1145
1146 data().IsStandardLayout = false;
1147 data().IsCXX11StandardLayout = false;
1148
1149
1150
1151
1153 data().DefaultedCopyConstructorIsDeleted = true;
1154 }
1155
1157 if (Field->hasInClassInitializer())
1158 data().HasUninitializedFields = false;
1159 } else if (->hasInClassInitializer() &&
->isMutable()) {
1161 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
1162 data().HasUninitializedFields = true;
1163 } else {
1164 data().HasUninitializedFields = true;
1165 }
1166 }
1167
1168
1169 if (->isLiteralType(Context) || T.isVolatileQualified())
1170 data().HasNonLiteralTypeFieldsOrBases = true;
1171
1172 if (Field->hasInClassInitializer() ||
1173 (Field->isAnonymousStructOrUnion() &&
1174 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
1175 data().HasInClassInitializer = true;
1176
1177
1178
1179
1180 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1181
1182
1183
1184
1185
1186
1188 data().Aggregate = false;
1189
1190
1191
1192 data().PlainOldData = false;
1193 }
1194
1195
1196
1197
1198
1200 data().DefaultedCopyAssignmentIsDeleted = true;
1201 data().DefaultedMoveAssignmentIsDeleted = true;
1202 }
1203
1204
1205
1206 bool IsZeroSize = Field->isZeroSize(Context);
1207
1209 if (FieldRec->isBeingDefined() || FieldRec->isCompleteDefinition()) {
1210 addedClassSubobject(FieldRec);
1211
1212
1213
1215
1216
1217
1218 data().NeedOverloadResolutionForCopyConstructor = true;
1219 data().NeedOverloadResolutionForMoveConstructor = true;
1220 data().NeedOverloadResolutionForCopyAssignment = true;
1221 data().NeedOverloadResolutionForMoveAssignment = true;
1222 }
1223
1224
1225
1226
1227
1228
1230 if (FieldRec->hasNonTrivialCopyConstructor())
1231 data().DefaultedCopyConstructorIsDeleted = true;
1232 if (FieldRec->hasNonTrivialMoveConstructor())
1233 data().DefaultedMoveConstructorIsDeleted = true;
1234 if (FieldRec->hasNonTrivialCopyAssignment())
1235 data().DefaultedCopyAssignmentIsDeleted = true;
1236 if (FieldRec->hasNonTrivialMoveAssignment())
1237 data().DefaultedMoveAssignmentIsDeleted = true;
1238 if (FieldRec->hasNonTrivialDestructor()) {
1239 data().DefaultedDestructorIsDeleted = true;
1240
1241
1242
1243 data().DefaultedDestructorIsConstexpr = true;
1244 }
1245 }
1246
1247
1248
1249 if (Field->isAnonymousStructOrUnion()) {
1250 data().NeedOverloadResolutionForCopyConstructor |=
1251 FieldRec->data().NeedOverloadResolutionForCopyConstructor;
1252 data().NeedOverloadResolutionForMoveConstructor |=
1253 FieldRec->data().NeedOverloadResolutionForMoveConstructor;
1254 data().NeedOverloadResolutionForCopyAssignment |=
1255 FieldRec->data().NeedOverloadResolutionForCopyAssignment;
1256 data().NeedOverloadResolutionForMoveAssignment |=
1257 FieldRec->data().NeedOverloadResolutionForMoveAssignment;
1258 data().NeedOverloadResolutionForDestructor |=
1259 FieldRec->data().NeedOverloadResolutionForDestructor;
1260 }
1261
1262
1263
1264
1265
1266
1267 if (!FieldRec->hasTrivialDefaultConstructor())
1268 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1269
1270
1271
1272
1273
1274
1275
1276 if (!FieldRec->hasTrivialCopyConstructor())
1277 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
1278
1279 if (!FieldRec->hasTrivialCopyConstructorForCall())
1280 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
1281
1282
1283
1284
1285 if (!FieldRec->hasTrivialMoveConstructor())
1286 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
1287
1288 if (!FieldRec->hasTrivialMoveConstructorForCall())
1289 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
1290
1291
1292
1293
1294
1295
1296
1297 if (!FieldRec->hasTrivialCopyAssignment())
1298 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
1299
1300
1301
1302 if (!FieldRec->hasTrivialMoveAssignment())
1303 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
1304
1305 if (!FieldRec->hasTrivialDestructor())
1306 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1307 if (!FieldRec->hasTrivialDestructorForCall())
1308 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1309 if (!FieldRec->hasIrrelevantDestructor())
1310 data().HasIrrelevantDestructor = false;
1311 if (FieldRec->isAnyDestructorNoReturn())
1312 data().IsAnyDestructorNoReturn = true;
1313 if (FieldRec->hasObjectMember())
1315 if (FieldRec->hasVolatileMember())
1317 if (FieldRec->getArgPassingRestrictions() ==
1320
1321
1322
1323
1324
1325 if (!FieldRec->isStandardLayout())
1326 data().IsStandardLayout = false;
1327 if (!FieldRec->isCXX11StandardLayout())
1328 data().IsCXX11StandardLayout = false;
1329
1330
1331
1332
1333
1334 if (data().IsStandardLayout &&
1335 (isUnion() || IsFirstField || IsZeroSize) &&
1336 hasSubobjectAtOffsetZeroOfEmptyBaseType(Context, FieldRec))
1337 data().IsStandardLayout = false;
1338
1339
1340
1341
1342
1343 if (data().IsCXX11StandardLayout && IsFirstField) {
1344
1345
1346 for (const auto &BI : bases()) {
1348 data().IsCXX11StandardLayout = false;
1349 break;
1350 }
1351 }
1352 }
1353
1354
1355 if (FieldRec->hasMutableFields())
1356 data().HasMutableFields = true;
1357
1358 if (Field->isMutable()) {
1359
1360
1361
1362 data().NeedOverloadResolutionForCopyConstructor = true;
1363 data().NeedOverloadResolutionForCopyAssignment = true;
1364 }
1365
1366
1367
1368
1369
1370
1371
1372
1373 if (->hasInClassInitializer() &&
1374 !FieldRec->hasConstexprDefaultConstructor() && ())
1375
1376
1377 data().DefaultedDefaultConstructorIsConstexpr =
1379
1380
1381
1382
1383
1384
1385 if (!FieldRec->hasCopyConstructorWithConstParam())
1386 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase = false;
1387
1388
1389
1390
1391
1392
1393
1394 if (!FieldRec->hasCopyAssignmentWithConstParam())
1395 data().ImplicitCopyAssignmentHasConstParam = false;
1396
1397 if (FieldRec->hasUninitializedExplicitInitFields() &&
1398 FieldRec->isAggregate())
1400
1401 if (FieldRec->hasUninitializedReferenceMember() &&
1402 ->hasInClassInitializer())
1403 data().HasUninitializedReferenceMember = true;
1404
1405
1406
1407
1408 if (FieldRec->hasVariantMembers() &&
1409 Field->isAnonymousStructOrUnion())
1410 data().HasVariantMembers = true;
1411 }
1412 } else {
1413
1415 (->hasInClassInitializer() &&
() &&
1417 data().DefaultedDefaultConstructorIsConstexpr = false;
1418
1419
1420
1421
1422
1423
1424 if (T.isConstQualified()) {
1425 data().DefaultedCopyAssignmentIsDeleted = true;
1426 data().DefaultedMoveAssignmentIsDeleted = true;
1427 }
1428
1429
1430
1431
1432
1433
1435 data().StructuralIfLiteral = false;
1436 }
1437
1438
1439
1440
1441 if (T.hasAddressDiscriminatedPointerAuth())
1442 data().HasTrivialSpecialMembers &=
1443 SMF_DefaultConstructor | SMF_Destructor;
1444
1445
1446
1447
1448 if (data().Empty && !IsZeroSize)
1449 data().Empty = false;
1450
1452 const Type *Ty = Field->getType()->getUnqualifiedDesugaredType();
1455
1457 if (const RecordType *RT = dyn_cast(Ty))
1459 else
1462 }
1463 }
1464
1465
1466 if (auto *Shadow = dyn_cast(D)) {
1467 if (Shadow->getDeclName().getNameKind()
1470 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1471 }
1472 }
1473
1474 if (const auto *Using = dyn_cast(D)) {
1475 if (Using->getDeclName().getNameKind() ==
1477 data().HasInheritedConstructor = true;
1478
1479
1480 data().Aggregate = false;
1481 }
1482
1483 if (Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1484 data().HasInheritedAssignment = true;
1485 }
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1497 data().Aggregate = data().UserDeclaredSpecialMembers == 0;
1498}
1499
1504 return false;
1505
1507
1508
1509
1511 return false;
1512 bool HasAtLeastOneLiteralMember =
1516 });
1517 if (!HasAtLeastOneLiteralMember)
1518 return false;
1519 }
1520
1523}
1524
1529
1531 unsigned SMKind) {
1532
1533
1534
1535
1536 if (const auto *DD = dyn_cast(MD)) {
1537 if (DD->isUserProvided())
1538 data().HasIrrelevantDestructor = false;
1539
1540
1541
1542
1543
1544
1545 if (DD->isVirtual()) {
1546 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1547 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1548 }
1549
1550 if (DD->isNoReturn())
1551 data().IsAnyDestructorNoReturn = true;
1552 }
1554
1555
1556
1557
1559 data().HasTrivialSpecialMembers |= SMKind;
1560 data().HasTrivialSpecialMembersForCall |= SMKind;
1562 data().HasTrivialSpecialMembersForCall |= SMKind;
1563 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1564 } else {
1565 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1566
1567
1568
1569
1570
1572 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1573 }
1574}
1575
1578
1579
1580 unsigned SMKind = 0;
1581
1582 if (const auto *Constructor = dyn_cast(D)) {
1583 if (Constructor->isDefaultConstructor()) {
1584 SMKind |= SMF_DefaultConstructor;
1586 data().HasConstexprDefaultConstructor = true;
1587 }
1589 SMKind |= SMF_CopyConstructor;
1590 else if (Constructor->isMoveConstructor())
1591 SMKind |= SMF_MoveConstructor;
1593
1594 data().HasConstexprNonCopyMoveConstructor = true;
1596 SMKind |= SMF_Destructor;
1598 data().HasIrrelevantDestructor = false;
1600 SMKind |= SMF_CopyAssignment;
1602 SMKind |= SMF_MoveAssignment;
1603
1604
1605
1608 data().HasTrivialSpecialMembers |= SMKind;
1609 else
1610 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1611 }
1612}
1613
1614void CXXRecordDecl::LambdaDefinitionData::AddCaptureList(ASTContext &Ctx,
1616 Captures.push_back(CaptureList);
1617 if (Captures.size() == 2) {
1618
1620 }
1621}
1622
1625 CXXRecordDecl::LambdaDefinitionData &Data = getLambdaData();
1626
1627
1628 Data.NumCaptures = Captures.size();
1629 Data.NumExplicitCaptures = 0;
1631 Captures.size());
1632 Data.AddCaptureList(Context, ToCapture);
1634 if (C.isExplicit())
1635 ++Data.NumExplicitCaptures;
1636
1638 ToCapture++;
1639 }
1640
1642 Data.DefaultedCopyAssignmentIsDeleted = true;
1643}
1644
1646 unsigned SMKind = 0;
1647
1648 if (const auto *Constructor = dyn_cast(D)) {
1650 SMKind = SMF_CopyConstructor;
1651 else if (Constructor->isMoveConstructor())
1652 SMKind = SMF_MoveConstructor;
1654 SMKind = SMF_Destructor;
1655
1657 data().HasTrivialSpecialMembersForCall |= SMKind;
1658 else
1659 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1660}
1661
1665 !TemplateOrInstantiation.isNull())
1666 return false;
1668 return true;
1669
1670 return isPOD() && data().HasOnlyCMembers;
1671}
1672
1674 if (()) return false;
1675 return getLambdaData().IsGenericLambda;
1676}
1677
1678#ifndef NDEBUG
1680 return llvm::all_of(R, [&](NamedDecl *D) {
1682 });
1683}
1684#endif
1685
1687 if (!RD.isLambda()) return nullptr;
1690
1692
1693
1694 if (Calls.empty())
1695 return nullptr;
1696
1698 "More than one lambda call operator!");
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1724 if (MD->getOwningModule() == M)
1725 return MD;
1726 }
1727
1728 llvm_unreachable("Couldn't find our call operator!");
1729}
1730
1733 return dyn_cast_or_null(CallOp);
1734}
1735
1738
1739 if (CallOp == nullptr)
1740 return nullptr;
1741
1742 if (const auto *CallOpTmpl = dyn_cast(CallOp))
1744
1746}
1747
1750 assert(CallOp && "null call operator");
1753}
1754
1757 assert(RD.isLambda() && "Must be a lambda");
1760 return RD.lookup(Name);
1761}
1762
1764 if (const auto *InvokerTemplate = dyn_cast(ND))
1767}
1768
1771 return nullptr;
1773
1775 const auto *FTy =
1777 if (FTy->getCallConv() == CC)
1779 }
1780
1781 return nullptr;
1782}
1783
1785 llvm::DenseMap<const ValueDecl *, FieldDecl *> &Captures,
1786 FieldDecl *&ThisCapture) const {
1787 Captures.clear();
1788 ThisCapture = nullptr;
1789
1790 LambdaDefinitionData &Lambda = getLambdaData();
1791 for (const LambdaCapture *List : Lambda.Captures) {
1793 for (const LambdaCapture *C = List, *CEnd = C + Lambda.NumCaptures;
1794 C != CEnd; ++C, ++Field) {
1795 if (C->capturesThis())
1796 ThisCapture = *Field;
1797 else if (C->capturesVariable())
1798 Captures[C->getCapturedVar()] = *Field;
1799 }
1801 }
1802}
1803
1809 return Tmpl->getTemplateParameters();
1810 return nullptr;
1811}
1812
1816 if (!List)
1817 return {};
1818
1819 assert(std::is_partitioned(List->begin(), List->end(),
1820 [](const NamedDecl *D) { return !D->isImplicit(); })
1821 && "Explicit template params should be ordered before implicit ones");
1822
1823 const auto ExplicitEnd = llvm::partition_point(
1826}
1827
1829 assert(isLambda() && "Not a lambda closure type!");
1831 return getLambdaData().ContextDecl.get(Source);
1832}
1833
1835 assert(isLambda() && "Not a lambda closure type!");
1836 getLambdaData().ManglingNumber = Numbering.ManglingNumber;
1838 getASTContext().DeviceLambdaManglingNumbers[this] =
1840 getLambdaData().IndexInContext = Numbering.IndexInContext;
1841 getLambdaData().ContextDecl = Numbering.ContextDecl;
1843}
1844
1846 assert(isLambda() && "Not a lambda closure type!");
1847 return getASTContext().DeviceLambdaManglingNumbers.lookup(this);
1848}
1849
1853 ->getConversionType();
1854 return Context.getCanonicalType(T);
1855}
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1875
1876
1877
1880
1881
1882
1885 if (ConvI != ConvE) {
1886 HiddenTypesBuffer = ParentHiddenTypes;
1887 HiddenTypes = &HiddenTypesBuffer;
1888
1891 bool Hidden = ParentHiddenTypes.count(ConvType);
1892 if (!Hidden)
1893 HiddenTypesBuffer.insert(ConvType);
1894
1895
1896
1897 if (Hidden && InVirtual)
1898 HiddenVBaseCs.insert(cast(I.getDecl()->getCanonicalDecl()));
1899
1900
1901 else if (!Hidden) {
1904
1905 if (InVirtual)
1906 VOutput.addDecl(I.getDecl(), IAccess);
1907 else
1908 Output.addDecl(Context, I.getDecl(), IAccess);
1909 }
1910 }
1911 }
1912
1913
1914 for (const auto &I : Record->bases()) {
1915 const auto *Base = I.getType()->getAsCXXRecordDecl();
1917 continue;
1918
1921 bool BaseInVirtual = InVirtual || I.isVirtual();
1922
1924 *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1925 }
1926}
1927
1928
1929
1930
1931
1935
1936
1937
1939
1940
1941
1943
1944
1946
1947
1948
1951 Output.append(Context, ConvI, ConvE);
1952 for (; ConvI != ConvE; ++ConvI)
1954
1955
1956 for (const auto &I : Record->bases()) {
1957 const auto *Base = I.getType()->getAsCXXRecordDecl();
1959 continue;
1960
1962 I.getAccessSpecifier(), HiddenTypes, Output,
1963 VBaseCs, HiddenVBaseCs);
1964 }
1965
1966
1968 I != E; ++I) {
1969 if (!HiddenVBaseCs.count(cast(I.getDecl()->getCanonicalDecl())))
1970 Output.addDecl(Context, I.getDecl(), I.getAccess());
1971 }
1972}
1973
1974
1975
1976llvm::iterator_rangeCXXRecordDecl::conversion\_iterator
1979
1981 if (bases().empty()) {
1982
1983 Set = &data().Conversions.get(Ctx);
1984 } else {
1985 Set = &data().VisibleConversions.get(Ctx);
1986
1987 if (!data().ComputedVisibleConversions) {
1989 data().ComputedVisibleConversions = true;
1990 }
1991 }
1992 return llvm::make_range(Set->begin(), Set->end());
1993}
1994
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2008 for (unsigned I = 0, E = Convs.size(); I != E; ++I) {
2009 if (Convs[I].getDecl() == ConvDecl) {
2011 assert(!llvm::is_contained(Convs, ConvDecl) &&
2012 "conversion was found multiple times in unresolved set");
2013 return;
2014 }
2015 }
2016
2017 llvm_unreachable("conversion not found in set!");
2018}
2019
2023
2024 return nullptr;
2025}
2026
2028 return dyn_cast_if_present<MemberSpecializationInfo *>(
2029 TemplateOrInstantiation);
2030}
2031
2032void
2035 assert(TemplateOrInstantiation.isNull() &&
2036 "Previous template or instantiation?");
2038 TemplateOrInstantiation
2040}
2041
2043 return dyn_cast_if_present<ClassTemplateDecl *>(TemplateOrInstantiation);
2044}
2045
2047 TemplateOrInstantiation = Template;
2048}
2049
2051 if (const auto *Spec = dyn_cast(this))
2052 return Spec->getSpecializationKind();
2053
2055 return MSInfo->getTemplateSpecializationKind();
2056
2058}
2059
2060void
2062 if (auto *Spec = dyn_cast(this)) {
2063 Spec->setSpecializationKind(TSK);
2064 return;
2065 }
2066
2068 MSInfo->setTemplateSpecializationKind(TSK);
2069 return;
2070 }
2071
2072 llvm_unreachable("Not a class template or member class specialization");
2073}
2074
2076 auto GetDefinitionOrSelf =
2078 if (auto *Def = D->getDefinition())
2079 return Def;
2080 return D;
2081 };
2082
2083
2084
2085 if (auto *TD = dyn_cast(this)) {
2086 auto From = TD->getInstantiatedFrom();
2087 if (auto *CTD = dyn_cast_if_present<ClassTemplateDecl *>(From)) {
2088 while (auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
2089 if (NewCTD->isMemberSpecialization())
2090 break;
2091 CTD = NewCTD;
2092 }
2093 return GetDefinitionOrSelf(CTD->getTemplatedDecl());
2094 }
2095 if (auto *CTPSD =
2096 dyn_cast_if_present<ClassTemplatePartialSpecializationDecl *>(
2097 From)) {
2098 while (auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
2099 if (NewCTPSD->isMemberSpecialization())
2100 break;
2101 CTPSD = NewCTPSD;
2102 }
2103 return GetDefinitionOrSelf(CTPSD);
2104 }
2105 }
2106
2111 RD = NewRD;
2112 return GetDefinitionOrSelf(RD);
2113 }
2114 }
2115
2117 "couldn't find pattern for class template instantiation");
2118 return nullptr;
2119}
2120
2123 CanQualType ClassType = Context.getCanonicalTagType(this);
2124
2126 Context.DeclarationNames.getCXXDestructorName(ClassType);
2127
2129
2130
2131
2132 for (auto *Decl : R) {
2133 auto* DD = dyn_cast(Decl);
2134 if (DD && !DD->isIneligibleOrNotSelected())
2135 return DD;
2136 }
2137 return nullptr;
2138}
2139
2142 return D->isDeleted();
2143 return false;
2144}
2145
2148 return false;
2149
2150 if (const auto *RD = dyn_cast(getDeclContext()))
2151 return RD->getDeclName() == getDeclName();
2152
2153 return false;
2154}
2155
2158 case Decl::ClassTemplatePartialSpecialization:
2159 return true;
2160 case Decl::ClassTemplateSpecialization:
2161 return false;
2162 case Decl::CXXRecord:
2164 default:
2165 llvm_unreachable("unexpected decl kind");
2166 }
2167}
2168
2171 if (auto *RD = dyn_cast(this))
2172 return RD->getCanonicalInjectedSpecializationType(Ctx);
2175 return TD->getCanonicalInjectedSpecializationType(Ctx);
2177}
2178
2182 return true;
2184 }
2185 return false;
2186}
2187
2189 assert(hasDefinition() && "checking for interface-like without a definition");
2190
2192 return true;
2193
2194
2195
2196
2200 return false;
2201
2202
2204 if (Method->isDefined() && ->isImplicit())
2205 return false;
2206
2207
2209
2210
2211
2214 ((getName() == "IUnknown" &&
2215 Uuid->getGuid() == "00000000-0000-0000-C000-000000000046") ||
2216 (getName() == "IDispatch" &&
2217 Uuid->getGuid() == "00020400-0000-0000-C000-000000000046"))) {
2219 return false;
2220 return true;
2221 }
2222
2223
2224
2225
2226
2228 return false;
2229
2231 if (BaseSpec.isVirtual() || BaseSpec.getAccessSpecifier() != AS_public)
2232 return false;
2233 const auto *Base = BaseSpec.getType()->getAsCXXRecordDecl();
2234 if (Base->isInterface() || ->isInterfaceLike())
2235 return false;
2236 return true;
2237}
2238
2242
2245 if (!FinalOverriders) {
2249 }
2250
2251 for (const CXXFinalOverriderMap::value_type &
2252 OverridingMethodsEntry : *FinalOverriders) {
2253 for (const auto &[_, SubobjOverrides] : OverridingMethodsEntry.second) {
2254 assert(SubobjOverrides.size() > 0 &&
2255 "All virtual functions have overriding virtual functions");
2256
2257 if (SubobjOverrides.front().Method->isPureVirtual())
2258 return true;
2259 }
2260 }
2261 return false;
2262}
2263
2266
2267
2268
2269
2270
2271
2272
2273
2276
2277
2279 I != E; ++I)
2280 I.setAccess((*I)->getAccess());
2281
2283
2285 !Context.getLangOpts().CPlusPlus20) {
2286
2288 if (const auto *AT = FD->getAttr())
2289 Context.getDiagnostics().Report(
2290 AT->getLocation(),
2291 diag::warn_cxx20_compat_requires_explicit_init_non_aggregate)
2292 << AT << FD << Context.getCanonicalTagType(this);
2293 }
2294 }
2295
2297
2298
2299
2301 if (const auto *AT = FD->getAttr())
2302 Context.getDiagnostics().Report(AT->getLocation(),
2303 diag::warn_attribute_needs_aggregate)
2304 << AT << Context.getCanonicalTagType(this);
2305 }
2307 }
2308}
2309
2311 if (data().Abstract || isInvalidDecl() || !data().Polymorphic ||
2313 return false;
2314
2315 for (const auto &B : bases()) {
2317 B.getType()->castAsCanonical()->getDecl());
2318 if (BaseDecl->isAbstract())
2319 return true;
2320 }
2321
2322 return false;
2323}
2324
2327 if (!Def)
2328 return false;
2329 if (Def->hasAttr())
2330 return true;
2331 if (const auto *Dtor = Def->getDestructor())
2332 if (Dtor->hasAttr())
2333 return true;
2334 return false;
2335}
2336
2337void CXXDeductionGuideDecl::anchor() {}
2338
2344 ODRHash SelfHash, OtherHash;
2348 } else
2349 return false;
2350 }
2351 return true;
2352}
2353
2355 switch (Function->getDeclKind()) {
2356 case Decl::Kind::CXXConstructor:
2358 case Decl::Kind::CXXConversion:
2360 case Decl::Kind::CXXDeductionGuide:
2362 default:
2363 return {};
2364 }
2365}
2366
2372 const CXXDeductionGuideDecl *GeneratedFrom,
2374 return new (C, DC) CXXDeductionGuideDecl(
2375 C, DC, StartLoc, ES, NameInfo, T, TInfo, EndLocation, Ctor, Kind,
2376 TrailingRequiresClause, GeneratedFrom, SourceKind);
2377}
2378
2381 return new (C, ID) CXXDeductionGuideDecl(
2385 {},
2387}
2388
2391 return new (C, DC) RequiresExprBodyDecl(C, DC, StartLoc);
2392}
2393
2396 return new (C, ID) RequiresExprBodyDecl(C, nullptr, SourceLocation());
2397}
2398
2399void CXXMethodDecl::anchor() {}
2400
2403
2405 return true;
2406
2409}
2410
2415 return true;
2417 return true;
2418 }
2419 return false;
2420}
2421
2422CXXMethodDecl *
2424 bool MayBeBase) {
2426 return this;
2427
2428
2431 if (MD) {
2433 return MD;
2435 return MD;
2436 }
2437 return nullptr;
2438 }
2439
2441 auto *MD = dyn_cast(ND);
2442 if (!MD)
2443 continue;
2445 return MD;
2447 return MD;
2448 }
2449
2450 return nullptr;
2451}
2452
2455 bool MayBeBase) {
2457 return MD;
2458
2460 auto AddFinalOverrider = [&](CXXMethodDecl *D) {
2461
2462
2465 return;
2466 }
2467
2468
2469 llvm::erase_if(FinalOverriders, [&](CXXMethodDecl *OtherD) {
2471 });
2472
2473 FinalOverriders.push_back(D);
2474 };
2475
2476 for (const auto &I : RD->bases()) {
2477 const auto *Base = I.getType()->getAsCXXRecordDecl();
2479 continue;
2481 AddFinalOverrider(D);
2482 }
2483
2484 return FinalOverriders.size() == 1 ? FinalOverriders.front() : nullptr;
2485}
2486
2495 CXXMethod, C, RD, StartLoc, NameInfo, T, TInfo, SC, UsesFPIntrin,
2496 isInline, ConstexprKind, EndLocation, TrailingRequiresClause);
2497}
2498
2501 return new (C, ID)
2505 {});
2506}
2507
2509 bool IsAppleKext) {
2510 assert(isVirtual() && "this method is expected to be virtual");
2511
2512
2513
2514 if (IsAppleKext)
2515 return nullptr;
2516
2517
2518
2521
2522
2524 return nullptr;
2525
2526
2527
2528 Base = Base->getBestDynamicClassTypeExpr();
2529 if (Base->isPRValue() && Base->getType()->isRecordType())
2530 return this;
2531
2532
2533 const CXXRecordDecl *BestDynamicDecl = Base->getBestDynamicClassType();
2534 if (!BestDynamicDecl)
2535 return nullptr;
2536
2537
2540
2541
2542
2543 if (!DevirtualizedMethod)
2544 return nullptr;
2545
2546
2547
2548
2550 return nullptr;
2551
2552
2553 if (DevirtualizedMethod->hasAttr())
2554 return DevirtualizedMethod;
2555
2556
2557
2558
2560 return DevirtualizedMethod;
2561
2562 if (const auto *DRE = dyn_cast(Base)) {
2563 if (const auto *VD = dyn_cast(DRE->getDecl()))
2564 if (VD->getType()->isRecordType())
2565
2566 return DevirtualizedMethod;
2567
2568 return nullptr;
2569 }
2570
2571
2572
2573
2574 if (const auto *ME = dyn_cast(Base)) {
2575 const ValueDecl *VD = ME->getMemberDecl();
2577 }
2578
2579
2580
2581 if (auto *BO = dyn_cast(Base)) {
2582 if (BO->isPtrMemOp()) {
2583 auto *MPT = BO->getRHS()->getType()->castAs<MemberPointerType>();
2584 if (MPT->getPointeeType()->isRecordType())
2585 return DevirtualizedMethod;
2586 }
2587 }
2588
2589
2590 return nullptr;
2591}
2592
2595 assert(PreventedBy.empty() && "PreventedBy is expected to be empty");
2596 if (().isAnyOperatorDelete())
2597 return false;
2598
2600
2601
2603 return false;
2604
2605
2606
2608 return false;
2609
2611 if (!PrimaryTemplate)
2612 return true;
2613
2614
2615
2616
2617
2618
2619
2622 return false;
2623 for (unsigned Idx = 1; Idx < getNumParams(); ++Idx) {
2625 return false;
2626 }
2627 return true;
2628 }
2629
2630
2631
2632
2633
2634
2635
2637 return false;
2638
2639
2640
2641
2642
2644 return true;
2645 unsigned UsualParams = 1;
2646
2647
2648
2649
2650
2651
2653 ++UsualParams;
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2668 Context.getSizeType()))
2669 ++UsualParams;
2670
2673 ++UsualParams;
2674
2676 return false;
2677
2678
2679
2680
2681
2682
2683 if (Context.getLangOpts().CPlusPlus17 ||
2684 Context.getLangOpts().AlignedAllocation ||
2686 return true;
2687
2688
2689
2692 for (const auto *D : R) {
2693 if (const auto *FD = dyn_cast(D)) {
2694 if (FD->getNumParams() == 1) {
2695 PreventedBy.push_back(FD);
2697 }
2698 }
2699 }
2701}
2702
2709
2713
2715
2716
2717
2718
2720 isStatic() ||
2721
2724 return false;
2725
2729
2732 return Context.hasSameUnqualifiedType(ClassType, ParamType);
2733}
2734
2736
2737
2738
2739
2743 return false;
2744
2747 return false;
2749
2752 return Context.hasSameUnqualifiedType(ClassType, ParamType);
2753}
2754
2756 assert(MD->isCanonicalDecl() && "Method is not canonical!");
2757 assert(MD->isVirtual() && "Method is not virtual!");
2758
2760}
2761
2766
2771
2776
2783
2789
2794
2795
2796
2798 if (Restrict)
2800
2801 ObjectTy = C.getLangOpts().HLSL ? C.getLValueReferenceType(ObjectTy)
2802 : C.getPointerType(ObjectTy);
2803
2804 if (Restrict)
2806 return ObjectTy;
2807}
2808
2810
2811
2812
2813
2814
2815 assert(isInstance() && "No 'this' for static methods!");
2818}
2819
2823
2829 return C.getRValueReferenceType(Type);
2830 return C.getLValueReferenceType(Type);
2831}
2832
2834
2835
2837 if (!CheckFn)
2838 CheckFn = this;
2839
2843}
2844
2850
2856 : Initializee(TInfo), Init(Init), MemberOrEllipsisLocation(EllipsisLoc),
2857 LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(IsVirtual),
2858 IsWritten(false), SourceOrder(0) {}
2859
2864 : Initializee(Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2865 LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(false),
2866 IsWritten(false), SourceOrder(0) {}
2867
2873 : Initializee(Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2874 LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(false),
2875 IsWritten(false), SourceOrder(0) {}
2876
2881 : Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R),
2882 IsDelegating(true), IsVirtual(false), IsWritten(false), SourceOrder(0) {}
2883
2885 return Context.getAllocator()
2887}
2888
2892 else
2893 return {};
2894}
2895
2899 else
2900 return nullptr;
2901}
2902
2906
2909
2911 return TSInfo->getTypeLoc().getBeginLoc();
2912
2913 return {};
2914}
2915
2920 return I->getSourceRange();
2921 return {};
2922 }
2923
2925}
2926
2927CXXConstructorDecl::CXXConstructorDecl(
2934 : CXXMethodDecl(CXXConstructor, C, RD, StartLoc, NameInfo, T, TInfo,
2935 SC_None, UsesFPIntrin, isInline, ConstexprKind,
2937 setNumCtorInitializers(0);
2938 setInheritingConstructor(static_cast<bool>(Inherited));
2939 setImplicit(isImplicitlyDeclared);
2940 CXXConstructorDeclBits.HasTrailingExplicitSpecifier = ES.getExpr() ? 1 : 0;
2941 if (Inherited)
2942 *getTrailingObjects() = Inherited;
2943 setExplicitSpecifier(ES);
2944}
2945
2946void CXXConstructorDecl::anchor() {}
2947
2950 uint64_t AllocKind) {
2951 bool hasTrailingExplicit = static_cast<bool>(AllocKind & TAKHasTailExplicit);
2953 static_cast<bool>(AllocKind & TAKInheritsConstructor);
2954 unsigned Extra =
2955 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2957 auto *Result = new (C, ID, Extra) CXXConstructorDecl(
2962 Result->CXXConstructorDeclBits.HasTrailingExplicitSpecifier =
2963 hasTrailingExplicit;
2966}
2967
2977 "Name must refer to a constructor");
2978 unsigned Extra =
2979 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2980 Inherited ? 1 : 0, ES.getExpr() ? 1 : 0);
2981 return new (C, RD, Extra) CXXConstructorDecl(
2982 C, RD, StartLoc, NameInfo, T, TInfo, ES, UsesFPIntrin, isInline,
2983 isImplicitlyDeclared, ConstexprKind, Inherited, TrailingRequiresClause);
2984}
2985
2987 return CtorInitializers.get(getASTContext().getExternalSource());
2988}
2989
2993 if (const auto *Construct = dyn_cast(E))
2994 return Construct->getConstructor();
2995
2996 return nullptr;
2997}
2998
3000
3001
3002
3003
3005}
3006
3007bool
3012
3017
3018
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3032 return false;
3033
3035
3036
3037 const auto *ParamRefType = Param->getType()->getAs<ReferenceType>();
3038 if (!ParamRefType)
3039 return false;
3040
3041
3043
3046 if (!Context.hasSameUnqualifiedType(PointeeType, ClassTy))
3047 return false;
3048
3049
3050
3051
3053 return true;
3054}
3055
3057
3058
3059
3060
3061
3062
3064 return false;
3065
3066
3067
3068
3072}
3073
3076 return false;
3077
3079
3081 CanQualType ParamType = Param->getType()->getCanonicalTypeUnqualified();
3082
3083
3085 return ParamType == ClassTy;
3086}
3087
3088void CXXDestructorDecl::anchor() {}
3089
3092 return new (C, ID) CXXDestructorDecl(
3095 {});
3096}
3097
3101 bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared,
3106 "Name must refer to a destructor");
3107 return new (C, RD) CXXDestructorDecl(
3108 C, RD, StartLoc, NameInfo, T, TInfo, UsesFPIntrin, isInline,
3109 isImplicitlyDeclared, ConstexprKind, TrailingRequiresClause);
3110}
3111
3114 if (OD && ().dtorHasOperatorDelete(
3121 ThisArg);
3122 }
3123}
3124
3126
3127
3128
3129
3130 assert(!OD ||
3133 if (OD && ().dtorHasOperatorDelete(
3139 OD);
3140 }
3141}
3142
3144 assert(!OD ||
3146 if (OD && ().dtorHasOperatorDelete(
3151 L->ResolvedOperatorArrayDelete(
3153 }
3154}
3155
3157 assert(!OD ||
3160 if (OD && ().dtorHasOperatorDelete(
3165 L->ResolvedOperatorGlobArrayDelete(
3167 }
3168}
3169
3174
3179
3184
3189
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201 const FunctionDecl *SelectedOperatorDelete =
3203 if (!SelectedOperatorDelete)
3204 return true;
3205
3207 return true;
3208
3209
3211}
3212
3213void CXXConversionDecl::anchor() {}
3214
3217 return new (C, ID) CXXConversionDecl(
3221}
3222
3231 "Name must refer to a conversion function");
3232 return new (C, RD) CXXConversionDecl(
3233 C, RD, StartLoc, NameInfo, T, TInfo, UsesFPIntrin, isInline, ES,
3234 ConstexprKind, EndLocation, TrailingRequiresClause);
3235}
3236
3241
3245 : Decl(LinkageSpec, DC, LangLoc), DeclContext(LinkageSpec),
3247 setLanguage(lang);
3249}
3250
3251void LinkageSpecDecl::anchor() {}
3252
3257 bool HasBraces) {
3258 return new (C, DC) LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
3259}
3260
3263 return new (C, ID)
3266}
3267
3268void UsingDirectiveDecl::anchor() {}
3269
3277 if (auto *NS = dyn_cast_or_null(Used))
3278 Used = NS->getFirstDecl();
3279 return new (C, DC) UsingDirectiveDecl(DC, L, NamespaceLoc, QualifierLoc,
3280 IdentLoc, Used, CommonAncestor);
3281}
3282
3285 return new (C, ID) UsingDirectiveDecl(nullptr, SourceLocation(),
3289}
3290
3292 if (auto *Alias = dyn_cast(this))
3295}
3296
3298 if (auto *NA = dyn_cast_or_null(NominatedNamespace))
3300 return cast_or_null(NominatedNamespace);
3301}
3302
3306 bool Nested)
3308 redeclarable_base(C), LocStart(StartLoc) {
3309 setInline(Inline);
3310 setNested(Nested);
3311 setPreviousDecl(PrevDecl);
3312}
3313
3317 NamespaceDecl *PrevDecl, bool Nested) {
3318 return new (C, DC)
3319 NamespaceDecl(C, DC, Inline, StartLoc, IdLoc, Id, PrevDecl, Nested);
3320}
3321
3324 return new (C, ID) NamespaceDecl(C, nullptr, false, SourceLocation(),
3326}
3327
3330}
3331
3334}
3335
3338}
3339
3340void NamespaceAliasDecl::anchor() {}
3341
3344}
3345
3348}
3349
3352}
3353
3359
3360 if (auto *NS = dyn_cast_or_null(Namespace))
3362 return new (C, DC) NamespaceAliasDecl(C, DC, UsingLoc, AliasLoc, Alias,
3363 QualifierLoc, IdentLoc, Namespace);
3364}
3365
3373
3374void LifetimeExtendedTemporaryDecl::anchor() {}
3375
3376
3379 if (!ExtendingDecl)
3381
3382
3385
3386
3388 return ExtendingDecl->getDeclContext()->isFunctionOrMethod() ? SD_Automatic
3390 return cast(ExtendingDecl)->getStorageDuration();
3391}
3392
3395 "don't need to cache the computed value for this temporary");
3396 if (MayCreate && !Value) {
3399 }
3400 assert(Value && "may not be null");
3401 return Value;
3402}
3403
3404void UsingShadowDecl::anchor() {}
3405
3409 : NamedDecl(K, DC, Loc, Name), redeclarable_base(C),
3410 UsingOrNextShadow(Introducer) {
3414 }
3416}
3417
3420 redeclarable_base(C) {}
3421
3426
3429 while (const auto *NextShadow =
3430 dyn_cast(Shadow->UsingOrNextShadow))
3431 Shadow = NextShadow;
3433}
3434
3435void ConstructorUsingShadowDecl::anchor() {}
3436
3441 return new (C, DC) ConstructorUsingShadowDecl(C, DC, Loc, Using, Target,
3442 IsVirtual);
3443}
3444
3447 return new (C, ID) ConstructorUsingShadowDecl(C, EmptyShell());
3448}
3449
3453
3454void BaseUsingDecl::anchor() {}
3455
3457 assert(!llvm::is_contained(shadows(), S) && "declaration already in set");
3459
3460 if (FirstUsingShadow.getPointer())
3461 S->UsingOrNextShadow = FirstUsingShadow.getPointer();
3462 FirstUsingShadow.setPointer(S);
3463}
3464
3466 assert(llvm::is_contained(shadows(), S) && "declaration not in set");
3468
3469
3470
3471 if (FirstUsingShadow.getPointer() == S) {
3472 FirstUsingShadow.setPointer(
3473 dyn_cast(S->UsingOrNextShadow));
3474 S->UsingOrNextShadow = this;
3475 return;
3476 }
3477
3479 while (Prev->UsingOrNextShadow != S)
3481 Prev->UsingOrNextShadow = S->UsingOrNextShadow;
3482 S->UsingOrNextShadow = this;
3483}
3484
3485void UsingDecl::anchor() {}
3486
3490 bool HasTypename) {
3491 return new (C, DC) UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
3492}
3493
3499
3505
3506void UsingEnumDecl::anchor() {}
3507
3512 return new (C, DC)
3513 UsingEnumDecl(DC, EnumType->getType()->castAsEnumDecl()->getDeclName(),
3514 UL, EL, NL, EnumType);
3515}
3516
3519 return new (C, ID)
3522}
3523
3525 return SourceRange(UsingLocation, EnumType->getTypeLoc().getEndLoc());
3526}
3527
3528void UsingPackDecl::anchor() {}
3529
3533 size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
3534 return new (C, DC, Extra) UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
3535}
3536
3538 unsigned NumExpansions) {
3539 size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
3540 auto *Result = new (C, ID, Extra) UsingPackDecl(nullptr, nullptr, {});
3541 Result->NumExpansions = NumExpansions;
3542 auto *Trail = Result->getTrailingObjects();
3543 std::uninitialized_fill_n(Trail, NumExpansions, nullptr);
3545}
3546
3547void UnresolvedUsingValueDecl::anchor() {}
3548
3555 return new (C, DC) UnresolvedUsingValueDecl(DC, C.DependentTy, UsingLoc,
3556 QualifierLoc, NameInfo,
3557 EllipsisLoc);
3558}
3559
3562 return new (C, ID) UnresolvedUsingValueDecl(nullptr, QualType(),
3567}
3568
3574
3575void UnresolvedUsingTypenameDecl::anchor() {}
3576
3585 return new (C, DC) UnresolvedUsingTypenameDecl(
3586 DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
3588}
3589
3593 return new (C, ID) UnresolvedUsingTypenameDecl(
3596}
3597
3601 return new (Ctx, DC) UnresolvedUsingIfExistsDecl(DC, Loc, Name);
3602}
3603
3607 return new (Ctx, ID)
3609}
3610
3611UnresolvedUsingIfExistsDecl::UnresolvedUsingIfExistsDecl(DeclContext *DC,
3614 : NamedDecl(Decl::UnresolvedUsingIfExists, DC, Loc, Name) {}
3615
3616void UnresolvedUsingIfExistsDecl::anchor() {}
3617
3618void StaticAssertDecl::anchor() {}
3619
3622 Expr *AssertExpr, Expr *Message,
3624 bool Failed) {
3625 return new (C, DC) StaticAssertDecl(DC, StaticAssertLoc, AssertExpr, Message,
3626 RParenLoc, Failed);
3627}
3628
3631 return new (C, ID) StaticAssertDecl(nullptr, SourceLocation(), nullptr,
3633}
3634
3637 "expected a VarDecl or a BindingDecl");
3638 if (auto *Var = llvm::dyn_cast(this))
3639 return Var;
3640 if (auto *BD = llvm::dyn_cast(this))
3641 return llvm::dyn_cast_if_present(BD->getDecomposedDecl());
3642 return nullptr;
3643}
3644
3645void BindingDecl::anchor() {}
3646
3650 return new (C, DC) BindingDecl(DC, IdLoc, Id, T);
3651}
3652
3654 return new (C, ID)
3656}
3657
3660 if (!B)
3661 return nullptr;
3662 auto *DRE = dyn_cast(B->IgnoreImplicit());
3663 if (!DRE)
3664 return nullptr;
3665
3667 assert(VD->isImplicit() && "holding var for binding decl not implicit");
3668 return VD;
3669}
3670
3672 assert(Binding && "expecting a pack expr");
3674 ValueDecl *const *First = FP->getNumExpansions() > 0 ? FP->begin() : nullptr;
3677 FP->getNumExpansions());
3678}
3679
3680void DecompositionDecl::anchor() {}
3681
3688 size_t Extra = additionalSizeToAlloc<BindingDecl *>(Bindings.size());
3689 return new (C, DC, Extra)
3690 DecompositionDecl(C, DC, StartLoc, LSquareLoc, T, TInfo, SC, Bindings);
3691}
3692
3695 unsigned NumBindings) {
3696 size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
3700
3701 Result->NumBindings = NumBindings;
3702 auto *Trail = Result->getTrailingObjects();
3703 std::uninitialized_fill_n(Trail, NumBindings, nullptr);
3705}
3706
3709 OS << '[';
3710 bool Comma = false;
3711 for (const auto *B : bindings()) {
3712 if (Comma)
3713 OS << ", ";
3714 B->printName(OS, Policy);
3715 Comma = true;
3716 }
3717 OS << ']';
3718}
3719
3720void MSPropertyDecl::anchor() {}
3721
3728 return new (C, DC) MSPropertyDecl(DC, L, N, T, TInfo, StartL, Getter, Setter);
3729}
3730
3737
3738void MSGuidDecl::anchor() {}
3739
3742 PartVal(P) {}
3743
3745 DeclContext *DC = C.getTranslationUnitDecl();
3746 return new (C, DC) MSGuidDecl(DC, T, P);
3747}
3748
3750 return new (C, ID) MSGuidDecl(nullptr, QualType(), Parts());
3751}
3752
3755 OS << llvm::format("GUID{%08" PRIx32 "-%04" PRIx16 "-%04" PRIx16 "-",
3756 PartVal.Part1, PartVal.Part2, PartVal.Part3);
3757 unsigned I = 0;
3758 for (uint8_t Byte : PartVal.Part4And5) {
3759 OS << llvm::format("%02" PRIx8, Byte);
3760 if (++I == 2)
3761 OS << '-';
3762 }
3763 OS << '}';
3764}
3765
3766
3768
3769
3770 using MatcherRef = llvm::function_ref<bool(QualType)>;
3771
3772 auto IsInt = [&Ctx](unsigned N) {
3774 return T->isUnsignedIntegerOrEnumerationType() &&
3776 };
3777 };
3778
3779 auto IsArray = [&Ctx](MatcherRef Elem, unsigned N) {
3780 return [&Ctx, Elem, N](QualType T) {
3783 };
3784 };
3785
3786 auto IsStruct = [](std::initializer_list Fields) {
3788 const RecordDecl *RD = T->getAsRecordDecl();
3789 if (!RD || RD->isUnion())
3790 return false;
3792 if (!RD)
3793 return false;
3794 if (auto *CXXRD = dyn_cast(RD))
3795 if (CXXRD->getNumBases())
3796 return false;
3797 auto MatcherIt = Fields.begin();
3799 if (FD->isUnnamedBitField())
3800 continue;
3801 if (FD->isBitField() || MatcherIt == Fields.end() ||
3802 !(*MatcherIt)(FD->getType()))
3803 return false;
3804 ++MatcherIt;
3805 }
3806 return MatcherIt == Fields.end();
3807 };
3808 };
3809
3810
3811 return IsStruct({IsInt(32), IsInt(16), IsInt(16), IsArray(IsInt(8), 8)})(T);
3812}
3813
3816 using llvm::APInt;
3817 using llvm::APSInt;
3819 APVal.getStructField(0) = APValue(APSInt(APInt(32, PartVal.Part1), true));
3820 APVal.getStructField(1) = APValue(APSInt(APInt(16, PartVal.Part2), true));
3821 APVal.getStructField(2) = APValue(APSInt(APInt(16, PartVal.Part3), true));
3824 for (unsigned I = 0; I != 8; ++I) {
3826 APValue(APSInt(APInt(8, PartVal.Part4And5[I]), true));
3827 }
3828
3829
3831 }
3832
3833 return APVal;
3834}
3835
3836void UnnamedGlobalConstantDecl::anchor() {}
3837
3838UnnamedGlobalConstantDecl::UnnamedGlobalConstantDecl(const ASTContext &C,
3845
3846
3847 if (Value.needsCleanup())
3848 C.addDestruction(&Value);
3849}
3850
3854 DeclContext *DC = C.getTranslationUnitDecl();
3855 return new (C, DC) UnnamedGlobalConstantDecl(C, DC, T, Value);
3856}
3857
3861 UnnamedGlobalConstantDecl(C, nullptr, QualType(), APValue());
3862}
3863
3866 OS << "unnamed-global-constant";
3867}
3868
3870 switch (AS) {
3872 llvm_unreachable("Invalid access specifier!");
3874 return "public";
3876 return "private";
3878 return "protected";
3879 }
3880 llvm_unreachable("Invalid access specifier!");
3881}
3882
Defines the clang::ASTContext interface.
This file provides some common utility functions for processing Lambda related AST Constructs.
Defines the Diagnostic-related interfaces.
static void CollectVisibleConversions(ASTContext &Context, const CXXRecordDecl *Record, bool InVirtual, AccessSpecifier Access, const llvm::SmallPtrSet< CanQualType, 8 > &ParentHiddenTypes, ASTUnresolvedSet &Output, UnresolvedSetImpl &VOutput, llvm::SmallPtrSet< NamedDecl *, 8 > &HiddenVBaseCs)
Collect the visible conversions of a base class.
Definition DeclCXX.cpp:1869
static const char * getAccessName(AccessSpecifier AS)
Definition DeclCXX.cpp:3869
static bool recursivelyOverrides(const CXXMethodDecl *DerivedMD, const CXXMethodDecl *BaseMD)
Definition DeclCXX.cpp:2411
static bool isValidStructGUID(ASTContext &Ctx, QualType T)
Determine if T is a valid 'struct _GUID' of the shape that we expect.
Definition DeclCXX.cpp:3767
static DeclContext::lookup_result getLambdaStaticInvokers(const CXXRecordDecl &RD)
Definition DeclCXX.cpp:1756
static NamedDecl * getLambdaCallOperatorHelper(const CXXRecordDecl &RD)
Definition DeclCXX.cpp:1686
static QualType getThisObjectType(ASTContext &C, const FunctionProtoType *FPT, const CXXRecordDecl *Decl)
Definition DeclCXX.cpp:2784
static bool hasPureVirtualFinalOverrider(const CXXRecordDecl &RD, const CXXFinalOverriderMap *FinalOverriders)
Definition DeclCXX.cpp:2243
static bool allLookupResultsAreTheSame(const DeclContext::lookup_result &R)
Definition DeclCXX.cpp:1679
static bool isDeclContextInNamespace(const DeclContext *DC)
Definition DeclCXX.cpp:2179
static bool hasRepeatedBaseClass(const CXXRecordDecl *StartRD)
Determine whether a class has a repeated base class.
Definition DeclCXX.cpp:165
static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv)
Definition DeclCXX.cpp:1850
static CXXMethodDecl * getInvokerAsMethod(NamedDecl *ND)
Definition DeclCXX.cpp:1763
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
TokenType getType() const
Returns the token's type, e.g.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the LambdaCapture class.
Defines the clang::LangOptions interface.
llvm::MachO::Record Record
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes,...
Defines an enumeration for C++ overloaded operators.
llvm::SmallVector< std::pair< const MemRegion *, SVal >, 4 > Bindings
static bool hasAttr(const Decl *D, bool IgnoreImplicitAttr)
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
Expr * getExpr()
Get 'expr' part of the associated expression/statement.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
APValue & getArrayInitializedElt(unsigned I)
APValue & getStructField(unsigned i)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const ConstantArrayType * getAsConstantArrayType(QualType T) const
unsigned getIntWidth(QualType T) const
DeclarationNameTable DeclarationNames
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
const LangOptions & getLangOpts() const
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
FunctionDecl * getOperatorDeleteForVDtor(const CXXDestructorDecl *Dtor, OperatorDeleteKind K) const
const TargetInfo & getTargetInfo() const
void addDestruction(T *Ptr) const
If T isn't trivially destructible, calls AddDeallocation to register it for destruction.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
static bool hasSameUnqualifiedType(QualType T1, QualType T2)
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
void addOperatorDeleteForVDtor(const CXXDestructorDecl *Dtor, FunctionDecl *OperatorDelete, OperatorDeleteKind K) const
An UnresolvedSet-like class which uses the ASTContext's allocator.
void append(ASTContext &C, iterator I, iterator E)
bool replace(const NamedDecl *Old, NamedDecl *New, AccessSpecifier AS)
Replaces the given declaration with the new one, once.
UnresolvedSetIterator iterator
void addDecl(ASTContext &C, NamedDecl *D, AccessSpecifier AS)
static AccessSpecDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:60
QualType getElementType() const
void addShadowDecl(UsingShadowDecl *S)
Definition DeclCXX.cpp:3456
shadow_range shadows() const
void removeShadowDecl(UsingShadowDecl *S)
Definition DeclCXX.cpp:3465
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
Definition DeclCXX.cpp:3658
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T)
Definition DeclCXX.cpp:3647
Expr * getBinding() const
Get the expression to which this declaration is bound.
ArrayRef< BindingDecl * > getBindingPackDecls() const
Definition DeclCXX.cpp:3671
static BindingDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3653
Represents a base class of a C++ class.
Represents a C++ constructor within a class.
bool isExplicit() const
Return true if the declaration is already resolved to be explicit.
init_iterator init_begin()
Retrieve an iterator to the first initializer.
CXXConstructorDecl * getTargetConstructor() const
When this constructor delegates to another, retrieve the target.
Definition DeclCXX.cpp:2990
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, uint64_t AllocKind)
Definition DeclCXX.cpp:2948
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
Definition DeclCXX.cpp:2999
bool isDelegatingConstructor() const
Determine whether this constructor is a delegating constructor.
bool isSpecializationCopyingObject() const
Determine whether this is a member template specialization that would copy the object to itself.
Definition DeclCXX.cpp:3074
bool isMoveConstructor() const
Determine whether this constructor is a move constructor (C++11 [class.copy]p3), which can be used to...
bool isCopyOrMoveConstructor() const
Determine whether this a copy or move constructor.
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, ExplicitSpecifier ES, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, InheritedConstructor Inherited=InheritedConstructor(), const AssociatedConstraint &TrailingRequiresClause={})
Definition DeclCXX.cpp:2968
bool isInheritingConstructor() const
Determine whether this is an implicit constructor synthesized to model a call to a constructor inheri...
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
bool isConvertingConstructor(bool AllowExplicit) const
Whether this constructor is a converting constructor (C++ [class.conv.ctor]), which can be used for u...
Definition DeclCXX.cpp:3056
bool isCopyConstructor() const
Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the cla...
bool isLambdaToBlockPointerConversion() const
Determine whether this conversion function is a conversion from a lambda closure type to a block poin...
Definition DeclCXX.cpp:3237
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, ExplicitSpecifier ES, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, const AssociatedConstraint &TrailingRequiresClause={})
Definition DeclCXX.cpp:3223
QualType getConversionType() const
Returns the type that this conversion function is converting to.
static CXXConversionDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3215
SourceLocation getRParenLoc() const
SourceRange getSourceRange() const LLVM_READONLY
Determine the source range covering the entire initializer.
Definition DeclCXX.cpp:2916
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
Definition DeclCXX.cpp:2903
bool isAnyMemberInitializer() const
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
int64_t getID(const ASTContext &Context) const
Definition DeclCXX.cpp:2884
bool isInClassMemberInitializer() const
Determine whether this initializer is an implicit initializer generated for a field with an initializ...
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
Definition DeclCXX.cpp:2896
SourceLocation getMemberLocation() const
FieldDecl * getAnyMember() const
TypeLoc getBaseClassLoc() const
If this is a base class initializer, returns the type of the base class with location information.
Definition DeclCXX.cpp:2889
CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual, SourceLocation L, Expr *Init, SourceLocation R, SourceLocation EllipsisLoc)
Creates a new base-class initializer.
Definition DeclCXX.cpp:2851
Represents a C++ deduction guide declaration.
static CXXDeductionGuideDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation, CXXConstructorDecl *Ctor=nullptr, DeductionCandidate Kind=DeductionCandidate::Normal, const AssociatedConstraint &TrailingRequiresClause={}, const CXXDeductionGuideDecl *SourceDG=nullptr, SourceDeductionGuideKind SK=SourceDeductionGuideKind::None)
Definition DeclCXX.cpp:2367
static CXXDeductionGuideDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:2380
Represents a C++ destructor within a class.
void setGlobalOperatorArrayDelete(FunctionDecl *OD)
Definition DeclCXX.cpp:3156
static CXXDestructorDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3090
CXXDestructorDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
const FunctionDecl * getOperatorGlobalDelete() const
Definition DeclCXX.cpp:3175
const FunctionDecl * getGlobalArrayOperatorDelete() const
Definition DeclCXX.cpp:3185
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, const AssociatedConstraint &TrailingRequiresClause={})
Definition DeclCXX.cpp:3098
const FunctionDecl * getOperatorDelete() const
Definition DeclCXX.cpp:3170
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg)
Definition DeclCXX.cpp:3112
bool isCalledByDelete(const FunctionDecl *OpDel=nullptr) const
Will this destructor ever be called when considering which deallocation function is associated with t...
Definition DeclCXX.cpp:3190
void setOperatorArrayDelete(FunctionDecl *OD)
Definition DeclCXX.cpp:3143
const FunctionDecl * getArrayOperatorDelete() const
Definition DeclCXX.cpp:3180
void setOperatorGlobalDelete(FunctionDecl *OD)
Definition DeclCXX.cpp:3125
A mapping from each virtual member function to its set of final overriders.
Represents a static or instance method of a struct/union/class.
bool isExplicitObjectMemberFunction() const
[C++2b][dcl.fct]/p7 An explicit object member function is a non-static member function with an explic...
Definition DeclCXX.cpp:2703
CXXMethodDecl * getCorrespondingMethodDeclaredInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find if RD declares a function that overrides this function, and if so, return it.
Definition DeclCXX.cpp:2423
bool isImplicitObjectMemberFunction() const
[C++2b][dcl.fct]/p7 An implicit object member function is a non-static member function without an exp...
Definition DeclCXX.cpp:2710
void addOverriddenMethod(const CXXMethodDecl *MD)
Definition DeclCXX.cpp:2755
bool hasInlineBody() const
Definition DeclCXX.cpp:2833
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, const AssociatedConstraint &TrailingRequiresClause={})
Definition DeclCXX.cpp:2488
bool isUsualDeallocationFunction(SmallVectorImpl< const FunctionDecl * > &PreventedBy) const
Determine whether this is a usual deallocation function (C++ [basic.stc.dynamic.deallocation]p2),...
Definition DeclCXX.cpp:2593
unsigned getNumExplicitParams() const
overridden_method_range overridden_methods() const
Definition DeclCXX.cpp:2778
unsigned size_overridden_methods() const
Definition DeclCXX.cpp:2772
const CXXMethodDecl *const * method_iterator
QualType getFunctionObjectParameterReferenceType() const
Return the type of the object pointed by this.
Definition DeclCXX.cpp:2820
method_iterator begin_overridden_methods() const
Definition DeclCXX.cpp:2762
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
QualType getThisType() const
Return the type of the this pointer.
Definition DeclCXX.cpp:2809
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
Definition DeclCXX.cpp:2735
CXXMethodDecl * getDevirtualizedMethod(const Expr *Base, bool IsAppleKext)
If it's possible to devirtualize a call to this method, return the called function.
Definition DeclCXX.cpp:2508
static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK)
Returns true if the given operator is implicitly static in a record context.
CXXMethodDecl * getCorrespondingMethodInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find the method in RD that corresponds to this one.
Definition DeclCXX.cpp:2454
bool isStatic() const
Definition DeclCXX.cpp:2401
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
Definition DeclCXX.cpp:2714
CXXMethodDecl(Kind DK, ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, const AssociatedConstraint &TrailingRequiresClause={})
static CXXMethodDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:2499
method_iterator end_overridden_methods() const
Definition DeclCXX.cpp:2767
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isLambdaStaticInvoker() const
Determine whether this is a lambda closure type's static member function that is used for the result ...
Definition DeclCXX.cpp:2845
llvm::iterator_range< llvm::TinyPtrVector< const CXXMethodDecl * >::const_iterator > overridden_method_range
Represents a C++ struct/union/class.
bool isHLSLIntangible() const
Returns true if the class contains HLSL intangible type, either as a field or in base class.
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
Definition DeclCXX.cpp:1828
bool mayBeAbstract() const
Determine whether this class may end up being abstract, even though it is not yet known to be abstrac...
Definition DeclCXX.cpp:2310
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr)
Definition DeclCXX.cpp:132
bool isTriviallyCopyable() const
Determine whether this class is considered trivially copyable per (C++11 [class]p6).
Definition DeclCXX.cpp:607
bool hasNonTrivialCopyAssignment() const
Determine whether this class has a non-trivial copy assignment operator (C++ [class....
TemplateParameterList * getGenericLambdaTemplateParameterList() const
Retrieve the generic lambda's template parameter list.
Definition DeclCXX.cpp:1805
bool isEffectivelyFinal() const
Determine whether it's impossible for a class to be derived from this class.
Definition DeclCXX.cpp:2325
bool hasSimpleMoveConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous move constructor that ...
bool isAggregate() const
Determine whether this class is an aggregate (C++ [dcl.init.aggr]), which is a class with no user-dec...
bool hasTrivialDefaultConstructor() const
Determine whether this class has a trivial default constructor (C++11 [class.ctor]p5).
void setBases(CXXBaseSpecifier const *const *Bases, unsigned NumBases)
Sets the base classes of this struct or class.
Definition DeclCXX.cpp:184
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e.
Definition DeclCXX.cpp:1673
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
bool hasUserDeclaredDestructor() const
Determine whether this class has a user-declared destructor.
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
Definition DeclCXX.cpp:2020
bool hasInjectedClassType() const
Determines whether this declaration has is canonically of an injected class type.
Definition DeclCXX.cpp:2156
void completeDefinition() override
Indicates that the definition of this class is now complete.
Definition DeclCXX.cpp:2239
bool isLiteral() const
Determine whether this class is a literal type.
Definition DeclCXX.cpp:1500
bool hasDeletedDestructor() const
Returns the destructor decl for this class.
Definition DeclCXX.cpp:2140
bool defaultedDestructorIsConstexpr() const
Determine whether a defaulted default constructor for this class would be constexpr.
bool isStandardLayout() const
Determine whether this class is standard-layout per C++ [class]p7.
void setCaptures(ASTContext &Context, ArrayRef< LambdaCapture > Captures)
Set the captures for this lambda closure type.
Definition DeclCXX.cpp:1623
unsigned getDeviceLambdaManglingNumber() const
Retrieve the device side mangling number.
Definition DeclCXX.cpp:1845
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation.
Definition DeclCXX.cpp:600
void setTrivialForCallFlags(CXXMethodDecl *MD)
Definition DeclCXX.cpp:1645
bool isLambda() const
Determine whether this class describes a lambda function object.
void addedSelectedDestructor(CXXDestructorDecl *DD)
Notify the class that this destructor is now selected.
Definition DeclCXX.cpp:1525
bool hasFriends() const
Determines whether this record has any friends.
method_range methods() const
CXXRecordDecl * getDefinition() const
static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, AccessSpecifier DeclAccess)
Calculates the access of a decl that is reached along a path.
void getCaptureFields(llvm::DenseMap< const ValueDecl *, FieldDecl * > &Captures, FieldDecl *&ThisCapture) const
For a closure type, retrieve the mapping from captured variables and this to the non-static data memb...
Definition DeclCXX.cpp:1784
bool hasConstexprNonCopyMoveConstructor() const
Determine whether this class has at least one constexpr constructor other than the copy or move const...
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, unsigned DependencyKind, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
Definition DeclCXX.cpp:141
llvm::iterator_range< conversion_iterator > getVisibleConversionFunctions() const
Get all conversion functions visible in current class, including conversion function templates.
Definition DeclCXX.cpp:1977
bool hasConstexprDestructor() const
Determine whether this class has a constexpr destructor.
Definition DeclCXX.cpp:595
unsigned getNumBases() const
Retrieves the number of base classes of this class.
bool hasNonLiteralTypeFieldsOrBases() const
Determine whether this class has a non-literal or/ volatile type non-static data member or base class...
bool isTriviallyCopyConstructible() const
Determine whether this class is considered trivially copyable per.
Definition DeclCXX.cpp:624
bool isCapturelessLambda() const
const CXXRecordDecl * getTemplateInstantiationPattern() const
Retrieve the record declaration from which this record could be instantiated.
Definition DeclCXX.cpp:2075
bool lambdaIsDefaultConstructibleAndAssignable() const
Determine whether this lambda should have an implicit default constructor and copy and move assignmen...
Definition DeclCXX.cpp:726
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
Definition DeclCXX.cpp:2050
base_class_iterator bases_begin()
FunctionTemplateDecl * getDependentLambdaCallOperator() const
Retrieve the dependent lambda call operator of the closure type if this is a templated closure type.
Definition DeclCXX.cpp:1731
void addedEligibleSpecialMemberFunction(const CXXMethodDecl *MD, unsigned SMKind)
Notify the class that an eligible SMF has been added.
Definition DeclCXX.cpp:1530
conversion_iterator conversion_end() const
void finishedDefaultedOrDeletedMember(CXXMethodDecl *MD)
Indicates that the declaration of a defaulted or deleted special member function is now complete.
Definition DeclCXX.cpp:1576
CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl)
Definition DeclCXX.cpp:124
bool isCLike() const
True if this class is C-like, without C++-specific features, e.g.
Definition DeclCXX.cpp:1662
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
Definition DeclCXX.cpp:2033
static CXXRecordDecl * CreateDeserialized(const ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:154
bool hasSimpleMoveAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous move assignment operat...
bool hasNonTrivialMoveConstructor() const
Determine whether this class has a non-trivial move constructor (C++11 [class.copy]p12)
CanQualType getCanonicalTemplateSpecializationType(const ASTContext &Ctx) const
Definition DeclCXX.cpp:2169
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
unsigned getODRHash() const
Definition DeclCXX.cpp:490
bool hasDefinition() const
ArrayRef< NamedDecl * > getLambdaExplicitTemplateParameters() const
Retrieve the lambda template parameters that were specified explicitly.
Definition DeclCXX.cpp:1814
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
Definition DeclCXX.cpp:2042
bool isPOD() const
Whether this class is a POD-type (C++ [class]p4)
void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const
Retrieve the final overriders for each virtual member function in the class hierarchy where this clas...
void removeConversion(const NamedDecl *Old)
Removes a conversion function from this class.
Definition DeclCXX.cpp:1995
bool hasSimpleCopyConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous copy constructor that ...
bool isInjectedClassName() const
Determines whether this declaration represents the injected class name.
Definition DeclCXX.cpp:2146
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
Definition DeclCXX.cpp:2121
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class....
UnresolvedSetIterator conversion_iterator
CXXMethodDecl * getLambdaStaticInvoker() const
Retrieve the lambda static invoker, the address of which is returned by the conversion operator,...
Definition DeclCXX.cpp:1748
bool hasSimpleDestructor() const
true if we know for sure that this class has an accessible destructor that is not deleted.
void setDescribedClassTemplate(ClassTemplateDecl *Template)
Definition DeclCXX.cpp:2046
bool isInterfaceLike() const
Definition DeclCXX.cpp:2188
void setLambdaNumbering(LambdaNumbering Numbering)
Set the mangling numbers and context declaration for a lambda class.
Definition DeclCXX.cpp:1834
bool forallBases(ForallBasesCallback BaseMatches) const
Determines if the given callback holds for all the direct or indirect base classes of this type.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization,...
Definition DeclCXX.cpp:2027
bool hasNonTrivialCopyConstructor() const
Determine whether this class has a non-trivial copy constructor (C++ [class.copy]p6,...
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
Definition DeclCXX.cpp:1736
const CXXRecordDecl * getStandardLayoutBaseWithFields() const
If this is a standard-layout class or union, any and all data members will be declared in the same ty...
Definition DeclCXX.cpp:559
bool hasSimpleCopyAssignment() const
true if we know for sure that this class has a single, accessible, unambiguous copy assignment operat...
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
Definition DeclCXX.cpp:2061
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
conversion_iterator conversion_begin() const
Declaration of a class template.
Represents the canonical version of C arrays with a specified constant size.
llvm::APInt getSize() const
Return the constant array size as an APInt.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
static ConstructorUsingShadowDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3446
UsingDecl * getIntroducer() const
Override the UsingShadowDecl's getIntroducer, returning the UsingDecl that introduced this.
static ConstructorUsingShadowDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, UsingDecl *Using, NamedDecl *Target, bool IsVirtual)
Definition DeclCXX.cpp:3438
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
Definition DeclCXX.cpp:3450
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
DeclContextLookupResult lookup_result
ASTContext & getParentASTContext() const
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
bool isTranslationUnit() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
DeclContext(Decl::Kind K)
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
LinkageSpecDeclBitfields LinkageSpecDeclBits
Decl::Kind getDeclKind() const
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
SourceLocation getEndLoc() const LLVM_READONLY
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
virtual Decl * getPreviousDeclImpl()
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain.
ASTMutationListener * getASTMutationListener() const
Kind
Lists the kind of concrete classes of Decl.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
bool isInvalidDecl() const
virtual Decl * getNextRedeclarationImpl()
Returns the next redeclaration or itself if this is the only decl.
SourceLocation getLocation() const
void setImplicit(bool I=true)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
unsigned Access
Access - Used by C++ decls for the access specifier.
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
virtual Decl * getMostRecentDeclImpl()
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
const LangOptions & getLangOpts() const LLVM_READONLY
Helper to get the language options from the ASTContext.
The name of a declaration.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
@ CXXConversionFunctionName
NameKind getNameKind() const
Determine what kind of name this is.
bool isIdentifier() const
Predicate functions for querying what type of name this is.
void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override
Pretty-print the unqualified name of this declaration.
Definition DeclCXX.cpp:3707
ArrayRef< BindingDecl * > bindings() const
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl * > Bindings)
Definition DeclCXX.cpp:3682
static DecompositionDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumBindings)
Definition DeclCXX.cpp:3693
Store information needed for an explicit specifier.
ExplicitSpecKind getKind() const
const Expr * getExpr() const
ExplicitSpecifier()=default
static ExplicitSpecifier getFromDecl(FunctionDecl *Function)
Definition DeclCXX.cpp:2354
bool isEquivalent(const ExplicitSpecifier Other) const
Check for equivalence of explicit specifiers.
Definition DeclCXX.cpp:2339
This represents one expression.
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
Abstract interface for external sources of AST nodes.
Represents a member of a struct/union/class.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set.
Represents a function declaration or definition.
static constexpr unsigned RequiredTypeAwareDeleteParameterCount
Count of mandatory parameters for type aware operator delete.
const ParmVarDecl * getParamDecl(unsigned i) const
bool isTrivialForCall() const
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to call this function.
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
bool isDestroyingOperatorDelete() const
Determine whether this is a destroying operator delete.
bool hasCXXExplicitFunctionObjectParameter() const
bool UsesFPIntrin() const
Determine whether the function was declared in source context that requires constrained FP intrinsics...
ArrayRef< ParmVarDecl * > parameters() const
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
const ParmVarDecl * getNonObjectParameter(unsigned I) const
bool isVariadic() const
Whether this function is variadic.
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
bool isDeleted() const
Whether this function has been deleted.
FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass S, bool UsesFPIntrin, bool isInlineSpecified, ConstexprSpecKind ConstexprKind, const AssociatedConstraint &TrailingRequiresClause)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function.
bool isPureVirtual() const
Whether this virtual function is pure, i.e.
bool isTypeAwareOperatorNewOrDelete() const
Determine whether this is a type aware operator new or delete.
bool isIneligibleOrNotSelected() const
void setIneligibleOrNotSelected(bool II)
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration.
bool hasOneParamOrDefaultArgs() const
Determine whether this function has a single parameter, or multiple parameters where all but the firs...
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
bool isDefined(const FunctionDecl *&Definition, bool CheckForPendingFriendDefinition=false) const
Returns true if the function has a definition that does not need to be instantiated.
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
Represents a prototype with parameter type info, e.g.
Qualifiers getMethodQuals() const
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
Declaration of a template function.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
FunctionType - C99 6.7.5.3 - Function Declarators.
One of these records is kept for each identifier that is lexed.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Represents a field injected from an anonymous union/struct into the parent scope.
Description of a constructor that was inherited from a base class.
An lvalue reference type, per C++11 [dcl.ref].
Describes the capture of a variable or of this, or of a C++1y init-capture.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
APValue * getOrCreateValue(bool MayCreate) const
Get the storage for the constant value of a materialized temporary of static storage duration.
Definition DeclCXX.cpp:3393
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
Definition DeclCXX.cpp:3377
ValueDecl * getExtendingDecl()
static LinkageSpecDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation ExternLoc, SourceLocation LangLoc, LinkageSpecLanguageIDs Lang, bool HasBraces)
Definition DeclCXX.cpp:3253
static LinkageSpecDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3261
APValue & getAsAPValue() const
Get the value of this MSGuidDecl as an APValue.
Definition DeclCXX.cpp:3814
void printName(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const override
Print this UUID in a human-readable format.
Definition DeclCXX.cpp:3753
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
Definition DeclCXX.cpp:3722
static MSPropertyDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3731
A pointer to member type per C++ 8.3.3 - Pointers to members.
Provides information a specialization of a member of a class template, which may be a member function...
Describes a module or submodule.
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
NamedDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N)
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents a C++ namespace alias.
static NamespaceAliasDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3366
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamespaceBaseDecl *Namespace)
Definition DeclCXX.cpp:3354
NamespaceAliasDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
NamespaceAliasDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
Represents C++ namespaces and their aliases.
NamespaceDecl * getNamespace()
Definition DeclCXX.cpp:3291
Represent a C++ namespace.
NamespaceDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
NamespaceDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested)
Definition DeclCXX.cpp:3314
static NamespaceDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3322
A C++ nested-name-specifier augmented with source location information.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
void AddStmt(const Stmt *S)
void AddCXXRecordDecl(const CXXRecordDecl *Record)
Represents a parameter to a function.
A (possibly-)qualified type.
void addRestrict()
Add the restrict qualifier to this QualType.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
void removeLocalRestrict()
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
Represents a struct/union/class.
RecordDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl)
void setArgPassingRestrictions(RecordArgPassingKind Kind)
field_iterator field_end() const
field_range fields() const
void setHasObjectMember(bool val)
void setHasVolatileMember(bool val)
virtual void completeDefinition()
Note that the definition of this type is now complete.
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
bool hasUninitializedExplicitInitFields() const
specific_decl_iterator< FieldDecl > field_iterator
void setHasUninitializedExplicitInitFields(bool V)
field_iterator field_begin() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
NamespaceDecl * getNextRedeclaration() const
Base for LValueReferenceType and RValueReferenceType.
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
Definition DeclCXX.cpp:2389
static RequiresExprBodyDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:2395
Encodes a location in the source.
A trivial tuple used to represent a source range.
static StaticAssertDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *Message, SourceLocation RParenLoc, bool Failed)
Definition DeclCXX.cpp:3620
static StaticAssertDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3629
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
bool isBeingDefined() const
Return true if this decl is currently being defined.
void setBeingDefined(bool V=true)
True if this decl is currently being defined.
TagKind getTagKind() const
bool isDependentType() const
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...
virtual bool areDefaultedSMFStillPOD(const LangOptions &) const
Controls whether explicitly defaulted (= default) special member functions disqualify something from ...
Stores a list of template parameters for a TemplateDecl and its derived classes.
Base wrapper for a particular "section" of type source info.
A container of type source information.
The base class of the type hierarchy.
bool isBlockPointerType() const
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
bool isRValueReferenceType() const
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isHLSLBuiltinIntangibleType() const
const T * castAs() const
Member-template castAs.
bool isReferenceType() const
const Type * getArrayElementTypeNoTypeQual() const
If this is an array type, return the element type of the array, potentially with type qualifiers miss...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isLValueReferenceType() const
bool isStructuralType() const
Determine if this type is a structural type, per C++20 [temp.param]p7.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isHLSLAttributedResourceType() const
const T * getAs() const
Member-template getAs'.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs,...
bool isRecordType() const
bool isObjCRetainableType() const
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
void printName(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const override
Print this in a human-readable format.
Definition DeclCXX.cpp:3864
A set of unresolved declarations.
void addDecl(NamedDecl *D)
The iterator over UnresolvedSets.
NamedDecl * getDecl() const
A set of unresolved declarations.
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
static UnresolvedUsingIfExistsDecl * CreateDeserialized(ASTContext &Ctx, GlobalDeclID ID)
Definition DeclCXX.cpp:3605
static UnresolvedUsingIfExistsDecl * Create(ASTContext &Ctx, DeclContext *DC, SourceLocation Loc, DeclarationName Name)
Definition DeclCXX.cpp:3599
Represents a dependent using declaration which was marked with typename.
static UnresolvedUsingTypenameDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TargetNameLoc, DeclarationName TargetName, SourceLocation EllipsisLoc)
Definition DeclCXX.cpp:3578
static UnresolvedUsingTypenameDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3591
Represents a dependent using declaration which was not marked with typename.
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
DeclarationNameInfo getNameInfo() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition DeclCXX.cpp:3569
static UnresolvedUsingValueDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, SourceLocation EllipsisLoc)
Definition DeclCXX.cpp:3550
static UnresolvedUsingValueDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3561
Represents a C++ using-declaration.
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition DeclCXX.cpp:3500
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
static UsingDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3494
DeclarationNameInfo getNameInfo() const
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
Definition DeclCXX.cpp:3487
static UsingDirectiveDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3283
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
Definition DeclCXX.cpp:3270
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition DeclCXX.cpp:3297
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition DeclCXX.cpp:3524
static UsingEnumDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3517
static UsingEnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, SourceLocation EnumL, SourceLocation NameL, TypeSourceInfo *EnumType)
Definition DeclCXX.cpp:3508
static UsingPackDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumExpansions)
Definition DeclCXX.cpp:3537
static UsingPackDecl * Create(ASTContext &C, DeclContext *DC, NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > UsingDecls)
Definition DeclCXX.cpp:3530
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
void setTargetDecl(NamedDecl *ND)
Sets the underlying declaration which has been brought into the local scope.
UsingShadowDecl(Kind K, ASTContext &C, DeclContext *DC, SourceLocation Loc, DeclarationName Name, BaseUsingDecl *Introducer, NamedDecl *Target)
Definition DeclCXX.cpp:3406
static UsingShadowDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclCXX.cpp:3422
friend class BaseUsingDecl
BaseUsingDecl * getIntroducer() const
Gets the (written or instantiated) using declaration that introduced this declaration.
Definition DeclCXX.cpp:3427
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
ValueDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T)
VarDecl * getPotentiallyDecomposedVarDecl()
Definition DeclCXX.cpp:3635
Represents a variable declaration or definition.
Defines the clang::TargetInfo interface.
bool LT(InterpState &S, CodePtr OpPC)
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isa(CodeGen::Address addr)
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
ConstexprSpecKind
Define the kind of constexpr specifier.
LinkageSpecLanguageIDs
Represents the language in a linkage specification.
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
StorageClass
Storage classes.
StorageDuration
The storage duration for an object (per C++ [basic.stc]).
@ SD_Static
Static storage duration.
@ SD_FullExpression
Full-expression storage duration (for temporaries).
@ SD_Automatic
Automatic storage duration (most local variables).
@ Result
The result type of a method or function.
const FunctionProtoType * T
@ Template
We are parsing a template declaration.
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
@ Type
The name was classified as a type.
@ CanNeverPassInRegs
The argument of this type cannot be passed directly in registers.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
StringRef getLambdaStaticInvokerName()
DeductionCandidate
Only used by CXXDeductionGuideDecl.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
CallingConv
CallingConv - Specifies the calling convention that a function uses.
U cast(CodeGen::Address addr)
@ Other
Other implicit parameter.
Information about how a lambda is numbered within its context.
unsigned DeviceManglingNumber
bool HasKnownInternalLinkage
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
DeclarationName getName() const
getName - Returns the embedded declaration name.
Describes how types, statements, expressions, and declarations should be printed.