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