loplugin:unnecessaryvirtual
Change-Id: If25d9307efda5f57b0f80a0cf5c2c5cab6a752d6 Reviewed-on: https://gerrit.libreoffice.org/27981 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
committed by
Noel Grandin
parent
8f25e553b9
commit
602647c241
@@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import io
|
|
||||||
|
|
||||||
definitionSet = set()
|
|
||||||
overridingSet = set()
|
|
||||||
|
|
||||||
|
|
||||||
with io.open(sys.argv[1], "rb", buffering=1024*1024) as txt:
|
|
||||||
for line in txt:
|
|
||||||
|
|
||||||
if line.startswith("definition:\t"):
|
|
||||||
idx1 = line.find("\t")
|
|
||||||
clazzName = line[idx1+1 : len(line)-1]
|
|
||||||
definitionSet.add(clazzName)
|
|
||||||
|
|
||||||
elif line.startswith("overriding:\t"):
|
|
||||||
idx1 = line.find("\t")
|
|
||||||
clazzName = line[idx1+1 : len(line)-1]
|
|
||||||
overridingSet.add(clazzName)
|
|
||||||
|
|
||||||
for clazz in sorted(definitionSet - overridingSet):
|
|
||||||
print clazz
|
|
||||||
|
|
||||||
# add an empty line at the end to make it easier for the removevirtuals plugin to mmap() the output file
|
|
||||||
print
|
|
||||||
|
|
@@ -22,7 +22,7 @@ Then we will post-process the 2 lists and find the set of virtual methods which
|
|||||||
The process goes something like this:
|
The process goes something like this:
|
||||||
$ make check
|
$ make check
|
||||||
$ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unnecessaryvirtual' check
|
$ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unnecessaryvirtual' check
|
||||||
$ ./compilerplugins/clang/unnecessaryvirtual.py unnecessaryvirtual.log > result.txt
|
$ ./compilerplugins/clang/unnecessaryvirtual.py
|
||||||
$ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir COMPILER_PLUGIN_TOOL='removevirtuals' $dir; done
|
$ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir COMPILER_PLUGIN_TOOL='removevirtuals' $dir; done
|
||||||
|
|
||||||
Note that the actual process may involve a fair amount of undoing, hand editing, and general messing around
|
Note that the actual process may involve a fair amount of undoing, hand editing, and general messing around
|
||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
for (const std::string & s : overridingSet)
|
for (const std::string & s : overridingSet)
|
||||||
output += "overriding:\t" + s + "\n";
|
output += "overriding:\t" + s + "\n";
|
||||||
ofstream myfile;
|
ofstream myfile;
|
||||||
myfile.open( SRCDIR "/unnecessaryvirtual.log", ios::app | ios::out);
|
myfile.open( SRCDIR "/loplugin.unnecessaryvirtual.log", ios::app | ios::out);
|
||||||
myfile << output;
|
myfile << output;
|
||||||
myfile.close();
|
myfile.close();
|
||||||
}
|
}
|
37
compilerplugins/clang/unnecessaryvirtual.py
Executable file
37
compilerplugins/clang/unnecessaryvirtual.py
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import io
|
||||||
|
|
||||||
|
definitionSet = set()
|
||||||
|
overridingSet = set()
|
||||||
|
|
||||||
|
|
||||||
|
with io.open("loplugin.unnecessaryvirtual.log", "rb", buffering=1024*1024) as txt:
|
||||||
|
for line in txt:
|
||||||
|
|
||||||
|
if line.startswith("definition:\t"):
|
||||||
|
idx1 = line.find("\t")
|
||||||
|
clazzName = line[idx1+1 : len(line)-1]
|
||||||
|
definitionSet.add(clazzName)
|
||||||
|
|
||||||
|
elif line.startswith("overriding:\t"):
|
||||||
|
idx1 = line.find("\t")
|
||||||
|
clazzName = line[idx1+1 : len(line)-1]
|
||||||
|
overridingSet.add(clazzName)
|
||||||
|
|
||||||
|
with open("loplugin.unnecessaryvirtual.report", "wt") as f:
|
||||||
|
for clazz in sorted(definitionSet - overridingSet):
|
||||||
|
# external code
|
||||||
|
if clazz.startswith("std::"): continue
|
||||||
|
if clazz.startswith("icu_"): continue
|
||||||
|
if clazz.startswith("__cxx"): continue
|
||||||
|
# windows-specific stuff
|
||||||
|
if clazz.startswith("canvas::"): continue
|
||||||
|
if clazz.startswith("psp::PrinterInfoManager"): continue
|
||||||
|
# some test magic
|
||||||
|
if clazz.startswith("apitest::"): continue
|
||||||
|
f.write(clazz + "\n")
|
||||||
|
# add an empty line at the end to make it easier for the removevirtuals plugin to mmap() the output file
|
||||||
|
f.write("\n")
|
||||||
|
|
@@ -115,7 +115,7 @@ namespace dbaccess
|
|||||||
// helper
|
// helper
|
||||||
virtual void SAL_CALL disposing() override;
|
virtual void SAL_CALL disposing() override;
|
||||||
|
|
||||||
virtual void notifyDataSourceModified();
|
void notifyDataSourceModified();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method can be used to propagate changes of property values.
|
* This method can be used to propagate changes of property values.
|
||||||
|
@@ -98,23 +98,6 @@ css::awt::Size SAL_CALL AccessibleComponentBase::getSize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SAL_CALL AccessibleComponentBase::addFocusListener (
|
|
||||||
const css::uno::Reference<
|
|
||||||
css::awt::XFocusListener >& /*xListener*/)
|
|
||||||
throw (css::uno::RuntimeException)
|
|
||||||
{
|
|
||||||
// Ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SAL_CALL AccessibleComponentBase::removeFocusListener (const css::uno::Reference<
|
|
||||||
css::awt::XFocusListener >& /*xListener*/ )
|
|
||||||
throw (css::uno::RuntimeException)
|
|
||||||
{
|
|
||||||
// Ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SAL_CALL AccessibleComponentBase::grabFocus()
|
void SAL_CALL AccessibleComponentBase::grabFocus()
|
||||||
throw (css::uno::RuntimeException, std::exception)
|
throw (css::uno::RuntimeException, std::exception)
|
||||||
{
|
{
|
||||||
|
@@ -34,7 +34,7 @@ public:
|
|||||||
NodeType getScopeNodeType() const
|
NodeType getScopeNodeType() const
|
||||||
{ return m_nodeType; }
|
{ return m_nodeType; }
|
||||||
|
|
||||||
virtual AstDeclaration* addDeclaration(AstDeclaration* pDecl);
|
AstDeclaration* addDeclaration(AstDeclaration* pDecl);
|
||||||
|
|
||||||
sal_uInt32 nMembers() const
|
sal_uInt32 nMembers() const
|
||||||
{ return (sal_uInt32)(m_declarations.size()); }
|
{ return (sal_uInt32)(m_declarations.size()); }
|
||||||
|
@@ -87,19 +87,6 @@ public:
|
|||||||
virtual css::awt::Size SAL_CALL getSize()
|
virtual css::awt::Size SAL_CALL getSize()
|
||||||
throw (css::uno::RuntimeException, std::exception) override;
|
throw (css::uno::RuntimeException, std::exception) override;
|
||||||
|
|
||||||
/** The default implementation ignores this call.
|
|
||||||
*/
|
|
||||||
virtual void SAL_CALL addFocusListener (
|
|
||||||
const css::uno::Reference<
|
|
||||||
css::awt::XFocusListener >& xListener)
|
|
||||||
throw (css::uno::RuntimeException);
|
|
||||||
|
|
||||||
/** The default implementation ignores this call.
|
|
||||||
*/
|
|
||||||
virtual void SAL_CALL removeFocusListener (const css::uno::Reference<
|
|
||||||
css::awt::XFocusListener >& xListener )
|
|
||||||
throw (css::uno::RuntimeException);
|
|
||||||
|
|
||||||
/** The default implementation does nothing.
|
/** The default implementation does nothing.
|
||||||
*/
|
*/
|
||||||
virtual void SAL_CALL grabFocus()
|
virtual void SAL_CALL grabFocus()
|
||||||
|
@@ -435,7 +435,7 @@ public:
|
|||||||
static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc );
|
static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc );
|
||||||
|
|
||||||
virtual bool PrepareClose(bool bUI = true);
|
virtual bool PrepareClose(bool bUI = true);
|
||||||
virtual bool IsInformationLost();
|
bool IsInformationLost();
|
||||||
virtual HiddenInformation GetHiddenInformationState( HiddenInformation nStates );
|
virtual HiddenInformation GetHiddenInformationState( HiddenInformation nStates );
|
||||||
sal_Int16 QueryHiddenInformation( HiddenWarningFact eFact, vcl::Window* pParent );
|
sal_Int16 QueryHiddenInformation( HiddenWarningFact eFact, vcl::Window* pParent );
|
||||||
bool IsSecurityOptOpenReadOnly() const;
|
bool IsSecurityOptOpenReadOnly() const;
|
||||||
|
@@ -87,13 +87,13 @@ public:
|
|||||||
void insertItems (const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected = true, bool bShowCategoryInTooltip = false);
|
void insertItems (const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected = true, bool bShowCategoryInTooltip = false);
|
||||||
|
|
||||||
// Fill view with template folders thumbnails
|
// Fill view with template folders thumbnails
|
||||||
virtual void Populate ();
|
void Populate ();
|
||||||
|
|
||||||
virtual void reload ();
|
virtual void reload ();
|
||||||
|
|
||||||
virtual void showAllTemplates ();
|
virtual void showAllTemplates ();
|
||||||
|
|
||||||
virtual void showRegion (TemplateContainerItem *pItem);
|
void showRegion (TemplateContainerItem *pItem);
|
||||||
|
|
||||||
void showRegion (const OUString &rName);
|
void showRegion (const OUString &rName);
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
std::vector<TemplateItemProperties>
|
std::vector<TemplateItemProperties>
|
||||||
getFilteredItems (const std::function<bool (const TemplateItemProperties&) > &rFunc) const;
|
getFilteredItems (const std::function<bool (const TemplateItemProperties&) > &rFunc) const;
|
||||||
|
|
||||||
virtual sal_uInt16 createRegion (const OUString &rName);
|
sal_uInt16 createRegion (const OUString &rName);
|
||||||
|
|
||||||
bool renameRegion(const OUString &rTitle, const OUString &rNewTitle);
|
bool renameRegion(const OUString &rTitle, const OUString &rNewTitle);
|
||||||
|
|
||||||
|
@@ -105,7 +105,7 @@ public:
|
|||||||
void setHelpText (const OUString &sText) { maHelpText = sText; }
|
void setHelpText (const OUString &sText) { maHelpText = sText; }
|
||||||
|
|
||||||
virtual OUString getHelpText() const { return maHelpText; };
|
virtual OUString getHelpText() const { return maHelpText; };
|
||||||
virtual OUString getTitle() const { return maTitle; };
|
OUString getTitle() const { return maTitle; };
|
||||||
|
|
||||||
void setTitle (const OUString& rTitle);
|
void setTitle (const OUString& rTitle);
|
||||||
|
|
||||||
|
@@ -95,7 +95,7 @@ protected:
|
|||||||
SfxStyleSheetBase( const SfxStyleSheetBase& );
|
SfxStyleSheetBase( const SfxStyleSheetBase& );
|
||||||
virtual ~SfxStyleSheetBase();
|
virtual ~SfxStyleSheetBase();
|
||||||
virtual void Load( SvStream&, sal_uInt16 );
|
virtual void Load( SvStream&, sal_uInt16 );
|
||||||
virtual void Store( SvStream& );
|
void Store( SvStream& );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@@ -388,7 +388,6 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
// callbacks for the data window
|
// callbacks for the data window
|
||||||
virtual void ImplStartTracking();
|
virtual void ImplStartTracking();
|
||||||
virtual void ImplTracking();
|
|
||||||
virtual void ImplEndTracking();
|
virtual void ImplEndTracking();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@@ -53,8 +53,8 @@ protected:
|
|||||||
virtual int GetNextToken_() override;
|
virtual int GetNextToken_() override;
|
||||||
|
|
||||||
void ReadUnknownData();
|
void ReadUnknownData();
|
||||||
virtual void ReadBitmapData();
|
void ReadBitmapData();
|
||||||
virtual void ReadOLEData();
|
void ReadOLEData();
|
||||||
|
|
||||||
virtual ~SvRTFParser();
|
virtual ~SvRTFParser();
|
||||||
|
|
||||||
|
@@ -121,7 +121,7 @@ public:
|
|||||||
|
|
||||||
const SvStream * GetStream() const { return m_pStream; }
|
const SvStream * GetStream() const { return m_pStream; }
|
||||||
|
|
||||||
virtual void SetSynchronMode(bool bTheSync = true) { m_bSync = bTheSync; }
|
void SetSynchronMode(bool bTheSync = true) { m_bSync = bTheSync; }
|
||||||
bool IsSynchronMode() const { return m_bSync; }
|
bool IsSynchronMode() const { return m_bSync; }
|
||||||
|
|
||||||
virtual ErrCode ReadAt(sal_uInt64 nPos, void * pBuffer, sal_Size nCount,
|
virtual ErrCode ReadAt(sal_uInt64 nPos, void * pBuffer, sal_Size nCount,
|
||||||
|
@@ -972,7 +972,7 @@ public:
|
|||||||
virtual void Erase( const Rectangle& rRect ) { DrawWallpaper( rRect, GetBackground() ); }
|
virtual void Erase( const Rectangle& rRect ) { DrawWallpaper( rRect, GetBackground() ); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
|
void DrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SAL_DLLPRIVATE void DrawWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
|
SAL_DLLPRIVATE void DrawWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
|
||||||
|
@@ -47,7 +47,7 @@ public:
|
|||||||
sal_Int32 getSize() const throw();
|
sal_Int32 getSize() const throw();
|
||||||
void forgetFromStart(sal_Int32 nBytesToForget) throw(css::io::BufferSizeExceededException);
|
void forgetFromStart(sal_Int32 nBytesToForget) throw(css::io::BufferSizeExceededException);
|
||||||
|
|
||||||
virtual void shrink() throw();
|
void shrink() throw();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@@ -42,8 +42,8 @@ public:
|
|||||||
virtual ~DropdownBox() override;
|
virtual ~DropdownBox() override;
|
||||||
virtual void dispose() override;
|
virtual void dispose() override;
|
||||||
|
|
||||||
virtual void HideContent();
|
void HideContent();
|
||||||
virtual void ShowContent();
|
void ShowContent();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECL_LINK_TYPED(PBClickHdl, Button*, void);
|
DECL_LINK_TYPED(PBClickHdl, Button*, void);
|
||||||
|
@@ -191,11 +191,6 @@ void BrowseBox::ImplStartTracking()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BrowseBox::ImplTracking()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BrowseBox::ImplEndTracking()
|
void BrowseBox::ImplEndTracking()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -559,8 +559,6 @@ void BrowserDataWin::Tracking( const TrackingEvent& rTEvt )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetParent()->ImplTracking();
|
|
||||||
|
|
||||||
long nDragRowDividerCurrentPos = aMousePos.Y() + m_nDragRowDividerOffset;
|
long nDragRowDividerCurrentPos = aMousePos.Y() + m_nDragRowDividerOffset;
|
||||||
|
|
||||||
// care for minimum row height
|
// care for minimum row height
|
||||||
|
@@ -276,7 +276,7 @@ public:
|
|||||||
virtual void UpdateAll( bool bInvalidateCompleteView );
|
virtual void UpdateAll( bool bInvalidateCompleteView );
|
||||||
void SetEntryHeight( short nHeight );
|
void SetEntryHeight( short nHeight );
|
||||||
void InvalidateEntry( SvTreeListEntry* );
|
void InvalidateEntry( SvTreeListEntry* );
|
||||||
virtual void RecalcFocusRect();
|
void RecalcFocusRect();
|
||||||
|
|
||||||
void SelectEntry( SvTreeListEntry* pEntry, bool bSelect );
|
void SelectEntry( SvTreeListEntry* pEntry, bool bSelect );
|
||||||
void SetDragDropMode( DragDropMode eDDMode );
|
void SetDragDropMode( DragDropMode eDDMode );
|
||||||
|
Reference in New Issue
Block a user