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:
Noel Grandin
2016-08-08 09:57:25 +02:00
committed by Noel Grandin
parent 8f25e553b9
commit 602647c241
20 changed files with 55 additions and 84 deletions

View File

@@ -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

View File

@@ -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:
$ make 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
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)
output += "overriding:\t" + s + "\n";
ofstream myfile;
myfile.open( SRCDIR "/unnecessaryvirtual.log", ios::app | ios::out);
myfile.open( SRCDIR "/loplugin.unnecessaryvirtual.log", ios::app | ios::out);
myfile << output;
myfile.close();
}

View 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")

View File

@@ -115,7 +115,7 @@ namespace dbaccess
// helper
virtual void SAL_CALL disposing() override;
virtual void notifyDataSourceModified();
void notifyDataSourceModified();
/**
* This method can be used to propagate changes of property values.

View File

@@ -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()
throw (css::uno::RuntimeException, std::exception)
{

View File

@@ -34,7 +34,7 @@ public:
NodeType getScopeNodeType() const
{ return m_nodeType; }
virtual AstDeclaration* addDeclaration(AstDeclaration* pDecl);
AstDeclaration* addDeclaration(AstDeclaration* pDecl);
sal_uInt32 nMembers() const
{ return (sal_uInt32)(m_declarations.size()); }

View File

@@ -87,19 +87,6 @@ public:
virtual css::awt::Size SAL_CALL getSize()
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.
*/
virtual void SAL_CALL grabFocus()

View File

@@ -435,7 +435,7 @@ public:
static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc );
virtual bool PrepareClose(bool bUI = true);
virtual bool IsInformationLost();
bool IsInformationLost();
virtual HiddenInformation GetHiddenInformationState( HiddenInformation nStates );
sal_Int16 QueryHiddenInformation( HiddenWarningFact eFact, vcl::Window* pParent );
bool IsSecurityOptOpenReadOnly() const;

View File

@@ -87,13 +87,13 @@ public:
void insertItems (const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected = true, bool bShowCategoryInTooltip = false);
// Fill view with template folders thumbnails
virtual void Populate ();
void Populate ();
virtual void reload ();
virtual void showAllTemplates ();
virtual void showRegion (TemplateContainerItem *pItem);
void showRegion (TemplateContainerItem *pItem);
void showRegion (const OUString &rName);
@@ -116,7 +116,7 @@ public:
std::vector<TemplateItemProperties>
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);

View File

@@ -105,7 +105,7 @@ public:
void setHelpText (const OUString &sText) { maHelpText = sText; }
virtual OUString getHelpText() const { return maHelpText; };
virtual OUString getTitle() const { return maTitle; };
OUString getTitle() const { return maTitle; };
void setTitle (const OUString& rTitle);

View File

@@ -95,7 +95,7 @@ protected:
SfxStyleSheetBase( const SfxStyleSheetBase& );
virtual ~SfxStyleSheetBase();
virtual void Load( SvStream&, sal_uInt16 );
virtual void Store( SvStream& );
void Store( SvStream& );
public:

View File

@@ -388,7 +388,6 @@ private:
protected:
// callbacks for the data window
virtual void ImplStartTracking();
virtual void ImplTracking();
virtual void ImplEndTracking();
public:

View File

@@ -53,8 +53,8 @@ protected:
virtual int GetNextToken_() override;
void ReadUnknownData();
virtual void ReadBitmapData();
virtual void ReadOLEData();
void ReadBitmapData();
void ReadOLEData();
virtual ~SvRTFParser();

View File

@@ -121,7 +121,7 @@ public:
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; }
virtual ErrCode ReadAt(sal_uInt64 nPos, void * pBuffer, sal_Size nCount,

View File

@@ -972,7 +972,7 @@ public:
virtual void Erase( const Rectangle& rRect ) { DrawWallpaper( rRect, GetBackground() ); }
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:
SAL_DLLPRIVATE void DrawWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );

View File

@@ -47,7 +47,7 @@ public:
sal_Int32 getSize() const throw();
void forgetFromStart(sal_Int32 nBytesToForget) throw(css::io::BufferSizeExceededException);
virtual void shrink() throw();
void shrink() throw();
private:

View File

@@ -42,8 +42,8 @@ public:
virtual ~DropdownBox() override;
virtual void dispose() override;
virtual void HideContent();
virtual void ShowContent();
void HideContent();
void ShowContent();
private:
DECL_LINK_TYPED(PBClickHdl, Button*, void);

View File

@@ -191,11 +191,6 @@ void BrowseBox::ImplStartTracking()
}
void BrowseBox::ImplTracking()
{
}
void BrowseBox::ImplEndTracking()
{
}

View File

@@ -559,8 +559,6 @@ void BrowserDataWin::Tracking( const TrackingEvent& rTEvt )
}
else
{
GetParent()->ImplTracking();
long nDragRowDividerCurrentPos = aMousePos.Y() + m_nDragRowDividerOffset;
// care for minimum row height

View File

@@ -276,7 +276,7 @@ public:
virtual void UpdateAll( bool bInvalidateCompleteView );
void SetEntryHeight( short nHeight );
void InvalidateEntry( SvTreeListEntry* );
virtual void RecalcFocusRect();
void RecalcFocusRect();
void SelectEntry( SvTreeListEntry* pEntry, bool bSelect );
void SetDragDropMode( DragDropMode eDDMode );