[analyzer] Older version of GCC 4.7 crash on lambdas in default arguments.

llvm-svn: 274975
This commit is contained in:
Benjamin Kramer 2016-07-09 12:16:58 +00:00
parent 951a6287c7
commit 6ec90ec2ab
1 changed files with 9 additions and 8 deletions

View File

@ -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);
}
}