From bf43660fabd1ed4349acf63a92004b1d58f93451 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Fri, 26 Apr 2013 17:01:13 +0000 Subject: [PATCH] filter out edm::Handle std::function --- .../StaticAnalyzers/src/ArgSizeChecker.cpp | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/Utilities/StaticAnalyzers/src/ArgSizeChecker.cpp b/Utilities/StaticAnalyzers/src/ArgSizeChecker.cpp index 6cf67b3890d29..52ea3826ac972 100644 --- a/Utilities/StaticAnalyzers/src/ArgSizeChecker.cpp +++ b/Utilities/StaticAnalyzers/src/ArgSizeChecker.cpp @@ -65,13 +65,18 @@ void ArgSizeChecker::checkPreStmt(const CXXConstructExpr *E, CheckerContext &ctx if ( size_param <= max_bits ) continue; std::string qname = QT.getAsString(); std::string pname = PQT.getAsString(); - std::string bpname = "class boost::shared_ptr<"; - std::string cbpname = "const class boost::shared_ptr<"; + std::string bpname = "class boost::"; + std::string cbpname = "const class boost::"; + std::string sfname = "class std::function<"; + std::string ehname = "class edm::Handle<"; + std::string cehname = "const class edm::Handle<"; const CXXMethodDecl * MD = llvm::dyn_cast(ctx.getCurrentAnalysisDeclContext()->getDecl()) ; - if ( pname.substr(0,bpname.length()) == bpname || pname.substr(0,cbpname.length()) == cbpname ) continue; + if ( pname.substr(0,bpname.length()) == bpname || pname.substr(0,cbpname.length()) == cbpname + || pname.substr(0,ehname.length()) == ehname || pname.substr(0,cehname.length()) == cehname + || pname.substr(0,sfname.length()) == sfname ) continue; os<<"Function parameter copied by value with size '"< max size '"<getNameAsString() <<"' class '"<< MD->getParent()->getNameAsString(); } os << "'\n"; @@ -112,15 +117,21 @@ void ArgSizeChecker::checkASTDecl(const CXXMethodDecl *MD, AnalysisManager& mgr, if ( size_param <= max_bits ) continue; std::string qname = QT.getAsString(); std::string pname = PQT.getAsString(); - std::string bpname = "class boost::shared_ptr<"; - std::string cbpname = "const class boost::shared_ptr<"; - if ( pname.substr(0,bpname.length()) == bpname || pname.substr(0,cbpname.length()) == cbpname ) continue; + std::string bpname = "class boost::"; + std::string cbpname = "const class boost::"; + std::string sfname = "class std::function<"; + std::string ehname = "class edm::Handle<"; + std::string cehname = "const class edm::Handle<"; + + if ( pname.substr(0,bpname.length()) == bpname || pname.substr(0,cbpname.length()) == cbpname + || pname.substr(0,ehname.length()) == ehname || pname.substr(0,cehname.length()) == cehname + || pname.substr(0,sfname.length()) == sfname ) continue; os<<"Function parameter passed by value with size of parameter '"< max size '"< max size '"<getNameAsString() <<"' class '"<getParent()->getNameAsString() <<"'\n";