Clang Project

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