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
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
130 : nullptr) {}
131
136 bool DelayTypeCreation) {
137 auto *R = new (C, DC) CXXRecordDecl(CXXRecord, TK, C, DC, StartLoc, IdLoc, Id,
138 PrevDecl);
140
141
142 if (!DelayTypeCreation)
143 C.getTypeDeclType(R, PrevDecl);
144 return R;
145}
146
150 unsigned DependencyKind, bool IsGeneric,
153 Loc, nullptr, nullptr);
155 R->DefinitionData = new (C) struct LambdaDefinitionData(
156 R, Info, DependencyKind, IsGeneric, CaptureDefault);
157 R->setMayHaveOutOfDateDef(false);
158 R->setImplicit(true);
159
160 C.getTypeDeclType(R, nullptr);
161 return R;
162}
163
166 auto *R = new (C, ID)
170 return R;
171}
172
173
174
175
179 while (!WorkList.empty()) {
180 const CXXRecordDecl *RD = WorkList.pop_back_val();
182 continue;
184 if (const CXXRecordDecl *B = BaseSpec.getType()->getAsCXXRecordDecl()) {
185 if (!SeenBaseTypes.insert(B).second)
186 return true;
187 WorkList.push_back(B);
188 }
189 }
190 }
191 return false;
192}
193
194void
196 unsigned NumBases) {
198
199 if (!data().Bases.isOffset() && data().NumBases > 0)
200 C.Deallocate(data().getBases());
201
202 if (NumBases) {
203 if (.getLangOpts().CPlusPlus17) {
204
205
206 data().Aggregate = false;
207 }
208
209
210
211 data().PlainOldData = false;
212 }
213
214
216
217
219
221 data().NumBases = NumBases;
222 for (unsigned i = 0; i < NumBases; ++i) {
223 data().getBases()[i] = *Bases[i];
224
227
229 continue;
230 auto *BaseClassDecl =
232
233
234
235
236
237
238 if (BaseClassDecl->data().HasBasesWithFields ||
239 !BaseClassDecl->field_empty()) {
240 if (data().HasBasesWithFields)
241
242 data().IsStandardLayout = false;
243 data().HasBasesWithFields = true;
244 }
245
246
247
248
249
250 if (BaseClassDecl->data().HasBasesWithNonStaticDataMembers ||
251 BaseClassDecl->hasDirectFields()) {
252 if (data().HasBasesWithNonStaticDataMembers)
253 data().IsCXX11StandardLayout = false;
254 data().HasBasesWithNonStaticDataMembers = true;
255 }
256
257 if (!BaseClassDecl->isEmpty()) {
258
259
260
261 data().Empty = false;
262 }
263
264
265
267 data().Aggregate = false;
268
269
270
271
272 data().StructuralIfLiteral = false;
273 }
274
275
276
277
278 if (BaseClassDecl->isPolymorphic()) {
279 data().Polymorphic = true;
280
281
282 data().Aggregate = false;
283 }
284
285
286
287
288 if (!BaseClassDecl->isStandardLayout())
289 data().IsStandardLayout = false;
290 if (!BaseClassDecl->isCXX11StandardLayout())
291 data().IsCXX11StandardLayout = false;
292
293
295 data().HasNonLiteralTypeFieldsOrBases = true;
296
297
298 for (const auto &VBase : BaseClassDecl->vbases()) {
299
300 if (SeenVBaseTypes.insert(C.getCanonicalType(VBase.getType())).second) {
301 VBases.push_back(&VBase);
302
303
304
305
306
307
308 if (CXXRecordDecl *VBaseDecl = VBase.getType()->getAsCXXRecordDecl())
309 if (!VBaseDecl->hasCopyConstructorWithConstParam())
310 data().ImplicitCopyConstructorCanHaveConstParamForVBase = false;
311
312
313
314 data().Aggregate = false;
315 }
316 }
317
318 if (Base->isVirtual()) {
319
320 if (SeenVBaseTypes.insert(C.getCanonicalType(BaseType)).second)
321 VBases.push_back(Base);
322
323
324
325
326 data().Empty = false;
327
328
329
330 data().Aggregate = false;
331
332
333
334
335
336 data().HasTrivialSpecialMembers &= SMF_Destructor;
337 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
338
339
340
341
342 data().IsStandardLayout = false;
343 data().IsCXX11StandardLayout = false;
344
345
346
347
348
349 data().DefaultedDefaultConstructorIsConstexpr = false;
350 data().DefaultedDestructorIsConstexpr = false;
351
352
353
354
355
356
357 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
358 data().ImplicitCopyConstructorCanHaveConstParamForVBase = false;
359 } else {
360
361
362
363
364 if (!BaseClassDecl->hasTrivialDefaultConstructor())
365 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
366
367
368
369
370
371
372 if (!BaseClassDecl->hasTrivialCopyConstructor())
373 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
374
375 if (!BaseClassDecl->hasTrivialCopyConstructorForCall())
376 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
377
378
379
380
381
382 if (!BaseClassDecl->hasTrivialMoveConstructor())
383 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
384
385 if (!BaseClassDecl->hasTrivialMoveConstructorForCall())
386 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
387
388
389
390
391
392
393 if (!BaseClassDecl->hasTrivialCopyAssignment())
394 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
395
396
397
398
399 if (!BaseClassDecl->hasTrivialMoveAssignment())
400 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
401
402
403
404
405
406 if (!BaseClassDecl->hasConstexprDefaultConstructor())
407 data().DefaultedDefaultConstructorIsConstexpr =
408 C.getLangOpts().CPlusPlus23;
409
410
411
412
413
414
415 if (!BaseClassDecl->hasCopyConstructorWithConstParam())
416 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase = false;
417 }
418
419
420
421
422 if (!BaseClassDecl->hasTrivialDestructor())
423 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
424
425 if (!BaseClassDecl->hasTrivialDestructorForCall())
426 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
427
428 if (!BaseClassDecl->hasIrrelevantDestructor())
429 data().HasIrrelevantDestructor = false;
430
431 if (BaseClassDecl->isAnyDestructorNoReturn())
432 data().IsAnyDestructorNoReturn = true;
433
434 if (BaseClassDecl->isHLSLIntangible())
435 data().IsHLSLIntangible = true;
436
437
438
439
440
441
442 if (!BaseClassDecl->hasCopyAssignmentWithConstParam())
443 data().ImplicitCopyAssignmentHasConstParam = false;
444
445
446
447 if (BaseClassDecl->hasObjectMember())
449
450 if (BaseClassDecl->hasVolatileMember())
452
453 if (BaseClassDecl->getArgPassingRestrictions() ==
456
457
458 if (BaseClassDecl->hasMutableFields())
459 data().HasMutableFields = true;
460
461 if (BaseClassDecl->hasUninitializedExplicitInitFields() &&
462 BaseClassDecl->isAggregate())
464
465 if (BaseClassDecl->hasUninitializedReferenceMember())
466 data().HasUninitializedReferenceMember = true;
467
468 if (!BaseClassDecl->allowConstDefaultInit())
469 data().HasUninitializedFields = true;
470
471 addedClassSubobject(BaseClassDecl);
472 }
473
474
475
476
477
478
479
480
482 data().IsStandardLayout = false;
483
484 if (VBases.empty()) {
485 data().IsParsingBaseSpecifiers = false;
486 return;
487 }
488
489
491 data().NumVBases = VBases.size();
492 for (int I = 0, E = VBases.size(); I != E; ++I) {
496 data().getVBases()[I] = *VBases[I];
497 }
498
499 data().IsParsingBaseSpecifiers = false;
500}
501
503 assert(hasDefinition() && "ODRHash only for records with definitions");
504
505
506 if (DefinitionData->HasODRHash)
507 return DefinitionData->ODRHash;
508
509
512 DefinitionData->HasODRHash = true;
514
515 return DefinitionData->ODRHash;
516}
517
518void CXXRecordDecl::addedClassSubobject(CXXRecordDecl *Subobj) {
519
520
521
522
523
524
526 data().NeedOverloadResolutionForCopyConstructor = true;
528 data().NeedOverloadResolutionForMoveConstructor = true;
529
530
531
532
533
534
535
537 data().NeedOverloadResolutionForCopyAssignment = true;
539 data().NeedOverloadResolutionForMoveAssignment = true;
540
541
542
543
544
545
546
547
549 data().NeedOverloadResolutionForCopyConstructor = true;
550 data().NeedOverloadResolutionForMoveConstructor = true;
551 data().NeedOverloadResolutionForDestructor = true;
552 }
553
554
555
556
557
558
560 data().DefaultedDestructorIsConstexpr =
562
563
564
565
566
567 if (!Subobj->data().StructuralIfLiteral)
568 data().StructuralIfLiteral = false;
569}
570
572 assert(
574 "getStandardLayoutBaseWithFields called on a non-standard-layout type");
575#ifdef EXPENSIVE_CHECKS
576 {
577 unsigned NumberOfBasesWithFields = 0;
579 ++NumberOfBasesWithFields;
582 if (->field_empty())
583 ++NumberOfBasesWithFields;
584 assert(
585 UniqueBases.insert(Base->getCanonicalDecl()).second &&
586 "Standard layout struct has multiple base classes of the same type");
587 return true;
588 });
589 assert(NumberOfBasesWithFields <= 1 &&
590 "Standard layout struct has fields declared in more than one class");
591 }
592#endif
594 return this;
597 if (->field_empty()) {
598
599 Result = Base;
600 return false;
601 }
602 return true;
603 });
605}
606
610}
611
614 return false;
615
617}
618
620
621
622
624
626
628
630
632
633 return true;
634}
635
637
638
639
641 return false;
642
644 return false;
645
646 return true;
647}
648
649void CXXRecordDecl::markedVirtualFunctionPure() {
650
651
652 data().Abstract = true;
653}
654
655bool CXXRecordDecl::hasSubobjectAtOffsetZeroOfEmptyBaseType(
658 return false;
659
663
664
665 auto Visit = [&](const CXXRecordDecl *RD) -> bool {
666 RD = RD->getCanonicalDecl();
667
668
669
670
671
672
673
674 if (!RD->data().HasBasesWithFields) {
675
676
677 if (Bases.empty()) {
679 Base = Base->getCanonicalDecl();
680 if (RD == Base)
681 return false;
682 Bases.insert(Base);
683 return true;
684 });
685 if (RDIsBase)
686 return true;
687 } else {
688 if (Bases.count(RD))
689 return true;
690 }
691 }
692
693 if (M.insert(RD).second)
694 WorkList.push_back(RD);
695 return false;
696 };
697
698 if (Visit(XFirst))
699 return true;
700
701 while (!WorkList.empty()) {
703
704
705
706
707
708
709
710
711 bool IsFirstField = true;
712 for (auto *FD : X->fields()) {
713
714
715 if (FD->isUnnamedBitField())
716 continue;
717
718 if (!IsFirstField && !FD->isZeroSize(Ctx))
719 continue;
720
721 if (FD->isInvalidDecl())
722 continue;
723
724
727 if (Visit(RD))
728 return true;
729
730 if (->isUnion())
731 IsFirstField = false;
732 }
733 }
734
735 return false;
736}
737
739 assert(isLambda() && "not a lambda");
740
741
742
743
744
745
746
747
748
749
750
752 return false;
754}
755
756void CXXRecordDecl::addedMember(Decl *D) {
757 if (->isImplicit() && !isa(D) && !isa(D) &&
758 (!isa(D) ||
761 data().HasOnlyCMembers = false;
762
763
765 return;
766
767 auto *FunTmpl = dyn_cast(D);
768 if (FunTmpl)
769 D = FunTmpl->getTemplatedDecl();
770
771
773 if (auto *ND = dyn_cast(DUnderlying)) {
774 DUnderlying = ND->getUnderlyingDecl();
775 if (auto *UnderlyingFunTmpl = dyn_cast(DUnderlying))
776 DUnderlying = UnderlyingFunTmpl->getTemplatedDecl();
777 }
778
779 if (const auto *Method = dyn_cast(D)) {
780 if (Method->isVirtual()) {
781
782
783 data().Aggregate = false;
784
785
786
787 data().PlainOldData = false;
788
789
790
791 data().Empty = false;
792
793
794
795
796 data().Polymorphic = true;
797
798
799
800
801
802 data().HasTrivialSpecialMembers &= SMF_Destructor;
803 data().HasTrivialSpecialMembersForCall &= SMF_Destructor;
804
805
806
807
808 data().IsStandardLayout = false;
809 data().IsCXX11StandardLayout = false;
810 }
811 }
812
813
814
817 L->AddedCXXImplicitMember(data().Definition, D);
818
819
820 unsigned SMKind = 0;
821
822
823 if (const auto *Constructor = dyn_cast(D)) {
824 if (Constructor->isInheritingConstructor()) {
825
826
827 } else {
829
830 data().UserDeclaredConstructor = true;
831
835
836
837
838
839
840 data().PlainOldData = false;
841 }
842 }
843
844 if (Constructor->isDefaultConstructor()) {
845 SMKind |= SMF_DefaultConstructor;
846
848 data().UserProvidedDefaultConstructor = true;
850 data().HasConstexprDefaultConstructor = true;
852 data().HasDefaultedDefaultConstructor = true;
853 }
854
855 if (!FunTmpl) {
856 unsigned Quals;
857 if (Constructor->isCopyConstructor(Quals)) {
858 SMKind |= SMF_CopyConstructor;
859
861 data().HasDeclaredCopyConstructorWithConstParam = true;
862 } else if (Constructor->isMoveConstructor())
863 SMKind |= SMF_MoveConstructor;
864 }
865
866
867
868
869
870
871
875 data().Aggregate = false;
876 }
877 }
878
879
880 if (const auto *Constructor = dyn_cast(DUnderlying)) {
881
882
883
884
885
886
888 data().HasConstexprNonCopyMoveConstructor = true;
889 if (!isa(D) && Constructor->isDefaultConstructor())
890 data().HasInheritedDefaultConstructor = true;
891 }
892
893
894 if (const auto *Method = dyn_cast(D)) {
895 if (isa(D))
896 SMKind |= SMF_Destructor;
897
898 if (Method->isCopyAssignmentOperator()) {
899 SMKind |= SMF_CopyAssignment;
900
901 const auto *ParamTy =
902 Method->getNonObjectParameter(0)->getType()->getAs<ReferenceType>();
903 if (!ParamTy || ParamTy->getPointeeType().isConstQualified())
904 data().HasDeclaredCopyAssignmentWithConstParam = true;
905 }
906
907 if (Method->isMoveAssignmentOperator())
908 SMKind |= SMF_MoveAssignment;
909
910
911 if (auto *Conversion = dyn_cast(D)) {
912
913
914
915
916
917
919
920 if (Conversion->getPrimaryTemplate()) {
921
922 } else {
926 FunTmpl ? cast(FunTmpl) : cast<NamedDecl>(Conversion);
929 Primary, AS);
930 else
931 Conversions.addDecl(Ctx, Primary, AS);
932 }
933 }
934
935 if (SMKind) {
936
937
938 data().HasTrivialSpecialMembers &=
939 data().DeclaredSpecialMembers | ~SMKind;
940 data().HasTrivialSpecialMembersForCall &=
941 data().DeclaredSpecialMembers | ~SMKind;
942
943
944
945 data().DeclaredSpecialMembers |= SMKind;
946 if (!Method->isImplicit()) {
947 data().UserDeclaredSpecialMembers |= SMKind;
948
950 if ((!Method->isDeleted() && !Method->isDefaulted() &&
951 SMKind != SMF_MoveAssignment) ||
953
954
955
956
957
958
959
960
961
962
963
964
965 data().PlainOldData = false;
966 }
967 }
968
969
970
971
972
973 if (!Method->isIneligibleOrNotSelected()) {
975 }
976 }
977
978 return;
979 }
980
981
982 if (const auto *Field = dyn_cast(D)) {
984
985
986
987
988
989
990 if (data().HasBasesWithFields)
991 data().IsStandardLayout = false;
992
993
994
995
996
997 if (Field->isUnnamedBitField()) {
998
999
1000
1001 if (data().Empty && ->isZeroLengthBitField() &&
1002 Context.getLangOpts().getClangABICompat() >
1004 data().Empty = false;
1005 return;
1006 }
1007
1008
1009
1010
1011
1012 if (data().HasBasesWithNonStaticDataMembers)
1013 data().IsCXX11StandardLayout = false;
1014
1015
1016
1017
1018
1019
1021 data().Aggregate = false;
1022 data().PlainOldData = false;
1023
1024
1025
1026
1027 data().StructuralIfLiteral = false;
1028 }
1029
1030
1031
1032 bool IsFirstField = !data().HasPrivateFields &&
1033 !data().HasProtectedFields && !data().HasPublicFields;
1034
1035
1036
1037
1038
1040 case AS_private: data().HasPrivateFields = true; break;
1041 case AS_protected: data().HasProtectedFields = true; break;
1042 case AS_public: data().HasPublicFields = true; break;
1043 case AS_none: llvm_unreachable("Invalid access specifier");
1044 };
1045 if ((data().HasPrivateFields + data().HasProtectedFields +
1046 data().HasPublicFields) > 1) {
1047 data().IsStandardLayout = false;
1048 data().IsCXX11StandardLayout = false;
1049 }
1050
1051
1052 if (Field->isMutable()) {
1053 data().HasMutableFields = true;
1054
1055
1056
1057
1058 data().StructuralIfLiteral = false;
1059 }
1060
1061
1062
1063
1064 if (isUnion() && ->isAnonymousStructOrUnion())
1065 data().HasVariantMembers = true;
1066
1067 if (isUnion() && IsFirstField)
1068 data().HasUninitializedFields = true;
1069
1070
1071
1072
1073
1074
1075
1076
1079 if (T.hasNonTrivialObjCLifetime()) {
1080
1081
1082
1083
1084
1085
1087 struct DefinitionData &Data = data();
1088 Data.PlainOldData = false;
1089 Data.HasTrivialSpecialMembers = 0;
1090
1091
1092
1095 data().HasTrivialSpecialMembersForCall = 0;
1096
1097
1100
1101 Data.HasIrrelevantDestructor = false;
1102
1104 data().DefaultedCopyConstructorIsDeleted = true;
1105 data().DefaultedMoveConstructorIsDeleted = true;
1106 data().DefaultedCopyAssignmentIsDeleted = true;
1107 data().DefaultedMoveAssignmentIsDeleted = true;
1108 data().DefaultedDestructorIsDeleted = true;
1109 data().NeedOverloadResolutionForCopyConstructor = true;
1110 data().NeedOverloadResolutionForMoveConstructor = true;
1111 data().NeedOverloadResolutionForCopyAssignment = true;
1112 data().NeedOverloadResolutionForMoveAssignment = true;
1113 data().NeedOverloadResolutionForDestructor = true;
1114 }
1115 } else if (!Context.getLangOpts().ObjCAutoRefCount) {
1117 }
1118 } else if (.isCXX98PODType(Context))
1119 data().PlainOldData = false;
1120
1121 if (Field->hasAttr())
1123
1125 if (->hasInClassInitializer())
1126 data().HasUninitializedReferenceMember = true;
1127
1128
1129
1130
1131 data().IsStandardLayout = false;
1132 data().IsCXX11StandardLayout = false;
1133
1134
1135
1136
1138 data().DefaultedCopyConstructorIsDeleted = true;
1139 }
1140
1142 if (Field->hasInClassInitializer())
1143 data().HasUninitializedFields = false;
1144 } else if (->hasInClassInitializer() &&
->isMutable()) {
1146 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
1147 data().HasUninitializedFields = true;
1148 } else {
1149 data().HasUninitializedFields = true;
1150 }
1151 }
1152
1153
1154 if (->isLiteralType(Context) || T.isVolatileQualified())
1155 data().HasNonLiteralTypeFieldsOrBases = true;
1156
1157 if (Field->hasInClassInitializer() ||
1158 (Field->isAnonymousStructOrUnion() &&
1159 Field->getType()->getAsCXXRecordDecl()->hasInClassInitializer())) {
1160 data().HasInClassInitializer = true;
1161
1162
1163
1164
1165 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1166
1167
1168
1169
1170
1171
1173 data().Aggregate = false;
1174
1175
1176
1177 data().PlainOldData = false;
1178 }
1179
1180
1181
1182
1183
1185 data().DefaultedCopyAssignmentIsDeleted = true;
1186 data().DefaultedMoveAssignmentIsDeleted = true;
1187 }
1188
1189
1190
1191 bool IsZeroSize = Field->isZeroSize(Context);
1192
1194 auto *FieldRec = cast(RecordTy->getDecl());
1195 if (FieldRec->getDefinition()) {
1196 addedClassSubobject(FieldRec);
1197
1198
1199
1201
1202
1203
1204 data().NeedOverloadResolutionForCopyConstructor = true;
1205 data().NeedOverloadResolutionForMoveConstructor = true;
1206 data().NeedOverloadResolutionForCopyAssignment = true;
1207 data().NeedOverloadResolutionForMoveAssignment = true;
1208 }
1209
1210
1211
1212
1213
1214
1216 if (FieldRec->hasNonTrivialCopyConstructor())
1217 data().DefaultedCopyConstructorIsDeleted = true;
1218 if (FieldRec->hasNonTrivialMoveConstructor())
1219 data().DefaultedMoveConstructorIsDeleted = true;
1220 if (FieldRec->hasNonTrivialCopyAssignment())
1221 data().DefaultedCopyAssignmentIsDeleted = true;
1222 if (FieldRec->hasNonTrivialMoveAssignment())
1223 data().DefaultedMoveAssignmentIsDeleted = true;
1224 if (FieldRec->hasNonTrivialDestructor()) {
1225 data().DefaultedDestructorIsDeleted = true;
1226
1227
1228
1229 data().DefaultedDestructorIsConstexpr = true;
1230 }
1231 }
1232
1233
1234
1235 if (Field->isAnonymousStructOrUnion()) {
1236 data().NeedOverloadResolutionForCopyConstructor |=
1237 FieldRec->data().NeedOverloadResolutionForCopyConstructor;
1238 data().NeedOverloadResolutionForMoveConstructor |=
1239 FieldRec->data().NeedOverloadResolutionForMoveConstructor;
1240 data().NeedOverloadResolutionForCopyAssignment |=
1241 FieldRec->data().NeedOverloadResolutionForCopyAssignment;
1242 data().NeedOverloadResolutionForMoveAssignment |=
1243 FieldRec->data().NeedOverloadResolutionForMoveAssignment;
1244 data().NeedOverloadResolutionForDestructor |=
1245 FieldRec->data().NeedOverloadResolutionForDestructor;
1246 }
1247
1248
1249
1250
1251
1252
1253 if (!FieldRec->hasTrivialDefaultConstructor())
1254 data().HasTrivialSpecialMembers &= ~SMF_DefaultConstructor;
1255
1256
1257
1258
1259
1260
1261
1262 if (!FieldRec->hasTrivialCopyConstructor())
1263 data().HasTrivialSpecialMembers &= ~SMF_CopyConstructor;
1264
1265 if (!FieldRec->hasTrivialCopyConstructorForCall())
1266 data().HasTrivialSpecialMembersForCall &= ~SMF_CopyConstructor;
1267
1268
1269
1270
1271 if (!FieldRec->hasTrivialMoveConstructor())
1272 data().HasTrivialSpecialMembers &= ~SMF_MoveConstructor;
1273
1274 if (!FieldRec->hasTrivialMoveConstructorForCall())
1275 data().HasTrivialSpecialMembersForCall &= ~SMF_MoveConstructor;
1276
1277
1278
1279
1280
1281
1282
1283 if (!FieldRec->hasTrivialCopyAssignment())
1284 data().HasTrivialSpecialMembers &= ~SMF_CopyAssignment;
1285
1286
1287
1288 if (!FieldRec->hasTrivialMoveAssignment())
1289 data().HasTrivialSpecialMembers &= ~SMF_MoveAssignment;
1290
1291 if (!FieldRec->hasTrivialDestructor())
1292 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1293 if (!FieldRec->hasTrivialDestructorForCall())
1294 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1295 if (!FieldRec->hasIrrelevantDestructor())
1296 data().HasIrrelevantDestructor = false;
1297 if (FieldRec->isAnyDestructorNoReturn())
1298 data().IsAnyDestructorNoReturn = true;
1299 if (FieldRec->hasObjectMember())
1301 if (FieldRec->hasVolatileMember())
1303 if (FieldRec->getArgPassingRestrictions() ==
1306
1307
1308
1309
1310
1311 if (!FieldRec->isStandardLayout())
1312 data().IsStandardLayout = false;
1313 if (!FieldRec->isCXX11StandardLayout())
1314 data().IsCXX11StandardLayout = false;
1315
1316
1317
1318
1319
1320 if (data().IsStandardLayout &&
1321 (isUnion() || IsFirstField || IsZeroSize) &&
1322 hasSubobjectAtOffsetZeroOfEmptyBaseType(Context, FieldRec))
1323 data().IsStandardLayout = false;
1324
1325
1326
1327
1328
1329 if (data().IsCXX11StandardLayout && IsFirstField) {
1330
1331
1332 for (const auto &BI : bases()) {
1334 data().IsCXX11StandardLayout = false;
1335 break;
1336 }
1337 }
1338 }
1339
1340
1341 if (FieldRec->hasMutableFields())
1342 data().HasMutableFields = true;
1343
1344 if (Field->isMutable()) {
1345
1346
1347
1348 data().NeedOverloadResolutionForCopyConstructor = true;
1349 data().NeedOverloadResolutionForCopyAssignment = true;
1350 }
1351
1352
1353
1354
1355
1356
1357
1358
1359 if (->hasInClassInitializer() &&
1360 !FieldRec->hasConstexprDefaultConstructor() && ())
1361
1362
1363 data().DefaultedDefaultConstructorIsConstexpr =
1365
1366
1367
1368
1369
1370
1371 if (!FieldRec->hasCopyConstructorWithConstParam())
1372 data().ImplicitCopyConstructorCanHaveConstParamForNonVBase = false;
1373
1374
1375
1376
1377
1378
1379
1380 if (!FieldRec->hasCopyAssignmentWithConstParam())
1381 data().ImplicitCopyAssignmentHasConstParam = false;
1382
1383 if (FieldRec->hasUninitializedExplicitInitFields() &&
1384 FieldRec->isAggregate())
1386
1387 if (FieldRec->hasUninitializedReferenceMember() &&
1388 ->hasInClassInitializer())
1389 data().HasUninitializedReferenceMember = true;
1390
1391
1392
1393
1394 if (FieldRec->hasVariantMembers() &&
1395 Field->isAnonymousStructOrUnion())
1396 data().HasVariantMembers = true;
1397 }
1398 } else {
1399
1401 (->hasInClassInitializer() &&
() &&
1403 data().DefaultedDefaultConstructorIsConstexpr = false;
1404
1405
1406
1407
1408
1409
1410 if (T.isConstQualified()) {
1411 data().DefaultedCopyAssignmentIsDeleted = true;
1412 data().DefaultedMoveAssignmentIsDeleted = true;
1413 }
1414
1415
1416
1417
1418
1419
1421 data().StructuralIfLiteral = false;
1422 }
1423
1424
1425
1426
1427 if (data().Empty && !IsZeroSize)
1428 data().Empty = false;
1429
1431 const Type *Ty = Field->getType()->getUnqualifiedDesugaredType();
1432 while (isa(Ty))
1434
1436 if (const RecordType *RT = dyn_cast(Ty))
1437 data().IsHLSLIntangible |= RT->getAsCXXRecordDecl()->isHLSLIntangible();
1438 else
1441 }
1442 }
1443
1444
1445 if (auto *Shadow = dyn_cast(D)) {
1446 if (Shadow->getDeclName().getNameKind()
1449 data().Conversions.get(Ctx).addDecl(Ctx, Shadow, Shadow->getAccess());
1450 }
1451 }
1452
1453 if (const auto *Using = dyn_cast(D)) {
1454 if (Using->getDeclName().getNameKind() ==
1456 data().HasInheritedConstructor = true;
1457
1458
1459 data().Aggregate = false;
1460 }
1461
1462 if (Using->getDeclName().getCXXOverloadedOperator() == OO_Equal)
1463 data().HasInheritedAssignment = true;
1464 }
1465}
1466
1471 return false;
1472
1474
1475
1476
1478 return false;
1479 bool HasAtLeastOneLiteralMember =
1481 return ->getType().isVolatileQualified() &&
1483 });
1484 if (!HasAtLeastOneLiteralMember)
1485 return false;
1486 }
1487
1490}
1491
1495}
1496
1498 unsigned SMKind) {
1499
1500
1501
1502
1503 if (const auto *DD = dyn_cast(MD)) {
1504 if (DD->isUserProvided())
1505 data().HasIrrelevantDestructor = false;
1506
1507
1508
1509
1510
1511
1512 if (DD->isVirtual()) {
1513 data().HasTrivialSpecialMembers &= ~SMF_Destructor;
1514 data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
1515 }
1516
1517 if (DD->isNoReturn())
1518 data().IsAnyDestructorNoReturn = true;
1519 }
1520
1522
1523
1524
1525
1527 data().HasTrivialSpecialMembers |= SMKind;
1528 data().HasTrivialSpecialMembersForCall |= SMKind;
1530 data().HasTrivialSpecialMembersForCall |= SMKind;
1531 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1532 } else {
1533 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1534
1535
1536
1537
1538
1540 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1541 }
1542}
1543
1545 assert(->isImplicit() &&
->isUserProvided());
1546
1547
1548 unsigned SMKind = 0;
1549
1550 if (const auto *Constructor = dyn_cast(D)) {
1551 if (Constructor->isDefaultConstructor()) {
1552 SMKind |= SMF_DefaultConstructor;
1553 if (Constructor->isConstexpr())
1554 data().HasConstexprDefaultConstructor = true;
1555 }
1556 if (Constructor->isCopyConstructor())
1557 SMKind |= SMF_CopyConstructor;
1558 else if (Constructor->isMoveConstructor())
1559 SMKind |= SMF_MoveConstructor;
1560 else if (Constructor->isConstexpr())
1561
1562 data().HasConstexprNonCopyMoveConstructor = true;
1563 } else if (isa(D)) {
1564 SMKind |= SMF_Destructor;
1566 data().HasIrrelevantDestructor = false;
1567 } else if (D->isCopyAssignmentOperator())
1568 SMKind |= SMF_CopyAssignment;
1569 else if (D->isMoveAssignmentOperator())
1570 SMKind |= SMF_MoveAssignment;
1571
1572
1573
1574 if (->isIneligibleOrNotSelected()) {
1575 if (D->isTrivial())
1576 data().HasTrivialSpecialMembers |= SMKind;
1577 else
1578 data().DeclaredNonTrivialSpecialMembers |= SMKind;
1579 }
1580}
1581
1582void CXXRecordDecl::LambdaDefinitionData::AddCaptureList(ASTContext &Ctx,
1584 Captures.push_back(CaptureList);
1585 if (Captures.size() == 2) {
1586
1588 }
1589}
1590
1593 CXXRecordDecl::LambdaDefinitionData &Data = getLambdaData();
1594
1595
1596 Data.NumCaptures = Captures.size();
1597 Data.NumExplicitCaptures = 0;
1599 Captures.size());
1600 Data.AddCaptureList(Context, ToCapture);
1602 if (C.isExplicit())
1603 ++Data.NumExplicitCaptures;
1604
1606 ToCapture++;
1607 }
1608
1610 Data.DefaultedCopyAssignmentIsDeleted = true;
1611}
1612
1614 unsigned SMKind = 0;
1615
1616 if (const auto *Constructor = dyn_cast(D)) {
1617 if (Constructor->isCopyConstructor())
1618 SMKind = SMF_CopyConstructor;
1619 else if (Constructor->isMoveConstructor())
1620 SMKind = SMF_MoveConstructor;
1621 } else if (isa(D))
1622 SMKind = SMF_Destructor;
1623
1624 if (D->isTrivialForCall())
1625 data().HasTrivialSpecialMembersForCall |= SMKind;
1626 else
1627 data().DeclaredNonTrivialSpecialMembersForCall |= SMKind;
1628}
1629
1633 !TemplateOrInstantiation.isNull())
1634 return false;
1636 return true;
1637
1638 return isPOD() && data().HasOnlyCMembers;
1639}
1640
1642 if (()) return false;
1643 return getLambdaData().IsGenericLambda;
1644}
1645
1646#ifndef NDEBUG
1648 return llvm::all_of(R, [&](NamedDecl *D) {
1650 });
1651}
1652#endif
1653
1655 if (!RD.isLambda()) return nullptr;
1658
1660 assert(!Calls.empty() && "Missing lambda call operator!");
1662 "More than one lambda call operator!");
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1687 auto *MD = cast(D);
1688 if (MD->getOwningModule() == M)
1689 return MD;
1690 }
1691
1692 llvm_unreachable("Couldn't find our call operator!");
1693}
1694
1697 return dyn_cast_or_null(CallOp);
1698}
1699
1702
1703 if (CallOp == nullptr)
1704 return nullptr;
1705
1706 if (const auto *CallOpTmpl = dyn_cast(CallOp))
1707 return cast(CallOpTmpl->getTemplatedDecl());
1708
1709 return cast(CallOp);
1710}
1711
1716}
1717
1720 assert(RD.isLambda() && "Must be a lambda");
1723 return RD.lookup(Name);
1724}
1725
1727 if (const auto *InvokerTemplate = dyn_cast(ND))
1728 return cast(InvokerTemplate->getTemplatedDecl());
1729 return cast(ND);
1730}
1731
1734 return nullptr;
1736
1738 const auto *FTy =
1739 cast(ND->getAsFunction())->getType()->castAs<FunctionType>();
1740 if (FTy->getCallConv() == CC)
1742 }
1743
1744 return nullptr;
1745}
1746
1748 llvm::DenseMap<const ValueDecl *, FieldDecl *> &Captures,
1749 FieldDecl *&ThisCapture) const {
1750 Captures.clear();
1751 ThisCapture = nullptr;
1752
1753 LambdaDefinitionData &Lambda = getLambdaData();
1754 for (const LambdaCapture *List : Lambda.Captures) {
1756 for (const LambdaCapture *C = List, *CEnd = C + Lambda.NumCaptures;
1757 C != CEnd; ++C, ++Field) {
1758 if (C->capturesThis())
1759 ThisCapture = *Field;
1760 else if (C->capturesVariable())
1761 Captures[C->getCapturedVar()] = *Field;
1762 }
1764 }
1765}
1766
1772 return Tmpl->getTemplateParameters();
1773 return nullptr;
1774}
1775
1779 if (!List)
1780 return {};
1781
1782 assert(std::is_partitioned(List->begin(), List->end(),
1783 [](const NamedDecl *D) { return !D->isImplicit(); })
1784 && "Explicit template params should be ordered before implicit ones");
1785
1786 const auto ExplicitEnd = llvm::partition_point(
1789}
1790
1792 assert(isLambda() && "Not a lambda closure type!");
1794 return getLambdaData().ContextDecl.get(Source);
1795}
1796
1798 assert(isLambda() && "Not a lambda closure type!");
1799 getLambdaData().ManglingNumber = Numbering.ManglingNumber;
1801 getASTContext().DeviceLambdaManglingNumbers[this] =
1803 getLambdaData().IndexInContext = Numbering.IndexInContext;
1804 getLambdaData().ContextDecl = Numbering.ContextDecl;
1806}
1807
1809 assert(isLambda() && "Not a lambda closure type!");
1810 return getASTContext().DeviceLambdaManglingNumbers.lookup(this);
1811}
1812
1816 ->getConversionType();
1818}
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1838
1839
1840
1843
1844
1845
1848 if (ConvI != ConvE) {
1849 HiddenTypesBuffer = ParentHiddenTypes;
1850 HiddenTypes = &HiddenTypesBuffer;
1851
1854 bool Hidden = ParentHiddenTypes.count(ConvType);
1855 if (!Hidden)
1856 HiddenTypesBuffer.insert(ConvType);
1857
1858
1859
1860 if (Hidden && InVirtual)
1861 HiddenVBaseCs.insert(cast(I.getDecl()->getCanonicalDecl()));
1862
1863
1864 else if (!Hidden) {
1867
1868 if (InVirtual)
1869 VOutput.addDecl(I.getDecl(), IAccess);
1870 else
1871 Output.addDecl(Context, I.getDecl(), IAccess);
1872 }
1873 }
1874 }
1875
1876
1877 for (const auto &I : Record->bases()) {
1878 const auto *RT = I.getType()->getAs<RecordType>();
1879 if (!RT) continue;
1880
1883 bool BaseInVirtual = InVirtual || I.isVirtual();
1884
1885 auto *Base = cast(RT->getDecl());
1887 *HiddenTypes, Output, VOutput, HiddenVBaseCs);
1888 }
1889}
1890
1891
1892
1893
1894
1898
1899
1900
1902
1903
1904
1906
1907
1909
1910
1911
1914 Output.append(Context, ConvI, ConvE);
1915 for (; ConvI != ConvE; ++ConvI)
1917
1918
1919 for (const auto &I : Record->bases()) {
1920 const auto *RT = I.getType()->getAs<RecordType>();
1921 if (!RT) continue;
1922
1924 I.isVirtual(), I.getAccessSpecifier(),
1925 HiddenTypes, Output, VBaseCs, HiddenVBaseCs);
1926 }
1927
1928
1930 I != E; ++I) {
1931 if (!HiddenVBaseCs.count(cast(I.getDecl()->getCanonicalDecl())))
1932 Output.addDecl(Context, I.getDecl(), I.getAccess());
1933 }
1934}
1935
1936
1937
1938llvm::iterator_rangeCXXRecordDecl::conversion\_iterator
1941
1944
1945 Set = &data().Conversions.get(Ctx);
1946 } else {
1947 Set = &data().VisibleConversions.get(Ctx);
1948
1949 if (!data().ComputedVisibleConversions) {
1951 data().ComputedVisibleConversions = true;
1952 }
1953 }
1954 return llvm::make_range(Set->begin(), Set->end());
1955}
1956
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1970 for (unsigned I = 0, E = Convs.size(); I != E; ++I) {
1971 if (Convs[I].getDecl() == ConvDecl) {
1973 assert(!llvm::is_contained(Convs, ConvDecl) &&
1974 "conversion was found multiple times in unresolved set");
1975 return;
1976 }
1977 }
1978
1979 llvm_unreachable("conversion not found in set!");
1980}
1981
1984 return cast(MSInfo->getInstantiatedFrom());
1985
1986 return nullptr;
1987}
1988
1991}
1992
1993void
1996 assert(TemplateOrInstantiation.isNull() &&
1997 "Previous template or instantiation?");
1998 assert(!isa(this));
1999 TemplateOrInstantiation
2001}
2002
2005}
2006
2008 TemplateOrInstantiation = Template;
2009}
2010
2012 if (const auto *Spec = dyn_cast(this))
2013 return Spec->getSpecializationKind();
2014
2016 return MSInfo->getTemplateSpecializationKind();
2017
2019}
2020
2021void
2023 if (auto *Spec = dyn_cast(this)) {
2024 Spec->setSpecializationKind(TSK);
2025 return;
2026 }
2027
2029 MSInfo->setTemplateSpecializationKind(TSK);
2030 return;
2031 }
2032
2033 llvm_unreachable("Not a class template or member class specialization");
2034}
2035
2037 auto GetDefinitionOrSelf =
2039 if (auto *Def = D->getDefinition())
2040 return Def;
2041 return D;
2042 };
2043
2044
2045
2046 if (auto *TD = dyn_cast(this)) {
2047 auto From = TD->getInstantiatedFrom();
2049 while (auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
2050 if (NewCTD->isMemberSpecialization())
2051 break;
2052 CTD = NewCTD;
2053 }
2054 return GetDefinitionOrSelf(CTD->getTemplatedDecl());
2055 }
2056 if (auto *CTPSD =
2058 while (auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
2059 if (NewCTPSD->isMemberSpecialization())
2060 break;
2061 CTPSD = NewCTPSD;
2062 }
2063 return GetDefinitionOrSelf(CTPSD);
2064 }
2065 }
2066
2071 RD = NewRD;
2072 return GetDefinitionOrSelf(RD);
2073 }
2074 }
2075
2077 "couldn't find pattern for class template instantiation");
2078 return nullptr;
2079}
2080
2084
2088
2090
2091
2092
2093 for (auto *Decl : R) {
2094 auto* DD = dyn_cast(Decl);
2095 if (DD && !DD->isIneligibleOrNotSelected())
2096 return DD;
2097 }
2098 return nullptr;
2099}
2100
2104 return true;
2106 }
2107 return false;
2108}
2109
2111 assert(hasDefinition() && "checking for interface-like without a definition");
2112
2114 return true;
2115
2116
2117
2118
2122 return false;
2123
2124
2125 for (const auto *const Method : methods())
2126 if (Method->isDefined() && !Method->isImplicit())
2127 return false;
2128
2129
2130 const auto *Uuid = getAttr();
2131
2132
2133
2136 ((getName() == "IUnknown" &&
2137 Uuid->getGuid() == "00000000-0000-0000-C000-000000000046") ||
2138 (getName() == "IDispatch" &&
2139 Uuid->getGuid() == "00020400-0000-0000-C000-000000000046"))) {
2141 return false;
2142 return true;
2143 }
2144
2145
2146
2147
2148
2150 return false;
2151
2153 if (BaseSpec.isVirtual() || BaseSpec.getAccessSpecifier() != AS_public)
2154 return false;
2155 const auto *Base = BaseSpec.getType()->getAsCXXRecordDecl();
2156 if (Base->isInterface() || ->isInterfaceLike())
2157 return false;
2158 return true;
2159}
2160
2163}
2164
2167 if (!FinalOverriders) {
2171 }
2172
2173 for (const CXXFinalOverriderMap::value_type &
2174 OverridingMethodsEntry : *FinalOverriders) {
2175 for (const auto &[_, SubobjOverrides] : OverridingMethodsEntry.second) {
2176 assert(SubobjOverrides.size() > 0 &&
2177 "All virtual functions have overriding virtual functions");
2178
2179 if (SubobjOverrides.front().Method->isPureVirtual())
2180 return true;
2181 }
2182 }
2183 return false;
2184}
2185
2188
2189
2190
2191
2192
2193
2194
2195
2198
2199
2201 I != E; ++I)
2202 I.setAccess((*I)->getAccess());
2203
2205
2208
2210 if (const auto *AT = FD->getAttr())
2212 AT->getLocation(),
2213 diag::warn_cxx20_compat_requires_explicit_init_non_aggregate)
2215 }
2216 }
2217
2219
2220
2221
2223 if (const auto *AT = FD->getAttr())
2225 diag::warn_attribute_needs_aggregate)
2227 }
2229 }
2230}
2231
2233 if (data().Abstract || isInvalidDecl() || !data().Polymorphic ||
2235 return false;
2236
2237 for (const auto &B : bases()) {
2238 const auto *BaseDecl =
2239 cast(B.getType()->castAs<RecordType>()->getDecl());
2240 if (BaseDecl->isAbstract())
2241 return true;
2242 }
2243
2244 return false;
2245}
2246
2249 if (!Def)
2250 return false;
2251 if (Def->hasAttr())
2252 return true;
2253 if (const auto *Dtor = Def->getDestructor())
2254 if (Dtor->hasAttr())
2255 return true;
2256 return false;
2257}
2258
2259void CXXDeductionGuideDecl::anchor() {}
2260
2266 ODRHash SelfHash, OtherHash;
2270 } else
2271 return false;
2272 }
2273 return true;
2274}
2275
2277 switch (Function->getDeclKind()) {
2278 case Decl::Kind::CXXConstructor:
2279 return cast(Function)->getExplicitSpecifier();
2280 case Decl::Kind::CXXConversion:
2281 return cast(Function)->getExplicitSpecifier();
2282 case Decl::Kind::CXXDeductionGuide:
2283 return cast(Function)->getExplicitSpecifier();
2284 default:
2285 return {};
2286 }
2287}
2288
2294 return new (C, DC)
2296 EndLocation, Ctor, Kind, TrailingRequiresClause);
2297}
2298
2305}
2306
2310}
2311
2315}
2316
2317void CXXMethodDecl::anchor() {}
2318
2321
2323 return true;
2324
2327}
2328
2333 return true;
2335 return true;
2336 }
2337 return false;
2338}
2339
2342 bool MayBeBase) {
2344 return this;
2345
2346
2347 if (isa(this)) {
2349 if (MD) {
2351 return MD;
2353 return MD;
2354 }
2355 return nullptr;
2356 }
2357
2359 auto *MD = dyn_cast(ND);
2360 if (!MD)
2361 continue;
2363 return MD;
2365 return MD;
2366 }
2367
2368 return nullptr;
2369}
2370
2373 bool MayBeBase) {
2375 return MD;
2376
2379
2380
2383 return;
2384 }
2385
2386
2387 llvm::erase_if(FinalOverriders, [&](CXXMethodDecl *OtherD) {
2389 });
2390
2391 FinalOverriders.push_back(D);
2392 };
2393
2394 for (const auto &I : RD->bases()) {
2396 if (!RT)
2397 continue;
2398 const auto *Base = cast(RT->getDecl());
2400 AddFinalOverrider(D);
2401 }
2402
2403 return FinalOverriders.size() == 1 ? FinalOverriders.front() : nullptr;
2404}
2405
2412 Expr *TrailingRequiresClause) {
2414 CXXMethod, C, RD, StartLoc, NameInfo, T, TInfo, SC, UsesFPIntrin,
2415 isInline, ConstexprKind, EndLocation, TrailingRequiresClause);
2416}
2417
2424}
2425
2427 bool IsAppleKext) {
2428 assert(isVirtual() && "this method is expected to be virtual");
2429
2430
2431
2432 if (IsAppleKext)
2433 return nullptr;
2434
2435
2436
2437 if (hasAttr())
2439
2440
2442 return nullptr;
2443
2444
2445
2446 Base = Base->getBestDynamicClassTypeExpr();
2447 if (Base->isPRValue() && Base->getType()->isRecordType())
2448 return this;
2449
2450
2451 const CXXRecordDecl *BestDynamicDecl = Base->getBestDynamicClassType();
2452 if (!BestDynamicDecl)
2453 return nullptr;
2454
2455
2458
2459
2460
2461 if (!DevirtualizedMethod)
2462 return nullptr;
2463
2464
2465
2466
2468 return nullptr;
2469
2470
2471 if (DevirtualizedMethod->hasAttr())
2472 return DevirtualizedMethod;
2473
2474
2475
2476
2478 return DevirtualizedMethod;
2479
2480 if (const auto *DRE = dyn_cast(Base)) {
2481 if (const auto *VD = dyn_cast(DRE->getDecl()))
2482 if (VD->getType()->isRecordType())
2483
2484 return DevirtualizedMethod;
2485
2486 return nullptr;
2487 }
2488
2489
2490
2491
2492 if (const auto *ME = dyn_cast(Base)) {
2493 const ValueDecl *VD = ME->getMemberDecl();
2495 }
2496
2497
2498
2499 if (auto *BO = dyn_cast(Base)) {
2500 if (BO->isPtrMemOp()) {
2502 if (MPT->getPointeeType()->isRecordType())
2503 return DevirtualizedMethod;
2504 }
2505 }
2506
2507
2508 return nullptr;
2509}
2510
2513 assert(PreventedBy.empty() && "PreventedBy is expected to be empty");
2516 return false;
2517
2518
2519
2520
2522 return false;
2523
2524
2525
2526
2527
2529 return true;
2530 unsigned UsualParams = 1;
2531
2532
2533
2534
2535
2536
2538 ++UsualParams;
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2554 ++UsualParams;
2555
2558 ++UsualParams;
2559
2561 return false;
2562
2563
2564
2565
2566
2567
2568 if (Context.getLangOpts().CPlusPlus17 ||
2569 Context.getLangOpts().AlignedAllocation ||
2571 return true;
2572
2573
2574
2577 for (const auto *D : R) {
2578 if (const auto *FD = dyn_cast(D)) {
2579 if (FD->getNumParams() == 1) {
2580 PreventedBy.push_back(FD);
2582 }
2583 }
2584 }
2586}
2587
2589
2590
2591
2593}
2594
2597}
2598
2600
2601
2602
2603
2605 isStatic() ||
2606
2609 return false;
2610
2614
2619}
2620
2622
2623
2624
2625
2629 return false;
2630
2633 return false;
2635
2640}
2641
2643 assert(MD->isCanonicalDecl() && "Method is not canonical!");
2644 assert(MD->isVirtual() && "Method is not virtual!");
2645
2647}
2648
2650 if (isa(this)) return nullptr;
2652}
2653
2655 if (isa(this)) return nullptr;
2657}
2658
2660 if (isa(this)) return 0;
2662}
2663
2666 if (isa(this))
2669}
2670
2674 return C.getQualifiedType(ClassTy, FPT->getMethodQuals());
2675}
2676
2681
2682
2683
2685 if (Restrict)
2687
2688 ObjectTy = C.getLangOpts().HLSL ? C.getLValueReferenceType(ObjectTy)
2689 : C.getPointerType(ObjectTy);
2690
2691 if (Restrict)
2693 return ObjectTy;
2694}
2695
2697
2698
2699
2700
2701
2702 assert(isInstance() && "No 'this' for static methods!");
2705}
2706
2710
2716 return C.getRValueReferenceType(Type);
2717 return C.getLValueReferenceType(Type);
2718}
2719
2721
2722
2724 if (!CheckFn)
2725 CheckFn = this;
2726
2730}
2731
2736}
2737
2743 : Initializee(TInfo), Init(Init), MemberOrEllipsisLocation(EllipsisLoc),
2744 LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(IsVirtual),
2745 IsWritten(false), SourceOrder(0) {}
2746
2751 : Initializee(Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2752 LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(false),
2753 IsWritten(false), SourceOrder(0) {}
2754
2760 : Initializee(Member), Init(Init), MemberOrEllipsisLocation(MemberLoc),
2761 LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(false),
2762 IsWritten(false), SourceOrder(0) {}
2763
2768 : Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R),
2769 IsDelegating(true), IsVirtual(false), IsWritten(false), SourceOrder(0) {}
2770
2774}
2775
2778 return cast<TypeSourceInfo *>(Initializee)->getTypeLoc();
2779 else
2780 return {};
2781}
2782
2785 return cast<TypeSourceInfo *>(Initializee)->getType().getTypePtr();
2786 else
2787 return nullptr;
2788}
2789
2793
2796
2797 if (const auto *TSInfo = cast<TypeSourceInfo *>(Initializee))
2798 return TSInfo->getTypeLoc().getBeginLoc();
2799
2800 return {};
2801}
2802
2806 if (Expr *I = D->getInClassInitializer())
2807 return I->getSourceRange();
2808 return {};
2809 }
2810
2812}
2813
2814CXXConstructorDecl::CXXConstructorDecl(
2820 : CXXMethodDecl(CXXConstructor, C, RD, StartLoc, NameInfo, T, TInfo,
2821 SC_None, UsesFPIntrin, isInline, ConstexprKind,
2823 setNumCtorInitializers(0);
2824 setInheritingConstructor(static_cast<bool>(Inherited));
2825 setImplicit(isImplicitlyDeclared);
2826 CXXConstructorDeclBits.HasTrailingExplicitSpecifier = ES.getExpr() ? 1 : 0;
2827 if (Inherited)
2828 *getTrailingObjects() = Inherited;
2829 setExplicitSpecifier(ES);
2830}
2831
2832void CXXConstructorDecl::anchor() {}
2833
2836 uint64_t AllocKind) {
2837 bool hasTrailingExplicit = static_cast<bool>(AllocKind & TAKHasTailExplicit);
2839 static_cast<bool>(AllocKind & TAKInheritsConstructor);
2840 unsigned Extra =
2841 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2848 Result->CXXConstructorDeclBits.HasTrailingExplicitSpecifier =
2849 hasTrailingExplicit;
2852}
2853
2862 "Name must refer to a constructor");
2863 unsigned Extra =
2864 additionalSizeToAlloc<InheritedConstructor, ExplicitSpecifier>(
2865 Inherited ? 1 : 0, ES.getExpr() ? 1 : 0);
2867 C, RD, StartLoc, NameInfo, T, TInfo, ES, UsesFPIntrin, isInline,
2868 isImplicitlyDeclared, ConstexprKind, Inherited, TrailingRequiresClause);
2869}
2870
2872 return CtorInitializers.get(getASTContext().getExternalSource());
2873}
2874
2878 if (const auto *Construct = dyn_cast(E))
2879 return Construct->getConstructor();
2880
2881 return nullptr;
2882}
2883
2885
2886
2887
2888
2890}
2891
2892bool
2896}
2897
2901}
2902
2903
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2917 return false;
2918
2920
2921
2923 if (!ParamRefType)
2924 return false;
2925
2926
2928
2934 return false;
2935
2936
2937
2938
2940 return true;
2941}
2942
2944
2945
2946
2947
2948
2949
2951 return false;
2952
2953
2954
2955
2959}
2960
2963 return false;
2964
2966
2969
2970
2974 return false;
2975
2976 return true;
2977}
2978
2979void CXXDestructorDecl::anchor() {}
2980
2986}
2987
2991 bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared,
2995 "Name must refer to a destructor");
2997 C, RD, StartLoc, NameInfo, T, TInfo, UsesFPIntrin, isInline,
2998 isImplicitlyDeclared, ConstexprKind, TrailingRequiresClause);
2999}
3000
3003 if (OD && ->OperatorDelete) {
3004 First->OperatorDelete = OD;
3005 First->OperatorDeleteThisArg = ThisArg;
3007 L->ResolvedOperatorDelete(First, OD, ThisArg);
3008 }
3009}
3010
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022 const FunctionDecl *SelectedOperatorDelete = OpDel ? OpDel : OperatorDelete;
3023 if (!SelectedOperatorDelete)
3024 return true;
3025
3027 return true;
3028
3029
3031}
3032
3033void CXXConversionDecl::anchor() {}
3034
3041}
3042
3048 Expr *TrailingRequiresClause) {
3051 "Name must refer to a conversion function");
3053 C, RD, StartLoc, NameInfo, T, TInfo, UsesFPIntrin, isInline, ES,
3054 ConstexprKind, EndLocation, TrailingRequiresClause);
3055}
3056
3060}
3061
3065 : Decl(LinkageSpec, DC, LangLoc), DeclContext(LinkageSpec),
3067 setLanguage(lang);
3069}
3070
3071void LinkageSpecDecl::anchor() {}
3072
3077 bool HasBraces) {
3078 return new (C, DC) LinkageSpecDecl(DC, ExternLoc, LangLoc, Lang, HasBraces);
3079}
3080
3086}
3087
3088void UsingDirectiveDecl::anchor() {}
3089
3097 if (auto *NS = dyn_cast_or_null(Used))
3098 Used = NS->getFirstDecl();
3099 return new (C, DC) UsingDirectiveDecl(DC, L, NamespaceLoc, QualifierLoc,
3100 IdentLoc, Used, CommonAncestor);
3101}
3102
3109}
3110
3112 if (auto *NA = dyn_cast_or_null(NominatedNamespace))
3113 return NA->getNamespace();
3114 return cast_or_null(NominatedNamespace);
3115}
3116
3120 bool Nested)
3122 redeclarable_base(C), LocStart(StartLoc) {
3123 setInline(Inline);
3124 setNested(Nested);
3125 setPreviousDecl(PrevDecl);
3126}
3127
3132 return new (C, DC)
3133 NamespaceDecl(C, DC, Inline, StartLoc, IdLoc, Id, PrevDecl, Nested);
3134}
3135
3140}
3141
3142NamespaceDecl *NamespaceDecl::getNextRedeclarationImpl() {
3144}
3145
3146NamespaceDecl *NamespaceDecl::getPreviousDeclImpl() {
3148}
3149
3150NamespaceDecl *NamespaceDecl::getMostRecentDeclImpl() {
3152}
3153
3154void NamespaceAliasDecl::anchor() {}
3155
3158}
3159
3162}
3163
3166}
3167
3175
3176 if (auto *NS = dyn_cast_or_null(Namespace))
3177 Namespace = NS->getFirstDecl();
3179 QualifierLoc, IdentLoc, Namespace);
3180}
3181
3188}
3189
3190void LifetimeExtendedTemporaryDecl::anchor() {}
3191
3192
3195 if (!ExtendingDecl)
3197
3198
3199 if (isa(ExtendingDecl))
3201
3202
3203 if (isa(ExtendingDecl))
3206 return cast(ExtendingDecl)->getStorageDuration();
3207}
3208
3211 "don't need to cache the computed value for this temporary");
3212 if (MayCreate && ) {
3215 }
3216 assert(Value && "may not be null");
3218}
3219
3220void UsingShadowDecl::anchor() {}
3221
3226 UsingOrNextShadow(Introducer) {
3228 assert(!isa(Target));
3230 }
3232}
3233
3237
3241}
3242
3245 while (const auto *NextShadow =
3246 dyn_cast(Shadow->UsingOrNextShadow))
3247 Shadow = NextShadow;
3248 return cast(Shadow->UsingOrNextShadow);
3249}
3250
3251void ConstructorUsingShadowDecl::anchor() {}
3252
3258 IsVirtual);
3259}
3260
3264}
3265
3268}
3269
3270void BaseUsingDecl::anchor() {}
3271
3273 assert(!llvm::is_contained(shadows(), S) && "declaration already in set");
3274 assert(S->getIntroducer() == this);
3275
3276 if (FirstUsingShadow.getPointer())
3277 S->UsingOrNextShadow = FirstUsingShadow.getPointer();
3278 FirstUsingShadow.setPointer(S);
3279}
3280
3282 assert(llvm::is_contained(shadows(), S) && "declaration not in set");
3283 assert(S->getIntroducer() == this);
3284
3285
3286
3287 if (FirstUsingShadow.getPointer() == S) {
3288 FirstUsingShadow.setPointer(
3289 dyn_cast(S->UsingOrNextShadow));
3290 S->UsingOrNextShadow = this;
3291 return;
3292 }
3293
3295 while (Prev->UsingOrNextShadow != S)
3296 Prev = cast(Prev->UsingOrNextShadow);
3297 Prev->UsingOrNextShadow = S->UsingOrNextShadow;
3298 S->UsingOrNextShadow = this;
3299}
3300
3301void UsingDecl::anchor() {}
3302
3306 bool HasTypename) {
3307 return new (C, DC) UsingDecl(DC, UL, QualifierLoc, NameInfo, HasTypename);
3308}
3309
3313 false);
3314}
3315
3320}
3321
3322void UsingEnumDecl::anchor() {}
3323
3330 return new (C, DC)
3332}
3333
3339}
3340
3343}
3344
3345void UsingPackDecl::anchor() {}
3346
3350 size_t Extra = additionalSizeToAlloc<NamedDecl *>(UsingDecls.size());
3351 return new (C, DC, Extra) UsingPackDecl(DC, InstantiatedFrom, UsingDecls);
3352}
3353
3355 unsigned NumExpansions) {
3356 size_t Extra = additionalSizeToAlloc<NamedDecl *>(NumExpansions);
3358 Result->NumExpansions = NumExpansions;
3359 auto *Trail = Result->getTrailingObjects<NamedDecl *>();
3360 for (unsigned I = 0; I != NumExpansions; ++I)
3361 new (Trail + I) NamedDecl*(nullptr);
3363}
3364
3365void UnresolvedUsingValueDecl::anchor() {}
3366
3374 QualifierLoc, NameInfo,
3375 EllipsisLoc);
3376}
3377
3385}
3386
3391}
3392
3393void UnresolvedUsingTypenameDecl::anchor() {}
3394
3404 DC, UsingLoc, TypenameLoc, QualifierLoc, TargetNameLoc,
3406}
3407
3414}
3415
3420}
3421
3425 return new (Ctx, ID)
3427}
3428
3429UnresolvedUsingIfExistsDecl::UnresolvedUsingIfExistsDecl(DeclContext *DC,
3432 : NamedDecl(Decl::UnresolvedUsingIfExists, DC, Loc, Name) {}
3433
3434void UnresolvedUsingIfExistsDecl::anchor() {}
3435
3436void StaticAssertDecl::anchor() {}
3437
3440 Expr *AssertExpr, Expr *Message,
3442 bool Failed) {
3443 return new (C, DC) StaticAssertDecl(DC, StaticAssertLoc, AssertExpr, Message,
3444 RParenLoc, Failed);
3445}
3446
3451}
3452
3454 assert((isa<VarDecl, BindingDecl>(this)) &&
3455 "expected a VarDecl or a BindingDecl");
3456 if (auto *Var = llvm::dyn_cast(this))
3457 return Var;
3458 if (auto *BD = llvm::dyn_cast(this))
3459 return llvm::dyn_cast(BD->getDecomposedDecl());
3460 return nullptr;
3461}
3462
3463void BindingDecl::anchor() {}
3464
3468}
3469
3472}
3473
3476 if (!B)
3477 return nullptr;
3478 auto *DRE = dyn_cast(B->IgnoreImplicit());
3479 if (!DRE)
3480 return nullptr;
3481
3482 auto *VD = cast(DRE->getDecl());
3483 assert(VD->isImplicit() && "holding var for binding decl not implicit");
3484 return VD;
3485}
3486
3487void DecompositionDecl::anchor() {}
3488
3495 size_t Extra = additionalSizeToAlloc<BindingDecl *>(Bindings.size());
3496 return new (C, DC, Extra)
3498}
3499
3502 unsigned NumBindings) {
3503 size_t Extra = additionalSizeToAlloc<BindingDecl *>(NumBindings);
3504 auto *Result = new (C, ID, Extra)
3507
3508 Result->NumBindings = NumBindings;
3510 for (unsigned I = 0; I != NumBindings; ++I)
3513}
3514
3517 OS << '[';
3518 bool Comma = false;
3519 for (const auto *B : bindings()) {
3520 if (Comma)
3521 OS << ", ";
3522 B->printName(OS, Policy);
3523 Comma = true;
3524 }
3525 OS << ']';
3526}
3527
3528void MSPropertyDecl::anchor() {}
3529
3536 return new (C, DC) MSPropertyDecl(DC, L, N, T, TInfo, StartL, Getter, Setter);
3537}
3538
3544}
3545
3546void MSGuidDecl::anchor() {}
3547
3550 PartVal(P) {}
3551
3553 DeclContext *DC = C.getTranslationUnitDecl();
3555}
3556
3559}
3560
3563 OS << llvm::format("GUID{%08" PRIx32 "-%04" PRIx16 "-%04" PRIx16 "-",
3565 unsigned I = 0;
3566 for (uint8_t Byte : PartVal.Part4And5) {
3567 OS << llvm::format("%02" PRIx8, Byte);
3568 if (++I == 2)
3569 OS << '-';
3570 }
3571 OS << '}';
3572}
3573
3574
3576
3577
3578 using MatcherRef = llvm::function_ref<bool(QualType)>;
3579
3580 auto IsInt = [&Ctx](unsigned N) {
3584 };
3585 };
3586
3587 auto IsArray = [&Ctx](MatcherRef Elem, unsigned N) {
3588 return [&Ctx, Elem, N](QualType T) {
3591 };
3592 };
3593
3594 auto IsStruct = [](std::initializer_list Fields) {
3597 if (!RD || RD->isUnion())
3598 return false;
3600 if (!RD)
3601 return false;
3602 if (auto *CXXRD = dyn_cast(RD))
3603 if (CXXRD->getNumBases())
3604 return false;
3605 auto MatcherIt = Fields.begin();
3607 if (FD->isUnnamedBitField())
3608 continue;
3609 if (FD->isBitField() || MatcherIt == Fields.end() ||
3610 !(*MatcherIt)(FD->getType()))
3611 return false;
3612 ++MatcherIt;
3613 }
3614 return MatcherIt == Fields.end();
3615 };
3616 };
3617
3618
3619 return IsStruct({IsInt(32), IsInt(16), IsInt(16), IsArray(IsInt(8), 8)})(T);
3620}
3621
3624 using llvm::APInt;
3625 using llvm::APSInt;
3632 for (unsigned I = 0; I != 8; ++I) {
3635 }
3636
3637
3639 }
3640
3641 return APVal;
3642}
3643
3644void UnnamedGlobalConstantDecl::anchor() {}
3645
3646UnnamedGlobalConstantDecl::UnnamedGlobalConstantDecl(const ASTContext &C,
3653
3654
3655 if (Value.needsCleanup())
3656 C.addDestruction(&Value);
3657}
3658
3662 DeclContext *DC = C.getTranslationUnitDecl();
3664}
3665
3670}
3671
3674 OS << "unnamed-global-constant";
3675}
3676
3678 switch (AS) {
3680 llvm_unreachable("Invalid access specifier!");
3682 return "public";
3684 return "private";
3686 return "protected";
3687 }
3688 llvm_unreachable("Invalid access specifier!");
3689}
3690
3694}
Defines the clang::ASTContext interface.
ASTImporterLookupTable & LT
This file provides some common utility functions for processing Lambda related AST Constructs.
Defines the Diagnostic-related interfaces.
enum clang::sema::@1725::IndirectLocalPathEntry::EntryKind Kind
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.
static const char * getAccessName(AccessSpecifier AS)
static bool recursivelyOverrides(const CXXMethodDecl *DerivedMD, const CXXMethodDecl *BaseMD)
static bool isValidStructGUID(ASTContext &Ctx, QualType T)
Determine if T is a valid 'struct _GUID' of the shape that we expect.
static DeclContext::lookup_result getLambdaStaticInvokers(const CXXRecordDecl &RD)
static NamedDecl * getLambdaCallOperatorHelper(const CXXRecordDecl &RD)
static QualType getThisObjectType(ASTContext &C, const FunctionProtoType *FPT, const CXXRecordDecl *Decl)
static bool hasPureVirtualFinalOverrider(const CXXRecordDecl &RD, const CXXFinalOverriderMap *FinalOverriders)
static bool allLookupResultsAreTheSame(const DeclContext::lookup_result &R)
static bool isDeclContextInNamespace(const DeclContext *DC)
static bool hasRepeatedBaseClass(const CXXRecordDecl *StartRD)
Determine whether a class has a repeated base class.
static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv)
static CXXMethodDecl * getInvokerAsMethod(NamedDecl *ND)
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.
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::Target Target
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.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
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
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
DeclarationNameTable DeclarationNames
QualType getRecordType(const RecordDecl *Decl) const
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
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
llvm::BumpPtrAllocator & getAllocator() const
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
void * Allocate(size_t Size, unsigned Align=8) const
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
DiagnosticsEngine & getDiagnostics() 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.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
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.
void addDecl(ASTContext &C, NamedDecl *D, AccessSpecifier AS)
Represents an access specifier followed by colon ':'.
static AccessSpecDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
QualType getElementType() const
Represents a C++ declaration that introduces decls from somewhere else.
void addShadowDecl(UsingShadowDecl *S)
shadow_range shadows() const
void removeShadowDecl(UsingShadowDecl *S)
A binding in a decomposition declaration.
VarDecl * getHoldingVar() const
Get the variable (if any) that holds the value of evaluating the binding.
Expr * getBinding() const
Get the expression to which this declaration is bound.
static BindingDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
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.
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, uint64_t AllocKind)
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
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.
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(), Expr *TrailingRequiresClause=nullptr)
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...
bool isCopyConstructor() const
Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the cla...
Represents a C++ conversion function within a class.
bool isLambdaToBlockPointerConversion() const
Determine whether this conversion function is a conversion from a lambda closure type to a block poin...
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, Expr *TrailingRequiresClause=nullptr)
QualType getConversionType() const
Returns the type that this conversion function is converting to.
static CXXConversionDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Represents a C++ base or member initializer.
SourceLocation getRParenLoc() const
SourceRange getSourceRange() const LLVM_READONLY
Determine the source range covering the entire initializer.
SourceLocation getSourceLocation() const
Determine the source location of the initializer.
bool isAnyMemberInitializer() const
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
int64_t getID(const ASTContext &Context) const
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.
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.
CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual, SourceLocation L, Expr *Init, SourceLocation R, SourceLocation EllipsisLoc)
Creates a new base-class initializer.
Represents a C++ deduction guide declaration.
static CXXDeductionGuideDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
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, Expr *TrailingRequiresClause=nullptr)
Represents a C++ destructor within a class.
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, Expr *TrailingRequiresClause=nullptr)
static CXXDestructorDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg)
bool isCalledByDelete(const FunctionDecl *OpDel=nullptr) const
Will this destructor ever be called when considering which deallocation function is associated with t...
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...
CXXMethodDecl * getCorrespondingMethodDeclaredInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find if RD declares a function that overrides this function, and if so, return it.
bool isImplicitObjectMemberFunction() const
[C++2b][dcl.fct]/p7 An implicit object member function is a non-static member function without an exp...
void addOverriddenMethod(const CXXMethodDecl *MD)
bool hasInlineBody() const
bool isUsualDeallocationFunction(SmallVectorImpl< const FunctionDecl * > &PreventedBy) const
Determine whether this is a usual deallocation function (C++ [basic.stc.dynamic.deallocation]p2),...
unsigned getNumExplicitParams() const
overridden_method_range overridden_methods() const
unsigned size_overridden_methods() const
const CXXMethodDecl *const * method_iterator
QualType getFunctionObjectParameterReferenceType() const
Return the type of the object pointed by this.
method_iterator begin_overridden_methods() const
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.
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
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, Expr *TrailingRequiresClause=nullptr)
CXXMethodDecl * getDevirtualizedMethod(const Expr *Base, bool IsAppleKext)
If it's possible to devirtualize a call to this method, return the called function.
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.
llvm::iterator_range< llvm::TinyPtrVector< const CXXMethodDecl * >::const_iterator > overridden_method_range
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
static CXXMethodDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
method_iterator end_overridden_methods() const
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 ...
Represents a C++ struct/union/class.
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
bool mayBeAbstract() const
Determine whether this class may end up being abstract, even though it is not yet known to be abstrac...
bool isTriviallyCopyable() const
Determine whether this class is considered trivially copyable per (C++11 [class]p6).
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.
bool isEffectivelyFinal() const
Determine whether it's impossible for a class to be derived from this class.
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.
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e.
base_class_iterator bases_end()
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...
void completeDefinition() override
Indicates that the definition of this class is now complete.
bool isLiteral() const
Determine whether this class is a literal type.
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.
unsigned getDeviceLambdaManglingNumber() const
Retrieve the device side mangling number.
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation.
void setTrivialForCallFlags(CXXMethodDecl *MD)
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.
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...
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)
llvm::iterator_range< conversion_iterator > getVisibleConversionFunctions() const
Get all conversion functions visible in current class, including conversion function templates.
bool hasConstexprDestructor() const
Determine whether this class has a constexpr destructor.
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...
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
bool isTriviallyCopyConstructible() const
Determine whether this class is considered trivially copyable per.
bool isCapturelessLambda() const
const CXXRecordDecl * getTemplateInstantiationPattern() const
Retrieve the record declaration from which this record could be instantiated.
bool lambdaIsDefaultConstructibleAndAssignable() const
Determine whether this lambda should have an implicit default constructor and copy and move assignmen...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
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.
void addedEligibleSpecialMemberFunction(const CXXMethodDecl *MD, unsigned SMKind)
Notify the class that an eligible SMF has been added.
conversion_iterator conversion_end() const
void finishedDefaultedOrDeletedMember(CXXMethodDecl *MD)
Indicates that the declaration of a defaulted or deleted special member function is now complete.
CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl)
bool isCLike() const
True if this class is C-like, without C++-specific features, e.g.
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
static CXXRecordDecl * CreateDeserialized(const ASTContext &C, GlobalDeclID ID)
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)
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
unsigned getODRHash() const
bool hasDefinition() const
ArrayRef< NamedDecl * > getLambdaExplicitTemplateParameters() const
Retrieve the lambda template parameters that were specified explicitly.
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
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.
bool hasSimpleCopyConstructor() const
true if we know for sure that this class has a single, accessible, unambiguous copy constructor that ...
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
bool hasNonTrivialMoveAssignment() const
Determine whether this class has a non-trivial move assignment operator (C++11 [class....
CXXMethodDecl * getLambdaStaticInvoker() const
Retrieve the lambda static invoker, the address of which is returned by the conversion operator,...
bool hasSimpleDestructor() const
true if we know for sure that this class has an accessible destructor that is not deleted.
void setDescribedClassTemplate(ClassTemplateDecl *Template)
bool isInterfaceLike() const
void setLambdaNumbering(LambdaNumbering Numbering)
Set the mangling numbers and context declaration for a lambda class.
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,...
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.
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...
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.
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
conversion_iterator conversion_begin() const
unsigned getCVRQualifiers() const
Retrieve the const/volatile/restrict qualifiers.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
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)
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)
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
The results of name lookup within a DeclContext.
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
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.
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
bool isFunctionOrMethod() const
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
LinkageSpecDeclBitfields LinkageSpecDeclBits
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.
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
SourceLocation getLocation() const
void setImplicit(bool I=true)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
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.
A decomposition declaration.
void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override
Pretty-print the unqualified name of this declaration.
ArrayRef< BindingDecl * > bindings() const
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl * > Bindings)
static DecompositionDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumBindings)
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
Store information needed for an explicit specifier.
ExplicitSpecKind getKind() const
const Expr * getExpr() const
static ExplicitSpecifier getFromDecl(FunctionDecl *Function)
bool isEquivalent(const ExplicitSpecifier Other) const
Check for equivalence of explicit specifiers.
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.
virtual Decl * GetExternalDecl(GlobalDeclID ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
Represents a member of a struct/union/class.
Represents a function declaration or definition.
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
FunctionDecl * getTemplateInstantiationPattern(bool ForDefinition=true) const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
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.
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.
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.
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.
@ Ver6
Attempt to be ABI-compatible with code generated by Clang 6.0.x (SVN r321711).
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.
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
ValueDecl * getExtendingDecl()
Represents a linkage specification.
static LinkageSpecDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation ExternLoc, SourceLocation LangLoc, LinkageSpecLanguageIDs Lang, bool HasBraces)
static LinkageSpecDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
APValue & getAsAPValue() const
Get the value of this MSGuidDecl as an APValue.
void printName(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const override
Print this UUID in a human-readable format.
An instance of this class represents the declaration of a property member.
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
static MSPropertyDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
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.
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.
NamedDecl * getMostRecentDecl()
Represents a C++ namespace alias.
static NamespaceAliasDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
Represent a C++ namespace.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested)
static NamespaceDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
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.
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.
void removeLocalRestrict()
@ 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.
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
void setHasUninitializedExplicitInitFields(bool V)
field_iterator field_begin() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
FunctionDecl * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
NamespaceDecl * getNextRedeclaration() const
NamespaceDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Base for LValueReferenceType and RValueReferenceType.
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
static RequiresExprBodyDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Encodes a location in the source.
A trivial tuple used to represent a source range.
Represents a C++11 static_assert declaration.
static StaticAssertDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *Message, SourceLocation RParenLoc, bool Failed)
static StaticAssertDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
bool isBeingDefined() const
Return true if this decl is currently being defined.
void setMayHaveOutOfDateDef(bool V=true)
Indicates whether it is possible for declarations of this kind to have an out-of-date definition.
void setBeingDefined(bool V=true)
True if this decl is currently being defined.
TagKind getTagKind() const
Exposes information about the current target.
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.
const Type * getTypeForDecl() const
Base wrapper for a particular "section" of type source info.
A container of type source information.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
bool isRValueReferenceType() const
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
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
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.
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)
static UnresolvedUsingIfExistsDecl * Create(ASTContext &Ctx, DeclContext *DC, SourceLocation Loc, DeclarationName Name)
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)
static UnresolvedUsingTypenameDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
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.
static UnresolvedUsingValueDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, SourceLocation EllipsisLoc)
static UnresolvedUsingValueDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
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.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
static UsingDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
DeclarationNameInfo getNameInfo() const
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Represents C++ using-directive.
static UsingDirectiveDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Represents a C++ using-enum-declaration.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static UsingEnumDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
static UsingEnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, SourceLocation EnumL, SourceLocation NameL, TypeSourceInfo *EnumType)
Represents a pack of using declarations that a single using-declarator pack-expanded into.
static UsingPackDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumExpansions)
static UsingPackDecl * Create(ASTContext &C, DeclContext *DC, NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > UsingDecls)
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)
static UsingShadowDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
BaseUsingDecl * getIntroducer() const
Gets the (written or instantiated) using declaration that introduced this declaration.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
VarDecl * getPotentiallyDecomposedVarDecl()
Represents a variable declaration or definition.
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
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 (&&).
StorageClass
Storage classes.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
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.
TagTypeKind
The kind of a tag type.
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
@ 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()
const FunctionProtoType * T
DeductionCandidate
Only used by CXXDeductionGuideDecl.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
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.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
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.
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer points to.
uint16_t Part2
...-89ab-...
uint32_t Part1
{01234567-...
uint16_t Part3
...-cdef-...
uint8_t Part4And5[8]
...-0123-456789abcdef}
Describes how types, statements, expressions, and declarations should be printed.