r181031 - Micro-optimization: check the overloaded operator kind before

John McCall rjmccall at apple.com
Fri May 3 10:11:14 PDT 2013


Author: rjmccall
Date: Fri May  3 12:11:14 2013
New Revision: 181031

URL: http://llvm.org/viewvc/llvm-project?rev=181031&view=rev
Log:
Micro-optimization: check the overloaded operator kind before
checking for a lambda.

Thanks to Jordan for the pointer.

Modified:
    cfe/trunk/lib/AST/DeclBase.cpp

Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=181031&r1=181030&r2=181031&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Fri May  3 12:11:14 2013
@@ -712,8 +712,8 @@ static Decl::Kind getKind(const DeclCont
 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)) {





More information about the cfe-commits mailing list