1 //===--- SemaLambda.h - Lambda Helper Functions --------------*- 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 /// \file 10 /// This file provides some common utility functions for processing 11 /// Lambdas. 12 /// 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_CLANG_SEMA_SEMALAMBDA_H 16 #define LLVM_CLANG_SEMA_SEMALAMBDA_H 17 18 #include "clang/AST/ASTLambda.h" 19 #include <optional> 20 21 namespace clang { 22 namespace sema { 23 class FunctionScopeInfo; 24 } 25 class Sema; 26 27 /// Examines the FunctionScopeInfo stack to determine the nearest 28 /// enclosing lambda (to the current lambda) that is 'capture-capable' for 29 /// the variable referenced in the current lambda (i.e. \p VarToCapture). 30 /// If successful, returns the index into Sema's FunctionScopeInfo stack 31 /// of the capture-capable lambda's LambdaScopeInfo. 32 /// See Implementation for more detailed comments. 33 34 std::optional<unsigned> getStackIndexOfNearestEnclosingCaptureCapableLambda( 35 ArrayRef<const sema::FunctionScopeInfo *> FunctionScopes, 36 ValueDecl *VarToCapture, Sema &S); 37 38 } // clang 39 40 #endif 41