From 7276c346678c2cb51c14f6011659376890bbabea Mon Sep 17 00:00:00 2001 From: Andrzej Hunt Date: Tue, 20 Oct 2015 21:23:42 +0200 Subject: Ignore the default constructor for loplugin:badvectorinit too The default constructor doesn't necessarily have 0 parameters, hence we need to explicitly test for this too. Change-Id: I685c44ab373ec8234a86824a77cc523a355c8b05 Reviewed-on: https://gerrit.libreoffice.org/19496 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- compilerplugins/clang/badvectorinit.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/badvectorinit.cxx b/compilerplugins/clang/badvectorinit.cxx index 005726e8d02a..709a65d7b729 100644 --- a/compilerplugins/clang/badvectorinit.cxx +++ b/compilerplugins/clang/badvectorinit.cxx @@ -172,7 +172,10 @@ bool BadVectorInit::VisitCXXConstructExpr(const CXXConstructExpr* expr) const CXXConstructorDecl *consDecl = expr->getConstructor(); consDecl = consDecl->getCanonicalDecl(); - if (consDecl->param_size() == 0) + // The default constructor can potentially have a parameter, e.g. + // in glibcxx-debug the default constructor is: + // explicit vector(const _Allocator& __a = _Allocator()) + if (consDecl->param_size() == 0 || consDecl->isDefaultConstructor()) return true; std::string aParentName = consDecl->getParent()->getQualifiedNameAsString(); -- cgit