compilerplugins/clang/defaultparams.cxx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
New commits: commit 931c51f65b77285d912b4f3d4a5385a82fb28172 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Oct 20 14:39:48 2015 +0200 Make loplugin:defaultparams handle enum values and nullptrs Change-Id: I0c57b414d9230406cf2632494ccfa576510b0e61 diff --git a/compilerplugins/clang/defaultparams.cxx b/compilerplugins/clang/defaultparams.cxx index e6f6921..3e5d5f8 100644 --- a/compilerplugins/clang/defaultparams.cxx +++ b/compilerplugins/clang/defaultparams.cxx @@ -57,16 +57,17 @@ bool DefaultParams::VisitCallExpr(CallExpr * callExpr) { break; } const Expr* defaultArgExpr = parmVarDecl->getDefaultArg(); - if (!(defaultArgExpr && - defaultArgExpr->getType()->isIntegralType( - compiler.getASTContext()))) - { + if (!defaultArgExpr) { break; } APSInt x1, x2; - if (!(arg->EvaluateAsInt(x1, compiler.getASTContext()) && - defaultArgExpr->EvaluateAsInt(x2, compiler.getASTContext()) && - x1 == x2)) + if (!((defaultArgExpr->isNullPointerConstant( + compiler.getASTContext(), Expr::NPC_NeverValueDependent) + && arg->isNullPointerConstant( + compiler.getASTContext(), Expr::NPC_NeverValueDependent)) + || (defaultArgExpr->EvaluateAsInt(x1, compiler.getASTContext()) + && arg->EvaluateAsInt(x2, compiler.getASTContext()) + && x1 == x2))) { break; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits