summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-10-05 07:50:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-10-05 09:48:43 +0200
commite1261e6ea6e897d38f69c0d250ec34ccf0f6d545 (patch)
treef6fea1de114f6e81d8e61014a7b366ddedc67b16
parente5d943d984bb0918f971eec45f45384cc0c72b67 (diff)
loplugin:finalclasses in vcl
Change-Id: I7de9cd6c5569217aa8d379c6d112cd1874bca8e2 Reviewed-on: https://gerrit.libreoffice.org/43151 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--compilerplugins/clang/finalclasses.cxx38
-rw-r--r--include/vcl/graphicfilter.hxx3
-rw-r--r--include/vcl/i18nhelp.hxx3
-rw-r--r--include/vcl/layout.hxx3
-rw-r--r--include/vcl/mnemonic.hxx2
-rw-r--r--include/vcl/morebtn.hxx2
-rw-r--r--include/vcl/texteng.hxx3
-rw-r--r--include/vcl/textview.hxx2
-rw-r--r--vcl/inc/headless/svpcairotextrender.hxx1
-rw-r--r--vcl/inc/opengl/program.hxx2
-rw-r--r--vcl/inc/sallayout.hxx3
-rw-r--r--vcl/inc/unx/genpspgraphics.h1
-rw-r--r--vcl/inc/unx/pixmap.hxx2
-rw-r--r--vcl/source/edit/textdoc.hxx4
-rw-r--r--vcl/source/filter/graphicfilter.cxx2
-rw-r--r--vcl/source/fontsubset/cff.cxx7
-rw-r--r--vcl/source/fontsubset/xlat.cxx3
-rw-r--r--vcl/unx/generic/dtrans/X11_clipboard.hxx2
-rw-r--r--vcl/workben/icontest.cxx3
-rw-r--r--vcl/workben/mtfdemo.cxx2
20 files changed, 35 insertions, 53 deletions
diff --git a/compilerplugins/clang/finalclasses.cxx b/compilerplugins/clang/finalclasses.cxx
index 4b7a35804719..294e52592a51 100644
--- a/compilerplugins/clang/finalclasses.cxx
+++ b/compilerplugins/clang/finalclasses.cxx
@@ -57,7 +57,11 @@ public:
bool shouldVisitTemplateInstantiations () const { return true; }
+ bool shouldVisitImplicitCode() const { return true; }
+
bool VisitCXXRecordDecl( const CXXRecordDecl* decl);
+private:
+ void checkBase(QualType qt);
};
bool startsWith(const std::string& rStr, const char* pSubStr) {
@@ -81,23 +85,18 @@ bool FinalClasses::VisitCXXRecordDecl(const CXXRecordDecl* decl)
if (ignoreLocation(decl))
return true;
decl = decl->getCanonicalDecl();
- if (!decl->isThisDeclarationADefinition())
+ if (!decl->hasDefinition())
return true;
for (auto it = decl->bases_begin(); it != decl->bases_end(); ++it)
{
const CXXBaseSpecifier spec = *it;
- // need to look through typedefs, hence the getUnqualifiedDesugaredType
- QualType baseType = spec.getType().getDesugaredType(compiler.getASTContext());
- std::string x;
- // so that we get just the template name, excluding the template parameters
- if (baseType->isRecordType())
- x = baseType->getAsCXXRecordDecl()->getQualifiedNameAsString();
- else if (auto templateType = baseType->getAs<TemplateSpecializationType>())
- x = templateType->getTemplateName().getAsTemplateDecl()->getQualifiedNameAsString();
- else
- x = baseType.getAsString();
- inheritedFromSet.insert( x );
+ checkBase(spec.getType());
+ }
+ for (auto it = decl->vbases_begin(); it != decl->vbases_end(); ++it)
+ {
+ const CXXBaseSpecifier spec = *it;
+ checkBase(spec.getType());
}
bool bFoundProtected = false;
@@ -135,6 +134,21 @@ bool FinalClasses::VisitCXXRecordDecl(const CXXRecordDecl* decl)
return true;
}
+void FinalClasses::checkBase(QualType baseType)
+{
+ // need to look through typedefs, hence the getUnqualifiedDesugaredType
+ baseType = baseType.getDesugaredType(compiler.getASTContext());
+ std::string x;
+ // so that we get just the template name, excluding the template parameters
+ if (baseType->isRecordType())
+ x = baseType->getAsCXXRecordDecl()->getQualifiedNameAsString();
+ else if (auto templateType = baseType->getAs<TemplateSpecializationType>())
+ x = templateType->getTemplateName().getAsTemplateDecl()->getQualifiedNameAsString();
+ else
+ x = baseType.getAsString();
+ inheritedFromSet.insert( x );
+}
+
loplugin::Plugin::Registration< FinalClasses > X("finalclasses", false);
}
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 133a16486834..fd6c3db22dc3 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -304,11 +304,10 @@ public:
ErrCode compressAsPNG(const Graphic& rGraphic, SvStream& rOutputStream);
-protected:
+private:
OUString aFilterPath;
FilterConfigCache* pConfig;
-private:
void ImplInit();
ErrCode ImplSetError( ErrCode nError, const SvStream* pStm = nullptr );
ErrCode ImpTestOrFindFormat( const OUString& rPath, SvStream& rStream, sal_uInt16& rFormat );
diff --git a/include/vcl/i18nhelp.hxx b/include/vcl/i18nhelp.hxx
index 7e22bd9571b3..b3a14255ca06 100644
--- a/include/vcl/i18nhelp.hxx
+++ b/include/vcl/i18nhelp.hxx
@@ -47,7 +47,6 @@ namespace vcl
class VCL_DLLPUBLIC I18nHelper
{
-private:
::osl::Mutex maMutex;
LanguageTag maLanguageTag;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
@@ -59,8 +58,6 @@ private:
SAL_DLLPRIVATE void ImplDestroyWrappers();
-protected:
-
SAL_DLLPRIVATE utl::TransliterationWrapper& ImplGetTransliterationWrapper() const;
SAL_DLLPRIVATE LocaleDataWrapper& ImplGetLocaleDataWrapper() const;
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 2c0f00fe7a4b..f52b95e3a9ec 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -488,13 +488,12 @@ public:
//set to true to disable the built-in scrolling callbacks to allow the user
//to override it
void setUserManagedScrolling(bool bUserManagedScrolling) { m_bUserManagedScrolling = bUserManagedScrolling;}
-protected:
+private:
virtual Size calculateRequisition() const override;
virtual void setAllocation(const Size &rAllocation) override;
DECL_LINK(ScrollBarHdl, ScrollBar*, void);
void InitScrollBars(const Size &rRequest);
virtual bool EventNotify(NotifyEvent& rNEvt) override;
-private:
bool m_bUserManagedScrolling;
VclPtr<ScrollBar> m_pVScroll;
VclPtr<ScrollBar> m_pHScroll;
diff --git a/include/vcl/mnemonic.hxx b/include/vcl/mnemonic.hxx
index f531ab66d348..f6d1dc73b6b7 100644
--- a/include/vcl/mnemonic.hxx
+++ b/include/vcl/mnemonic.hxx
@@ -51,12 +51,10 @@
class VCL_DLLPUBLIC MnemonicGenerator
{
-private:
// 0 == Mnemonic; >0 == count of characters
sal_uInt8 maMnemonics[MAX_MNEMONICS];
css::uno::Reference< css::i18n::XCharacterClassification > mxCharClass;
-protected:
SAL_DLLPRIVATE static sal_uInt16 ImplGetMnemonicIndex( sal_Unicode c );
SAL_DLLPRIVATE static sal_Unicode ImplFindMnemonic( const OUString& rKey );
diff --git a/include/vcl/morebtn.hxx b/include/vcl/morebtn.hxx
index a18e341fccd1..1ee17a348380 100644
--- a/include/vcl/morebtn.hxx
+++ b/include/vcl/morebtn.hxx
@@ -30,7 +30,6 @@ struct ImplMoreButtonData;
class VCL_DLLPUBLIC MoreButton : public PushButton
{
-private:
ImplMoreButtonData* mpMBData;
bool mbState;
@@ -38,7 +37,6 @@ private:
MoreButton& operator=( const MoreButton & ) = delete;
SAL_DLLPRIVATE void ShowState();
-protected:
using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index 3abf26abf172..1596e0094c7b 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -93,7 +93,6 @@ class VCL_DLLPUBLIC TextEngine : public SfxBroadcaster
friend class TextUndoInsertChars;
friend class TextUndoRemoveChars;
-private:
TextDoc* mpDoc;
TEParaPortions* mpTEParaPortions;
VclPtr<OutputDevice> mpRefDev;
@@ -137,8 +136,6 @@ private:
bool mbRightToLeft : 1;
bool mbHasMultiLineParas : 1;
-protected:
-
void CursorMoved( sal_uInt32 nNode );
void TextModified();
diff --git a/include/vcl/textview.hxx b/include/vcl/textview.hxx
index 9688d9544782..c0cb1de16b96 100644
--- a/include/vcl/textview.hxx
+++ b/include/vcl/textview.hxx
@@ -84,13 +84,11 @@ class VCL_DLLPUBLIC TextView : public vcl::unohelper::DragAndDropClient
friend class TextUndoManager;
friend class TextSelFunctionSet;
-private:
std::unique_ptr<ImpTextView> mpImpl;
TextView( const TextView& ) = delete;
TextView& operator=( const TextView& ) = delete;
-protected:
bool ImpIndentBlock( bool bRight );
void ShowSelection();
void HideSelection();
diff --git a/vcl/inc/headless/svpcairotextrender.hxx b/vcl/inc/headless/svpcairotextrender.hxx
index dbd69b399732..bb258512a7c2 100644
--- a/vcl/inc/headless/svpcairotextrender.hxx
+++ b/vcl/inc/headless/svpcairotextrender.hxx
@@ -16,7 +16,6 @@ class SvpSalGraphics;
class SvpCairoTextRender : public CairoTextRender
{
-protected:
SvpSalGraphics& mrParent;
public:
diff --git a/vcl/inc/opengl/program.hxx b/vcl/inc/opengl/program.hxx
index 88ec1b7c1896..da2be164866f 100644
--- a/vcl/inc/opengl/program.hxx
+++ b/vcl/inc/opengl/program.hxx
@@ -112,7 +112,7 @@ public:
GLenum eType, GLboolean bNormalized, GLsizei aStride,
const GLvoid* pPointer);
-protected:
+private:
GLuint GetUniformLocation( const OString& rName );
};
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 4fd0e4c25317..b64de3ffed69 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -89,7 +89,6 @@ public:
ImplLayoutRuns maRuns;
ImplLayoutRuns maFallbackRuns;
-public:
ImplLayoutArgs( const OUString& rStr,
int nMinCharPos, int nEndCharPos, SalLayoutFlags nFlags,
const LanguageTag& rLanguageTag,
@@ -111,7 +110,7 @@ public:
{ return !maFallbackRuns.IsEmpty(); }
bool PrepareFallback();
-protected:
+private:
void AddRun( int nMinCharPos, int nEndCharPos, bool bRTL );
};
diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h
index c3e7c35cc350..49682011954b 100644
--- a/vcl/inc/unx/genpspgraphics.h
+++ b/vcl/inc/unx/genpspgraphics.h
@@ -41,7 +41,6 @@ class ImplFontMetricData;
class VCL_DLLPUBLIC GenPspGraphics : public SalGraphics
{
- protected:
psp::JobData* m_pJobData;
psp::PrinterGfx* m_pPrinterGfx;
diff --git a/vcl/inc/unx/pixmap.hxx b/vcl/inc/unx/pixmap.hxx
index 658935a70e4d..81144a2cda10 100644
--- a/vcl/inc/unx/pixmap.hxx
+++ b/vcl/inc/unx/pixmap.hxx
@@ -35,7 +35,7 @@ public:
int GetWidth() const { return mnWidth; };
int GetHeight() const { return mnHeight; };
-protected:
+private:
int mnWidth;
int mnHeight;
};
diff --git a/vcl/source/edit/textdoc.hxx b/vcl/source/edit/textdoc.hxx
index 5a6fd869b040..61839aae9936 100644
--- a/vcl/source/edit/textdoc.hxx
+++ b/vcl/source/edit/textdoc.hxx
@@ -65,11 +65,9 @@ public:
class TextNode
{
-private:
OUString maText;
TextCharAttribList maCharAttribs;
-protected:
void ExpandAttribs( sal_Int32 nIndex, sal_Int32 nNewChars );
void CollapseAttribs( sal_Int32 nIndex, sal_Int32 nDelChars );
@@ -95,11 +93,9 @@ public:
class TextDoc
{
-private:
std::vector<TextNode*> maTextNodes;
sal_uInt16 mnLeftMargin;
-protected:
void DestroyTextNodes();
public:
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index f040a6489676..44f0bc6c2f27 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -88,8 +88,6 @@ static ::osl::Mutex& getListMutex()
class ImpFilterOutputStream : public ::cppu::WeakImplHelper< css::io::XOutputStream >
{
-protected:
-
SvStream& mrStm;
virtual void SAL_CALL writeBytes( const css::uno::Sequence< sal_Int8 >& rData ) override
diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index bd7312457b77..f78d601fcc0a 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -266,7 +266,7 @@ public:
static const int NMAXSTACK = 48; // see CFF.appendixB
static const int NMAXHINTS = 2*96; // see CFF.appendixB
static const int NMAXTRANS = 32; // see CFF.appendixB
-public:
+
explicit CffSubsetterContext( const U8* pBasePtr, int nBaseLen);
bool initialCffRead();
@@ -274,9 +274,8 @@ public:
const sal_GlyphId* pGlyphIds, const U8* pEncoding,
GlyphWidth* pGlyphWidths, int nGlyphCount, FontSubsetInfo& );
-protected:
- int convert2Type1Ops( CffLocal*, const U8* pType2Ops, int nType2Len, U8* pType1Ops);
private:
+ int convert2Type1Ops( CffLocal*, const U8* pType2Ops, int nType2Len, U8* pType1Ops);
void convertOneTypeOp();
void convertOneTypeEsc();
void callType2Subr( bool bGlobal, int nSubrNumber);
@@ -293,11 +292,9 @@ private:
bool mbIgnoreHints;
sal_Int32 mnCntrMask;
-private:
int seekIndexData( int nIndexBase, int nDataIndex);
void seekIndexEnd( int nIndexBase);
-private:
CffLocal maCffLocal[256];
CffLocal* mpCffLocal;
diff --git a/vcl/source/fontsubset/xlat.cxx b/vcl/source/fontsubset/xlat.cxx
index 3363b5bd21c5..630720a520b4 100644
--- a/vcl/source/fontsubset/xlat.cxx
+++ b/vcl/source/fontsubset/xlat.cxx
@@ -30,9 +30,8 @@ public:
explicit ConverterCache();
~ConverterCache();
sal_uInt16 convertOne( int nSelect, sal_Unicode );
-protected:
- void ensureConverter( int nSelect );
private:
+ void ensureConverter( int nSelect );
rtl_UnicodeToTextConverter maConverterCache[ MAX_CVT_SELECT+1 ];
rtl_UnicodeToTextContext maContexts[ MAX_CVT_SELECT+1 ];
};
diff --git a/vcl/unx/generic/dtrans/X11_clipboard.hxx b/vcl/unx/generic/dtrans/X11_clipboard.hxx
index 8c7773fd02e2..45c8c35b0353 100644
--- a/vcl/unx/generic/dtrans/X11_clipboard.hxx
+++ b/vcl/unx/generic/dtrans/X11_clipboard.hxx
@@ -47,8 +47,6 @@ namespace x11 {
X11Clipboard( SelectionManager& rManager, Atom aSelection );
- protected:
-
friend class SelectionManager;
void fireChangedContentsEvent();
diff --git a/vcl/workben/icontest.cxx b/vcl/workben/icontest.cxx
index 216ab9e4b890..08524157f906 100644
--- a/vcl/workben/icontest.cxx
+++ b/vcl/workben/icontest.cxx
@@ -60,9 +60,6 @@ namespace {
class MyWorkWindow : public WorkWindow
{
-private:
-
-protected:
double mnStartTime;
int mnPaintCount;
diff --git a/vcl/workben/mtfdemo.cxx b/vcl/workben/mtfdemo.cxx
index 6effbadcc473..a9f52da4397a 100644
--- a/vcl/workben/mtfdemo.cxx
+++ b/vcl/workben/mtfdemo.cxx
@@ -104,7 +104,7 @@ public:
return 0;
}
-protected:
+private:
uno::Reference<lang::XMultiServiceFactory> xMSF;
void Init() override
{