clang: include/clang/Sema/ScopeInfo.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_SEMA_SCOPEINFO_H
15#define LLVM_CLANG_SEMA_SCOPEINFO_H
16
26#include "llvm/ADT/DenseMap.h"
27#include "llvm/ADT/DenseMapInfo.h"
28#include "llvm/ADT/MapVector.h"
29#include "llvm/ADT/PointerIntPair.h"
30#include "llvm/ADT/SmallPtrSet.h"
31#include "llvm/ADT/SmallSet.h"
32#include "llvm/ADT/SmallVector.h"
33#include "llvm/ADT/StringRef.h"
34#include "llvm/ADT/StringSwitch.h"
35#include "llvm/ADT/TinyPtrVector.h"
36#include "llvm/Support/Casting.h"
37#include "llvm/Support/ErrorHandling.h"
38#include
39#include
40#include
41
43
62
63namespace sema {
64
65
66
68public:
69
70
72
73
74
76
77
78
80
83
87};
88
90public:
93 llvm::TinyPtrVector<const Stmt*> Stmts;
94
98};
99
101
102
103
105protected:
112
113public:
114
116
117
118
120
121
123
124
126
127
128
130
131
133
134
136
137
139
140
142
143
144
146
147
148
149
151
152
154
155
156
157
159
160
161
162
164
165
166
168
169
170
172
173
174
177
178
180
181
182
184
185
187
188
191
192
194
195
197
198private:
199
201
202public:
203
204
205 using SwitchInfo = llvm::PointerIntPair<SwitchStmt*, 1, bool>;
206
207
208
210
211
212
213
215
216
218
219
220
222
223
225
226
227
229
230
232
233
235
236
237
238
240
241
242
244
245
247
248public:
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271 class WeakObjectProfileTy {
272
273
274
275
276
277
278 using BaseInfoTy = llvm::PointerIntPair<const NamedDecl *, 1, bool>;
279 BaseInfoTy Base;
280
281
282
283
284
285 const NamedDecl *Property = nullptr;
286
287
288 static BaseInfoTy getBaseInfo(const Expr *BaseE);
289
290 inline WeakObjectProfileTy();
291 static inline WeakObjectProfileTy getSentinel();
292
293 public:
296 WeakObjectProfileTy(const DeclRefExpr *RE);
298
301
302
303
304
305
306
307
308
309
310
311
312
314 return Base.getInt();
315 }
316
318 return Base == Other.Base && Property == Other.Property;
319 }
320
321
322
323
324
326 public:
328 return WeakObjectProfileTy();
329 }
330
332 return WeakObjectProfileTy::getSentinel();
333 }
334
335 static unsigned getHashValue(const WeakObjectProfileTy &Val) {
336 using Pair = std::pair<BaseInfoTy, const NamedDecl *>;
337
338 return llvm::DenseMapInfo::getHashValue(Pair(Val.Base,
339 Val.Property));
340 }
341
342 static bool isEqual(const WeakObjectProfileTy &LHS,
343 const WeakObjectProfileTy &RHS) {
344 return LHS == RHS;
345 }
346 };
347 };
348
349
350
351
352
353
354
356 llvm::PointerIntPair<const Expr *, 1, bool> Rep;
357
358 public:
359 WeakUseTy(const Expr *Use, bool IsRead) : Rep(Use, IsRead) {}
360
362 bool isUnsafe() const { return Rep.getInt(); }
364
366 return Rep == Other.Rep;
367 }
368 };
369
370
371
372
374
375
376
377
381
382private:
383
384
385
387
388protected:
390
391public:
402
404
405
406
407
408
409
410
411
413 return ErrorTrap.hasUnrecoverableErrorOccurred();
414 }
415
416
417
418
419 template
420 inline void recordUseOfWeak(const ExprT *E, bool IsRead = true);
421
424
425
426
427
428
430
432 return WeakObjectUses;
433 }
434
438
442
446
448
452
456
460
464
470
476
481
486
491
492
496
497
501
503
506 "first coroutine statement location already set");
509 llvm::StringSwitch(Keyword)
510 .Case("co_return",
512 .Case("co_await",
514 .Case("co_yield",
516 }
517
520 && "no coroutine statement available");
525 return "co_return";
527 return "co_await";
529 return "co_yield";
530 };
531 llvm_unreachable("FirstCoroutineStmtKind has an invalid value");
532 }
533
536 "we already have valid suspend points");
538 }
539
543
545 assert(Initial && Final && "suspend points cannot be null");
546 assert(CoroutineSuspends.first == nullptr && "suspend points already set");
550 }
551
552
553
555
557};
558
560
561
562
563
564
565
566
567
568
569
570
571
572
573 enum CaptureKind {
574 Cap_ByCopy, Cap_ByRef, Cap_Block, Cap_VLA
575 };
576
577 union {
578
580
581
583 };
584
585
587
588
590
591
592
594
595
596 LLVM_PREFERRED_TYPE(CaptureKind)
597 unsigned Kind : 2;
598
599
600
601 LLVM_PREFERRED_TYPE(bool)
602 unsigned Nested : 1;
603
604
605 LLVM_PREFERRED_TYPE(bool)
606 unsigned CapturesThis : 1;
607
608
609
610 LLVM_PREFERRED_TYPE(bool)
611 unsigned ODRUsed : 1;
612
613
614
615 LLVM_PREFERRED_TYPE(bool)
616 unsigned NonODRUsed : 1;
617
618
619
620 LLVM_PREFERRED_TYPE(bool)
622
623public:
626 bool Invalid)
627 : CapturedVar(Var), Loc(Loc), EllipsisLoc(EllipsisLoc),
628 CaptureType(CaptureType), Kind(Block ? Cap_Block
629 : ByRef ? Cap_ByRef
630 : Cap_ByCopy),
631 Nested(IsNested), CapturesThis(false), ODRUsed(false),
632 NonODRUsed(false), Invalid(Invalid) {}
633
636 QualType CaptureType, const bool ByCopy, bool Invalid)
637 : Loc(Loc), CaptureType(CaptureType),
638 Kind(ByCopy ? Cap_ByCopy : Cap_ByRef), Nested(IsNested),
639 CapturesThis(true), ODRUsed(false), NonODRUsed(false),
640 Invalid(Invalid) {}
641
645 : CapturedVLA(VLA), Loc(Loc), CaptureType(CaptureType), Kind(Cap_VLA),
646 Nested(IsNested), CapturesThis(false), ODRUsed(false),
648
653
658
660
662
663
665
669 if (IsODRUse)
670 ODRUsed = true;
671 else
672 NonODRUsed = true;
673 }
674
679
684
685
687
688
689
691
692
693
694
696};
697
699protected:
701
702public:
707
709
712
713
714 llvm::DenseMap<ValueDecl *, unsigned> CaptureMap;
715
716
717
719
720
722
723
724
726
727
729
730
731
733
734
736
740 Captures.push_back(Capture(Var, isBlock, isByref, isNested, Loc,
741 EllipsisLoc, CaptureType, Invalid));
743 }
744
748 false, Loc, CaptureType));
749 }
750
752 bool ByCopy);
753
754
756
757
762
763
765
766
768
769
770
772 assert(isCaptured(Var) && "Variable has not been captured");
774 }
775
777 llvm::DenseMap<ValueDecl *, unsigned>::const_iterator Known =
779 assert(Known != CaptureMap.end() && "Variable has not been captured");
780 return Captures[Known->second - 1];
781 }
782
787};
788
789
791public:
793
794
795
797
798
799
801
807
809
813};
814
815
817public:
818
820
821
823
824
826
827
829
830
832
835
846
848
849
853 return "default captured statement";
855 return "Objective-C @finally statement";
857 return "OpenMP region";
858 }
859 llvm_unreachable("Invalid captured region kind!");
860 }
861
865};
866
869public:
870
872
873
875
876
877
878
880
882
883
885
886
887
889
890
891
893
894
895
897
898
900
901
903
904
906
907
908
909
911
912
913
914
916
917
918
919
920
921
922
923
924
925
926
927
928
929
931
932
933
934
935
937
938
940
941
942
943
949
951
952
954
959
960
964
968
969
970
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
997
1001
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1067
1072
1074 llvm::function_ref<void(ValueDecl *, Expr *)> Callback) const;
1075
1077};
1078
1079FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy()
1081
1082FunctionScopeInfo::WeakObjectProfileTy
1083FunctionScopeInfo::WeakObjectProfileTy::getSentinel() {
1084 FunctionScopeInfo::WeakObjectProfileTy Result;
1085 Result.Base.setInt(true);
1086 return Result;
1087}
1088
1089template
1091 assert(E);
1093 Uses.push_back(WeakUseTy(E, IsRead));
1094}
1095
1099 bool ByCopy) {
1101 ByCopy, false));
1103}
1104
1105}
1106
1107}
1108
1109#endif
This file defines the classes used to store parsed information about declaration-specifiers and decla...
Defines the clang::Expr interface and subclasses for C++ expressions.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
Defines the clang::SourceLocation class and associated facilities.
C Language Family Type Representation.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Represents a static or instance method of a struct/union/class.
Represents a C++ struct/union/class.
Represents the body of a CapturedStmt, and serves as its DeclContext.
A reference to a declared variable, function, enum, etc.
RAII class that determines when any errors have occurred between the time the instance was created an...
Concrete class used by the front-end to report problems and issues.
This represents one expression.
This represents a decl that may have a name.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
Represents one property declaration in an Objective-C interface.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Represents a parameter to a function.
A (possibly-)qualified type.
Represents a struct/union/class.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Scope - A scope is a transient data structure that is used while parsing the program.
Encodes a location in the source.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
SwitchStmt - This represents a 'switch' stmt.
Stores a list of template parameters for a TemplateDecl and its derived classes.
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.
Represents a C array with a specified size that is not an integer-constant-expression.
Scope * TheScope
TheScope - This is the scope for the block itself, which contains arguments etc.
Definition ScopeInfo.h:796
BlockScopeInfo(DiagnosticsEngine &Diag, Scope *BlockScope, BlockDecl *Block)
Definition ScopeInfo.h:802
static bool classof(const FunctionScopeInfo *FSI)
Definition ScopeInfo.h:810
BlockDecl * TheDecl
Definition ScopeInfo.h:792
~BlockScopeInfo() override
QualType FunctionType
BlockType - The function type of the block, if one was given.
Definition ScopeInfo.h:800
Definition ScopeInfo.h:559
ValueDecl * getVariable() const
Definition ScopeInfo.h:675
bool isVariableCapture() const
Definition ScopeInfo.h:650
bool isBlockCapture() const
Definition ScopeInfo.h:656
SourceLocation getLocation() const
Retrieve the location at which this variable was captured.
Definition ScopeInfo.h:686
IsThisCapture
Definition ScopeInfo.h:634
@ ThisCapture
Definition ScopeInfo.h:634
bool isNonODRUsed() const
Definition ScopeInfo.h:667
Capture(IsThisCapture, bool IsNested, SourceLocation Loc, QualType CaptureType, const bool ByCopy, bool Invalid)
Definition ScopeInfo.h:635
bool isODRUsed() const
Definition ScopeInfo.h:666
void markUsed(bool IsODRUse)
Definition ScopeInfo.h:668
bool isInitCapture() const
Determine whether this capture is an init-capture.
ValueDecl * CapturedVar
Otherwise, the captured variable (if any).
Definition ScopeInfo.h:582
bool isInvalid() const
Definition ScopeInfo.h:661
bool isVLATypeCapture() const
Definition ScopeInfo.h:657
SourceLocation getEllipsisLoc() const
Retrieve the source location of the ellipsis, whose presence indicates that the capture is a pack exp...
Definition ScopeInfo.h:690
bool isThisCapture() const
Definition ScopeInfo.h:649
QualType getCaptureType() const
Retrieve the capture type for this capture, which is effectively the type of the non-static data memb...
Definition ScopeInfo.h:695
bool isCopyCapture() const
Definition ScopeInfo.h:654
bool isReferenceCapture() const
Definition ScopeInfo.h:655
Capture(IsVLACapture, const VariableArrayType *VLA, bool IsNested, SourceLocation Loc, QualType CaptureType)
Definition ScopeInfo.h:643
bool isNested() const
Definition ScopeInfo.h:659
IsVLACapture
Definition ScopeInfo.h:642
@ VLACapture
Definition ScopeInfo.h:642
Capture(ValueDecl *Var, bool Block, bool ByRef, bool IsNested, SourceLocation Loc, SourceLocation EllipsisLoc, QualType CaptureType, bool Invalid)
Definition ScopeInfo.h:624
const VariableArrayType * getCapturedVLAType() const
Definition ScopeInfo.h:680
const VariableArrayType * CapturedVLA
If Kind == Cap_VLA, the captured type.
Definition ScopeInfo.h:579
static bool classof(const FunctionScopeInfo *FSI)
Definition ScopeInfo.h:862
~CapturedRegionScopeInfo() override
unsigned short OpenMPLevel
Definition ScopeInfo.h:833
unsigned short CapRegionKind
The kind of captured region.
Definition ScopeInfo.h:831
ImplicitParamDecl * ContextParam
The implicit parameter for the captured variables.
Definition ScopeInfo.h:828
unsigned short OpenMPCaptureLevel
Definition ScopeInfo.h:834
StringRef getRegionName() const
A descriptive name for the kind of captured region this is.
Definition ScopeInfo.h:850
Scope * TheScope
This is the enclosing scope of the captured region.
Definition ScopeInfo.h:825
CapturedRegionScopeInfo(DiagnosticsEngine &Diag, Scope *S, CapturedDecl *CD, RecordDecl *RD, ImplicitParamDecl *Context, CapturedRegionKind K, unsigned OpenMPLevel, unsigned OpenMPCaptureLevel)
Definition ScopeInfo.h:836
RecordDecl * TheRecordDecl
The captured record type.
Definition ScopeInfo.h:822
CapturedDecl * TheCapturedDecl
The CapturedDecl for this statement.
Definition ScopeInfo.h:819
const Capture & getCapture(ValueDecl *Var) const
Definition ScopeInfo.h:776
void addVLATypeCapture(SourceLocation Loc, const VariableArrayType *VLAType, QualType CaptureType)
Definition ScopeInfo.h:745
QualType ReturnType
ReturnType - The target type of return statements in this context, or null if unknown.
Definition ScopeInfo.h:732
bool isCaptured(ValueDecl *Var) const
Determine whether the given variable has been captured.
Definition ScopeInfo.h:764
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
Definition ScopeInfo.h:728
SmallVector< Capture, 4 > Captures
Captures - The captures.
Definition ScopeInfo.h:721
ImplicitCaptureStyle ImpCaptureStyle
Definition ScopeInfo.h:708
unsigned CXXThisCaptureIndex
CXXThisCaptureIndex - The (index+1) of the capture of 'this'; zero if 'this' is not captured.
Definition ScopeInfo.h:718
bool HasImplicitReturnType
Definition ScopeInfo.h:725
Capture & getCXXThisCapture()
Retrieve the capture of C++ 'this', if it has been captured.
Definition ScopeInfo.h:758
CapturingScopeInfo(const CapturingScopeInfo &)=default
llvm::DenseMap< ValueDecl *, unsigned > CaptureMap
CaptureMap - A map of captured variables to (index+1) into Captures.
Definition ScopeInfo.h:714
static bool classof(const FunctionScopeInfo *FSI)
Definition ScopeInfo.h:783
bool isCXXThisCaptured() const
Determine whether the C++ 'this' is captured.
Definition ScopeInfo.h:755
ImplicitCaptureStyle
Definition ScopeInfo.h:703
@ ImpCap_Block
Definition ScopeInfo.h:704
@ ImpCap_CapturedRegion
Definition ScopeInfo.h:705
@ ImpCap_None
Definition ScopeInfo.h:704
@ ImpCap_LambdaByval
Definition ScopeInfo.h:704
@ ImpCap_LambdaByref
Definition ScopeInfo.h:704
SmallVector< NamedDecl *, 4 > LocalPacks
Packs introduced by this, if any.
Definition ScopeInfo.h:735
void addThisCapture(bool isNested, SourceLocation Loc, QualType CaptureType, bool ByCopy)
Definition ScopeInfo.h:1096
CapturingScopeInfo(DiagnosticsEngine &Diag, ImplicitCaptureStyle Style)
Definition ScopeInfo.h:710
bool isVLATypeCaptured(const VariableArrayType *VAT) const
Determine whether the given variable-array type has been captured.
void addCapture(ValueDecl *Var, bool isBlock, bool isByref, bool isNested, SourceLocation Loc, SourceLocation EllipsisLoc, QualType CaptureType, bool Invalid)
Definition ScopeInfo.h:737
Capture & getCapture(ValueDecl *Var)
Retrieve the capture of the given variable, if it has been captured already.
Definition ScopeInfo.h:771
FPOptions InitialFPFeatures
FP options at the beginning of the compound statement, prior to any pragma.
Definition ScopeInfo.h:79
bool HasEmptyLoopBodies
Whether this compound statement contains ‘for’ or ‘while’ loops with empty bodies.
Definition ScopeInfo.h:71
void setHasEmptyLoopBodies()
Definition ScopeInfo.h:84
bool IsStmtExpr
Whether this compound statement corresponds to a GNU statement expression.
Definition ScopeInfo.h:75
CompoundScopeInfo(bool IsStmtExpr, FPOptions FPO)
Definition ScopeInfo.h:81
Definition ScopeInfo.h:325
static WeakObjectProfileTy getEmptyKey()
Definition ScopeInfo.h:327
static WeakObjectProfileTy getTombstoneKey()
Definition ScopeInfo.h:331
static bool isEqual(const WeakObjectProfileTy &LHS, const WeakObjectProfileTy &RHS)
Definition ScopeInfo.h:342
static unsigned getHashValue(const WeakObjectProfileTy &Val)
Definition ScopeInfo.h:335
Represents a simple identification of a weak object.
Definition ScopeInfo.h:271
bool isExactProfile() const
Returns true if the object base specifies a known object in memory, rather than, say,...
Definition ScopeInfo.h:313
bool operator==(const WeakObjectProfileTy &Other) const
Definition ScopeInfo.h:317
const NamedDecl * getBase() const
Definition ScopeInfo.h:299
const NamedDecl * getProperty() const
Definition ScopeInfo.h:300
Represents a single use of a weak object.
Definition ScopeInfo.h:355
void markSafe()
Definition ScopeInfo.h:363
const Expr * getUseExpr() const
Definition ScopeInfo.h:361
bool operator==(const WeakUseTy &Other) const
Definition ScopeInfo.h:365
WeakUseTy(const Expr *Use, bool IsRead)
Definition ScopeInfo.h:359
bool isUnsafe() const
Definition ScopeInfo.h:362
Retains information about a function, method, or block that is currently being parsed.
Definition ScopeInfo.h:104
llvm::PointerIntPair< SwitchStmt *, 1, bool > SwitchInfo
A SwitchStmt, along with a flag indicating if its list of case statements is incomplete (because we d...
Definition ScopeInfo.h:205
void setHasObjCTry(SourceLocation TryLoc)
Definition ScopeInfo.h:471
SmallVector< ReturnStmt *, 4 > Returns
The list of return statements that occur within the function or block, if there is any chance of appl...
Definition ScopeInfo.h:214
FunctionScopeInfo(DiagnosticsEngine &Diag)
Definition ScopeInfo.h:392
bool HasIndirectGoto
Whether this function contains any indirect gotos.
Definition ScopeInfo.h:125
bool HasFallthroughStmt
Whether there is a fallthrough statement in this function.
Definition ScopeInfo.h:138
SourceLocation FirstVLALoc
First use of a VLA within the current function.
Definition ScopeInfo.h:196
SourceLocation FirstCXXOrObjCTryLoc
First C++ 'try' or ObjC @try statement in the current function.
Definition ScopeInfo.h:189
bool UsesFPIntrin
Whether this function uses constrained floating point intrinsics.
Definition ScopeInfo.h:141
void setHasMustTail()
Definition ScopeInfo.h:447
ScopeKind
Definition ScopeInfo.h:106
@ SK_Function
Definition ScopeInfo.h:107
@ SK_Block
Definition ScopeInfo.h:108
@ SK_CapturedRegion
Definition ScopeInfo.h:110
@ SK_Lambda
Definition ScopeInfo.h:109
void addByrefBlockVar(VarDecl *VD)
Definition ScopeInfo.h:498
llvm::SmallMapVector< ParmVarDecl *, Stmt *, 4 > CoroutineParameterMoves
A mapping between the coroutine function parameters that were moved to the coroutine frame,...
Definition ScopeInfo.h:221
void setFirstCoroutineStmt(SourceLocation Loc, StringRef Keyword)
Definition ScopeInfo.h:504
void recordUseOfWeak(const ExprT *E, bool IsRead=true)
Record that a weak object was accessed.
Definition ScopeInfo.h:1090
unsigned char FirstCoroutineStmtKind
An enumeration representing the kind of the first coroutine statement in the function.
Definition ScopeInfo.h:176
bool NeedsScopeChecking() const
Definition ScopeInfo.h:487
bool HasDroppedStmt
Whether a statement was dropped because it was invalid.
Definition ScopeInfo.h:132
void setNeedsCoroutineSuspends(bool value=true)
Definition ScopeInfo.h:534
void markSafeWeakUse(const Expr *E)
Record that a given expression is a "safe" access of a weak object (e.g.
void setHasOMPDeclareReductionCombiner()
Definition ScopeInfo.h:453
SourceLocation FirstCoroutineStmtLoc
First coroutine statement in the current function.
Definition ScopeInfo.h:183
bool FoundImmediateEscalatingExpression
Whether we found an immediate-escalating expression.
Definition ScopeInfo.h:179
void setHasIndirectGoto()
Definition ScopeInfo.h:443
void setCoroutineSuspends(Stmt *Initial, Stmt *Final)
Definition ScopeInfo.h:544
void setHasDroppedStmt()
Definition ScopeInfo.h:449
std::pair< Stmt *, Stmt * > CoroutineSuspends
The initial and final coroutine suspend points.
Definition ScopeInfo.h:224
bool ObjCIsDesignatedInit
True when this is a method marked as a designated initializer.
Definition ScopeInfo.h:153
bool isCoroutine() const
Definition ScopeInfo.h:502
void Clear()
Clear out the information in this function scope, making it suitable for reuse.
bool ObjCShouldCallSuper
A flag that is set when parsing a method that must call super's implementation, such as -dealloc,...
Definition ScopeInfo.h:150
VarDecl * CoroutinePromise
The promise object for this coroutine, if any.
Definition ScopeInfo.h:217
void addBlock(const BlockDecl *BD)
Definition ScopeInfo.h:493
SmallVector< WeakUseTy, 4 > WeakUseVector
Used to collect uses of a particular weak object in a function body.
Definition ScopeInfo.h:373
ScopeKind Kind
What kind of scope we are describing.
Definition ScopeInfo.h:115
bool hasInvalidCoroutineSuspends() const
Definition ScopeInfo.h:540
bool HasBranchProtectedScope
Whether this function contains a VLA, @try, try, C++ initializer, or anything else that can't be jump...
Definition ScopeInfo.h:119
bool hasUnrecoverableErrorOccurred() const
Determine whether an unrecoverable error has occurred within this function.
Definition ScopeInfo.h:412
void setUsesFPIntrin()
Definition ScopeInfo.h:461
SmallVector< PossiblyUnreachableDiag, 4 > PossiblyUnreachableDiags
A list of PartialDiagnostics created but delayed within the current function scope.
Definition ScopeInfo.h:239
FunctionScopeInfo(const FunctionScopeInfo &)=default
enum clang::sema::FunctionScopeInfo::@340304006310276167163023075110222134352007243353 FirstTryType
bool ObjCWarnForNoInitDelegation
This starts true for a secondary initializer method and will be set to false if there is an invocatio...
Definition ScopeInfo.h:167
llvm::SmallDenseMap< WeakObjectProfileTy, WeakUseVector, 8, WeakObjectProfileTy::DenseMapInfo > WeakObjectUseMap
Used to collect all uses of weak objects in a function body.
Definition ScopeInfo.h:378
void setHasFallthroughStmt()
Definition ScopeInfo.h:457
bool isPlainFunction() const
Definition ScopeInfo.h:556
StringRef getFirstCoroutineStmtKeyword() const
Definition ScopeInfo.h:518
bool HasPotentialAvailabilityViolations
Whether we make reference to a declaration that could be unavailable.
Definition ScopeInfo.h:145
SourceLocation FirstReturnLoc
First 'return' statement in the current function.
Definition ScopeInfo.h:186
bool HasBranchIntoScope
Whether this function contains any switches or direct gotos.
Definition ScopeInfo.h:122
SourceLocation FirstSEHTryLoc
First SEH '__try' statement in the current function.
Definition ScopeInfo.h:193
void setHasCXXTry(SourceLocation TryLoc)
Definition ScopeInfo.h:465
SmallVector< CompoundScopeInfo, 4 > CompoundScopes
The stack of currently active compound statement scopes in the function.
Definition ScopeInfo.h:228
const WeakObjectUseMap & getWeakObjectUses() const
Definition ScopeInfo.h:431
llvm::SmallPtrSet< const BlockDecl *, 1 > Blocks
The set of blocks that are introduced in this function.
Definition ScopeInfo.h:231
void setHasVLA(SourceLocation VLALoc)
Definition ScopeInfo.h:482
@ TryLocIsCXX
Definition ScopeInfo.h:190
@ TryLocIsObjC
Definition ScopeInfo.h:190
@ Unknown
Definition ScopeInfo.h:190
void setHasBranchProtectedScope()
Definition ScopeInfo.h:439
void setHasBranchIntoScope()
Definition ScopeInfo.h:435
void setHasSEHTry(SourceLocation TryLoc)
Definition ScopeInfo.h:477
bool ObjCIsSecondaryInit
True when this is an initializer method not marked as a designated initializer within a class that ha...
Definition ScopeInfo.h:163
bool NeedsCoroutineSuspends
True only when this function has not already built, or attempted to build, the initial and final coro...
Definition ScopeInfo.h:171
llvm::SmallVector< AddrLabelExpr *, 4 > AddrLabels
The set of GNU address of label extension "&&label".
Definition ScopeInfo.h:246
llvm::TinyPtrVector< VarDecl * > ByrefBlockVars
The set of __block variables that are introduced in this function.
Definition ScopeInfo.h:234
bool ObjCWarnForNoDesignatedInitChain
This starts true for a method marked as designated initializer and will be set to false if there is a...
Definition ScopeInfo.h:158
SmallVector< SwitchInfo, 8 > SwitchStack
SwitchStack - This is the current set of active switch statements in the block.
Definition ScopeInfo.h:209
bool HasMustTail
Whether this function contains any statement marked with [[clang::musttail]].
Definition ScopeInfo.h:129
bool HasOMPDeclareReductionCombiner
True if current scope is for OpenMP declare reduction combiner.
Definition ScopeInfo.h:135
virtual ~FunctionScopeInfo()
llvm::SmallPtrSet< const ParmVarDecl *, 8 > ModifiedNonNullParams
A list of parameters which have the nonnull attribute and are modified in the function.
Definition ScopeInfo.h:243
SourceLocation PotentialThisCaptureLocation
Definition ScopeInfo.h:950
void removePotentialCapture(Expr *E)
Definition ScopeInfo.h:1057
void finishedExplicitCaptures()
Note when all explicit captures have been added.
Definition ScopeInfo.h:961
bool hasPotentialThisCapture() const
Definition ScopeInfo.h:1002
LambdaScopeInfo(DiagnosticsEngine &Diag)
Definition ScopeInfo.h:955
CleanupInfo Cleanup
Whether any of the capture expressions requires cleanups.
Definition ScopeInfo.h:902
SourceRange IntroducerRange
Source range covering the lambda introducer [...].
Definition ScopeInfo.h:884
bool isGenericLambda() const
Is this scope known to be for a generic lambda?
Definition ScopeInfo.h:971
bool lambdaCaptureShouldBeConst() const
void clearPotentialCaptures()
Definition ScopeInfo.h:1060
bool ExplicitParams
Whether the (empty) parameter list is explicit.
Definition ScopeInfo.h:899
TemplateParameterList * GLTemplateParameterList
If this is a generic lambda, and the template parameter list has been created (from the TemplateParam...
Definition ScopeInfo.h:915
void addPotentialCapture(Expr *VarExpr)
Add a variable that might potentially be captured by the lambda and therefore the enclosing lambdas.
Definition ScopeInfo.h:992
void markVariableExprAsNonODRUsed(Expr *CapturingVarExpr)
Mark a variable's reference in a lambda as non-odr using.
Definition ScopeInfo.h:1045
void addPotentialThisCapture(SourceLocation Loc)
Definition ScopeInfo.h:998
ParmVarDecl * ExplicitObjectParameter
Definition ScopeInfo.h:881
llvm::SmallPtrSet< VarDecl *, 4 > CUDAPotentialODRUsedVars
Variables that are potentially ODR-used in CUDA/HIP.
Definition ScopeInfo.h:953
llvm::SmallVector< ShadowedOuterDecl, 4 > ShadowingDecls
Definition ScopeInfo.h:948
ExprResult RequiresClause
The requires-clause immediately following the explicit template parameter list, if any.
Definition ScopeInfo.h:910
SourceRange ExplicitTemplateParamsRange
Source range covering the explicit template parameter list (if it exists).
Definition ScopeInfo.h:905
bool hasPotentialCaptures() const
Definition ScopeInfo.h:1068
bool isVariableExprMarkedAsNonODRUsed(Expr *CapturingVarExpr) const
Definition ScopeInfo.h:1051
CXXRecordDecl * Lambda
The class that describes the lambda.
Definition ScopeInfo.h:871
llvm::SmallPtrSet< Expr *, 8 > NonODRUsedCapturingExprs
Contains all variable-referring-expressions that refer to local variables that are usable as constant...
Definition ScopeInfo.h:936
void visitPotentialCaptures(llvm::function_ref< void(ValueDecl *, Expr *)> Callback) const
unsigned getNumPotentialVariableCaptures() const
Definition ScopeInfo.h:1064
unsigned NumExplicitCaptures
The number of captures in the Captures list that are explicit captures.
Definition ScopeInfo.h:892
SourceLocation CaptureDefaultLoc
Source location of the '&' or '=' specifying the default capture type, if any.
Definition ScopeInfo.h:888
llvm::DenseMap< unsigned, SourceRange > ExplicitCaptureRanges
A map of explicit capture indices to their introducer source ranges.
Definition ScopeInfo.h:939
static bool classof(const FunctionScopeInfo *FSI)
Definition ScopeInfo.h:965
bool AfterParameterList
Indicate that we parsed the parameter list at which point the mutability of the lambda is known.
Definition ScopeInfo.h:879
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
Definition ScopeInfo.h:874
bool Mutable
Whether this is a mutable lambda.
Definition ScopeInfo.h:896
llvm::SmallVector< Expr *, 4 > PotentiallyCapturingExprs
Contains all variable-referring-expressions (i.e.
Definition ScopeInfo.h:930
SourceLocation Loc
Definition ScopeInfo.h:92
llvm::TinyPtrVector< const Stmt * > Stmts
Definition ScopeInfo.h:93
PartialDiagnostic PD
Definition ScopeInfo.h:91
PossiblyUnreachableDiag(const PartialDiagnostic &PD, SourceLocation Loc, ArrayRef< const Stmt * > Stmts)
Definition ScopeInfo.h:95
FirstCoroutineStmtKind
Definition ScopeInfo.h:100
@ CoAwait
Definition ScopeInfo.h:100
@ CoReturn
Definition ScopeInfo.h:100
@ CoYield
Definition ScopeInfo.h:100
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
CapturedRegionKind
The different kinds of captured statement.
@ Keyword
The name has been typo-corrected to a keyword.
ActionResult< Expr * > ExprResult
@ Other
Other implicit parameter.
SmallVector< NamedDecl *, 4 > TemplateParams
Store the list of the template parameters for a generic lambda or an abbreviated function template.
Contains all of the variables defined in this lambda that shadow variables that were defined in paren...
Definition ScopeInfo.h:944
const NamedDecl * ShadowedDecl
Definition ScopeInfo.h:946
const NamedDecl * VD
Definition ScopeInfo.h:945