diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-12-22 09:23:19 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-12-22 09:23:19 +0100 |
commit | 1dc43e24b34bfdd56928e674fbc53e8fda481e79 (patch) | |
tree | 4b03c65e91745271c5e8f5371bd7412e74292fd9 | |
parent | 4a591d74a7f73f3e381c9ddb8bbeda3d41647364 (diff) |
Generalize vector/deque ctor checks to work with MSVCRT
Change-Id: I2d493a36b8c2e3abe69964c04b46f08d67ef8a48
-rw-r--r-- | compilerplugins/clang/store/badvectorinit.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compilerplugins/clang/store/badvectorinit.cxx b/compilerplugins/clang/store/badvectorinit.cxx index 7b26ca301203..a793c96346a8 100644 --- a/compilerplugins/clang/store/badvectorinit.cxx +++ b/compilerplugins/clang/store/badvectorinit.cxx @@ -178,12 +178,13 @@ bool BadVectorInit::VisitCXXConstructExpr(const CXXConstructExpr* expr) if (aParentName.find("vector") == string::npos && aParentName.find("deque") == string::npos) return true; - // ignore the copy constructor + // ignore the copy/move constructors, and those taking an initializer_list + // etc.: + if (consDecl->isCopyConstructor() || consDecl->isMoveConstructor()) + return true; const ParmVarDecl* pParam = consDecl->getParamDecl(0); std::string aParam1 = pParam->getOriginalType().getAsString(); - if (aParam1.find("vector") != string::npos - || aParam1.find("deque") != string::npos - || aParam1.find("initializer_list") != string::npos + if (aParam1.find("initializer_list") != string::npos || aParam1.find("iterator") != string::npos) return true; |