diff options
27 files changed, 151 insertions, 168 deletions
diff --git a/compilerplugins/clang/unnecessaryvirtual.cxx b/compilerplugins/clang/unnecessaryvirtual.cxx index 1ecc47114a0b..82f91c71f1a7 100644 --- a/compilerplugins/clang/unnecessaryvirtual.cxx +++ b/compilerplugins/clang/unnecessaryvirtual.cxx @@ -34,8 +34,19 @@ TODO does not find destructors that don't need to be virtual namespace { +struct MyFuncInfo +{ + std::string name; + std::string sourceLocation; + +}; +bool operator < (const MyFuncInfo &lhs, const MyFuncInfo &rhs) +{ + return lhs.name < rhs.name; +} + // try to limit the voluminous output a little -static std::set<std::string> definitionSet; +static std::set<MyFuncInfo> definitionSet; static std::set<std::string> overridingSet; class UnnecessaryVirtual: @@ -51,8 +62,8 @@ public: // dump all our output in one write call - this is to try and limit IO "crosstalk" between multiple processes // writing to the same logfile std::string output; - for (const std::string & s : definitionSet) - output += "definition:\t" + s + "\n"; + for (const MyFuncInfo & s : definitionSet) + output += "definition:\t" + s.name + "\t" + s.sourceLocation + "\n"; for (const std::string & s : overridingSet) output += "overriding:\t" + s + "\n"; ofstream myfile; @@ -61,11 +72,12 @@ public: myfile.close(); } bool shouldVisitTemplateInstantiations () const { return true; } + bool shouldVisitImplicitCode() const { return true; } bool VisitCXXMethodDecl( const CXXMethodDecl* decl ); - bool VisitCallExpr(CallExpr* ); private: std::string fullyQualifiedName(const FunctionDecl* functionDecl); + std::string toString(SourceLocation loc); }; std::string niceName(const CXXMethodDecl* functionDecl) @@ -87,6 +99,16 @@ std::string niceName(const CXXMethodDecl* functionDecl) std::string UnnecessaryVirtual::fullyQualifiedName(const FunctionDecl* functionDecl) { + if (functionDecl->getInstantiatedFromMemberFunction()) + functionDecl = functionDecl->getInstantiatedFromMemberFunction(); + else if (functionDecl->getClassScopeSpecializationPattern()) + functionDecl = functionDecl->getClassScopeSpecializationPattern(); +// workaround clang-3.5 issue +#if CLANG_VERSION >= 30600 + else if (functionDecl->getTemplateInstantiationPattern()) + functionDecl = functionDecl->getTemplateInstantiationPattern(); +#endif + std::string ret = compat::getReturnType(*functionDecl).getCanonicalType().getAsString(); ret += " "; if (isa<CXXMethodDecl>(functionDecl)) { @@ -113,110 +135,68 @@ std::string UnnecessaryVirtual::fullyQualifiedName(const FunctionDecl* functionD bool UnnecessaryVirtual::VisitCXXMethodDecl( const CXXMethodDecl* methodDecl ) { + if (ignoreLocation(methodDecl)) { + return true; + } + if (!methodDecl->isThisDeclarationADefinition() || + !methodDecl->isVirtual() || + methodDecl->isDeleted()) + { + return true; + } methodDecl = methodDecl->getCanonicalDecl(); + // ignore stuff that forms part of the stable URE interface + if (isInUnoIncludeFile(methodDecl)) { + return true; + } std::string aNiceName = niceName(methodDecl); // for destructors, we need to check if any of the superclass' destructors are virtual if (isa<CXXDestructorDecl>(methodDecl)) { - /* TODO I need to check if the base class has any virtual functions, since overriding - classes will simply get a compiler-provided virtual destructor by default. - - if (!methodDecl->isVirtual() && !methodDecl->isPure()) { - return true; + const CXXRecordDecl* cxxRecordDecl = methodDecl->getParent(); + if (cxxRecordDecl->getNumBases() == 0) { + definitionSet.insert( { aNiceName, toString( methodDecl->getLocation() ) } ); + return true; } - std::set<std::string> overriddenSet; - const CXXRecordDecl *pRecordDecl = methodDecl->getParent(); - for(auto baseSpecifier = pRecordDecl->bases_begin(); - baseSpecifier != pRecordDecl->bases_end(); ++baseSpecifier) + for(auto baseSpecifier = cxxRecordDecl->bases_begin(); + baseSpecifier != cxxRecordDecl->bases_end(); ++baseSpecifier) { if (baseSpecifier->getType()->isRecordType()) { - const CXXRecordDecl *pSuperclassCXXRecordDecl = baseSpecifier->getType()->getAsCXXRecordDecl(); - if (pSuperclassCXXRecordDecl->getDestructor()) - { - std::string aOverriddenNiceName = niceName(pSuperclassCXXRecordDecl->getDestructor()); - overriddenSet.insert(aOverriddenNiceName); - } + const CXXRecordDecl* superclassCXXRecordDecl = baseSpecifier->getType()->getAsCXXRecordDecl(); + std::string aOverriddenNiceName = niceName(superclassCXXRecordDecl->getDestructor()); + overridingSet.insert(aOverriddenNiceName); } } - if (overriddenSet.empty()) { - cout << "definition:\t" << aNiceName << endl; - } else { - for(std::string s : overriddenSet) - cout << "overriding:\t" << s << endl; - }*/ return true; } - if (!methodDecl->isVirtual()) { - return true; - } if (methodDecl->size_overridden_methods() == 0) { - // ignore stuff that forms part of the stable URE interface - if (isInUnoIncludeFile(methodDecl)) { - return true; - } - // ignore templates and template instantiations, - // I just cannot get clang to give me decent overriding method data out of them - if (methodDecl->getParent()->getDescribedClassTemplate() - || methodDecl->getParent()->getTemplateInstantiationPattern()) - return true; - if (aNiceName.find("processOpCode2") != std::string::npos) - { - methodDecl->dump(); - cout << "definition " << aNiceName << endl; - } - definitionSet.insert(aNiceName); + definitionSet.insert( { aNiceName, toString( methodDecl->getLocation() ) } ); } else { for (auto iter = methodDecl->begin_overridden_methods(); iter != methodDecl->end_overridden_methods(); ++iter) { const CXXMethodDecl *overriddenMethod = *iter; // we only care about the first level override to establish that a virtual qualifier was useful. - if (overriddenMethod->isPure() || overriddenMethod->size_overridden_methods() == 0) { + if (overriddenMethod->isPure() || overriddenMethod->size_overridden_methods() == 0) + { std::string aOverriddenNiceName = niceName(overriddenMethod); overridingSet.insert(aOverriddenNiceName); - if (aNiceName.find("processOpCode2") != std::string::npos) - { - methodDecl->dump(); - cout << "overriding " << aNiceName << endl; - } } - } + } } return true; } -// prevent recursive templates from blowing up the stack -static std::set<std::string> traversedFunctionSet; - -bool UnnecessaryVirtual::VisitCallExpr(CallExpr* expr) +std::string UnnecessaryVirtual::toString(SourceLocation loc) { - // Note that I don't ignore ANYTHING here, because I want to get calls to my code that result - // from template instantiation deep inside the STL and other external code - - FunctionDecl* calleeFunctionDecl = expr->getDirectCallee(); - if (calleeFunctionDecl == nullptr) { - Expr* callee = expr->getCallee()->IgnoreParenImpCasts(); - DeclRefExpr* dr = dyn_cast<DeclRefExpr>(callee); - if (dr) { - calleeFunctionDecl = dyn_cast<FunctionDecl>(dr->getDecl()); - if (calleeFunctionDecl) - goto gotfunc; - } - return true; - } - -gotfunc: - // if we see a call to a function, it may effectively create new code, - // if the function is templated. However, if we are inside a template function, - // calling another function on the same template, the same problem occurs. - // Rather than tracking all of that, just traverse anything we have not already traversed. - if (traversedFunctionSet.insert(fullyQualifiedName(calleeFunctionDecl)).second) - TraverseFunctionDecl(calleeFunctionDecl); - - return true; + SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( loc ); + StringRef name = compiler.getSourceManager().getFilename(expansionLoc); + std::string sourceLocation = std::string(name.substr(strlen(SRCDIR)+1)) + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc)); + normalizeDotDotInFilePath(sourceLocation); + return sourceLocation; } diff --git a/compilerplugins/clang/unnecessaryvirtual.py b/compilerplugins/clang/unnecessaryvirtual.py index dd1ea719c7e7..651f8732758e 100755 --- a/compilerplugins/clang/unnecessaryvirtual.py +++ b/compilerplugins/clang/unnecessaryvirtual.py @@ -1,9 +1,11 @@ #!/usr/bin/python -import sys import io +import re +import sys definitionSet = set() +definitionToSourceLocationMap = dict() overridingSet = set() @@ -11,38 +13,54 @@ with io.open("loplugin.unnecessaryvirtual.log", "rb", buffering=1024*1024) as tx for line in txt: tokens = line.strip().split("\t") if tokens[0] == "definition:": - clazzName = tokens[1] - definitionSet.add(clazzName) + fullMethodName = tokens[1] + sourceLocation = tokens[2] + definitionSet.add(fullMethodName) + definitionToSourceLocationMap[fullMethodName] = sourceLocation elif tokens[0] == "overriding:": - clazzName = tokens[1] - overridingSet.add(clazzName) + fullMethodName = tokens[1] + overridingSet.add(fullMethodName) +unnecessaryVirtualSet = set() + +for clazz in (definitionSet - overridingSet): + # windows-specific stuff + if clazz.startswith("canvas::"): continue + if clazz.startswith("psp::PrinterInfoManager"): continue + if clazz.startswith("DdeTopic::"): continue + if clazz == "basegfx::unotools::UnoPolyPolygon::void-modifying()const": continue + if clazz == "SalLayout::_Bool-IsKashidaPosValid(int,)const": continue + if clazz == "SalLayout::void-DisableGlyphInjection(_Bool,)": continue + # Linux-TDF specific + if clazz == "X11SalFrame::void-updateGraphics(_Bool,)": continue + # OSX specific + if clazz == "SalFrame::void-SetRepresentedURL(const class rtl::OUString &,)": continue + if clazz == "SalMenu::_Bool-AddMenuBarButton(const struct SalMenuButtonItem &,)": continue + if clazz == "SalMenu::class Rectangle-GetMenuBarButtonRectPixel(sal_uInt16,class SalFrame *,)": continue + if clazz == "SalMenu::void-RemoveMenuBarButton(sal_uInt16,)": continue + if clazz == "SalLayout::_Bool-DrawTextSpecial(class SalGraphics &,sal_uInt32,)const": continue + # GTK < 3 + if clazz == "GtkSalDisplay::int-CaptureMouse(class SalFrame *,)": continue + # some test magic + if clazz.startswith("apitest::"): continue + # ignore external code + if definitionToSourceLocationMap[clazz].startswith("external/"): continue + + unnecessaryVirtualSet.add((clazz,definitionToSourceLocationMap[clazz] )) + + +# sort the results using a "natural order" so sequences like [item1,item2,item10] sort nicely +def natural_sort_key(s, _nsre=re.compile('([0-9]+)')): + return [int(text) if text.isdigit() else text.lower() + for text in re.split(_nsre, s)] + +# sort results by name and line number +tmp1list = sorted(unnecessaryVirtualSet, key=lambda v: natural_sort_key(v[1])) + 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 - if clazz.startswith("DdeTopic::"): continue - if clazz == "basegfx::unotools::UnoPolyPolygon::void-modifying()const": continue - if clazz == "SalLayout::_Bool-IsKashidaPosValid(int,)const": continue - if clazz == "SalLayout::void-DisableGlyphInjection(_Bool,)": continue - # Linux-TDF specific - if clazz == "X11SalFrame::void-updateGraphics(_Bool,)": continue - # OSX specific - if clazz == "SalFrame::void-SetRepresentedURL(const class rtl::OUString &,)": continue - if clazz == "SalMenu::_Bool-AddMenuBarButton(const struct SalMenuButtonItem &,)": continue - if clazz == "SalMenu::class Rectangle-GetMenuBarButtonRectPixel(sal_uInt16,class SalFrame *,)": continue - if clazz == "SalMenu::void-RemoveMenuBarButton(sal_uInt16,)": continue - if clazz == "SalLayout::_Bool-DrawTextSpecial(class SalGraphics &,sal_uInt32,)const": continue - # GTK < 3 - if clazz == "GtkSalDisplay::int-CaptureMouse(class SalFrame *,)": 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 + for t in tmp1list: + f.write( t[1] + "\n" ) + f.write( " " + t[0] + "\n" ) + # add an empty line at the end to make it easier for the removevirtuals plugin to mmap() the output file f.write("\n") diff --git a/compilerplugins/clang/unusedenumvalues.py b/compilerplugins/clang/unusedenumvalues.py index eb3158509562..76c9fe619eb3 100755 --- a/compilerplugins/clang/unusedenumvalues.py +++ b/compilerplugins/clang/unusedenumvalues.py @@ -108,9 +108,3 @@ with open("loplugin.unusedenumvalues.report-untouched", "wt") as f: f.write( t[1] + "\n" ) f.write( " " + t[0] + "\n" ) - - -# add an empty line at the end to make it easier for the unusedFieldsremove plugin to mmap() the output file -print - - diff --git a/include/xmloff/xmlnume.hxx b/include/xmloff/xmlnume.hxx index 4583c18578bf..9d4b253403d9 100644 --- a/include/xmloff/xmlnume.hxx +++ b/include/xmloff/xmlnume.hxx @@ -37,7 +37,7 @@ class SvXMLExportItemMapper; class SvXMLExport; class XMLTextListAutoStylePool; -class XMLOFF_DLLPUBLIC SvxXMLNumRuleExport +class XMLOFF_DLLPUBLIC SvxXMLNumRuleExport final { SvXMLExport& rExport; const OUString sNumberingRules; @@ -64,7 +64,7 @@ protected: public: SvxXMLNumRuleExport( SvXMLExport& rExport ); - virtual ~SvxXMLNumRuleExport(); + ~SvxXMLNumRuleExport(); // should be private but sw::StoredChapterNumberingExport needs it void exportLevelStyles( diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx index da271105e5f0..905a6e31d318 100644 --- a/include/xmloff/xmlnumfe.hxx +++ b/include/xmloff/xmlnumfe.hxx @@ -43,7 +43,7 @@ class SvXMLNumUsedList_Impl; struct SvXMLEmbeddedTextEntry; class SvXMLEmbeddedTextEntryArr; -class XMLOFF_DLLPUBLIC SvXMLNumFmtExport +class XMLOFF_DLLPUBLIC SvXMLNumFmtExport final { private: SvXMLExport& rExport; @@ -103,7 +103,7 @@ public: const css::uno::Reference< css::util::XNumberFormatsSupplier >& rSupp, const OUString& rPrefix ); - virtual ~SvXMLNumFmtExport(); + ~SvXMLNumFmtExport(); // core API void Export( bool bIsAutoStyle); diff --git a/include/xmloff/xmltabe.hxx b/include/xmloff/xmltabe.hxx index 140d3b634c34..85c182df573f 100644 --- a/include/xmloff/xmltabe.hxx +++ b/include/xmloff/xmltabe.hxx @@ -30,7 +30,7 @@ namespace com { namespace sun { namespace star { } } } -class SvxXMLTabStopExport +class SvxXMLTabStopExport final { SvXMLExport& rExport; // for access to document handler @@ -41,7 +41,7 @@ protected: public: SvxXMLTabStopExport( SvXMLExport& rExport ); - virtual ~SvxXMLTabStopExport(); + ~SvxXMLTabStopExport(); // core API void Export( const css::uno::Any& rAny ); diff --git a/include/xmloff/xmluconv.hxx b/include/xmloff/xmluconv.hxx index 9d22985cee83..8c11ca48c9d3 100644 --- a/include/xmloff/xmluconv.hxx +++ b/include/xmloff/xmluconv.hxx @@ -75,7 +75,7 @@ public: a lot of the methods here have been moved to <sax/tools/converter.hxx>! */ -class XMLOFF_DLLPUBLIC SvXMLUnitConverter +class XMLOFF_DLLPUBLIC SvXMLUnitConverter final { private: SvXMLUnitConverter(const SvXMLUnitConverter&) = delete; @@ -93,7 +93,7 @@ public: sal_Int16 eCoreMeasureUnit /*css::util::MeasureUnit*/, sal_Int16 eXMLMeasureUnit /*css::util::MeasureUnit*/); - virtual ~SvXMLUnitConverter(); + ~SvXMLUnitConverter(); static sal_Int16 GetMeasureUnit(FieldUnit const nFieldUnit); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx index b1ac2f1df701..5ae070024f7c 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx @@ -57,7 +57,7 @@ struct HorizontallyMergedCell }; /// Class to handle events generated by TableManager::resolveCurrentTable(). -class DomainMapperTableHandler +class DomainMapperTableHandler final { css::uno::Reference<css::text::XTextAppendAndConvert> m_xText; DomainMapper_Impl& m_rDMapper_Impl; @@ -84,7 +84,7 @@ public: DomainMapperTableHandler(css::uno::Reference<css::text::XTextAppendAndConvert> const& xText, DomainMapper_Impl& rDMapper_Impl); - virtual ~DomainMapperTableHandler(); + ~DomainMapperTableHandler(); /** Handle start of table. diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index b643b7f34c05..84afc50db754 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -335,7 +335,7 @@ struct SymbolData }; class DomainMapper; -class DomainMapper_Impl +class DomainMapper_Impl final { public: typedef std::map < OUString, BookmarkInsertPosition > BookmarkMap_t; @@ -475,7 +475,7 @@ public: css::uno::Reference< css::lang::XComponent > const& xModel, SourceDocumentType eDocumentType, utl::MediaDescriptor& rMediaDesc); - virtual ~DomainMapper_Impl(); + ~DomainMapper_Impl(); SectionPropertyMap* GetLastSectionContext( ) { diff --git a/writerfilter/source/dmapper/LoggedResources.hxx b/writerfilter/source/dmapper/LoggedResources.hxx index 09079b563a6e..0c466448a85b 100644 --- a/writerfilter/source/dmapper/LoggedResources.hxx +++ b/writerfilter/source/dmapper/LoggedResources.hxx @@ -28,11 +28,11 @@ namespace writerfilter { #ifdef DEBUG_WRITERFILTER -class LoggedResourcesHelper +class LoggedResourcesHelper final { public: explicit LoggedResourcesHelper(const std::string & sPrefix); - virtual ~LoggedResourcesHelper(); + ~LoggedResourcesHelper(); void startElement(const std::string & sElement); static void endElement(const std::string & sElement); diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx index 039eabdb927e..29d3f5fcb9d5 100644 --- a/writerfilter/source/dmapper/NumberingManager.hxx +++ b/writerfilter/source/dmapper/NumberingManager.hxx @@ -105,12 +105,12 @@ private: }; /// Represents a numbering picture bullet: an id and a graphic. -class NumPicBullet +class NumPicBullet final { public: typedef std::shared_ptr<NumPicBullet> Pointer; NumPicBullet(); - virtual ~NumPicBullet(); + ~NumPicBullet(); void SetId(sal_Int32 nId); sal_Int32 GetId() { return m_nId;} diff --git a/writerfilter/source/dmapper/SdtHelper.hxx b/writerfilter/source/dmapper/SdtHelper.hxx index 86c634da918b..a619d508f2de 100644 --- a/writerfilter/source/dmapper/SdtHelper.hxx +++ b/writerfilter/source/dmapper/SdtHelper.hxx @@ -45,7 +45,7 @@ namespace dmapper * w:sdt tokens can't be imported as form fields, as w:sdt supports * e.g. date picking as well. */ -class SdtHelper +class SdtHelper final { DomainMapper_Impl& m_rDM_Impl; @@ -70,7 +70,7 @@ class SdtHelper void createControlShape(css::awt::Size aSize, css::uno::Reference<css::awt::XControlModel> const&, const css::uno::Sequence<css::beans::PropertyValue>& rGrabBag); public: SdtHelper(DomainMapper_Impl& rDM_Impl); - virtual ~SdtHelper(); + ~SdtHelper(); std::vector<OUString>& getDropDownItems() { diff --git a/writerfilter/source/dmapper/TableData.hxx b/writerfilter/source/dmapper/TableData.hxx index 19aa4cd88ed9..03ad4995119e 100644 --- a/writerfilter/source/dmapper/TableData.hxx +++ b/writerfilter/source/dmapper/TableData.hxx @@ -33,7 +33,7 @@ namespace dmapper /** Class containing the data to describe a table cell. */ -class CellData +class CellData final { /** Handle to start of cell. @@ -60,8 +60,6 @@ public: { } - virtual ~CellData() {} - /** Set the end handle of a cell. @@ -103,7 +101,7 @@ public: /** Class to handle data of a table row. */ -class RowData +class RowData final { typedef ::std::vector<CellData::Pointer_t> Cells; @@ -127,8 +125,6 @@ public: { } - virtual ~RowData() {} - /** Add a cell to the row. diff --git a/writerfilter/source/dmapper/TableManager.hxx b/writerfilter/source/dmapper/TableManager.hxx index 7c9ba153ab4b..d9d9826e3157 100644 --- a/writerfilter/source/dmapper/TableManager.hxx +++ b/writerfilter/source/dmapper/TableManager.hxx @@ -49,7 +49,7 @@ class DomainMapperTableHandler; */ class TableManager { - class TableManagerState + class TableManagerState final { /** properties of the current cell @@ -90,10 +90,6 @@ class TableManager { } - virtual ~TableManagerState() - { - } - void startLevel() { TablePropertyMapPtr pProps; diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.hxx b/writerfilter/source/dmapper/TablePropertiesHandler.hxx index 55a823a6b979..5a52aedff558 100644 --- a/writerfilter/source/dmapper/TablePropertiesHandler.hxx +++ b/writerfilter/source/dmapper/TablePropertiesHandler.hxx @@ -34,7 +34,7 @@ namespace dmapper { class DomainMapper; -class TablePropertiesHandler +class TablePropertiesHandler final { private: PropertyMapPtr m_pCurrentProperties; @@ -43,7 +43,7 @@ private: public: TablePropertiesHandler(); - virtual ~TablePropertiesHandler( ); + ~TablePropertiesHandler( ); bool sprm(Sprm & sprm); diff --git a/writerfilter/source/dmapper/WrapPolygonHandler.hxx b/writerfilter/source/dmapper/WrapPolygonHandler.hxx index 0f4002752622..3192408aa330 100644 --- a/writerfilter/source/dmapper/WrapPolygonHandler.hxx +++ b/writerfilter/source/dmapper/WrapPolygonHandler.hxx @@ -29,7 +29,7 @@ namespace writerfilter { namespace dmapper { -class WrapPolygon +class WrapPolygon final { public: typedef std::vector<css::awt::Point> Points_t; @@ -40,7 +40,7 @@ private: public: WrapPolygon(); - virtual ~WrapPolygon(); + ~WrapPolygon(); void addPoint(const css::awt::Point & rPoint); diff --git a/writerfilter/source/ooxml/OOXMLParserState.hxx b/writerfilter/source/ooxml/OOXMLParserState.hxx index ea3e00401313..0ba0079d1653 100644 --- a/writerfilter/source/ooxml/OOXMLParserState.hxx +++ b/writerfilter/source/ooxml/OOXMLParserState.hxx @@ -39,7 +39,7 @@ struct SavedAlternateState bool m_bTookChoice; ///< Did we take the Choice or want Fallback instead? }; -class OOXMLParserState +class OOXMLParserState final { bool mbInSectionGroup; bool mbInParagraphGroup; @@ -64,7 +64,7 @@ public: typedef std::shared_ptr<OOXMLParserState> Pointer_t; OOXMLParserState(); - virtual ~OOXMLParserState(); + ~OOXMLParserState(); bool isInSectionGroup() const { return mbInSectionGroup;} void setInSectionGroup(bool bInSectionGroup); diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx index 5e21b84d9946..42260b3ad29b 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.hxx +++ b/writerfilter/source/rtftok/rtfsdrimport.hxx @@ -22,11 +22,11 @@ namespace writerfilter namespace rtftok { /// Handles the import of drawings using RTF markup. -class RTFSdrImport +class RTFSdrImport final { public: RTFSdrImport(RTFDocumentImpl& rImport, css::uno::Reference<css::lang::XComponent> const& xDstDoc); - virtual ~RTFSdrImport(); + ~RTFSdrImport(); enum ShapeOrPict { SHAPE, PICT }; void resolve(RTFShape& rShape, bool bClose, ShapeOrPict shapeOrPict); diff --git a/writerfilter/source/rtftok/rtfskipdestination.hxx b/writerfilter/source/rtftok/rtfskipdestination.hxx index f70a8c71bbcb..50be7549c51c 100644 --- a/writerfilter/source/rtftok/rtfskipdestination.hxx +++ b/writerfilter/source/rtftok/rtfskipdestination.hxx @@ -17,11 +17,11 @@ namespace writerfilter namespace rtftok { /// Skips a destination after a not parsed control word if it was prefixed with \* -class RTFSkipDestination +class RTFSkipDestination final { public: RTFSkipDestination(RTFListener& rImport); - virtual ~RTFSkipDestination(); + ~RTFSkipDestination(); void setParsed(bool bParsed); void setReset(bool bReset); private: diff --git a/writerfilter/source/rtftok/rtftokenizer.hxx b/writerfilter/source/rtftok/rtftokenizer.hxx index 0e2039d61674..8005fd6c1c17 100644 --- a/writerfilter/source/rtftok/rtftokenizer.hxx +++ b/writerfilter/source/rtftok/rtftokenizer.hxx @@ -24,11 +24,11 @@ namespace writerfilter namespace rtftok { /// RTF tokenizer that separates control words from text. -class RTFTokenizer +class RTFTokenizer final { public: RTFTokenizer(RTFListener& rImport, SvStream* pInStream, css::uno::Reference<css::task::XStatusIndicator> const& xStatusIndicator); - virtual ~RTFTokenizer(); + ~RTFTokenizer(); RTFError resolveParse(); static int asHex(char ch); diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx index 4be936bfaf16..ba65fd435eff 100644 --- a/xmloff/inc/txtflde.hxx +++ b/xmloff/inc/txtflde.hxx @@ -149,7 +149,7 @@ enum FieldIdEnum { }; -class XMLTextFieldExport +class XMLTextFieldExport final { SvXMLExport& rExport; @@ -164,7 +164,7 @@ public: XMLTextFieldExport( SvXMLExport& rExp, /// XMLPropertyState for the combined characters field XMLPropertyState* pCombinedCharState ); - virtual ~XMLTextFieldExport(); + ~XMLTextFieldExport(); /// Export this field and the surrounding span element with the formatting. /// To be called for every field in the document body. diff --git a/xmloff/inc/txtvfldi.hxx b/xmloff/inc/txtvfldi.hxx index 02df858d3b4d..26f14cd019f9 100644 --- a/xmloff/inc/txtvfldi.hxx +++ b/xmloff/inc/txtvfldi.hxx @@ -31,7 +31,7 @@ /** helper class: parses value-type and associated value attributes */ -class XMLValueImportHelper +class XMLValueImportHelper final { const OUString sPropertyContent; @@ -70,7 +70,7 @@ public: bool bValue, /// process value (Prep.Field) bool bFormula); /// process formula (Prep.F.) - virtual ~XMLValueImportHelper(); + ~XMLValueImportHelper(); /// process attribute values void ProcessAttribute( sal_uInt16 nAttrToken, diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 843ae9c4eb9f..6bc6a90c3d8e 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -129,7 +129,7 @@ public: SchXMLExportHelper_Impl( SvXMLExport& rExport, SvXMLAutoStylePoolP& rASPool ); - virtual ~SchXMLExportHelper_Impl(); + ~SchXMLExportHelper_Impl(); SchXMLExportHelper_Impl(const SchXMLExportHelper_Impl&) = delete; SchXMLExportHelper_Impl& operator=(const SchXMLExportHelper_Impl&) = delete; diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx index 88ba4da34785..3b36471bafc4 100644 --- a/xmloff/source/draw/animationexport.cxx +++ b/xmloff/source/draw/animationexport.cxx @@ -503,7 +503,7 @@ class AnimationsExporterImpl { public: AnimationsExporterImpl( SvXMLExport& rExport, const Reference< XPropertySet >& xPageProps ); - virtual ~AnimationsExporterImpl(); + ~AnimationsExporterImpl(); void prepareNode( const Reference< XAnimationNode >& xNode ); void exportNode( const Reference< XAnimationNode >& xNode ); diff --git a/xmloff/source/forms/formattributes.hxx b/xmloff/source/forms/formattributes.hxx index d0a2405ce605..5bed7db46f17 100644 --- a/xmloff/source/forms/formattributes.hxx +++ b/xmloff/source/forms/formattributes.hxx @@ -271,7 +271,7 @@ namespace xmloff <p>The construction of this class is rather expensive (or at least it's initialization from outside), so it should be shared</p> */ - class OAttribute2Property + class OAttribute2Property final { public: // TODO: maybe the following struct should be used for exports, too. In this case we would not need to @@ -295,7 +295,7 @@ namespace xmloff public: OAttribute2Property(); - virtual ~OAttribute2Property(); + ~OAttribute2Property(); /** return the AttributeAssignment which corresponds to the given attribute diff --git a/xmlsecurity/source/framework/buffernode.hxx b/xmlsecurity/source/framework/buffernode.hxx index 34cd10c87f83..150b47e3dabd 100644 --- a/xmlsecurity/source/framework/buffernode.hxx +++ b/xmlsecurity/source/framework/buffernode.hxx @@ -28,7 +28,7 @@ class ElementMark; class ElementCollector; -class BufferNode +class BufferNode final /****** buffernode.hxx/CLASS BufferNode *************************************** * * NAME @@ -78,7 +78,6 @@ private: public: explicit BufferNode( const css::uno::Reference< css::xml::wrapper::XXMLElementWrapper >& xXMLElement); - virtual ~BufferNode() {}; bool isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId) const; void setReceivedAll(); diff --git a/xmlsecurity/source/xmlsec/saxhelper.hxx b/xmlsecurity/source/xmlsec/saxhelper.hxx index b89081a89163..58b2cb3553ee 100644 --- a/xmlsecurity/source/xmlsec/saxhelper.hxx +++ b/xmlsecurity/source/xmlsec/saxhelper.hxx @@ -31,7 +31,7 @@ /** This class represents a SAX handler which simply forwards to the corresponding libxml API and translates parameter if necessary. */ -class SAXHelper +class SAXHelper final { private: xmlParserCtxtPtr m_pParserCtxt ; @@ -39,7 +39,7 @@ class SAXHelper public: SAXHelper( ) ; - virtual ~SAXHelper() ; + ~SAXHelper() ; xmlNodePtr getCurrentNode() { return m_pParserCtxt->node;} void setCurrentNode(const xmlNodePtr pNode); |