summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-05-12 15:32:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-05-15 08:45:17 +0200
commit5e7583fe864c4491c5a19d2896b6555448146ad8 (patch)
treed7b34190055d5d2348346cdeaf139f5318ba5e78 /compilerplugins
parent4582acb3eeb2af0411ab8598ec17d74381225acf (diff)
loplugin:useuniqueptr
ignore SAL_LOG type stuff in the destructor Change-Id: If014382ca0c96edd3f2b325a28451d83b3d1f278 Reviewed-on: https://gerrit.libreoffice.org/37539 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/useuniqueptr.cxx18
1 files changed, 16 insertions, 2 deletions
diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx
index 4d9d159e11fb..24f6007ca2af 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -50,10 +50,21 @@ bool UseUniquePtr::VisitCXXDestructorDecl(const CXXDestructorDecl* destructorDec
if (compoundStmt == nullptr) {
return true;
}
- if (compoundStmt->size() != 1) {
+
+ const CXXDeleteExpr* deleteExpr;
+ if (compoundStmt->size() == 1) {
+ deleteExpr = dyn_cast<CXXDeleteExpr>(compoundStmt->body_front());
+ }
+ else if (compoundStmt->size() == 2) {
+ // ignore SAL_INFO type stuff
+ // TODO should probably be a little more specific here
+ if (!isa<DoStmt>(compoundStmt->body_front())) {
+ return true;
+ }
+ deleteExpr = dyn_cast<CXXDeleteExpr>(compoundStmt->body_back());
+ } else {
return true;
}
- const CXXDeleteExpr* deleteExpr = dyn_cast<CXXDeleteExpr>(compoundStmt->body_front());
if (deleteExpr == nullptr) {
return true;
}
@@ -104,6 +115,9 @@ bool UseUniquePtr::VisitCXXDestructorDecl(const CXXDestructorDecl* destructorDec
// @TODO SwDoc has some weird ref-counting going on
if (aFileName.startswith(SRCDIR "/sw/inc/shellio.hxx"))
return true;
+ // @TODO it's sharing pointers with another class
+ if (aFileName.startswith(SRCDIR "/sc/inc/formulacell.hxx"))
+ return true;
report(
DiagnosticsEngine::Warning,