From: John McCall Date: Fri, 3 May 2013 17:11:14 +0000 (+0000) Subject: Micro-optimization: check the overloaded operator kind before X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=000817b3b2ab95c5b9cbb76950cd01b79fe93f55;p=clang 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 8549b17137..c1fbdb996d 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -712,8 +712,8 @@ static Decl::Kind getKind(const DeclContext *DC) { return DC->getDeclKind(); } template static Decl *getNonClosureContext(T *D) { if (getKind(D) == Decl::CXXMethod) { CXXMethodDecl *MD = cast(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(D)) {