summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-06-17 09:49:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-19 14:08:50 +0200
commite3077168072452fb8f1c0a8afb2992877cb96d1c (patch)
tree785da5126ddb052250ee3747fa221c746cc62e82 /compilerplugins
parente48dd86341fff8a010f514bbcd818468f3a92815 (diff)
loplugin:finalclasses
improve the plugin to detect more cases. I only apply the new final changes to classes in /include here. Which reveals that RoadmapWizard::getPageController( TabPage* _pCurrentPage ) will always return nullptr Also needed to sprinkle some SAL_DLLPUBLIC_TEMPLATE around to workaround Visual Studio linking problems. Change-Id: Iadb7d46a9e0e73dabce562375ca013c0fea6690c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117365 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/finalclasses.cxx4
-rwxr-xr-xcompilerplugins/clang/finalclasses.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/compilerplugins/clang/finalclasses.cxx b/compilerplugins/clang/finalclasses.cxx
index 4271a0a76f1b..ff7b34925630 100644
--- a/compilerplugins/clang/finalclasses.cxx
+++ b/compilerplugins/clang/finalclasses.cxx
@@ -22,7 +22,7 @@ or
In the case of (a), those members/fields can be made private.
In the case of (b), making the class final means the compiler can devirtualise
-some method class.
+some method calls
The process goes something like this:
$ make check
@@ -86,7 +86,6 @@ bool FinalClasses::VisitCXXRecordDecl(const CXXRecordDecl* decl)
{
if (ignoreLocation(decl))
return true;
- decl = decl->getCanonicalDecl();
if (!decl->hasDefinition())
return true;
@@ -114,6 +113,7 @@ bool FinalClasses::VisitCXXRecordDecl(const CXXRecordDecl* decl)
if ( i->isVirtual() )
bFoundVirtual = true;
}
+
if (!bFoundProtected)
{
for (auto it = decl->field_begin(); it != decl->field_end(); ++it) {
diff --git a/compilerplugins/clang/finalclasses.py b/compilerplugins/clang/finalclasses.py
index dfaa402f9513..05a1d0c43c8c 100755
--- a/compilerplugins/clang/finalclasses.py
+++ b/compilerplugins/clang/finalclasses.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import re
import sys