Author: d0k Date: Sat Jul 9 07:16:58 2016 New Revision: 274975 URL: http://llvm.org/viewvc/llvm-project?rev=274975&view=rev Log: [analyzer] Older version of GCC 4.7 crash on lambdas in default arguments.
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp?rev=274975&r1=274974&r2=274975&view=diff ============================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp Sat Jul 9 07:16:58 2016 @@ -141,15 +141,15 @@ private: return false; } - const Decl *getDecl(const DeclRefExpr *DR) { return DR->getDecl(); } - - const Decl *getDecl(const MemberExpr *ME) { return ME->getMemberDecl(); } + static const Decl *getDecl(const DeclRefExpr *DR) { return DR->getDecl(); } + static const Decl *getDecl(const MemberExpr *ME) { + return ME->getMemberDecl(); + } template <typename T1> void Erase(const T1 *DR, - llvm::function_ref<bool(const MallocOverflowCheck &)> Pred = - [](const MallocOverflowCheck &) { return true; }) { - auto P = [this, DR, Pred](const MallocOverflowCheck &Check) { + llvm::function_ref<bool(const MallocOverflowCheck &)> Pred) { + auto P = [DR, Pred](const MallocOverflowCheck &Check) { if (const auto *CheckDR = dyn_cast<T1>(Check.variable)) return getDecl(CheckDR) == getDecl(DR) && Pred(Check); return false; @@ -159,11 +159,12 @@ private: } void CheckExpr(const Expr *E_p) { + auto PredTrue = [](const MallocOverflowCheck &) { return true; }; const Expr *E = E_p->IgnoreParenImpCasts(); if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(E)) - Erase<DeclRefExpr>(DR); + Erase<DeclRefExpr>(DR, PredTrue); else if (const auto *ME = dyn_cast<MemberExpr>(E)) { - Erase<MemberExpr>(ME); + Erase<MemberExpr>(ME, PredTrue); } } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits