diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-13 20:42:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-14 10:13:46 +0200 |
commit | 8e39ef66928a3e37c618d3a70a631e71266db274 (patch) | |
tree | 8cab0264e58c885ae7d78a77d90fd041bcdbe15d /compilerplugins/clang/useuniqueptr.cxx | |
parent | d7e06e46acc2ee17101cef63e59b9f5efcbfab14 (diff) |
extend loplugin useuniqueptr to POD types
Change-Id: I6ff24f048bd8f75bf87a78b718f37b57855d4781
Reviewed-on: https://gerrit.libreoffice.org/39932
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/useuniqueptr.cxx')
-rw-r--r-- | compilerplugins/clang/useuniqueptr.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx index 9e0dd33e900b..dc1371f00b4a 100644 --- a/compilerplugins/clang/useuniqueptr.cxx +++ b/compilerplugins/clang/useuniqueptr.cxx @@ -37,7 +37,7 @@ public: bool VisitCompoundStmt(const CompoundStmt* ); private: void CheckForSingleUnconditionalDelete(const CXXDestructorDecl*, const CompoundStmt* ); - void CheckForDeleteArrayOfPOD(const CompoundStmt* ); + void CheckForDeleteOfPOD(const CompoundStmt* ); }; bool UseUniquePtr::VisitCXXDestructorDecl(const CXXDestructorDecl* destructorDecl) @@ -52,7 +52,7 @@ bool UseUniquePtr::VisitCXXDestructorDecl(const CXXDestructorDecl* destructorDec return true; CheckForSingleUnconditionalDelete(destructorDecl, compoundStmt); - CheckForDeleteArrayOfPOD(compoundStmt); + CheckForDeleteOfPOD(compoundStmt); return true; } @@ -195,13 +195,13 @@ bool UseUniquePtr::VisitCompoundStmt(const CompoundStmt* compoundStmt) return true; } -void UseUniquePtr::CheckForDeleteArrayOfPOD(const CompoundStmt* compoundStmt) +void UseUniquePtr::CheckForDeleteOfPOD(const CompoundStmt* compoundStmt) { for (auto i = compoundStmt->body_begin(); i != compoundStmt->body_end(); ++i) { auto deleteExpr = dyn_cast<CXXDeleteExpr>(*i); - if (!deleteExpr || !deleteExpr->isArrayForm()) + if (!deleteExpr) continue; const Expr* argExpr = deleteExpr->getArgument(); @@ -221,7 +221,7 @@ void UseUniquePtr::CheckForDeleteArrayOfPOD(const CompoundStmt* compoundStmt) auto pointerType = dyn_cast<PointerType>(fieldDecl->getType()->getUnqualifiedDesugaredType()); QualType elementType = pointerType->getPointeeType(); - if (!elementType.isTrivialType(compiler.getASTContext())) + if (!elementType.isPODType(compiler.getASTContext())) continue; StringRef aFileName = compiler.getSourceManager().getFilename(compiler.getSourceManager().getSpellingLoc(fieldDecl->getLocStart())); @@ -237,7 +237,7 @@ void UseUniquePtr::CheckForDeleteArrayOfPOD(const CompoundStmt* compoundStmt) report( DiagnosticsEngine::Warning, - "managing array of trival type %0 manually, rather use std::vector / std::array / std::unique_ptr", + "managing POD type %0 manually, rather use std::vector / std::array / std::unique_ptr", deleteExpr->getLocStart()) << elementType << deleteExpr->getSourceRange(); |