diff options
author | Andrzej Hunt <andrzej@ahunt.org> | 2015-10-20 21:23:42 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-10-21 06:54:08 +0000 |
commit | 7276c346678c2cb51c14f6011659376890bbabea (patch) | |
tree | 40ae51a008c526c3d43189049eac404b3f28cffa /compilerplugins | |
parent | 46ceb619548a27bddc210012949903e3d9f01391 (diff) |
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 <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/badvectorinit.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
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(); |