Micro-optimization: check the overloaded operator kind before
checking for a lambda.
Thanks to Jordan for the pointer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181031 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index 8549b17..c1fbdb9 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -712,8 +712,8 @@
template <class T> static Decl *getNonClosureContext(T *D) {
if (getKind(D) == Decl::CXXMethod) {
CXXMethodDecl *MD = cast<CXXMethodDecl>(D);
- if (MD->getParent()->isLambda() &&
- MD->getOverloadedOperator() == OO_Call)
+ if (MD->getOverloadedOperator() == OO_Call &&
+ MD->getParent()->isLambda())
return getNonClosureContext(MD->getParent()->getParent());
return MD;
} else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {