diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-09-20 14:53:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-09-20 17:00:04 +0200 |
commit | 4487a14e7cce62e4fb6c1ebddac5f3e713c061de (patch) | |
tree | 733013b1557b4fbe089208eef607e4cb729c7642 /compilerplugins/clang/test | |
parent | 40f42f317757ef02d0a4d1cfd1c4f5bd8583e8e0 (diff) |
loplugin:xmlimport check for bad conversions to fastparser
add a check for classes which have been partly converted to fastparser,
but not completedly.
This is to help me when I convert stuff.
and it uncovers a bug introduced with
commit 998308c363dfad03143591aa18256d2669b4da11
use more FastParser in SvXMLStylesContext
Change-Id: Ib50e7136da10a1a7a346102aa47efef2f543e2ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102669
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/test')
-rw-r--r-- | compilerplugins/clang/test/xmlimport.cxx | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/compilerplugins/clang/test/xmlimport.cxx b/compilerplugins/clang/test/xmlimport.cxx index 965d4936e41c..36230ffdb2d8 100644 --- a/compilerplugins/clang/test/xmlimport.cxx +++ b/compilerplugins/clang/test/xmlimport.cxx @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * @@ -12,6 +12,13 @@ // Cannot include this, makes clang crash //#include "xmloff/xmlimp.hxx" +#include <com/sun/star/uno/Reference.hxx> + +namespace com::sun::star::xml::sax +{ +class XAttributeList; +} + class SvXMLImportContext { public: @@ -20,6 +27,10 @@ public: virtual void createFastChildContext() {} virtual void startFastElement() {} virtual void endFastElement() {} + + virtual void StartElement(const css::uno::Reference<css::xml::sax::XAttributeList>&) {} + virtual void EndElement() {} + virtual void Characters(const OUString&) {} }; class Test1 : public SvXMLImportContext @@ -51,4 +62,27 @@ public: virtual void endFastElement() override; }; +class Test5 : public SvXMLImportContext +{ +public: + // expected-error@+1 {{overrides startElement, but looks like a fastparser context class, no constructor that takes slowparser args [loplugin:xmlimport]}} + virtual void + StartElement(const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override; + // expected-error@+1 {{overrides startElement, but looks like a fastparser context class, no constructor that takes slowparser args [loplugin:xmlimport]}} + virtual void EndElement() override; + // expected-error@+1 {{overrides startElement, but looks like a fastparser context class, no constructor that takes slowparser args [loplugin:xmlimport]}} + virtual void Characters(const OUString&) override; +}; + +// no warning expected +class Test6 : public SvXMLImportContext +{ +public: + Test6(sal_uInt16, const OUString&); + virtual void + StartElement(const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override; + virtual void EndElement() override; + virtual void Characters(const OUString&) override; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |