SemaLambda.h revision ecb5819a9e64fb654d46a3b270a286cc570c58ff
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 19#include "clang/AST/DeclCXX.h" 20#include "clang/AST/DeclTemplate.h" 21#include "clang/Sema/ScopeInfo.h" 22 23namespace clang { 24static inline const char *getLambdaStaticInvokerName() { 25 return "__invoke"; 26} 27static inline bool isGenericLambdaCallOperatorSpecialization(CXXMethodDecl *MD) { 28 if (MD) { 29 CXXRecordDecl *LambdaClass = MD->getParent(); 30 if (LambdaClass && LambdaClass->isGenericLambda()) { 31 return LambdaClass->getLambdaCallOperator() 32 == MD->getTemplateInstantiationPattern(); 33 } 34 } 35 return false; 36} 37 38static inline bool isGenericLambdaCallOperatorSpecialization(Decl *D) { 39 return isGenericLambdaCallOperatorSpecialization( 40 dyn_cast<CXXMethodDecl>(D)); 41} 42} // clang 43 44#endif // LLVM_CLANG_SEMA_LAMBDA_H 45