clang  15.0.0git
ScopeInfo.h
Go to the documentation of this file.
1 //===- ScopeInfo.h - Information about a semantic context -------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines FunctionScopeInfo and its subclasses, which contain
10 // information about a single function, block, lambda, or method body.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_SEMA_SCOPEINFO_H
15 #define LLVM_CLANG_SEMA_SCOPEINFO_H
16 
17 #include "clang/AST/Expr.h"
18 #include "clang/AST/ExprCXX.h"
19 #include "clang/AST/Type.h"
21 #include "clang/Basic/LLVM.h"
24 #include "clang/Sema/CleanupInfo.h"
25 #include "clang/Sema/DeclSpec.h"
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 <algorithm>
39 #include <cassert>
40 #include <utility>
41 
42 namespace clang {
43 
44 class BlockDecl;
45 class CapturedDecl;
46 class CXXMethodDecl;
47 class CXXRecordDecl;
48 class ImplicitParamDecl;
49 class NamedDecl;
50 class ObjCIvarRefExpr;
51 class ObjCMessageExpr;
52 class ObjCPropertyDecl;
53 class ObjCPropertyRefExpr;
54 class ParmVarDecl;
55 class RecordDecl;
56 class ReturnStmt;
57 class Scope;
58 class Stmt;
59 class SwitchStmt;
60 class TemplateParameterList;
61 class VarDecl;
62 
63 namespace sema {
64 
65 /// Contains information about the compound statement currently being
66 /// parsed.
68 public:
69  /// Whether this compound stamement contains `for' or `while' loops
70  /// with empty bodies.
71  bool HasEmptyLoopBodies = false;
72 
73  /// Whether this compound statement corresponds to a GNU statement
74  /// expression.
75  bool IsStmtExpr;
76 
78 
80  HasEmptyLoopBodies = true;
81  }
82 };
83 
85 public:
88  llvm::TinyPtrVector<const Stmt*> Stmts;
89 
92  : PD(PD), Loc(Loc), Stmts(Stmts) {}
93 };
94 
95 /// Retains information about a function, method, or block that is
96 /// currently being parsed.
98 protected:
99  enum ScopeKind {
104  };
105 
106 public:
107  /// What kind of scope we are describing.
109 
110  /// Whether this function contains a VLA, \@try, try, C++
111  /// initializer, or anything else that can't be jumped past.
113 
114  /// Whether this function contains any switches or direct gotos.
116 
117  /// Whether this function contains any indirect gotos.
118  bool HasIndirectGoto : 1;
119 
120  /// Whether this function contains any statement marked with
121  /// \c [[clang::musttail]].
122  bool HasMustTail : 1;
123 
124  /// Whether a statement was dropped because it was invalid.
125  bool HasDroppedStmt : 1;
126 
127  /// True if current scope is for OpenMP declare reduction combiner.
129 
130  /// Whether there is a fallthrough statement in this function.
132 
133  /// Whether this function uses constrained floating point intrinsics
134  bool UsesFPIntrin : 1;
135 
136  /// Whether we make reference to a declaration that could be
137  /// unavailable.
139 
140  /// A flag that is set when parsing a method that must call super's
141  /// implementation, such as \c -dealloc, \c -finalize, or any method marked
142  /// with \c __attribute__((objc_requires_super)).
144 
145  /// True when this is a method marked as a designated initializer.
147 
148  /// This starts true for a method marked as designated initializer and will
149  /// be set to false if there is an invocation to a designated initializer of
150  /// the super class.
152 
153  /// True when this is an initializer method not marked as a designated
154  /// initializer within a class that has at least one initializer marked as a
155  /// designated initializer.
157 
158  /// This starts true for a secondary initializer method and will be set to
159  /// false if there is an invocation of an initializer on 'self'.
161 
162  /// True only when this function has not already built, or attempted
163  /// to build, the initial and final coroutine suspend points
165 
166  /// An enumeration represeting the kind of the first coroutine statement
167  /// in the function. One of co_return, co_await, or co_yield.
168  unsigned char FirstCoroutineStmtKind : 2;
169 
170  /// First coroutine statement in the current function.
171  /// (ex co_return, co_await, co_yield)
173 
174  /// First 'return' statement in the current function.
176 
177  /// First C++ 'try' or ObjC @try statement in the current function.
180 
181  /// First SEH '__try' statement in the current function.
183 
184 private:
185  /// Used to determine if errors occurred in this function or block.
186  DiagnosticErrorTrap ErrorTrap;
187 
188 public:
189  /// A SwitchStmt, along with a flag indicating if its list of case statements
190  /// is incomplete (because we dropped an invalid one while parsing).
191  using SwitchInfo = llvm::PointerIntPair<SwitchStmt*, 1, bool>;
192 
193  /// SwitchStack - This is the current set of active switch statements in the
194  /// block.
196 
197  /// The list of return statements that occur within the function or
198  /// block, if there is any chance of applying the named return value
199  /// optimization, or if we need to infer a return type.
201 
202  /// The promise object for this coroutine, if any.
204 
205  /// A mapping between the coroutine function parameters that were moved
206  /// to the coroutine frame, and their move statements.
207  llvm::SmallMapVector<ParmVarDecl *, Stmt *, 4> CoroutineParameterMoves;
208 
209  /// The initial and final coroutine suspend points.
210  std::pair<Stmt *, Stmt *> CoroutineSuspends;
211 
212  /// The stack of currently active compound stamement scopes in the
213  /// function.
215 
216  /// The set of blocks that are introduced in this function.
218 
219  /// The set of __block variables that are introduced in this function.
220  llvm::TinyPtrVector<VarDecl *> ByrefBlockVars;
221 
222  /// A list of PartialDiagnostics created but delayed within the
223  /// current function scope. These diagnostics are vetted for reachability
224  /// prior to being emitted.
226 
227  /// A list of parameters which have the nonnull attribute and are
228  /// modified in the function.
230 
231 public:
232  /// Represents a simple identification of a weak object.
233  ///
234  /// Part of the implementation of -Wrepeated-use-of-weak.
235  ///
236  /// This is used to determine if two weak accesses refer to the same object.
237  /// Here are some examples of how various accesses are "profiled":
238  ///
239  /// Access Expression | "Base" Decl | "Property" Decl
240  /// :---------------: | :-----------------: | :------------------------------:
241  /// self.property | self (VarDecl) | property (ObjCPropertyDecl)
242  /// self.implicitProp | self (VarDecl) | -implicitProp (ObjCMethodDecl)
243  /// self->ivar.prop | ivar (ObjCIvarDecl) | prop (ObjCPropertyDecl)
244  /// cxxObj.obj.prop | obj (FieldDecl) | prop (ObjCPropertyDecl)
245  /// [self foo].prop | 0 (unknown) | prop (ObjCPropertyDecl)
246  /// self.prop1.prop2 | prop1 (ObjCPropertyDecl) | prop2 (ObjCPropertyDecl)
247  /// MyClass.prop | MyClass (ObjCInterfaceDecl) | -prop (ObjCMethodDecl)
248  /// MyClass.foo.prop | +foo (ObjCMethodDecl) | -prop (ObjCPropertyDecl)
249  /// weakVar | 0 (known) | weakVar (VarDecl)
250  /// self->weakIvar | self (VarDecl) | weakIvar (ObjCIvarDecl)
251  ///
252  /// Objects are identified with only two Decls to make it reasonably fast to
253  /// compare them.
255  /// The base object decl, as described in the class documentation.
256  ///
257  /// The extra flag is "true" if the Base and Property are enough to uniquely
258  /// identify the object in memory.
259  ///
260  /// \sa isExactProfile()
261  using BaseInfoTy = llvm::PointerIntPair<const NamedDecl *, 1, bool>;
262  BaseInfoTy Base;
263 
264  /// The "property" decl, as described in the class documentation.
265  ///
266  /// Note that this may not actually be an ObjCPropertyDecl, e.g. in the
267  /// case of "implicit" properties (regular methods accessed via dot syntax).
268  const NamedDecl *Property = nullptr;
269 
270  /// Used to find the proper base profile for a given base expression.
271  static BaseInfoTy getBaseInfo(const Expr *BaseE);
272 
273  inline WeakObjectProfileTy();
274  static inline WeakObjectProfileTy getSentinel();
275 
276  public:
279  WeakObjectProfileTy(const DeclRefExpr *RE);
281 
282  const NamedDecl *getBase() const { return Base.getPointer(); }
283  const NamedDecl *getProperty() const { return Property; }
284 
285  /// Returns true if the object base specifies a known object in memory,
286  /// rather than, say, an instance variable or property of another object.
287  ///
288  /// Note that this ignores the effects of aliasing; that is, \c foo.bar is
289  /// considered an exact profile if \c foo is a local variable, even if
290  /// another variable \c foo2 refers to the same object as \c foo.
291  ///
292  /// For increased precision, accesses with base variables that are
293  /// properties or ivars of 'self' (e.g. self.prop1.prop2) are considered to
294  /// be exact, though this is not true for arbitrary variables
295  /// (foo.prop1.prop2).
296  bool isExactProfile() const {
297  return Base.getInt();
298  }
299 
300  bool operator==(const WeakObjectProfileTy &Other) const {
301  return Base == Other.Base && Property == Other.Property;
302  }
303 
304  // For use in DenseMap.
305  // We can't specialize the usual llvm::DenseMapInfo at the end of the file
306  // because by that point the DenseMap in FunctionScopeInfo has already been
307  // instantiated.
308  class DenseMapInfo {
309  public:
311  return WeakObjectProfileTy();
312  }
313 
315  return WeakObjectProfileTy::getSentinel();
316  }
317 
318  static unsigned getHashValue(const WeakObjectProfileTy &Val) {
319  using Pair = std::pair<BaseInfoTy, const NamedDecl *>;
320 
321  return llvm::DenseMapInfo<Pair>::getHashValue(Pair(Val.Base,
322  Val.Property));
323  }
324 
325  static bool isEqual(const WeakObjectProfileTy &LHS,
326  const WeakObjectProfileTy &RHS) {
327  return LHS == RHS;
328  }
329  };
330  };
331 
332  /// Represents a single use of a weak object.
333  ///
334  /// Stores both the expression and whether the access is potentially unsafe
335  /// (i.e. it could potentially be warned about).
336  ///
337  /// Part of the implementation of -Wrepeated-use-of-weak.
338  class WeakUseTy {
339  llvm::PointerIntPair<const Expr *, 1, bool> Rep;
340 
341  public:
342  WeakUseTy(const Expr *Use, bool IsRead) : Rep(Use, IsRead) {}
343 
344  const Expr *getUseExpr() const { return Rep.getPointer(); }
345  bool isUnsafe() const { return Rep.getInt(); }
346  void markSafe() { Rep.setInt(false); }
347 
348  bool operator==(const WeakUseTy &Other) const {
349  return Rep == Other.Rep;
350  }
351  };
352 
353  /// Used to collect uses of a particular weak object in a function body.
354  ///
355  /// Part of the implementation of -Wrepeated-use-of-weak.
357 
358  /// Used to collect all uses of weak objects in a function body.
359  ///
360  /// Part of the implementation of -Wrepeated-use-of-weak.
361  using WeakObjectUseMap =
362  llvm::SmallDenseMap<WeakObjectProfileTy, WeakUseVector, 8,
364 
365 private:
366  /// Used to collect all uses of weak objects in this function body.
367  ///
368  /// Part of the implementation of -Wrepeated-use-of-weak.
369  WeakObjectUseMap WeakObjectUses;
370 
371 protected:
372  FunctionScopeInfo(const FunctionScopeInfo&) = default;
373 
374 public:
383  NeedsCoroutineSuspends(true), ErrorTrap(Diag) {}
384 
385  virtual ~FunctionScopeInfo();
386 
387  /// Determine whether an unrecoverable error has occurred within this
388  /// function. Note that this may return false even if the function body is
389  /// invalid, because the errors may be suppressed if they're caused by prior
390  /// invalid declarations.
391  ///
392  /// FIXME: Migrate the caller of this to use containsErrors() instead once
393  /// it's ready.
395  return ErrorTrap.hasUnrecoverableErrorOccurred();
396  }
397 
398  /// Record that a weak object was accessed.
399  ///
400  /// Part of the implementation of -Wrepeated-use-of-weak.
401  template <typename ExprT>
402  inline void recordUseOfWeak(const ExprT *E, bool IsRead = true);
403 
404  void recordUseOfWeak(const ObjCMessageExpr *Msg,
405  const ObjCPropertyDecl *Prop);
406 
407  /// Record that a given expression is a "safe" access of a weak object (e.g.
408  /// assigning it to a strong variable.)
409  ///
410  /// Part of the implementation of -Wrepeated-use-of-weak.
411  void markSafeWeakUse(const Expr *E);
412 
414  return WeakObjectUses;
415  }
416 
418  HasBranchIntoScope = true;
419  }
420 
423  }
424 
426  HasIndirectGoto = true;
427  }
428 
429  void setHasMustTail() { HasMustTail = true; }
430 
432  HasDroppedStmt = true;
433  }
434 
437  }
438 
440  HasFallthroughStmt = true;
441  }
442 
444  UsesFPIntrin = true;
445  }
446 
449  FirstCXXOrObjCTryLoc = TryLoc;
451  }
452 
455  FirstCXXOrObjCTryLoc = TryLoc;
457  }
458 
461  FirstSEHTryLoc = TryLoc;
462  }
463 
464  bool NeedsScopeChecking() const {
465  return !HasDroppedStmt && (HasIndirectGoto || HasMustTail ||
467  }
468 
469  // Add a block introduced in this function.
470  void addBlock(const BlockDecl *BD) {
471  Blocks.insert(BD);
472  }
473 
474  // Add a __block variable introduced in this function.
476  ByrefBlockVars.push_back(VD);
477  }
478 
479  bool isCoroutine() const { return !FirstCoroutineStmtLoc.isInvalid(); }
480 
481  void setFirstCoroutineStmt(SourceLocation Loc, StringRef Keyword) {
482  assert(FirstCoroutineStmtLoc.isInvalid() &&
483  "first coroutine statement location already set");
484  FirstCoroutineStmtLoc = Loc;
485  FirstCoroutineStmtKind = llvm::StringSwitch<unsigned char>(Keyword)
486  .Case("co_return", 0)
487  .Case("co_await", 1)
488  .Case("co_yield", 2);
489  }
490 
491  StringRef getFirstCoroutineStmtKeyword() const {
493  && "no coroutine statement available");
494  switch (FirstCoroutineStmtKind) {
495  case 0: return "co_return";
496  case 1: return "co_await";
497  case 2: return "co_yield";
498  default:
499  llvm_unreachable("FirstCoroutineStmtKind has an invalid value");
500  };
501  }
502 
503  void setNeedsCoroutineSuspends(bool value = true) {
504  assert((!value || CoroutineSuspends.first == nullptr) &&
505  "we already have valid suspend points");
506  NeedsCoroutineSuspends = value;
507  }
508 
510  return !NeedsCoroutineSuspends && CoroutineSuspends.first == nullptr;
511  }
512 
513  void setCoroutineSuspends(Stmt *Initial, Stmt *Final) {
514  assert(Initial && Final && "suspend points cannot be null");
515  assert(CoroutineSuspends.first == nullptr && "suspend points already set");
516  NeedsCoroutineSuspends = false;
517  CoroutineSuspends.first = Initial;
518  CoroutineSuspends.second = Final;
519  }
520 
521  /// Clear out the information in this function scope, making it
522  /// suitable for reuse.
523  void Clear();
524 
525  bool isPlainFunction() const { return Kind == SK_Function; }
526 };
527 
528 class Capture {
529  // There are three categories of capture: capturing 'this', capturing
530  // local variables, and C++1y initialized captures (which can have an
531  // arbitrary initializer, and don't really capture in the traditional
532  // sense at all).
533  //
534  // There are three ways to capture a local variable:
535  // - capture by copy in the C++11 sense,
536  // - capture by reference in the C++11 sense, and
537  // - __block capture.
538  // Lambdas explicitly specify capture by copy or capture by reference.
539  // For blocks, __block capture applies to variables with that annotation,
540  // variables of reference type are captured by reference, and other
541  // variables are captured by copy.
542  enum CaptureKind {
543  Cap_ByCopy, Cap_ByRef, Cap_Block, Cap_VLA
544  };
545 
546  union {
547  /// If Kind == Cap_VLA, the captured type.
549 
550  /// Otherwise, the captured variable (if any).
552  };
553 
554  /// The source location at which the first capture occurred.
555  SourceLocation Loc;
556 
557  /// The location of the ellipsis that expands a parameter pack.
558  SourceLocation EllipsisLoc;
559 
560  /// The type as it was captured, which is the type of the non-static data
561  /// member that would hold the capture.
562  QualType CaptureType;
563 
564  /// The CaptureKind of this capture.
565  unsigned Kind : 2;
566 
567  /// Whether this is a nested capture (a capture of an enclosing capturing
568  /// scope's capture).
569  unsigned Nested : 1;
570 
571  /// Whether this is a capture of '*this'.
572  unsigned CapturesThis : 1;
573 
574  /// Whether an explicit capture has been odr-used in the body of the
575  /// lambda.
576  unsigned ODRUsed : 1;
577 
578  /// Whether an explicit capture has been non-odr-used in the body of
579  /// the lambda.
580  unsigned NonODRUsed : 1;
581 
582  /// Whether the capture is invalid (a capture was required but the entity is
583  /// non-capturable).
584  unsigned Invalid : 1;
585 
586 public:
587  Capture(VarDecl *Var, bool Block, bool ByRef, bool IsNested,
588  SourceLocation Loc, SourceLocation EllipsisLoc, QualType CaptureType,
589  bool Invalid)
590  : CapturedVar(Var), Loc(Loc), EllipsisLoc(EllipsisLoc),
591  CaptureType(CaptureType),
592  Kind(Block ? Cap_Block : ByRef ? Cap_ByRef : Cap_ByCopy),
593  Nested(IsNested), CapturesThis(false), ODRUsed(false),
594  NonODRUsed(false), Invalid(Invalid) {}
595 
597  Capture(IsThisCapture, bool IsNested, SourceLocation Loc,
598  QualType CaptureType, const bool ByCopy, bool Invalid)
599  : Loc(Loc), CaptureType(CaptureType),
600  Kind(ByCopy ? Cap_ByCopy : Cap_ByRef), Nested(IsNested),
601  CapturesThis(true), ODRUsed(false), NonODRUsed(false),
602  Invalid(Invalid) {}
603 
605  Capture(IsVLACapture, const VariableArrayType *VLA, bool IsNested,
606  SourceLocation Loc, QualType CaptureType)
607  : CapturedVLA(VLA), Loc(Loc), CaptureType(CaptureType), Kind(Cap_VLA),
608  Nested(IsNested), CapturesThis(false), ODRUsed(false),
609  NonODRUsed(false), Invalid(false) {}
610 
611  bool isThisCapture() const { return CapturesThis; }
612  bool isVariableCapture() const {
613  return !isThisCapture() && !isVLATypeCapture();
614  }
615 
616  bool isCopyCapture() const { return Kind == Cap_ByCopy; }
617  bool isReferenceCapture() const { return Kind == Cap_ByRef; }
618  bool isBlockCapture() const { return Kind == Cap_Block; }
619  bool isVLATypeCapture() const { return Kind == Cap_VLA; }
620 
621  bool isNested() const { return Nested; }
622 
623  bool isInvalid() const { return Invalid; }
624 
625  /// Determine whether this capture is an init-capture.
626  bool isInitCapture() const;
627 
628  bool isODRUsed() const { return ODRUsed; }
629  bool isNonODRUsed() const { return NonODRUsed; }
630  void markUsed(bool IsODRUse) {
631  if (IsODRUse)
632  ODRUsed = true;
633  else
634  NonODRUsed = true;
635  }
636 
637  VarDecl *getVariable() const {
638  assert(isVariableCapture());
639  return CapturedVar;
640  }
641 
643  assert(isVLATypeCapture());
644  return CapturedVLA;
645  }
646 
647  /// Retrieve the location at which this variable was captured.
648  SourceLocation getLocation() const { return Loc; }
649 
650  /// Retrieve the source location of the ellipsis, whose presence
651  /// indicates that the capture is a pack expansion.
652  SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
653 
654  /// Retrieve the capture type for this capture, which is effectively
655  /// the type of the non-static data member in the lambda/block structure
656  /// that would store this capture.
657  QualType getCaptureType() const { return CaptureType; }
658 };
659 
661 protected:
662  CapturingScopeInfo(const CapturingScopeInfo&) = default;
663 
664 public:
668  };
669 
671 
674 
675  /// CaptureMap - A map of captured variables to (index+1) into Captures.
676  llvm::DenseMap<VarDecl*, unsigned> CaptureMap;
677 
678  /// CXXThisCaptureIndex - The (index+1) of the capture of 'this';
679  /// zero if 'this' is not captured.
680  unsigned CXXThisCaptureIndex = 0;
681 
682  /// Captures - The captures.
684 
685  /// - Whether the target type of return statements in this context
686  /// is deduced (e.g. a lambda or block with omitted return type).
687  bool HasImplicitReturnType = false;
688 
689  /// ReturnType - The target type of return statements in this context,
690  /// or null if unknown.
692 
693  void addCapture(VarDecl *Var, bool isBlock, bool isByref, bool isNested,
694  SourceLocation Loc, SourceLocation EllipsisLoc,
695  QualType CaptureType, bool Invalid) {
696  Captures.push_back(Capture(Var, isBlock, isByref, isNested, Loc,
697  EllipsisLoc, CaptureType, Invalid));
698  CaptureMap[Var] = Captures.size();
699  }
700 
702  QualType CaptureType) {
703  Captures.push_back(Capture(Capture::VLACapture, VLAType,
704  /*FIXME: IsNested*/ false, Loc, CaptureType));
705  }
706 
707  void addThisCapture(bool isNested, SourceLocation Loc, QualType CaptureType,
708  bool ByCopy);
709 
710  /// Determine whether the C++ 'this' is captured.
711  bool isCXXThisCaptured() const { return CXXThisCaptureIndex != 0; }
712 
713  /// Retrieve the capture of C++ 'this', if it has been captured.
715  assert(isCXXThisCaptured() && "this has not been captured");
716  return Captures[CXXThisCaptureIndex - 1];
717  }
718 
719  /// Determine whether the given variable has been captured.
720  bool isCaptured(VarDecl *Var) const {
721  return CaptureMap.count(Var);
722  }
723 
724  /// Determine whether the given variable-array type has been captured.
725  bool isVLATypeCaptured(const VariableArrayType *VAT) const;
726 
727  /// Retrieve the capture of the given variable, if it has been
728  /// captured already.
730  assert(isCaptured(Var) && "Variable has not been captured");
731  return Captures[CaptureMap[Var] - 1];
732  }
733 
734  const Capture &getCapture(VarDecl *Var) const {
735  llvm::DenseMap<VarDecl*, unsigned>::const_iterator Known
736  = CaptureMap.find(Var);
737  assert(Known != CaptureMap.end() && "Variable has not been captured");
738  return Captures[Known->second - 1];
739  }
740 
741  static bool classof(const FunctionScopeInfo *FSI) {
742  return FSI->Kind == SK_Block || FSI->Kind == SK_Lambda
743  || FSI->Kind == SK_CapturedRegion;
744  }
745 };
746 
747 /// Retains information about a block that is currently being parsed.
748 class BlockScopeInfo final : public CapturingScopeInfo {
749 public:
751 
752  /// TheScope - This is the scope for the block itself, which contains
753  /// arguments etc.
755 
756  /// BlockType - The function type of the block, if one was given.
757  /// Its return type may be BuiltinType::Dependent.
759 
762  TheScope(BlockScope) {
763  Kind = SK_Block;
764  }
765 
766  ~BlockScopeInfo() override;
767 
768  static bool classof(const FunctionScopeInfo *FSI) {
769  return FSI->Kind == SK_Block;
770  }
771 };
772 
773 /// Retains information about a captured region.
775 public:
776  /// The CapturedDecl for this statement.
778 
779  /// The captured record type.
781 
782  /// This is the enclosing scope of the captured region.
784 
785  /// The implicit parameter for the captured variables.
787 
788  /// The kind of captured region.
789  unsigned short CapRegionKind;
790 
791  unsigned short OpenMPLevel;
792  unsigned short OpenMPCaptureLevel;
793 
795  RecordDecl *RD, ImplicitParamDecl *Context,
796  CapturedRegionKind K, unsigned OpenMPLevel,
797  unsigned OpenMPCaptureLevel)
803  }
804 
805  ~CapturedRegionScopeInfo() override;
806 
807  /// A descriptive name for the kind of captured region this is.
808  StringRef getRegionName() const {
809  switch (CapRegionKind) {
810  case CR_Default:
811  return "default captured statement";
812  case CR_ObjCAtFinally:
813  return "Objective-C @finally statement";
814  case CR_OpenMP:
815  return "OpenMP region";
816  }
817  llvm_unreachable("Invalid captured region kind!");
818  }
819 
820  static bool classof(const FunctionScopeInfo *FSI) {
821  return FSI->Kind == SK_CapturedRegion;
822  }
823 };
824 
825 class LambdaScopeInfo final :
827 public:
828  /// The class that describes the lambda.
829  CXXRecordDecl *Lambda = nullptr;
830 
831  /// The lambda's compiler-generated \c operator().
833 
834  /// Source range covering the lambda introducer [...].
836 
837  /// Source location of the '&' or '=' specifying the default capture
838  /// type, if any.
840 
841  /// The number of captures in the \c Captures list that are
842  /// explicit captures.
843  unsigned NumExplicitCaptures = 0;
844 
845  /// Whether this is a mutable lambda.
846  bool Mutable = false;
847 
848  /// Whether the (empty) parameter list is explicit.
849  bool ExplicitParams = false;
850 
851  /// Whether any of the capture expressions requires cleanups.
853 
854  /// Whether the lambda contains an unexpanded parameter pack.
856 
857  /// Packs introduced by this lambda, if any.
859 
860  /// Source range covering the explicit template parameter list (if it exists).
862 
863  /// The requires-clause immediately following the explicit template parameter
864  /// list, if any. (Note that there may be another requires-clause included as
865  /// part of the lambda-declarator.)
867 
868  /// If this is a generic lambda, and the template parameter
869  /// list has been created (from the TemplateParams) then store
870  /// a reference to it (cache it to avoid reconstructing it).
872 
873  /// Contains all variable-referring-expressions (i.e. DeclRefExprs
874  /// or MemberExprs) that refer to local variables in a generic lambda
875  /// or a lambda in a potentially-evaluated-if-used context.
876  ///
877  /// Potentially capturable variables of a nested lambda that might need
878  /// to be captured by the lambda are housed here.
879  /// This is specifically useful for generic lambdas or
880  /// lambdas within a potentially evaluated-if-used context.
881  /// If an enclosing variable is named in an expression of a lambda nested
882  /// within a generic lambda, we don't always know know whether the variable
883  /// will truly be odr-used (i.e. need to be captured) by that nested lambda,
884  /// until its instantiation. But we still need to capture it in the
885  /// enclosing lambda if all intervening lambdas can capture the variable.
887 
888  /// Contains all variable-referring-expressions that refer
889  /// to local variables that are usable as constant expressions and
890  /// do not involve an odr-use (they may still need to be captured
891  /// if the enclosing full-expression is instantiation dependent).
892  llvm::SmallSet<Expr *, 8> NonODRUsedCapturingExprs;
893 
894  /// A map of explicit capture indices to their introducer source ranges.
895  llvm::DenseMap<unsigned, SourceRange> ExplicitCaptureRanges;
896 
897  /// Contains all of the variables defined in this lambda that shadow variables
898  /// that were defined in parent contexts. Used to avoid warnings when the
899  /// shadowed variables are uncaptured by this lambda.
901  const VarDecl *VD;
903  };
905 
907 
910  Kind = SK_Lambda;
911  }
912 
913  /// Note when all explicit captures have been added.
915  NumExplicitCaptures = Captures.size();
916  }
917 
918  static bool classof(const FunctionScopeInfo *FSI) {
919  return FSI->Kind == SK_Lambda;
920  }
921 
922  /// Is this scope known to be for a generic lambda? (This will be false until
923  /// we parse a template parameter list or the first 'auto'-typed parameter).
924  bool isGenericLambda() const {
925  return !TemplateParams.empty() || GLTemplateParameterList;
926  }
927 
928  /// Add a variable that might potentially be captured by the
929  /// lambda and therefore the enclosing lambdas.
930  ///
931  /// This is also used by enclosing lambda's to speculatively capture
932  /// variables that nested lambda's - depending on their enclosing
933  /// specialization - might need to capture.
934  /// Consider:
935  /// void f(int, int); <-- don't capture
936  /// void f(const int&, double); <-- capture
937  /// void foo() {
938  /// const int x = 10;
939  /// auto L = [=](auto a) { // capture 'x'
940  /// return [=](auto b) {
941  /// f(x, a); // we may or may not need to capture 'x'
942  /// };
943  /// };
944  /// }
945  void addPotentialCapture(Expr *VarExpr) {
946  assert(isa<DeclRefExpr>(VarExpr) || isa<MemberExpr>(VarExpr) ||
947  isa<FunctionParmPackExpr>(VarExpr));
948  PotentiallyCapturingExprs.push_back(VarExpr);
949  }
950 
953  }
954 
955  bool hasPotentialThisCapture() const {
957  }
958 
959  /// Mark a variable's reference in a lambda as non-odr using.
960  ///
961  /// For generic lambdas, if a variable is named in a potentially evaluated
962  /// expression, where the enclosing full expression is dependent then we
963  /// must capture the variable (given a default capture).
964  /// This is accomplished by recording all references to variables
965  /// (DeclRefExprs or MemberExprs) within said nested lambda in its array of
966  /// PotentialCaptures. All such variables have to be captured by that lambda,
967  /// except for as described below.
968  /// If that variable is usable as a constant expression and is named in a
969  /// manner that does not involve its odr-use (e.g. undergoes
970  /// lvalue-to-rvalue conversion, or discarded) record that it is so. Upon the
971  /// act of analyzing the enclosing full expression (ActOnFinishFullExpr)
972  /// if we can determine that the full expression is not instantiation-
973  /// dependent, then we can entirely avoid its capture.
974  ///
975  /// const int n = 0;
976  /// [&] (auto x) {
977  /// (void)+n + x;
978  /// };
979  /// Interestingly, this strategy would involve a capture of n, even though
980  /// it's obviously not odr-used here, because the full-expression is
981  /// instantiation-dependent. It could be useful to avoid capturing such
982  /// variables, even when they are referred to in an instantiation-dependent
983  /// expression, if we can unambiguously determine that they shall never be
984  /// odr-used. This would involve removal of the variable-referring-expression
985  /// from the array of PotentialCaptures during the lvalue-to-rvalue
986  /// conversions. But per the working draft N3797, (post-chicago 2013) we must
987  /// capture such variables.
988  /// Before anyone is tempted to implement a strategy for not-capturing 'n',
989  /// consider the insightful warning in:
990  /// /cfe-commits/Week-of-Mon-20131104/092596.html
991  /// "The problem is that the set of captures for a lambda is part of the ABI
992  /// (since lambda layout can be made visible through inline functions and the
993  /// like), and there are no guarantees as to which cases we'll manage to build
994  /// an lvalue-to-rvalue conversion in, when parsing a template -- some
995  /// seemingly harmless change elsewhere in Sema could cause us to start or stop
996  /// building such a node. So we need a rule that anyone can implement and get
997  /// exactly the same result".
998  void markVariableExprAsNonODRUsed(Expr *CapturingVarExpr) {
999  assert(isa<DeclRefExpr>(CapturingVarExpr) ||
1000  isa<MemberExpr>(CapturingVarExpr) ||
1001  isa<FunctionParmPackExpr>(CapturingVarExpr));
1002  NonODRUsedCapturingExprs.insert(CapturingVarExpr);
1003  }
1004  bool isVariableExprMarkedAsNonODRUsed(Expr *CapturingVarExpr) const {
1005  assert(isa<DeclRefExpr>(CapturingVarExpr) ||
1006  isa<MemberExpr>(CapturingVarExpr) ||
1007  isa<FunctionParmPackExpr>(CapturingVarExpr));
1008  return NonODRUsedCapturingExprs.count(CapturingVarExpr);
1009  }
1011  llvm::erase_value(PotentiallyCapturingExprs, E);
1012  }
1014  PotentiallyCapturingExprs.clear();
1016  }
1018  return PotentiallyCapturingExprs.size();
1019  }
1020 
1021  bool hasPotentialCaptures() const {
1024  }
1025 
1027  llvm::function_ref<void(VarDecl *, Expr *)> Callback) const;
1028 };
1029 
1030 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy()
1031  : Base(nullptr, false) {}
1032 
1033 FunctionScopeInfo::WeakObjectProfileTy
1034 FunctionScopeInfo::WeakObjectProfileTy::getSentinel() {
1035  FunctionScopeInfo::WeakObjectProfileTy Result;
1036  Result.Base.setInt(true);
1037  return Result;
1038 }
1039 
1040 template <typename ExprT>
1041 void FunctionScopeInfo::recordUseOfWeak(const ExprT *E, bool IsRead) {
1042  assert(E);
1043  WeakUseVector &Uses = WeakObjectUses[WeakObjectProfileTy(E)];
1044  Uses.push_back(WeakUseTy(E, IsRead));
1045 }
1046 
1047 inline void CapturingScopeInfo::addThisCapture(bool isNested,
1048  SourceLocation Loc,
1049  QualType CaptureType,
1050  bool ByCopy) {
1051  Captures.push_back(Capture(Capture::ThisCapture, isNested, Loc, CaptureType,
1052  ByCopy, /*Invalid*/ false));
1053  CXXThisCaptureIndex = Captures.size();
1054 }
1055 
1056 } // namespace sema
1057 
1058 } // namespace clang
1059 
1060 #endif // LLVM_CLANG_SEMA_SCOPEINFO_H
clang::sema::CapturedRegionScopeInfo::classof
static bool classof(const FunctionScopeInfo *FSI)
Definition: ScopeInfo.h:820
clang::sema::FunctionScopeInfo::WeakObjectProfileTy::DenseMapInfo::getHashValue
static unsigned getHashValue(const WeakObjectProfileTy &Val)
Definition: ScopeInfo.h:318
clang::sema::FunctionScopeInfo::WeakObjectProfileTy::DenseMapInfo::getTombstoneKey
static WeakObjectProfileTy getTombstoneKey()
Definition: ScopeInfo.h:314
clang::sema::CapturingScopeInfo::addCapture
void addCapture(VarDecl *Var, bool isBlock, bool isByref, bool isNested, SourceLocation Loc, SourceLocation EllipsisLoc, QualType CaptureType, bool Invalid)
Definition: ScopeInfo.h:693
clang::sema::Capture::isThisCapture
bool isThisCapture() const
Definition: ScopeInfo.h:611
clang::sema::LambdaScopeInfo::ExplicitTemplateParamsRange
SourceRange ExplicitTemplateParamsRange
Source range covering the explicit template parameter list (if it exists).
Definition: ScopeInfo.h:861
clang::sema::FunctionScopeInfo::NeedsCoroutineSuspends
bool NeedsCoroutineSuspends
True only when this function has not already built, or attempted to build, the initial and final coro...
Definition: ScopeInfo.h:164
clang::sema::FunctionScopeInfo::PossiblyUnreachableDiags
SmallVector< PossiblyUnreachableDiag, 4 > PossiblyUnreachableDiags
A list of PartialDiagnostics created but delayed within the current function scope.
Definition: ScopeInfo.h:225
clang::sema::Capture::markUsed
void markUsed(bool IsODRUse)
Definition: ScopeInfo.h:630
clang::sema::Capture::getLocation
SourceLocation getLocation() const
Retrieve the location at which this variable was captured.
Definition: ScopeInfo.h:648
clang::InventedTemplateParameterInfo
Definition: DeclSpec.h:2711
clang::sema::FunctionScopeInfo::getWeakObjectUses
const WeakObjectUseMap & getWeakObjectUses() const
Definition: ScopeInfo.h:413
clang::sema::FunctionScopeInfo::setHasFallthroughStmt
void setHasFallthroughStmt()
Definition: ScopeInfo.h:439
clang::sema::FunctionScopeInfo::getFirstCoroutineStmtKeyword
StringRef getFirstCoroutineStmtKeyword() const
Definition: ScopeInfo.h:491
clang::sema::FunctionScopeInfo::Kind
ScopeKind Kind
What kind of scope we are describing.
Definition: ScopeInfo.h:108
clang::sema::Capture::isODRUsed
bool isODRUsed() const
Definition: ScopeInfo.h:628
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:210
clang::sema::FunctionScopeInfo::CoroutineSuspends
std::pair< Stmt *, Stmt * > CoroutineSuspends
The initial and final coroutine suspend points.
Definition: ScopeInfo.h:210
clang::sema::LambdaScopeInfo::ExplicitParams
bool ExplicitParams
Whether the (empty) parameter list is explicit.
Definition: ScopeInfo.h:849
clang::sema::CapturedRegionScopeInfo::CapturedRegionScopeInfo
CapturedRegionScopeInfo(DiagnosticsEngine &Diag, Scope *S, CapturedDecl *CD, RecordDecl *RD, ImplicitParamDecl *Context, CapturedRegionKind K, unsigned OpenMPLevel, unsigned OpenMPCaptureLevel)
Definition: ScopeInfo.h:794
Diag
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.
Definition: LiteralSupport.cpp:78
clang::sema::FunctionScopeInfo::SK_Lambda
@ SK_Lambda
Definition: ScopeInfo.h:102
clang::sema::BlockScopeInfo::BlockScopeInfo
BlockScopeInfo(DiagnosticsEngine &Diag, Scope *BlockScope, BlockDecl *Block)
Definition: ScopeInfo.h:760
clang::sema::FunctionScopeInfo::ByrefBlockVars
llvm::TinyPtrVector< VarDecl * > ByrefBlockVars
The set of __block variables that are introduced in this function.
Definition: ScopeInfo.h:220
clang::sema::CapturingScopeInfo::CapturingScopeInfo
CapturingScopeInfo(const CapturingScopeInfo &)=default
clang::sema::Capture::isInitCapture
bool isInitCapture() const
Determine whether this capture is an init-capture.
Definition: ScopeInfo.cpp:220
clang::sema::Capture::getVariable
VarDecl * getVariable() const
Definition: ScopeInfo.h:637
clang::sema::LambdaScopeInfo::Mutable
bool Mutable
Whether this is a mutable lambda.
Definition: ScopeInfo.h:846
llvm::SmallVector< SwitchInfo, 8 >
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::sema::Capture::isReferenceCapture
bool isReferenceCapture() const
Definition: ScopeInfo.h:617
clang::sema::FunctionScopeInfo::setUsesFPIntrin
void setUsesFPIntrin()
Definition: ScopeInfo.h:443
clang::sema::FunctionScopeInfo::SwitchInfo
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:191
clang::sema::FunctionScopeInfo::Clear
void Clear()
Clear out the information in this function scope, making it suitable for reuse.
Definition: ScopeInfo.cpp:25
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:247
clang::sema::FunctionScopeInfo::CoroutineParameterMoves
llvm::SmallMapVector< ParmVarDecl *, Stmt *, 4 > CoroutineParameterMoves
A mapping between the coroutine function parameters that were moved to the coroutine frame,...
Definition: ScopeInfo.h:207
clang::sema::FunctionScopeInfo::FirstTryType
enum clang::sema::FunctionScopeInfo::@233 FirstTryType
clang::sema::FunctionScopeInfo::HasBranchIntoScope
bool HasBranchIntoScope
Whether this function contains any switches or direct gotos.
Definition: ScopeInfo.h:115
clang::sema::Capture::Capture
Capture(IsThisCapture, bool IsNested, SourceLocation Loc, QualType CaptureType, const bool ByCopy, bool Invalid)
Definition: ScopeInfo.h:597
clang::sema::LambdaScopeInfo::NumExplicitCaptures
unsigned NumExplicitCaptures
The number of captures in the Captures list that are explicit captures.
Definition: ScopeInfo.h:843
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:675
clang::sema::FunctionScopeInfo::FirstCoroutineStmtKind
unsigned char FirstCoroutineStmtKind
An enumeration represeting the kind of the first coroutine statement in the function.
Definition: ScopeInfo.h:168
clang::sema::FunctionScopeInfo::addByrefBlockVar
void addByrefBlockVar(VarDecl *VD)
Definition: ScopeInfo.h:475
clang::sema::FunctionScopeInfo::setHasOMPDeclareReductionCombiner
void setHasOMPDeclareReductionCombiner()
Definition: ScopeInfo.h:435
clang::sema::FunctionScopeInfo::WeakObjectProfileTy::isExactProfile
bool isExactProfile() const
Returns true if the object base specifies a known object in memory, rather than, say,...
Definition: ScopeInfo.h:296
clang::sema::FunctionScopeInfo::NeedsScopeChecking
bool NeedsScopeChecking() const
Definition: ScopeInfo.h:464
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:192
clang::sema::CompoundScopeInfo::CompoundScopeInfo
CompoundScopeInfo(bool IsStmtExpr)
Definition: ScopeInfo.h:77
clang::sema::LambdaScopeInfo::GLTemplateParameterList
TemplateParameterList * GLTemplateParameterList
If this is a generic lambda, and the template parameter list has been created (from the TemplateParam...
Definition: ScopeInfo.h:871
clang::sema::FunctionScopeInfo::WeakObjectProfileTy::DenseMapInfo::isEqual
static bool isEqual(const WeakObjectProfileTy &LHS, const WeakObjectProfileTy &RHS)
Definition: ScopeInfo.h:325
clang::CapturedRegionKind
CapturedRegionKind
The different kinds of captured statement.
Definition: CapturedStmt.h:16
clang::sema::CapturingScopeInfo::ImplicitCaptureStyle
ImplicitCaptureStyle
Definition: ScopeInfo.h:665
clang::sema::CapturingScopeInfo::addVLATypeCapture
void addVLATypeCapture(SourceLocation Loc, const VariableArrayType *VLAType, QualType CaptureType)
Definition: ScopeInfo.h:701
llvm::SmallPtrSet
Definition: ASTContext.h:82
clang::sema::FunctionScopeInfo::FirstSEHTryLoc
SourceLocation FirstSEHTryLoc
First SEH '__try' statement in the current function.
Definition: ScopeInfo.h:182
clang::sema::FunctionScopeInfo::WeakUseTy::operator==
bool operator==(const WeakUseTy &Other) const
Definition: ScopeInfo.h:348
clang::DiagnosticErrorTrap::hasUnrecoverableErrorOccurred
bool hasUnrecoverableErrorOccurred() const
Determine whether any unrecoverable errors have occurred since this object instance was created.
Definition: Diagnostic.h:1088
clang::sema::FunctionScopeInfo::SK_Function
@ SK_Function
Definition: ScopeInfo.h:100
clang::sema::FunctionScopeInfo::TryLocIsObjC
@ TryLocIsObjC
Definition: ScopeInfo.h:179
clang::sema::LambdaScopeInfo::LambdaScopeInfo
LambdaScopeInfo(DiagnosticsEngine &Diag)
Definition: ScopeInfo.h:908
DeclSpec.h
clang::sema::FunctionScopeInfo::UsesFPIntrin
bool UsesFPIntrin
Whether this function uses constrained floating point intrinsics.
Definition: ScopeInfo.h:134
clang::sema::BlockScopeInfo::TheDecl
BlockDecl * TheDecl
Definition: ScopeInfo.h:750
clang::sema::Capture
Definition: ScopeInfo.h:528
clang::sema::LambdaScopeInfo::isGenericLambda
bool isGenericLambda() const
Is this scope known to be for a generic lambda? (This will be false until we parse a template paramet...
Definition: ScopeInfo.h:924
clang::sema::LambdaScopeInfo::ShadowedOuterDecl
Contains all of the variables defined in this lambda that shadow variables that were defined in paren...
Definition: ScopeInfo.h:900
clang::sema::CapturingScopeInfo::classof
static bool classof(const FunctionScopeInfo *FSI)
Definition: ScopeInfo.h:741
clang::CapturedDecl
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4390
clang::sema::BlockScopeInfo
Retains information about a block that is currently being parsed.
Definition: ScopeInfo.h:748
clang::sema::LambdaScopeInfo::RequiresClause
ExprResult RequiresClause
The requires-clause immediately following the explicit template parameter list, if any.
Definition: ScopeInfo.h:866
clang::sema::LambdaScopeInfo::finishedExplicitCaptures
void finishedExplicitCaptures()
Note when all explicit captures have been added.
Definition: ScopeInfo.h:914
clang::DiagnosticErrorTrap
RAII class that determines when any errors have occurred between the time the instance was created an...
Definition: Diagnostic.h:1071
clang::sema::FunctionScopeInfo::Returns
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:200
clang::sema::FunctionScopeInfo::WeakUseTy::WeakUseTy
WeakUseTy(const Expr *Use, bool IsRead)
Definition: ScopeInfo.h:342
clang::sema::LambdaScopeInfo::CallOperator
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
Definition: ScopeInfo.h:832
clang::sema::BlockScopeInfo::classof
static bool classof(const FunctionScopeInfo *FSI)
Definition: ScopeInfo.h:768
clang::sema::Capture::IsVLACapture
IsVLACapture
Definition: ScopeInfo.h:604
clang::sema::FunctionScopeInfo::SK_Block
@ SK_Block
Definition: ScopeInfo.h:101
clang::sema::Capture::isCopyCapture
bool isCopyCapture() const
Definition: ScopeInfo.h:616
clang::sema::FunctionScopeInfo::setHasBranchProtectedScope
void setHasBranchProtectedScope()
Definition: ScopeInfo.h:421
clang::sema::CapturedRegionScopeInfo
Retains information about a captured region.
Definition: ScopeInfo.h:774
clang::sema::FunctionScopeInfo::recordUseOfWeak
void recordUseOfWeak(const ExprT *E, bool IsRead=true)
Record that a weak object was accessed.
Definition: ScopeInfo.h:1041
clang::sema::FunctionScopeInfo::WeakUseVector
SmallVector< WeakUseTy, 4 > WeakUseVector
Used to collect uses of a particular weak object in a function body.
Definition: ScopeInfo.h:356
clang::sema::Capture::ThisCapture
@ ThisCapture
Definition: ScopeInfo.h:596
clang::sema::CapturingScopeInfo::ImpCap_Block
@ ImpCap_Block
Definition: ScopeInfo.h:666
clang::ObjCPropertyRefExpr
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:614
clang::sema::CapturedRegionScopeInfo::CapRegionKind
unsigned short CapRegionKind
The kind of captured region.
Definition: ScopeInfo.h:789
clang::sema::PossiblyUnreachableDiag::Loc
SourceLocation Loc
Definition: ScopeInfo.h:87
clang::sema::LambdaScopeInfo::Lambda
CXXRecordDecl * Lambda
The class that describes the lambda.
Definition: ScopeInfo.h:829
clang::sema::FunctionScopeInfo::WeakUseTy::isUnsafe
bool isUnsafe() const
Definition: ScopeInfo.h:345
clang::CR_ObjCAtFinally
@ CR_ObjCAtFinally
Definition: CapturedStmt.h:18
clang::sema::PossiblyUnreachableDiag::Stmts
llvm::TinyPtrVector< const Stmt * > Stmts
Definition: ScopeInfo.h:88
clang::sema::LambdaScopeInfo::getNumPotentialVariableCaptures
unsigned getNumPotentialVariableCaptures() const
Definition: ScopeInfo.h:1017
clang::sema::FunctionScopeInfo::Blocks
llvm::SmallPtrSet< const BlockDecl *, 1 > Blocks
The set of blocks that are introduced in this function.
Definition: ScopeInfo.h:217
clang::sema::FunctionScopeInfo::HasMustTail
bool HasMustTail
Whether this function contains any statement marked with [[clang::musttail]].
Definition: ScopeInfo.h:122
clang::sema::Capture::CapturedVLA
const VariableArrayType * CapturedVLA
If Kind == Cap_VLA, the captured type.
Definition: ScopeInfo.h:548
clang::sema::LambdaScopeInfo::markVariableExprAsNonODRUsed
void markVariableExprAsNonODRUsed(Expr *CapturingVarExpr)
Mark a variable's reference in a lambda as non-odr using.
Definition: ScopeInfo.h:998
clang::sema::LambdaScopeInfo::removePotentialCapture
void removePotentialCapture(Expr *E)
Definition: ScopeInfo.h:1010
clang::BlockDecl
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4201
clang::sema::FunctionScopeInfo::WeakObjectProfileTy::DenseMapInfo
Definition: ScopeInfo.h:308
clang::sema::FunctionScopeInfo::HasDroppedStmt
bool HasDroppedStmt
Whether a statement was dropped because it was invalid.
Definition: ScopeInfo.h:125
clang::sema::CompoundScopeInfo::IsStmtExpr
bool IsStmtExpr
Whether this compound statement corresponds to a GNU statement expression.
Definition: ScopeInfo.h:75
clang::Scope
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:40
clang::sema::Capture::getCapturedVLAType
const VariableArrayType * getCapturedVLAType() const
Definition: ScopeInfo.h:642
clang::sema::LambdaScopeInfo::PotentialThisCaptureLocation
SourceLocation PotentialThisCaptureLocation
Definition: ScopeInfo.h:906
clang::sema::PossiblyUnreachableDiag::PD
PartialDiagnostic PD
Definition: ScopeInfo.h:86
clang::sema::Capture::getCaptureType
QualType getCaptureType() const
Retrieve the capture type for this capture, which is effectively the type of the non-static data memb...
Definition: ScopeInfo.h:657
clang::sema::FunctionScopeInfo::setHasCXXTry
void setHasCXXTry(SourceLocation TryLoc)
Definition: ScopeInfo.h:447
clang::sema::FunctionScopeInfo::setHasIndirectGoto
void setHasIndirectGoto()
Definition: ScopeInfo.h:425
clang::sema::FunctionScopeInfo::hasUnrecoverableErrorOccurred
bool hasUnrecoverableErrorOccurred() const
Determine whether an unrecoverable error has occurred within this function.
Definition: ScopeInfo.h:394
clang::sema::CapturingScopeInfo::ImpCap_None
@ ImpCap_None
Definition: ScopeInfo.h:666
clang::sema::Capture::isInvalid
bool isInvalid() const
Definition: ScopeInfo.h:623
clang::sema::LambdaScopeInfo::hasPotentialThisCapture
bool hasPotentialThisCapture() const
Definition: ScopeInfo.h:955
clang::sema::FunctionScopeInfo::CoroutinePromise
VarDecl * CoroutinePromise
The promise object for this coroutine, if any.
Definition: ScopeInfo.h:203
clang::sema::CompoundScopeInfo::HasEmptyLoopBodies
bool HasEmptyLoopBodies
Whether this compound stamement contains ‘for’ or ‘while’ loops with empty bodies.
Definition: ScopeInfo.h:71
clang::sema::Capture::isNonODRUsed
bool isNonODRUsed() const
Definition: ScopeInfo.h:629
clang::sema::LambdaScopeInfo::hasPotentialCaptures
bool hasPotentialCaptures() const
Definition: ScopeInfo.h:1021
clang::sema::FunctionScopeInfo::WeakUseTy
Represents a single use of a weak object.
Definition: ScopeInfo.h:338
clang::sema::CapturedRegionScopeInfo::getRegionName
StringRef getRegionName() const
A descriptive name for the kind of captured region this is.
Definition: ScopeInfo.h:808
clang::sema::FunctionScopeInfo::SwitchStack
SmallVector< SwitchInfo, 8 > SwitchStack
SwitchStack - This is the current set of active switch statements in the block.
Definition: ScopeInfo.h:195
clang::sema::FunctionScopeInfo::HasBranchProtectedScope
bool HasBranchProtectedScope
Whether this function contains a VLA, @try, try, C++ initializer, or anything else that can't be jump...
Definition: ScopeInfo.h:112
clang::sema::FunctionScopeInfo::HasPotentialAvailabilityViolations
bool HasPotentialAvailabilityViolations
Whether we make reference to a declaration that could be unavailable.
Definition: ScopeInfo.h:138
Type.h
clang::sema::CapturingScopeInfo::ImpCap_CapturedRegion
@ ImpCap_CapturedRegion
Definition: ScopeInfo.h:667
clang::ImplicitParamDecl
Definition: Decl.h:1613
clang::sema::FunctionScopeInfo::setHasBranchIntoScope
void setHasBranchIntoScope()
Definition: ScopeInfo.h:417
clang::CR_OpenMP
@ CR_OpenMP
Definition: CapturedStmt.h:19
Expr.h
clang::sema::FunctionScopeInfo::ScopeKind
ScopeKind
Definition: ScopeInfo.h:99
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:874
clang::sema::CapturingScopeInfo::getCapture
Capture & getCapture(VarDecl *Var)
Retrieve the capture of the given variable, if it has been captured already.
Definition: ScopeInfo.h:729
clang::TemplateParameterList
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:69
clang::sema::FunctionScopeInfo::~FunctionScopeInfo
virtual ~FunctionScopeInfo()
Definition: ScopeInfo.cpp:249
clang::sema::LambdaScopeInfo::visitPotentialCaptures
void visitPotentialCaptures(llvm::function_ref< void(VarDecl *, Expr *)> Callback) const
Definition: ScopeInfo.cpp:233
ExprCXX.h
Base
clang::sema::FunctionScopeInfo::setHasDroppedStmt
void setHasDroppedStmt()
Definition: ScopeInfo.h:431
clang::sema::CapturedRegionScopeInfo::~CapturedRegionScopeInfo
~CapturedRegionScopeInfo() override
Definition: ScopeInfo.cpp:251
clang::sema::CapturingScopeInfo::ImpCaptureStyle
ImplicitCaptureStyle ImpCaptureStyle
Definition: ScopeInfo.h:670
clang::sema::FunctionScopeInfo::ObjCShouldCallSuper
bool ObjCShouldCallSuper
A flag that is set when parsing a method that must call super's implementation, such as -dealloc,...
Definition: ScopeInfo.h:143
clang::sema::FunctionScopeInfo::FunctionScopeInfo
FunctionScopeInfo(DiagnosticsEngine &Diag)
Definition: ScopeInfo.h:375
clang::ObjCMessageExpr
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:940
clang::sema::FunctionScopeInfo::setHasSEHTry
void setHasSEHTry(SourceLocation TryLoc)
Definition: ScopeInfo.h:459
clang::sema::Capture::isNested
bool isNested() const
Definition: ScopeInfo.h:621
clang::sema::CapturedRegionScopeInfo::TheRecordDecl
RecordDecl * TheRecordDecl
The captured record type.
Definition: ScopeInfo.h:780
clang::sema::BlockScopeInfo::FunctionType
QualType FunctionType
BlockType - The function type of the block, if one was given.
Definition: ScopeInfo.h:758
clang::sema::LambdaScopeInfo::LocalPacks
SmallVector< NamedDecl *, 4 > LocalPacks
Packs introduced by this lambda, if any.
Definition: ScopeInfo.h:858
clang::sema::CapturingScopeInfo::ImpCap_LambdaByval
@ ImpCap_LambdaByval
Definition: ScopeInfo.h:666
clang::sema::Capture::CapturedVar
VarDecl * CapturedVar
Otherwise, the captured variable (if any).
Definition: ScopeInfo.h:551
clang::sema::Capture::Capture
Capture(IsVLACapture, const VariableArrayType *VLA, bool IsNested, SourceLocation Loc, QualType CaptureType)
Definition: ScopeInfo.h:605
clang::sema::FunctionScopeInfo
Retains information about a function, method, or block that is currently being parsed.
Definition: ScopeInfo.h:97
clang::sema::FunctionScopeInfo::WeakUseTy::markSafe
void markSafe()
Definition: ScopeInfo.h:346
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
SourceLocation.h
clang::CR_Default
@ CR_Default
Definition: CapturedStmt.h:17
clang::sema::FunctionScopeInfo::FirstCoroutineStmtLoc
SourceLocation FirstCoroutineStmtLoc
First coroutine statement in the current function.
Definition: ScopeInfo.h:172
clang::sema::FunctionScopeInfo::ObjCWarnForNoInitDelegation
bool ObjCWarnForNoInitDelegation
This starts true for a secondary initializer method and will be set to false if there is an invocatio...
Definition: ScopeInfo.h:160
clang::VariableArrayType
Represents a C array with a specified size that is not an integer-constant-expression.
Definition: Type.h:3046
clang::sema::CapturingScopeInfo::Captures
SmallVector< Capture, 4 > Captures
Captures - The captures.
Definition: ScopeInfo.h:683
clang::sema::FunctionScopeInfo::ObjCIsDesignatedInit
bool ObjCIsDesignatedInit
True when this is a method marked as a designated initializer.
Definition: ScopeInfo.h:146
false
#define false
Definition: stdbool.h:22
clang::sema::LambdaScopeInfo::Cleanup
CleanupInfo Cleanup
Whether any of the capture expressions requires cleanups.
Definition: ScopeInfo.h:852
clang::sema::FunctionScopeInfo::FirstReturnLoc
SourceLocation FirstReturnLoc
First 'return' statement in the current function.
Definition: ScopeInfo.h:175
clang::InventedTemplateParameterInfo::TemplateParams
SmallVector< NamedDecl *, 4 > TemplateParams
Store the list of the template parameters for a generic lambda or an abbreviated function template.
Definition: DeclSpec.h:2728
clang::sema::FunctionScopeInfo::WeakObjectProfileTy::operator==
bool operator==(const WeakObjectProfileTy &Other) const
Definition: ScopeInfo.h:300
clang::sema::CapturedRegionScopeInfo::TheCapturedDecl
CapturedDecl * TheCapturedDecl
The CapturedDecl for this statement.
Definition: ScopeInfo.h:777
clang::sema::Capture::isVLATypeCapture
bool isVLATypeCapture() const
Definition: ScopeInfo.h:619
llvm::ArrayRef
Definition: LLVM.h:34
clang::sema::FunctionScopeInfo::WeakUseTy::getUseExpr
const Expr * getUseExpr() const
Definition: ScopeInfo.h:344
clang::ObjCPropertyDecl
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:732
clang::sema::CapturingScopeInfo::getCapture
const Capture & getCapture(VarDecl *Var) const
Definition: ScopeInfo.h:734
CapturedStmt.h
clang::sema::FunctionScopeInfo::ObjCIsSecondaryInit
bool ObjCIsSecondaryInit
True when this is an initializer method not marked as a designated initializer within a class that ha...
Definition: ScopeInfo.h:156
LLVM.h
clang::sema::LambdaScopeInfo::clearPotentialCaptures
void clearPotentialCaptures()
Definition: ScopeInfo.h:1013
clang::sema::PossiblyUnreachableDiag
Definition: ScopeInfo.h:84
clang::sema::FunctionScopeInfo::ObjCWarnForNoDesignatedInitChain
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:151
clang::sema::CapturingScopeInfo::CapturingScopeInfo
CapturingScopeInfo(DiagnosticsEngine &Diag, ImplicitCaptureStyle Style)
Definition: ScopeInfo.h:672
clang::sema::LambdaScopeInfo::IntroducerRange
SourceRange IntroducerRange
Source range covering the lambda introducer [...].
Definition: ScopeInfo.h:835
clang::sema::CapturingScopeInfo::isCaptured
bool isCaptured(VarDecl *Var) const
Determine whether the given variable has been captured.
Definition: ScopeInfo.h:720
clang::sema::FunctionScopeInfo::isCoroutine
bool isCoroutine() const
Definition: ScopeInfo.h:479
clang::sema::FunctionScopeInfo::markSafeWeakUse
void markSafeWeakUse(const Expr *E)
Record that a given expression is a "safe" access of a weak object (e.g.
Definition: ScopeInfo.cpp:158
clang::sema::BlockScopeInfo::TheScope
Scope * TheScope
TheScope - This is the scope for the block itself, which contains arguments etc.
Definition: ScopeInfo.h:754
clang::PartialDiagnostic
Definition: PartialDiagnostic.h:31
clang::ActionResult< Expr * >
clang::sema::LambdaScopeInfo::isVariableExprMarkedAsNonODRUsed
bool isVariableExprMarkedAsNonODRUsed(Expr *CapturingVarExpr) const
Definition: ScopeInfo.h:1004
clang::sema::CapturingScopeInfo::CaptureMap
llvm::DenseMap< VarDecl *, unsigned > CaptureMap
CaptureMap - A map of captured variables to (index+1) into Captures.
Definition: ScopeInfo.h:676
clang::sema::FunctionScopeInfo::setHasMustTail
void setHasMustTail()
Definition: ScopeInfo.h:429
clang::sema::LambdaScopeInfo
Definition: ScopeInfo.h:825
clang::sema::FunctionScopeInfo::WeakObjectUseMap
llvm::SmallDenseMap< WeakObjectProfileTy, WeakUseVector, 8, WeakObjectProfileTy::DenseMapInfo > WeakObjectUseMap
Used to collect all uses of weak objects in a function body.
Definition: ScopeInfo.h:363
clang::sema::FunctionScopeInfo::setFirstCoroutineStmt
void setFirstCoroutineStmt(SourceLocation Loc, StringRef Keyword)
Definition: ScopeInfo.h:481
clang::sema::LambdaScopeInfo::ContainsUnexpandedParameterPack
bool ContainsUnexpandedParameterPack
Whether the lambda contains an unexpanded parameter pack.
Definition: ScopeInfo.h:855
clang::sema::CapturingScopeInfo::ImpCap_LambdaByref
@ ImpCap_LambdaByref
Definition: ScopeInfo.h:666
clang::sema::FunctionScopeInfo::WeakObjectProfileTy
Represents a simple identification of a weak object.
Definition: ScopeInfo.h:254
clang::SourceLocation::isInvalid
bool isInvalid() const
Definition: SourceLocation.h:111
clang::sema::FunctionScopeInfo::HasOMPDeclareReductionCombiner
bool HasOMPDeclareReductionCombiner
True if current scope is for OpenMP declare reduction combiner.
Definition: ScopeInfo.h:128
clang::sema::BlockScopeInfo::~BlockScopeInfo
~BlockScopeInfo() override
Definition: ScopeInfo.cpp:250
clang::sema::CapturedRegionScopeInfo::ContextParam
ImplicitParamDecl * ContextParam
The implicit parameter for the captured variables.
Definition: ScopeInfo.h:786
PartialDiagnostic.h
clang::sema::LambdaScopeInfo::NonODRUsedCapturingExprs
llvm::SmallSet< Expr *, 8 > NonODRUsedCapturingExprs
Contains all variable-referring-expressions that refer to local variables that are usable as constant...
Definition: ScopeInfo.h:892
clang
Definition: CalledOnceCheck.h:17
clang::sema::CapturedRegionScopeInfo::TheScope
Scope * TheScope
This is the enclosing scope of the captured region.
Definition: ScopeInfo.h:783
clang::sema::FunctionScopeInfo::CompoundScopes
SmallVector< CompoundScopeInfo, 4 > CompoundScopes
The stack of currently active compound stamement scopes in the function.
Definition: ScopeInfo.h:214
clang::sema::CompoundScopeInfo
Contains information about the compound statement currently being parsed.
Definition: ScopeInfo.h:67
clang::sema::CapturedRegionScopeInfo::OpenMPCaptureLevel
unsigned short OpenMPCaptureLevel
Definition: ScopeInfo.h:792
clang::sema::FunctionScopeInfo::WeakObjectProfileTy::DenseMapInfo::getEmptyKey
static WeakObjectProfileTy getEmptyKey()
Definition: ScopeInfo.h:310
clang::sema::LambdaScopeInfo::PotentiallyCapturingExprs
llvm::SmallVector< Expr *, 4 > PotentiallyCapturingExprs
Contains all variable-referring-expressions (i.e.
Definition: ScopeInfo.h:886
clang::sema::LambdaScopeInfo::ExplicitCaptureRanges
llvm::DenseMap< unsigned, SourceRange > ExplicitCaptureRanges
A map of explicit capture indices to their introducer source ranges.
Definition: ScopeInfo.h:895
clang::DeclaratorContext::Block
@ Block
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:69
clang::sema::Capture::VLACapture
@ VLACapture
Definition: ScopeInfo.h:604
clang::sema::FunctionScopeInfo::isPlainFunction
bool isPlainFunction() const
Definition: ScopeInfo.h:525
CleanupInfo.h
clang::sema::LambdaScopeInfo::ShadowingDecls
llvm::SmallVector< ShadowedOuterDecl, 4 > ShadowingDecls
Definition: ScopeInfo.h:904
clang::sema::LambdaScopeInfo::classof
static bool classof(const FunctionScopeInfo *FSI)
Definition: ScopeInfo.h:918
clang::sema::FunctionScopeInfo::ModifiedNonNullParams
llvm::SmallPtrSet< const ParmVarDecl *, 8 > ModifiedNonNullParams
A list of parameters which have the nonnull attribute and are modified in the function.
Definition: ScopeInfo.h:229
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:110
clang::sema::FunctionScopeInfo::FirstCXXOrObjCTryLoc
SourceLocation FirstCXXOrObjCTryLoc
First C++ 'try' or ObjC @try statement in the current function.
Definition: ScopeInfo.h:178
clang::sema::FunctionScopeInfo::HasIndirectGoto
bool HasIndirectGoto
Whether this function contains any indirect gotos.
Definition: ScopeInfo.h:118
clang::sema::Capture::Capture
Capture(VarDecl *Var, bool Block, bool ByRef, bool IsNested, SourceLocation Loc, SourceLocation EllipsisLoc, QualType CaptureType, bool Invalid)
Definition: ScopeInfo.h:587
clang::sema::CapturingScopeInfo::HasImplicitReturnType
bool HasImplicitReturnType
Definition: ScopeInfo.h:687
clang::sema::FunctionScopeInfo::WeakObjectProfileTy::getProperty
const NamedDecl * getProperty() const
Definition: ScopeInfo.h:283
clang::sema::FunctionScopeInfo::SK_CapturedRegion
@ SK_CapturedRegion
Definition: ScopeInfo.h:103
clang::sema::CapturingScopeInfo::addThisCapture
void addThisCapture(bool isNested, SourceLocation Loc, QualType CaptureType, bool ByCopy)
Definition: ScopeInfo.h:1047
clang::ObjCSubstitutionContext::Property
@ Property
The type of a property.
clang::sema::CapturingScopeInfo
Definition: ScopeInfo.h:660
clang::sema::FunctionScopeInfo::Unknown
@ Unknown
Definition: ScopeInfo.h:179
clang::sema::LambdaScopeInfo::ShadowedOuterDecl::ShadowedDecl
const VarDecl * ShadowedDecl
Definition: ScopeInfo.h:902
clang::sema::CapturingScopeInfo::CXXThisCaptureIndex
unsigned CXXThisCaptureIndex
CXXThisCaptureIndex - The (index+1) of the capture of 'this'; zero if 'this' is not captured.
Definition: ScopeInfo.h:680
clang::sema::Capture::isBlockCapture
bool isBlockCapture() const
Definition: ScopeInfo.h:618
clang::sema::LambdaScopeInfo::addPotentialThisCapture
void addPotentialThisCapture(SourceLocation Loc)
Definition: ScopeInfo.h:951
clang::sema::CapturingScopeInfo::getCXXThisCapture
Capture & getCXXThisCapture()
Retrieve the capture of C++ 'this', if it has been captured.
Definition: ScopeInfo.h:714
clang::sema::FunctionScopeInfo::hasInvalidCoroutineSuspends
bool hasInvalidCoroutineSuspends() const
Definition: ScopeInfo.h:509
clang::sema::FunctionScopeInfo::HasFallthroughStmt
bool HasFallthroughStmt
Whether there is a fallthrough statement in this function.
Definition: ScopeInfo.h:131
clang::sema::LambdaScopeInfo::addPotentialCapture
void addPotentialCapture(Expr *VarExpr)
Add a variable that might potentially be captured by the lambda and therefore the enclosing lambdas.
Definition: ScopeInfo.h:945
clang::sema::CapturingScopeInfo::isVLATypeCaptured
bool isVLATypeCaptured(const VariableArrayType *VAT) const
Determine whether the given variable-array type has been captured.
Definition: ScopeInfo.cpp:226
clang::sema::FunctionScopeInfo::setNeedsCoroutineSuspends
void setNeedsCoroutineSuspends(bool value=true)
Definition: ScopeInfo.h:503
true
#define true
Definition: stdbool.h:21
clang::sema::Capture::IsThisCapture
IsThisCapture
Definition: ScopeInfo.h:596
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::sema::FunctionScopeInfo::FunctionScopeInfo
FunctionScopeInfo(const FunctionScopeInfo &)=default
clang::sema::FunctionScopeInfo::setHasObjCTry
void setHasObjCTry(SourceLocation TryLoc)
Definition: ScopeInfo.h:453
clang::sema::Capture::isVariableCapture
bool isVariableCapture() const
Definition: ScopeInfo.h:612
clang::CleanupInfo
Definition: CleanupInfo.h:19
clang::sema::FunctionScopeInfo::TryLocIsCXX
@ TryLocIsCXX
Definition: ScopeInfo.h:179
clang::sema::FunctionScopeInfo::setCoroutineSuspends
void setCoroutineSuspends(Stmt *Initial, Stmt *Final)
Definition: ScopeInfo.h:513
clang::sema::CapturedRegionScopeInfo::OpenMPLevel
unsigned short OpenMPLevel
Definition: ScopeInfo.h:791
clang::sema::CapturingScopeInfo::ReturnType
QualType ReturnType
ReturnType - The target type of return statements in this context, or null if unknown.
Definition: ScopeInfo.h:691
clang::sema::Capture::getEllipsisLoc
SourceLocation getEllipsisLoc() const
Retrieve the source location of the ellipsis, whose presence indicates that the capture is a pack exp...
Definition: ScopeInfo.h:652
clang::DeclRefExpr
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1223
clang::RecordDecl
Represents a struct/union/class.
Definition: Decl.h:3901
clang::ObjCIvarRefExpr
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:548
clang::sema::PossiblyUnreachableDiag::PossiblyUnreachableDiag
PossiblyUnreachableDiag(const PartialDiagnostic &PD, SourceLocation Loc, ArrayRef< const Stmt * > Stmts)
Definition: ScopeInfo.h:90
clang::sema::LambdaScopeInfo::ShadowedOuterDecl::VD
const VarDecl * VD
Definition: ScopeInfo.h:901
clang::sema::FunctionScopeInfo::WeakObjectProfileTy::getBase
const NamedDecl * getBase() const
Definition: ScopeInfo.h:282
clang::sema::FunctionScopeInfo::addBlock
void addBlock(const BlockDecl *BD)
Definition: ScopeInfo.h:470
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1968
clang::sema::CompoundScopeInfo::setHasEmptyLoopBodies
void setHasEmptyLoopBodies()
Definition: ScopeInfo.h:79
clang::sema::LambdaScopeInfo::CaptureDefaultLoc
SourceLocation CaptureDefaultLoc
Source location of the '&' or '=' specifying the default capture type, if any.
Definition: ScopeInfo.h:839
clang::sema::CapturingScopeInfo::isCXXThisCaptured
bool isCXXThisCaptured() const
Determine whether the C++ 'this' is captured.
Definition: ScopeInfo.h:711