diff options
author | Andrzej Hunt <andrzej@ahunt.org> | 2015-10-20 21:23:42 +0200 |
---|---|---|
committer | Andrzej Hunt <andrzej@ahunt.org> | 2015-10-21 10:23:52 +0200 |
commit | 7bf56d5495b583d7d1629b89d4de8a77f212f976 (patch) | |
tree | 20cd1d8a99be0a3ca394a3918865158484db46dd | |
parent | 6e51d7a50f43f0702649851f141b1e6e5c7cddf9 (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
-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(); |