Lines Matching full:capture
33 /// enclosing lambda (to the current lambda) that is 'capture-ready' for
36 /// of the capture-ready lambda's LambdaScopeInfo.
40 /// lambda that is ready to capture the \p VarToCapture being referenced in
43 /// that is the lambda with the highest index that is 'capture-ready'.
45 /// A lambda 'L' is capture-ready for 'V' (var or this) if:
49 /// stack), can all capture or have already captured V.
50 /// If \p VarToCapture is 'null' then we are trying to capture 'this'.
52 /// Note that a lambda that is deemed 'capture-ready' still needs to be checked
53 /// for whether it is 'capture-capable' (see
55 /// capture.
60 /// \param VarToCapture - the variable to capture. If NULL, capture 'this'.
64 /// lambda which is capture-ready. If the return value evaluates to 'false'
65 /// then no lambda is capture-ready for \p VarToCapture.
71 // Label failure to capture.
83 // If VarToCapture is null, we are attempting to capture 'this'.
95 // the variable declaration - it obviously can/must not capture the
99 // arrived here) - so we don't yet have a lambda that can capture the
105 // For an enclosing lambda to be capture ready for an entity, all
106 // intervening lambda's have to be able to capture that entity. If even
108 // then no enclosing lambda can ever capture that entity.
112 // [](auto b) { #2 <-- an intervening lambda that can never capture 'x'
114 // f(x, c); <-- can not lead to x's speculative capture by #1 or #2
116 // If they do not have a default implicit capture, check to see
119 // to ever capture this variable, there is no further enclosing
120 // non-dependent lambda that can capture this variable.
137 // (one index above) is capture-ready.
144 /// enclosing lambda (to the current lambda) that is 'capture-capable' for
147 /// of the capture-capable lambda's LambdaScopeInfo.
151 /// current lambda at the top of the stack) that can truly capture
153 /// a) 'capture-ready' - be the innermost lambda that is 'capture-ready':
156 /// lambda can either implicitly or explicitly capture the variable.
159 /// b) 'capture-capable' - make sure the 'capture-ready' lambda can truly
160 /// capture the variable by checking all its enclosing lambdas:
161 /// - check if all outer lambdas enclosing the 'capture-ready' lambda
162 /// identified above in 'a' can also capture the variable (this is done
170 /// \param VarToCapture - the variable to capture. If NULL, capture 'this'.
175 /// lambda which is capture-capable. If the return value evaluates to 'false'
176 /// then no lambda is capture-capable for \p VarToCapture.
194 "The capture ready lambda for a potential capture can only be the "
200 // If VarToCapture is null, we are attempting to capture 'this'
205 // Check if the capture-ready lambda can truly capture the variable, by
206 // checking whether all enclosing lambdas of the capture-ready lambda allow
207 // the capture - i.e. make sure it is capture-capable.
219 // Check if the capture-ready lambda can truly capture 'this' by checking
220 // whether all enclosing lambdas of the capture-ready lambda can capture
386 // Given a lambda with a lambda-capture, the type of the explicit object
808 // diagnose this later when we try to capture it.
813 // Deduce the type of the init capture.
858 // Create a dummy variable representing the init-capture. This is not actually
860 // init-capture.
876 assert(Var->isInitCapture() && "init capture flag should be set");
1114 // Distinct capture names, for diagnostics.
1130 // lambda-capture.
1140 // If a lambda-capture includes a capture-default that is =,
1141 // each simple-capture of that lambda-capture shall be of the form
1166 assert(C->Id && "missing identifier for capture");
1178 // is not, then an error has occurred - so ignore the capture for now.
1180 // FIXME: we should create the init capture variable and mark it invalid
1192 llvm_unreachable("not an init-capture?");
1212 "init capture has valid but null init?");
1215 // If a lambda-capture includes a capture-default that is &, the
1216 // identifiers in the lambda-capture shall not be preceded by &.
1217 // If a lambda-capture includes a capture-default that is =, [...]
1232 // The identifiers in a capture-list are looked up using the usual
1270 // lambda-capture.
1283 // Previous capture captured something different (one or both was
1284 // an init-capture): no fixit.
1303 // A capture followed by an ellipsis is a pack expansion (14.5.3).
1344 // capture-default or simple-capture in its lambda-introducer.
1349 // For DR1632, we also allow a capture-default in any context where we can
1472 for (const auto &Capture : Intro.Captures) {
1473 if (Capture.Id == Param->getIdentifier()) {
1475 Diag(Capture.Loc, diag::note_var_explicitly_captured_here)
1476 << Capture.Id << true;
1491 // C++23 [expr.prim.lambda.capture]p5:
1492 // If an identifier in a capture appears as the declarator-id of a parameter
1502 for (const auto &Capture : Intro.Captures) {
1503 if (Capture.Id == TP->getIdentifier()) {
1504 Diag(Capture.Loc, diag::err_template_param_shadow) << Capture.Id;
1882 ExprResult Sema::BuildCaptureInit(const Capture &Cap,
1889 // An init-capture is initialized directly from its stored initializer.
1894 // capture, the capture notionally happens at the capture-default, so use
1921 assert(Cap.isVariableCapture() && "unknown kind of capture");
1928 // In OpenMP, the capture kind doesn't actually describe how to capture:
1930 // make a copy, even for a "copy capture".
1963 llvm_unreachable("block capture in lambda");
1965 llvm_unreachable("Unknown implicit capture style");
1968 bool Sema::CaptureHasSideEffects(const Capture &From) {
1994 const Capture &From) {
2018 /// given capture.
2020 const sema::Capture &Capture) {
2021 SourceLocation Loc = Capture.getLocation();
2022 QualType FieldType = Capture.getCaptureType();
2025 if (Capture.isVariableCapture()) {
2026 const auto *Var = dyn_cast_or_null<VarDecl>(Capture.getVariable());
2032 // appropriate, at least for an implicit capture.
2061 if (Capture.isVLATypeCapture())
2062 Field->setCapturedVLAType(Capture.getCapturedVLAType());
2105 // True if the current capture has a used capture or default before it.
2111 const Capture &From = LSI->Captures[I];
2116 assert(!From.isBlockCapture() && "Cannot capture __block variables");
2137 // If there are no captures preceding this capture, remove the
2142 // Otherwise, remove the comma since the last used capture.
2157 // Map the capture to our AST representation.
2158 LambdaCapture Capture = [&] {
2161 // because it results in a reference capture. Don't warn prior to
2175 assert(From.isVariableCapture() && "unknown kind of capture");
2184 // Form the initializer for the capture field.
2187 // FIXME: Skip this capture if the capture is not used, the initializer
2188 // has no side-effects, the type of the capture is trivial, and the
2191 // Add a FieldDecl for the capture and form its initializer.
2193 Captures.push_back(Capture);
2203 // The closure type for a lambda-expression with no lambda-capture
2248 // Emit delayed shadowing warnings now that the full capture list is known.
2330 // Add capture. The capture uses a fake variable, which doesn't correspond
2339 BlockDecl::Capture Capture(/*variable=*/CapVar, /*byRef=*/false,
2341 Block->setCaptures(Context, Capture, /*CapturesCXXThis=*/false);