mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
[Sema] Replace mem_fn with lambdas. NFC.
I'm told that some optimizers like lambdas a lot more than mem_fn. Given that the readability difference is basically nil, and we seem to use lambdas basically everywhere else, it seems sensible to just use lambdas. llvm-svn: 276577
This commit is contained in:
@@ -1144,14 +1144,16 @@ void Sema::ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope,
|
||||
|
||||
/// \brief Add a lambda's conversion to function pointer, as described in
|
||||
/// C++11 [expr.prim.lambda]p6.
|
||||
static void addFunctionPointerConversion(Sema &S,
|
||||
static void addFunctionPointerConversion(Sema &S,
|
||||
SourceRange IntroducerRange,
|
||||
CXXRecordDecl *Class,
|
||||
CXXMethodDecl *CallOperator) {
|
||||
// This conversion is explicitly disabled if the lambda's function has
|
||||
// pass_object_size attributes on any of its parameters.
|
||||
if (llvm::any_of(CallOperator->parameters(),
|
||||
std::mem_fn(&ParmVarDecl::hasAttr<PassObjectSizeAttr>)))
|
||||
auto HasPassObjectSizeAttr = [](const ParmVarDecl *P) {
|
||||
return P->hasAttr<PassObjectSizeAttr>();
|
||||
};
|
||||
if (llvm::any_of(CallOperator->parameters(), HasPassObjectSizeAttr))
|
||||
return;
|
||||
|
||||
// Add the conversion to function pointer.
|
||||
|
||||
@@ -39,8 +39,9 @@ using namespace clang;
|
||||
using namespace sema;
|
||||
|
||||
static bool functionHasPassObjectSizeParams(const FunctionDecl *FD) {
|
||||
return llvm::any_of(FD->parameters(),
|
||||
std::mem_fn(&ParmVarDecl::hasAttr<PassObjectSizeAttr>));
|
||||
return llvm::any_of(FD->parameters(), [](const ParmVarDecl *P) {
|
||||
return P->hasAttr<PassObjectSizeAttr>();
|
||||
});
|
||||
}
|
||||
|
||||
/// A convenience routine for creating a decayed reference to a function.
|
||||
@@ -8954,8 +8955,9 @@ static bool checkAddressOfFunctionIsAvailable(Sema &S, const FunctionDecl *FD,
|
||||
return false;
|
||||
}
|
||||
|
||||
auto I = llvm::find_if(
|
||||
FD->parameters(), std::mem_fn(&ParmVarDecl::hasAttr<PassObjectSizeAttr>));
|
||||
auto I = llvm::find_if(FD->parameters(), [](const ParmVarDecl *P) {
|
||||
return P->hasAttr<PassObjectSizeAttr>();
|
||||
});
|
||||
if (I == FD->param_end())
|
||||
return true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user