]> granicus.if.org Git - clang/commitdiff
Micro-optimization: check the overloaded operator kind before
authorJohn McCall <rjmccall@apple.com>
Fri, 3 May 2013 17:11:14 +0000 (17:11 +0000)
committerJohn McCall <rjmccall@apple.com>
Fri, 3 May 2013 17:11:14 +0000 (17:11 +0000)
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

lib/AST/DeclBase.cpp

index 8549b1713745965768a63c946fe0bf356ce60d22..c1fbdb996d37957d6dde65848ded36d1e29cc16c 100644 (file)
@@ -712,8 +712,8 @@ static Decl::Kind getKind(const DeclContext *DC) { return DC->getDeclKind(); }
 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)) {