SemaLambda.h revision 651f13cea278ec967336033dd032faef0e9fc2ec
1//===--- SemaLambda.h - Lambda Helper Functions --------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9///
10/// \file
11/// \brief This file provides some common utility functions for processing
12/// Lambdas.
13///
14//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_CLANG_SEMA_LAMBDA_H
17#define LLVM_CLANG_SEMA_LAMBDA_H
18#include "clang/AST/ASTLambda.h"
19#include "clang/Sema/ScopeInfo.h"
20namespace clang {
21
22
23/// \brief Examines the FunctionScopeInfo stack to determine the nearest
24/// enclosing lambda (to the current lambda) that is 'capture-capable' for
25/// the variable referenced in the current lambda (i.e. \p VarToCapture).
26/// If successful, returns the index into Sema's FunctionScopeInfo stack
27/// of the capture-capable lambda's LambdaScopeInfo.
28/// See Implementation for more detailed comments.
29
30Optional<unsigned> getStackIndexOfNearestEnclosingCaptureCapableLambda(
31    ArrayRef<const sema::FunctionScopeInfo *> FunctionScopes,
32    VarDecl *VarToCapture, Sema &S);
33
34} // clang
35
36#endif // LLVM_CLANG_SEMA_LAMBDA_H
37