1 //===--- ASTLambda.h - Lambda Helper Functions --------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief This file provides some common utility functions for processing
12 /// Lambda related AST Constructs.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_CLANG_AST_LAMBDA_H
17 #define LLVM_CLANG_AST_LAMBDA_H
19 #include "clang/AST/DeclCXX.h"
20 #include "clang/AST/DeclTemplate.h"
23 inline StringRef getLambdaStaticInvokerName() {
26 // This function returns true if M is a specialization, a template,
27 // or a non-generic lambda call operator.
28 inline bool isLambdaCallOperator(const CXXMethodDecl *MD) {
29 const CXXRecordDecl *LambdaClass = MD->getParent();
30 if (!LambdaClass || !LambdaClass->isLambda()) return false;
31 return MD->getOverloadedOperator() == OO_Call;
34 inline bool isGenericLambdaCallOperatorSpecialization(CXXMethodDecl *MD) {
35 CXXRecordDecl *LambdaClass = MD->getParent();
36 if (LambdaClass && LambdaClass->isGenericLambda())
37 return isLambdaCallOperator(MD) &&
38 MD->isFunctionTemplateSpecialization();
42 inline bool isGenericLambdaCallOperatorSpecialization(Decl *D) {
43 if (!D || !isa<CXXMethodDecl>(D)) return false;
44 return isGenericLambdaCallOperatorSpecialization(
45 cast<CXXMethodDecl>(D));
49 #endif // LLVM_CLANG_AST_LAMBDA_H