clang: include/clang/Sema/Initialization.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_CLANG_SEMA_INITIALIZATION_H
14#define LLVM_CLANG_SEMA_INITIALIZATION_H
15
30#include "llvm/ADT/ArrayRef.h"
31#include "llvm/ADT/SmallVector.h"
32#include "llvm/ADT/StringRef.h"
33#include "llvm/ADT/iterator_range.h"
34#include "llvm/Support/Casting.h"
35#include
36#include
37#include
38
40
41class CXXBaseSpecifier;
42class CXXConstructorDecl;
43class ObjCMethodDecl;
44class Sema;
45
46
48public:
49
51
53
54
56
57
59
60
62
63
65
66
67
69
70
71
73
74
76
77
78
80
81
83
84
86
87
89
90
91
93
94
95
97
98
99
101
102
103
105
106
107
109
110
111
113
114
115
117
118
119
121
122
123
125
126
127
129
130
131
132
133 };
134
135private:
136
138
139
140
142
143
145
146
147 mutable unsigned ManglingNumber = 0;
148
149 struct LN {
150
151
152
153
155
156
157
158 bool NRVO;
159 };
160
161 struct VD {
162
163 ValueDecl *VariableOrMember;
164
165
166
167
168 bool IsImplicitFieldInit;
169
170
171
172 bool IsDefaultMemberInit;
173 };
174
175 struct C {
176
177 IdentifierInfo *VarID;
178
179
180 SourceLocation Location;
181 };
182
183 union {
184
185
187
188
189
191
192
193
194 llvm::PointerIntPair<ParmVarDecl *, 1> Parameter;
195
196
197
199
201
202
203
204
205 llvm::PointerIntPair<const CXXBaseSpecifier *, 1> Base;
206
207
208
209
211
213 };
214
216
217
220
221
222
223
225 bool NRVO = false)
230 }
231
232
233 InitializedEntity(FieldDecl *Member, const InitializedEntity *Parent,
234 bool Implicit, bool DefaultMemberInit,
235 bool IsParenAggInit = false)
239
240
241 InitializedEntity(ASTContext &Context, unsigned Index,
242 const InitializedEntity &Parent);
243
244
245 InitializedEntity(IdentifierInfo *VarID, QualType FieldType, SourceLocation Loc)
250 }
251
252public:
253
256 }
257
258
262 }
263
264
265
268 bool Consumed = (Context.getLangOpts().ObjCAutoRefCount &&
269 Parm->hasAttr());
270
273 Entity.Type =
274 Context.getVariableArrayDecayedType(Type.getUnqualifiedType());
275 Entity.Parent = nullptr;
276 Entity.Parameter = {Parm, Consumed};
277 return Entity;
278 }
279
280
281
284 bool Consumed) {
287 Entity.Type = Context.getVariableArrayDecayedType(Type);
288 Entity.Parent = nullptr;
289 Entity.Parameter = {nullptr, Consumed};
290 return Entity;
291 }
292
293
298 Entity.Type = T;
299 Entity.Parent = nullptr;
300 Entity.Variable = {Param, false, false};
301 return Entity;
302 }
303
304
308 }
309
313 }
314
318 }
319
323 BlockVarLoc, Type);
324 }
325
326
330 }
331
332
335 }
336
337
340 }
341
342
346 if (Context.getLangOpts().OpenCLCPlusPlus) {
347 assert(.hasAddressSpace() && "Temporary already has address space!");
349 }
350
352 }
353
354
360 }
361
362
366 Result.MethodDecl = MD;
368 }
369
370
373 bool IsInheritedVirtualBase,
375
376
379 }
380
381
387 }
388
389
395 }
396
397
398
401 false,
402 true);
403 }
404
405
409 }
410
411
416 }
417
418
421 }
422
423
424
425
430 }
431
432
436 Result.TypeInfo = TSI;
438 }
439
440
442
443
444
445
447
448
450
451
452
456
457 return nullptr;
458 }
459
460
462
463
464
466
467
469
470
471
473
477 }
478
481 }
482
483
484
488 }
489
490
492 assert(getKind() == EK_Base && "Not a base specifier");
493 return Base.getPointer();
494 }
495
496
498 assert(getKind() == EK_Base && "Not a base specifier");
499 return Base.getInt();
500 }
501
502
504 return getKind() == EK_New && isa_and_nonnull(
505 getType()->getAsArrayTypeUnsafe());
506 }
507
508
509
512 }
513
514
515
518 }
519
520
521
525 }
526
527
528
532 }
533
534
535
540 }
541
542
543
547 this->Index = Index;
548 }
549
550
553 return Capture.VarID ? Capture.VarID->getName() : "this";
554 }
555
556
557
561 }
562
565 }
566
568
569
570
571 void dump() const;
572
573private:
574 unsigned dumpImpl(raw_ostream &OS) const;
575};
576
577
578
579
581public:
582
584
586
587
589
590
592
593
595
596
599
600private:
601
602 enum InitContext {
603
604 IC_Normal,
605
606
607 IC_ExplicitConvs,
608
609
610 IC_Implicit,
611
612
613 IC_StaticCast,
614
615
616 IC_CStyleCast,
617
618
619 IC_FunctionalCast
620 };
621
622
624
625
626 InitContext Context : 8;
627
628
629 SourceLocation Locations[3];
630
631 InitializationKind(InitKind Kind, InitContext Context, SourceLocation Loc1,
632 SourceLocation Loc2, SourceLocation Loc3)
633 : Kind(Kind), Context(Context) {
634 Locations[0] = Loc1;
635 Locations[1] = Loc2;
636 Locations[2] = Loc3;
637 }
638
639public:
640
645 InitLoc, LParenLoc, RParenLoc);
646 }
647
650 InitLoc);
651 }
652
657 RBraceLoc);
658 }
659
660
661
665 }
666
667
670 bool InitList) {
671
672
674 IC_CStyleCast, StartLoc, TypeRange.getBegin(),
676 }
677
678
680 bool InitList) {
682 IC_FunctionalCast, TypeRange.getBegin(),
684 }
685
686
689 bool AllowExplicitConvs = false) {
691 AllowExplicitConvs? IC_ExplicitConvs : IC_Normal,
692 InitLoc, EqualLoc, EqualLoc);
693 }
694
695
698 }
699
700
704 bool isImplicit = false) {
706 InitLoc, LParenLoc, RParenLoc);
707 }
708
709
710
716 if (isa(Init))
719 }
720
721
723 return Kind;
724 }
725
726
728 return Context >= IC_StaticCast;
729 }
730
731
732 bool isStaticCast() const { return Context == IC_StaticCast; }
733
734
736 return Context >= IC_CStyleCast;
737 }
738
739
741 return Context == IC_CStyleCast;
742 }
743
744
746 return Context == IC_FunctionalCast;
747 }
748
749
750
751
753
754
756
757
759 return SourceRange(Locations[0], Locations[2]);
760 }
761
762
763
765 assert(Kind == IK_Copy && "Only copy initialization has an '='");
766 return Locations[1];
767 }
768
770
771
772
774
775
776
777
778
780 return () || Context == IC_ExplicitConvs;
781 }
782
783
784
787 }
788
789
790
791
794 "initialization have parentheses or "
795 "braces");
796 return SourceRange(Locations[1], Locations[2]);
797 }
798};
799
800
801
803public:
804
806
807
809
810
811
812
814
815
818
819
820
822
823
825
826
828
829
831
832
834
835
837
838
840
841
842
843
845
846
847
849
850
851
853
854
856
857
859
860
862
863
865
866
868
869
871
872
874
875
877
878
880
881
883
884
886
887
888
890
891
893
894
896
897
899
900
901
903
904
906
907
909
910
912
913
915
916
917
919
920
922
923
925
926
928
929
931
932
933
935
936
938
939
941
942
943
946
947
949 public:
950
952
953
955
960 };
961
962 union {
963
964
965
966
967
968
969
970
971
972
974
975
976
978
979
980
982 };
983
985 };
986
987private:
988
990
991
993
994public:
995
997
999
1000
1002
1003
1005
1006
1007
1009
1010
1011
1013
1014
1016
1017
1019
1020
1021
1023
1024
1026
1027
1029
1030
1032
1033
1035
1036
1038
1039
1041
1042
1044
1045
1047
1048
1050
1051
1053
1054
1055
1057
1058
1060
1061
1063
1064
1066
1067
1069
1070
1072
1073
1075
1076
1078
1079
1081
1082
1084
1085
1086
1088
1089
1091
1092
1094
1095
1097
1098
1100
1101
1103
1104
1106
1107
1109
1110
1111
1113
1114
1115
1117
1118
1120
1121
1122
1124
1125
1127 };
1128
1129private:
1130
1132
1133
1135
1136
1138
1139
1140 QualType FailedIncompleteType;
1141
1142
1143
1144 std::string ZeroInitializationFixit;
1146
1147public:
1148
1149
1151 ZeroInitializationFixit = Fixit;
1152 ZeroInitializationFixitLoc = L;
1153 }
1154
1155private:
1156
1157
1159
1160public:
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1184 bool TopLevelOfInitList = false,
1185 bool TreatUnavailableAsInvalid = true);
1188 bool TopLevelOfInitList, bool TreatUnavailableAsInvalid);
1189
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1217 QualType *ResultType = nullptr);
1218
1219
1220
1221
1222
1227
1228
1230
1231
1233
1234
1235 explicit operator bool() const { return (); }
1236
1237
1239
1241
1244
1245 using step_range = llvm::iterator_range<step_iterator>;
1246
1248
1249
1250
1252
1253
1255
1256
1257
1259
1260
1261
1262
1263
1264
1267 bool HadMultipleCandidates);
1268
1269
1270
1271
1272
1273
1274
1275
1278
1279
1280
1281
1282
1283
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1297
1298
1299
1301
1302
1303
1307 bool HadMultipleCandidates);
1308
1309
1310
1313
1314
1315
1317
1318
1319
1321
1322
1324 QualType T, bool TopLevelOfInitList = false);
1325
1326
1328
1329
1330
1331
1332
1333
1337 bool HadMultipleCandidates,
1338 bool FromInitList, bool AsInitList);
1339
1340
1342
1343
1344
1345
1346
1347
1349
1350
1352
1353
1354
1356
1357
1359
1360
1362
1363
1365
1366
1368
1369
1370
1372
1373
1374
1376
1377
1378
1380
1381
1382
1384
1386
1387
1388
1389
1391
1392
1393
1395
1396
1399 this->Failure = Failure;
1401 "Incomplete type failure requires a type!");
1402 }
1403
1404
1405
1407
1408
1409
1411 return FailedCandidateSet;
1412 }
1413
1414
1415
1417 return FailedOverloadResult;
1418 }
1419
1420
1421
1423 FailedIncompleteType = IncompleteType;
1425 }
1426
1427
1429 assert(Failed() && "Not an initialization failure!");
1430 return Failure;
1431 }
1432
1433
1434
1435 void dump(raw_ostream &OS) const;
1436
1437
1438
1439 void dump() const;
1440};
1441
1442}
1443
1444#endif
Defines the clang::ASTContext interface.
enum clang::sema::@1725::IndirectLocalPathEntry::EntryKind Kind
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 clang::LangOptions interface.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a base class of a C++ class.
Represents a C++ constructor within a class.
A POD class for pairing a NamedDecl* with an access specifier.
The name of a declaration.
This represents one expression.
Represents a member of a struct/union/class.
Represents a function declaration or definition.
One of these records is kept for each identifier that is lexed.
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
Represents a field injected from an anonymous union/struct into the parent scope.
Describes an C or C++ initializer list.
Describes the kind of initialization being performed, along with location information for tokens rela...
SourceLocation getLocation() const
Retrieve the location at which initialization is occurring.
static InitializationKind CreateCast(SourceRange TypeRange)
Create a direct initialization due to a cast that isn't a C-style or functional cast.
InitKind
The kind of initialization being performed.
@ IK_DirectList
Direct list-initialization.
@ IK_Value
Value initialization.
@ IK_Direct
Direct initialization.
@ IK_Copy
Copy initialization.
@ IK_Default
Default initialization.
SourceLocation getEqualLoc() const
Retrieve the location of the equal sign for copy initialization (if present).
bool isCStyleOrFunctionalCast() const
Determine whether this initialization is a C-style cast.
static InitializationKind CreateDefault(SourceLocation InitLoc)
Create a default initialization.
bool hasParenOrBraceRange() const
Determine whether this initialization has a source range containing the locations of open and closing...
bool isExplicitCast() const
Determine whether this initialization is an explicit cast.
bool isFunctionalCast() const
Determine whether this is a functional-style cast.
InitKind getKind() const
Determine the initialization kind.
bool AllowExplicit() const
Retrieve whether this initialization allows the use of explicit constructors.
static InitializationKind CreateDirect(SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
Create a direct initialization.
static InitializationKind CreateForInit(SourceLocation Loc, bool DirectInit, Expr *Init)
Create an initialization from an initializer (which, for direct initialization from a parenthesized l...
bool isImplicitValueInit() const
Determine whether this initialization is an implicit value-initialization, e.g., as occurs during agg...
bool isCStyleCast() const
Determine whether this is a C-style cast.
static InitializationKind CreateCopy(SourceLocation InitLoc, SourceLocation EqualLoc, bool AllowExplicitConvs=false)
Create a copy initialization.
static InitializationKind CreateDirectList(SourceLocation InitLoc)
SourceRange getParenOrBraceRange() const
Retrieve the source range containing the locations of the open and closing parentheses or braces for ...
bool allowExplicitConversionFunctionsInRefBinding() const
Retrieve whether this initialization allows the use of explicit conversion functions when binding a r...
static InitializationKind CreateDirectList(SourceLocation InitLoc, SourceLocation LBraceLoc, SourceLocation RBraceLoc)
bool isStaticCast() const
Determine whether this initialization is a static cast.
static InitializationKind CreateValue(SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool isImplicit=false)
Create a value initialization.
SourceRange getRange() const
Retrieve the source range that covers the initialization.
static InitializationKind CreateFunctionalCast(SourceRange TypeRange, bool InitList)
Create a direct initialization for a functional cast.
static InitializationKind CreateCStyleCast(SourceLocation StartLoc, SourceRange TypeRange, bool InitList)
Create a direct initialization for a C-style cast.
A single step in the initialization sequence.
StepKind Kind
The kind of conversion or initialization step we are taking.
InitListExpr * WrappingSyntacticList
When Kind = SK_RewrapInitList, the syntactic form of the wrapping list.
ImplicitConversionSequence * ICS
When Kind = SK_ConversionSequence, the implicit conversion sequence.
struct F Function
When Kind == SK_ResolvedOverloadedFunction or Kind == SK_UserConversion, the function that the expres...
Describes the sequence of initializations required to initialize a given object or reference with a s...
step_iterator step_begin() const
void AddListInitializationStep(QualType T)
Add a list-initialization step.
ExprResult Perform(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, QualType *ResultType=nullptr)
Perform the actual initialization of the given entity based on the computed initialization sequence.
void AddStringInitStep(QualType T)
Add a string init step.
void AddStdInitializerListConstructionStep(QualType T)
Add a step to construct a std::initializer_list object from an initializer list.
void AddConstructorInitializationStep(DeclAccessPair FoundDecl, CXXConstructorDecl *Constructor, QualType T, bool HadMultipleCandidates, bool FromInitList, bool AsInitList)
Add a constructor-initialization step.
StepKind
Describes the kind of a particular step in an initialization sequence.
@ SK_StdInitializerListConstructorCall
Perform initialization via a constructor taking a single std::initializer_list argument.
@ SK_AtomicConversion
Perform a conversion adding _Atomic to a type.
@ SK_ObjCObjectConversion
An initialization that "converts" an Objective-C object (not a point to an object) to another Objecti...
@ SK_GNUArrayInit
Array initialization (from an array rvalue) as a GNU extension.
@ SK_CastDerivedToBaseLValue
Perform a derived-to-base cast, producing an lvalue.
@ SK_ProduceObjCObject
Produce an Objective-C object pointer.
@ SK_FunctionReferenceConversion
Perform a function reference conversion, see [dcl.init.ref]p4.
@ SK_BindReference
Reference binding to an lvalue.
@ SK_ArrayLoopInit
Array initialization by elementwise copy.
@ SK_ConstructorInitialization
Perform initialization via a constructor.
@ SK_OCLSamplerInit
Initialize an OpenCL sampler from an integer.
@ SK_StringInit
Initialization by string.
@ SK_ZeroInitialization
Zero-initialize the object.
@ SK_CastDerivedToBaseXValue
Perform a derived-to-base cast, producing an xvalue.
@ SK_QualificationConversionXValue
Perform a qualification conversion, producing an xvalue.
@ SK_UserConversion
Perform a user-defined conversion, either via a conversion function or via a constructor.
@ SK_CastDerivedToBasePRValue
Perform a derived-to-base cast, producing an rvalue.
@ SK_BindReferenceToTemporary
Reference binding to a temporary.
@ SK_PassByIndirectRestore
Pass an object by indirect restore.
@ SK_ParenthesizedArrayInit
Array initialization from a parenthesized initializer list.
@ SK_ParenthesizedListInit
Initialize an aggreagate with parenthesized list of values.
@ SK_ArrayInit
Array initialization (from an array rvalue).
@ SK_ExtraneousCopyToTemporary
An optional copy of a temporary object to another temporary object, which is permitted (but not requi...
@ SK_ArrayLoopIndex
Array indexing for initialization by elementwise copy.
@ SK_ConversionSequenceNoNarrowing
Perform an implicit conversion sequence without narrowing.
@ SK_RewrapInitList
Rewrap the single-element initializer list for a reference.
@ SK_CAssignment
C assignment.
@ SK_ConstructorInitializationFromList
Perform initialization via a constructor, taking arguments from a single InitListExpr.
@ SK_PassByIndirectCopyRestore
Pass an object by indirect copy-and-restore.
@ SK_ResolveAddressOfOverloadedFunction
Resolve the address of an overloaded function to a specific function declaration.
@ SK_UnwrapInitList
Unwrap the single-element initializer list for a reference.
@ SK_FinalCopy
Direct-initialization from a reference-related object in the final stage of class copy-initialization...
@ SK_QualificationConversionLValue
Perform a qualification conversion, producing an lvalue.
@ SK_StdInitializerList
Construct a std::initializer_list from an initializer list.
@ SK_QualificationConversionPRValue
Perform a qualification conversion, producing a prvalue.
@ SK_ConversionSequence
Perform an implicit conversion sequence.
@ SK_ListInitialization
Perform list-initialization without a constructor.
@ SK_OCLZeroOpaqueType
Initialize an opaque OpenCL type (event_t, queue_t, etc.) with zero.
void AddUserConversionStep(FunctionDecl *Function, DeclAccessPair FoundDecl, QualType T, bool HadMultipleCandidates)
Add a new step invoking a conversion function, which is either a constructor or a conversion function...
void SetZeroInitializationFixit(const std::string &Fixit, SourceLocation L)
Call for initializations are invalid but that would be valid zero initialzations if Fixit was applied...
llvm::iterator_range< step_iterator > step_range
void AddQualificationConversionStep(QualType Ty, ExprValueKind Category)
Add a new step that performs a qualification conversion to the given type.
void AddFunctionReferenceConversionStep(QualType Ty)
Add a new step that performs a function reference conversion to the given type.
~InitializationSequence()
void AddDerivedToBaseCastStep(QualType BaseType, ExprValueKind Category)
Add a new step in the initialization that performs a derived-to- base cast.
FailureKind getFailureKind() const
Determine why initialization failed.
void InitializeFrom(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, bool TopLevelOfInitList, bool TreatUnavailableAsInvalid)
void AddParenthesizedListInitStep(QualType T)
void SetFailed(FailureKind Failure)
Note that this initialization sequence failed.
bool isAmbiguous() const
Determine whether this initialization failed due to an ambiguity.
void AddUnwrapInitListInitStep(InitListExpr *Syntactic)
Only used when initializing structured bindings from an array with direct-list-initialization.
void AddOCLZeroOpaqueTypeStep(QualType T)
Add a step to initialzie an OpenCL opaque type (event_t, queue_t, etc.) from a zero constant.
void AddFinalCopy(QualType T)
Add a new step that makes a copy of the input to an object of the given type, as the final step in cl...
OverloadingResult getFailedOverloadResult() const
Get the overloading result, for when the initialization sequence failed due to a bad overload.
void setSequenceKind(enum SequenceKind SK)
Set the kind of sequence computed.
void AddObjCObjectConversionStep(QualType T)
Add an Objective-C object conversion step, which is always a no-op.
void SetOverloadFailure(FailureKind Failure, OverloadingResult Result)
Note that this initialization sequence failed due to failed overload resolution.
step_iterator step_end() const
void AddParenthesizedArrayInitStep(QualType T)
Add a parenthesized array initialization step.
void AddExtraneousCopyToTemporary(QualType T)
Add a new step that makes an extraneous copy of the input to a temporary of the same class type.
void setIncompleteTypeFailure(QualType IncompleteType)
Note that this initialization sequence failed due to an incomplete type.
void AddOCLSamplerInitStep(QualType T)
Add a step to initialize an OpenCL sampler from an integer constant.
void AddCAssignmentStep(QualType T)
Add a C assignment step.
void AddPassByIndirectCopyRestoreStep(QualType T, bool shouldCopy)
Add a step to pass an object by indirect copy-restore.
void RewrapReferenceInitList(QualType T, InitListExpr *Syntactic)
Add steps to unwrap a initializer list for a reference around a single element and rewrap it at the e...
bool Diagnose(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, ArrayRef< Expr * > Args)
Diagnose an potentially-invalid initialization sequence.
bool Failed() const
Determine whether the initialization sequence is invalid.
void AddAtomicConversionStep(QualType Ty)
Add a new step that performs conversion from non-atomic to atomic type.
void dump() const
Dump a representation of this initialization sequence to standard error, for debugging purposes.
void AddConversionSequenceStep(const ImplicitConversionSequence &ICS, QualType T, bool TopLevelOfInitList=false)
Add a new step that applies an implicit conversion sequence.
void AddZeroInitializationStep(QualType T)
Add a zero-initialization step.
void AddProduceObjCObjectStep(QualType T)
Add a step to "produce" an Objective-C object (by retaining it).
enum SequenceKind getKind() const
Determine the kind of initialization sequence computed.
SequenceKind
Describes the kind of initialization sequence computed.
@ NormalSequence
A normal sequence.
@ FailedSequence
A failed initialization sequence.
@ DependentSequence
A dependent initialization, which could not be type-checked due to the presence of dependent types or...
void AddReferenceBindingStep(QualType T, bool BindingTemporary)
Add a new step binding a reference to an object.
FailureKind
Describes why initialization failed.
@ FK_UserConversionOverloadFailed
Overloading for a user-defined conversion failed.
@ FK_NarrowStringIntoWideCharArray
Initializing a wide char array with narrow string literal.
@ FK_ArrayTypeMismatch
Array type mismatch.
@ FK_ParenthesizedListInitForReference
Reference initialized from a parenthesized initializer list.
@ FK_NonConstLValueReferenceBindingToVectorElement
Non-const lvalue reference binding to a vector element.
@ FK_ReferenceInitDropsQualifiers
Reference binding drops qualifiers.
@ FK_InitListBadDestinationType
Initialization of some unused destination type with an initializer list.
@ FK_ConversionFromPropertyFailed
Implicit conversion failed.
@ FK_NonConstLValueReferenceBindingToUnrelated
Non-const lvalue reference binding to an lvalue of unrelated type.
@ FK_ListConstructorOverloadFailed
Overloading for list-initialization by constructor failed.
@ FK_ReferenceInitFailed
Reference binding failed.
@ FK_DesignatedInitForNonAggregate
@ FK_ArrayNeedsInitList
Array must be initialized with an initializer list.
@ FK_PlainStringIntoUTF8Char
Initializing char8_t array with plain string literal.
@ FK_NonConstantArrayInit
Non-constant array initializer.
@ FK_NonConstLValueReferenceBindingToTemporary
Non-const lvalue reference binding to a temporary.
@ FK_ConversionFailed
Implicit conversion failed.
@ FK_ArrayNeedsInitListOrStringLiteral
Array must be initialized with an initializer list or a string literal.
@ FK_ParenthesizedListInitForScalar
Scalar initialized from a parenthesized initializer list.
@ FK_PlaceholderType
Initializer has a placeholder type which cannot be resolved by initialization.
@ FK_IncompatWideStringIntoWideChar
Initializing wide char array with incompatible wide string literal.
@ FK_NonConstLValueReferenceBindingToMatrixElement
Non-const lvalue reference binding to a matrix element.
@ FK_TooManyInitsForReference
Too many initializers provided for a reference.
@ FK_NonConstLValueReferenceBindingToBitfield
Non-const lvalue reference binding to a bit-field.
@ FK_ReferenceAddrspaceMismatchTemporary
Reference with mismatching address space binding to temporary.
@ FK_ListInitializationFailed
List initialization failed at some point.
@ FK_TooManyInitsForScalar
Too many initializers for scalar.
@ FK_AddressOfOverloadFailed
Cannot resolve the address of an overloaded function.
@ FK_VariableLengthArrayHasInitializer
Variable-length array must not have an initializer.
@ FK_ArrayNeedsInitListOrWideStringLiteral
Array must be initialized with an initializer list or a wide string literal.
@ FK_RValueReferenceBindingToLValue
Rvalue reference binding to an lvalue.
@ FK_Incomplete
Initialization of an incomplete type.
@ FK_WideStringIntoCharArray
Initializing char array with wide string literal.
@ FK_ExplicitConstructor
List-copy-initialization chose an explicit constructor.
@ FK_ReferenceInitOverloadFailed
Overloading due to reference initialization failed.
@ FK_ConstructorOverloadFailed
Overloading for initialization by constructor failed.
@ FK_ReferenceBindingToInitList
Reference initialization from an initializer list.
@ FK_DefaultInitOfConst
Default-initialization of a 'const' object.
@ FK_ParenthesizedListInitFailed
Parenthesized list initialization failed at some point.
@ FK_AddressOfUnaddressableFunction
Trying to take the address of a function that doesn't support having its address taken.
@ FK_UTF8StringIntoPlainChar
Initializing char array with UTF-8 string literal.
bool isDirectReferenceBinding() const
Determine whether this initialization is a direct reference binding (C++ [dcl.init....
void AddArrayInitLoopStep(QualType T, QualType EltTy)
Add an array initialization loop step.
void AddAddressOverloadResolutionStep(FunctionDecl *Function, DeclAccessPair Found, bool HadMultipleCandidates)
Add a new step in the initialization that resolves the address of an overloaded function to a specifi...
void AddArrayInitStep(QualType T, bool IsGNUExtension)
Add an array initialization step.
bool isConstructorInitialization() const
Determine whether this initialization is direct call to a constructor.
SmallVectorImpl< Step >::const_iterator step_iterator
OverloadCandidateSet & getFailedCandidateSet()
Retrieve a reference to the candidate set when overload resolution fails.
Describes an entity that is being initialized.
static InitializedEntity InitializeBase(ASTContext &Context, const CXXBaseSpecifier *Base, bool IsInheritedVirtualBase, const InitializedEntity *Parent=nullptr)
Create the initialization entity for a base class subobject.
static InitializedEntity InitializeResult(SourceLocation ReturnLoc, QualType Type)
Create the initialization entity for the result of a function.
static InitializedEntity InitializeMember(FieldDecl *Member, const InitializedEntity *Parent=nullptr, bool Implicit=false)
Create the initialization entity for a member subobject.
VD Variable
When Kind == EK_Variable, EK_Member, EK_Binding, or EK_TemplateParameter, the variable,...
static InitializedEntity InitializeRelatedResult(ObjCMethodDecl *MD, QualType Type)
Create the initialization entity for a related result.
void setParameterCFAudited()
EntityKind getKind() const
Determine the kind of initialization.
DeclarationName getName() const
Retrieve the name of the entity being initialized.
static InitializedEntity InitializeException(SourceLocation ThrowLoc, QualType Type)
Create the initialization entity for an exception object.
unsigned allocateManglingNumber() const
QualType getType() const
Retrieve type being initialized.
static InitializedEntity InitializeTemporary(ASTContext &Context, TypeSourceInfo *TypeInfo)
Create the initialization entity for a temporary.
ValueDecl * getDecl() const
Retrieve the variable, parameter, or field being initialized.
static InitializedEntity InitializeParameter(ASTContext &Context, QualType Type, bool Consumed)
Create the initialization entity for a parameter that is only known by its type.
static InitializedEntity InitializeStmtExprResult(SourceLocation ReturnLoc, QualType Type)
bool isImplicitMemberInitializer() const
Is this the implicit initialization of a member of a class from a defaulted constructor?
const InitializedEntity * getParent() const
Retrieve the parent of the entity being initialized, when the initialization itself is occurring with...
static InitializedEntity InitializeTemporary(QualType Type)
Create the initialization entity for a temporary.
bool isParameterConsumed() const
Determine whether this initialization consumes the parameter.
static InitializedEntity InitializeBinding(VarDecl *Binding)
Create the initialization entity for a structured binding.
static InitializedEntity InitializeParameter(ASTContext &Context, ParmVarDecl *Parm, QualType Type)
Create the initialization entity for a parameter, but use another type.
TypeSourceInfo * TypeInfo
When Kind == EK_Temporary or EK_CompoundLiteralInit, the type source information for the temporary.
static InitializedEntity InitializeMemberFromDefaultMemberInitializer(FieldDecl *Member)
Create the initialization entity for a default member initializer.
static InitializedEntity InitializeElement(ASTContext &Context, unsigned Index, const InitializedEntity &Parent)
Create the initialization entity for an array element.
unsigned getElementIndex() const
If this is an array, vector, or complex number element, get the element's index.
bool isInheritedVirtualBase() const
Return whether the base is an inherited virtual base.
static InitializedEntity InitializeLambdaToBlock(SourceLocation BlockVarLoc, QualType Type)
void setElementIndex(unsigned Index)
If this is already the initializer for an array or vector element, sets the element index.
SourceLocation getCaptureLoc() const
Determine the location of the capture when initializing field from a captured variable in a lambda.
static InitializedEntity InitializeBlock(SourceLocation BlockVarLoc, QualType Type)
bool isParamOrTemplateParamKind() const
static InitializedEntity InitializeNew(SourceLocation NewLoc, QualType Type)
Create the initialization entity for an object allocated via new.
llvm::PointerIntPair< const CXXBaseSpecifier *, 1 > Base
When Kind == EK_Base, the base specifier that provides the base class.
static InitializedEntity InitializeTemporary(TypeSourceInfo *TypeInfo, QualType Type)
Create the initialization entity for a temporary.
static InitializedEntity InitializeVariable(VarDecl *Var)
Create the initialization entity for a variable.
bool allowsNRVO() const
Determine whether this initialization allows the named return value optimization, which also applies ...
bool isParameterKind() const
void dump() const
Dump a representation of the initialized entity to standard error, for debugging purposes.
static InitializedEntity InitializeParameter(ASTContext &Context, ParmVarDecl *Parm)
Create the initialization entity for a parameter.
static InitializedEntity InitializeLambdaCapture(IdentifierInfo *VarID, QualType FieldType, SourceLocation Loc)
Create the initialization entity for a lambda capture.
EntityKind
Specifies the kind of entity being initialized.
@ EK_Variable
The entity being initialized is a variable.
@ EK_Temporary
The entity being initialized is a temporary object.
@ EK_Binding
The entity being initialized is a structured binding of a decomposition declaration.
@ EK_BlockElement
The entity being initialized is a field of block descriptor for the copied-in c++ object.
@ EK_Parameter_CF_Audited
The entity being initialized is a function parameter; function is member of group of audited CF APIs.
@ EK_LambdaToBlockConversionBlockElement
The entity being initialized is a field of block descriptor for the copied-in lambda object that's us...
@ EK_Member
The entity being initialized is a non-static data member subobject.
@ EK_Base
The entity being initialized is a base member subobject.
@ EK_Result
The entity being initialized is the result of a function call.
@ EK_TemplateParameter
The entity being initialized is a non-type template parameter.
@ EK_StmtExprResult
The entity being initialized is the result of a statement expression.
@ EK_ParenAggInitMember
The entity being initialized is a non-static data member subobject of an object initialized via paren...
@ EK_VectorElement
The entity being initialized is an element of a vector.
@ EK_New
The entity being initialized is an object (or array of objects) allocated via new.
@ EK_CompoundLiteralInit
The entity being initialized is the initializer for a compound literal.
@ EK_Parameter
The entity being initialized is a function parameter.
@ EK_Delegating
The initialization is being done by a delegating constructor.
@ EK_ComplexElement
The entity being initialized is the real or imaginary part of a complex number.
@ EK_ArrayElement
The entity being initialized is an element of an array.
@ EK_LambdaCapture
The entity being initialized is the field that captures a variable in a lambda.
@ EK_Exception
The entity being initialized is an exception object that is being thrown.
@ EK_RelatedResult
The entity being implicitly initialized back to the formal result type.
static InitializedEntity InitializeTemplateParameter(QualType T, NonTypeTemplateParmDecl *Param)
Create the initialization entity for a template parameter.
StringRef getCapturedVarName() const
For a lambda capture, return the capture's name.
static InitializedEntity InitializeMemberFromParenAggInit(FieldDecl *Member)
Create the initialization entity for a member subobject initialized via parenthesized aggregate init.
SourceLocation getThrowLoc() const
Determine the location of the 'throw' keyword when initializing an exception object.
static InitializedEntity InitializeDelegation(QualType Type)
Create the initialization entity for a delegated constructor.
unsigned Index
When Kind == EK_ArrayElement, EK_VectorElement, or EK_ComplexElement, the index of the array or vecto...
static InitializedEntity InitializeCompoundLiteralInit(TypeSourceInfo *TSI)
Create the entity for a compound literal initializer.
static InitializedEntity InitializeMember(IndirectFieldDecl *Member, const InitializedEntity *Parent=nullptr, bool Implicit=false)
Create the initialization entity for a member subobject.
bool isVariableLengthArrayNew() const
Determine whether this is an array new with an unknown bound.
ObjCMethodDecl * MethodDecl
When Kind == EK_RelatedResult, the ObjectiveC method where result type was implicitly changed to acco...
bool isDefaultMemberInitializer() const
Is this the default member initializer of a member (specified inside the class definition)?
llvm::PointerIntPair< ParmVarDecl *, 1 > Parameter
When Kind == EK_Parameter, the ParmVarDecl, with the integer indicating whether the parameter is "con...
const CXXBaseSpecifier * getBaseSpecifier() const
Retrieve the base specifier.
SourceLocation getReturnLoc() const
Determine the location of the 'return' keyword when initializing the result of a function call.
TypeSourceInfo * getTypeSourceInfo() const
Retrieve complete type-source information for the object being constructed, if known.
ObjCMethodDecl * getMethodDecl() const
Retrieve the ObjectiveC method being initialized.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
ObjCMethodDecl - Represents an instance or class method declaration.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
Represents a parameter to a function.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Sema - This implements semantic analysis and AST building for C.
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
A container of type source information.
QualType getType() const
Return the type wrapped by this type source info.
The base class of the type hierarchy.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
The JSON file list parser is used to communicate input to InstallAPI.
OverloadingResult
OverloadingResult - Capture the result of performing overload resolution.
@ Result
The result type of a method or function.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
const FunctionProtoType * T
@ Implicit
An implicit conversion.
bool HadMultipleCandidates