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