[Libreoffice-commits] core.git: compilerplugins/clang sw/qa

2023-11-30 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/ostr.cxx  |   83 +++-
 compilerplugins/clang/test/ostr.cxx |   10 
 sw/qa/extras/layout/layout3.cxx |9 ++-
 3 files changed, 96 insertions(+), 6 deletions(-)

New commits:
commit f824c4f23c01510b12b53f33778bfa72f7a2ea57
Author: Stephan Bergmann 
AuthorDate: Mon Nov 27 21:43:55 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Nov 30 14:35:13 2023 +0100

Extended loplugin:ostr

Change-Id: I987d6d60ca2d1e8ed8b8cde1e0c7996c0fff71b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160006
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/ostr.cxx b/compilerplugins/clang/ostr.cxx
index da68451e6316..189b74da3152 100644
--- a/compilerplugins/clang/ostr.cxx
+++ b/compilerplugins/clang/ostr.cxx
@@ -352,7 +352,7 @@ public:
 {
 return true;
 }
-if (!compiler.getDiagnosticOpts().VerifyDiagnostics)
+if (!compiler.getDiagnosticOpts().VerifyDiagnostics && utf16)
 {
 //TODO: Leave rewriting these uses of ordinary string literals for 
later (but already
 // cover them when verifying CompilerTest_compilerplugins_clang):
@@ -364,7 +364,7 @@ public:
 Lexer::MeasureTokenLength(l3, compiler.getSourceManager(), 
compiler.getLangOpts()));
 l4 = l4.getLocWithOffset(
 Lexer::MeasureTokenLength(l4, compiler.getSourceManager(), 
compiler.getLangOpts()));
-if ((!utf16 || replaceText(l1, delta(l1, l2), macroBegin ? "u\"\" 
" : "u"))
+if (replaceText(l1, delta(l1, l2), utf16 ? (macroBegin ? "u\"\" " 
: "u") : "")
 && replaceText(l3, delta(l3, l4),
utf16 ? (macroEnd ? " \"\"_ustr" : "_ustr")
  : (macroEnd ? " \"\"_ostr" : "_ostr")))
@@ -380,6 +380,85 @@ public:
 return true;
 }
 
+bool VisitCXXOperatorCallExpr(CXXOperatorCallExpr const* expr)
+{
+if (ignoreLocation(expr))
+{
+return true;
+}
+if (expr->getOperator() != OO_Equal)
+{
+return true;
+}
+if (!loplugin::TypeCheck(expr->getArg(0)->getType())
+ .Class("OString")
+ .Namespace("rtl")
+ .GlobalNamespace())
+{
+return true;
+}
+auto const e2 = 
dyn_cast(expr->getArg(1)->IgnoreParenImpCasts());
+if (e2 == nullptr)
+{
+return true;
+}
+if (rewriter != nullptr)
+{
+auto loc = e2->getEndLoc();
+auto const macroEnd = loc.isMacroID()
+  && Lexer::isAtEndOfMacroExpansion(
+ loc, compiler.getSourceManager(), 
compiler.getLangOpts());
+if (macroEnd)
+{
+loc = 
compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
+}
+if (insertTextAfterToken(loc, macroEnd ? " \"\"_ostr" : "_ostr"))
+{
+return true;
+}
+}
+report(DiagnosticsEngine::Warning,
+   "use a _ostr user-defined string literal instead of assigning 
from an ordinary"
+   " string literal",
+   expr->getExprLoc())
+<< expr->getSourceRange();
+return true;
+}
+
+bool VisitCXXMemberCallExpr(CXXMemberCallExpr const* expr)
+{
+if (ignoreLocation(expr))
+{
+return true;
+}
+if (!loplugin::DeclCheck(expr->getMethodDecl()).Operator(OO_Equal))
+{
+return true;
+}
+if (!loplugin::TypeCheck(expr->getObjectType())
+ .Class("OString")
+ .Namespace("rtl")
+ .GlobalNamespace())
+{
+return true;
+}
+auto const e2 = 
dyn_cast(expr->getArg(0)->IgnoreParenImpCasts());
+if (e2 == nullptr)
+{
+return true;
+}
+if (rewriter != nullptr)
+{
+//TODO
+}
+report(DiagnosticsEngine::Warning,
+   "use a _ostr user-defined string literal instead of assigning 
from an ordinary"
+   " string literal",
+   expr->getExprLoc())
+<< expr->getSourceRange();
+return true;
+}
+
 bool VisitCastExpr(CastExpr const* expr)
 {
 if (ignoreLocation(expr))
diff --git a/compilerplugins/clang/test/ostr.cxx 
b/compilerplugins/clang/test/ostr.cxx
index 8e772b1258a2..e6e3a9b556e2 100644
--- a/compilerplugins/clang/test/ostr.cxx
+++ b/compilerplugins/clang/test/ostr.cxx
@@ -112,6 +112,16 @@ void f()
 // expected-error-re@+1 {{use a _ustr user-defined string literal instead 
of constructing an instance of '{{(rtl::)?}}OUString' from an ordinary string 
literal [loplugin:ostr]}}
 takeO

[Libreoffice-commits] core.git: compilerplugins/clang writerfilter/source

2023-11-25 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/fieldcast.results   |3 ---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 ++-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |4 ++--
 3 files changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 77a47ead5d126cca8d5529a92ce20c40f0f6ca06
Author: Noel Grandin 
AuthorDate: Sat Nov 25 11:35:14 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Nov 25 16:29:53 2023 +0100

loplugin:fieldcast in DomainMapper_Impl

Change-Id: I1d734e1d30b91b84d42067b9cc621581ad744a40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159949
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/fieldcast.results 
b/compilerplugins/clang/fieldcast.results
index c1ede6ef7ae5..7be14a330da5 100644
--- a/compilerplugins/clang/fieldcast.results
+++ b/compilerplugins/clang/fieldcast.results
@@ -625,9 +625,6 @@ vcl/source/window/impldockingwrapper.hxx:46
 vcl/source/window/menufloatingwindow.hxx:38
 MenuFloatingWindow pMenu VclPtr
 PopupMenu
-writerfilter/source/dmapper/DomainMapper_Impl.hxx:529
-writerfilter::dmapper::DomainMapper_Impl m_pLastSectionContext 
PropertyMapPtr
-writerfilter::dmapper::SectionPropertyMap
 writerfilter/source/dmapper/NumberingManager.hxx:221
 writerfilter::dmapper::ListsManager m_pCurrentDefinition class 
AbstractListDef::Pointer
 writerfilter::dmapper::ListDef
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index ae69b3ba5b89..e24d0e55389a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1269,7 +1269,8 @@ voidDomainMapper_Impl::PopProperties(ContextType eId)
 {
 if (m_aPropertyStacks[eId].size() == 1) // tdf#112202 only top level 
!!!
 {
-m_pLastSectionContext = m_aPropertyStacks[eId].top();
+m_pLastSectionContext = dynamic_cast< SectionPropertyMap* >( 
m_aPropertyStacks[eId].top().get() );
+assert(m_pLastSectionContext);
 }
 }
 else if (eId == CONTEXT_CHARACTER)
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index ec34244400dc..c6fa87537d9a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -526,7 +526,7 @@ private:
 std::unique_ptr m_pThemeHandler;
 
 PropertyMapPtr  m_pTopContext;
-PropertyMapPtr   m_pLastSectionContext;
+tools::SvRef m_pLastSectionContext;
 PropertyMapPtr   m_pLastCharacterContext;
 
 ::std::vector m_aCurrentTabStops;
@@ -655,7 +655,7 @@ public:
 
 SectionPropertyMap* GetLastSectionContext( )
 {
-return dynamic_cast< SectionPropertyMap* >( m_pLastSectionContext.get( 
) );
+return m_pLastSectionContext.get( );
 }
 
 css::uno::Reference const & 
GetPageStyles();


[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2023-11-25 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/fieldcast.results |3 -
 sw/source/ui/misc/glossary.cxx  |5 +-
 sw/source/uibase/inc/unotools.hxx   |6 ++-
 sw/source/uibase/utlui/unotools.cxx |   54 +---
 4 files changed, 29 insertions(+), 39 deletions(-)

New commits:
commit d54ae809aa29fa7a9894c0a1236374fa96e01a43
Author: Noel Grandin 
AuthorDate: Sat Nov 25 11:14:44 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Nov 25 15:22:28 2023 +0100

loplugin:fieldcast in SwOneExampleFrame

Change-Id: Ic00ad388b2c18d90075db8e8d0d6b114ed13841a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159948
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/fieldcast.results 
b/compilerplugins/clang/fieldcast.results
index 6fa27d645135..c1ede6ef7ae5 100644
--- a/compilerplugins/clang/fieldcast.results
+++ b/compilerplugins/clang/fieldcast.results
@@ -547,9 +547,6 @@ sw/source/uibase/inc/fldmgr.hxx:103
 sw/source/uibase/inc/swuiccoll.hxx:35
 SwCondCollPage m_pFormat SwFormat *
 SwConditionTextFormatColl
-sw/source/uibase/inc/unotools.hxx:48
-SwOneExampleFrame m_xCursor css::uno::Reference
-OTextCursorHelper
 unoidl/source/unoidl-read.cxx:151
 (anonymous namespace)::Entity entity const rtl::Reference
 unoidl::PublishableEntity
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index c7183d5126e1..8b2860c20c29 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -54,6 +54,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1042,7 +1043,7 @@ void SwGlossaryDlg::ResumeShowAutoText()
 m_xAutoText = text::AutoTextContainer::create( 
comphelper::getProcessComponentContext() );
 }
 
-uno::Reference< XTextCursor > & xCursor = 
m_xExampleFrame->GetTextCursor();
+rtl::Reference< SwXTextCursor > & xCursor = 
m_xExampleFrame->GetTextCursor();
 if(xCursor.is())
 {
 if (!sShortName.isEmpty())
@@ -1054,7 +1055,7 @@ void SwGlossaryDlg::ResumeShowAutoText()
 uno::Any aEntry(xGroup->getByName(sShortName));
 uno::Reference< XAutoTextEntry >  xEntry;
 aEntry >>= xEntry;
-xEntry->applyTo(xCursor);
+
xEntry->applyTo(static_cast(xCursor.get()));
 }
 }
 }
diff --git a/sw/source/uibase/inc/unotools.hxx 
b/sw/source/uibase/inc/unotools.hxx
index cda9ec73fcd5..e472a2f92706 100644
--- a/sw/source/uibase/inc/unotools.hxx
+++ b/sw/source/uibase/inc/unotools.hxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define EX_SHOW_ONLINE_LAYOUT   0x01
 // hard zoom value
@@ -39,13 +40,14 @@
 #define EX_LOCALIZE_TOC_STRINGS 0x08
 
 class SwView;
+class SwXTextCursor;
 
 class SW_DLLPUBLIC SwOneExampleFrame final : public 
weld::CustomWidgetController
 {
 ScopedVclPtr m_xVirDev;
 css::uno::Reference< css::frame::XModel > m_xModel;
 css::uno::Reference< css::frame::XController >m_xController;
-css::uno::Reference< css::text::XTextCursor > m_xCursor;
+rtl::Reference< SwXTextCursor >   m_xCursor;
 
 Idlem_aLoadedIdle;
 Link m_aInitializedLink;
@@ -74,7 +76,7 @@ public:
 virtual ~SwOneExampleFrame() override;
 
 css::uno::Reference< css::frame::XModel > &   GetModel()  {return 
m_xModel;}
-css::uno::Reference< css::text::XTextCursor > &   GetTextCursor() {return 
m_xCursor;}
+rtl::Reference< SwXTextCursor > & GetTextCursor() {return 
m_xCursor;}
 
 void ClearDocument();
 
diff --git a/sw/source/uibase/utlui/unotools.cxx 
b/sw/source/uibase/utlui/unotools.cxx
index 7e72566685e2..93edfaad30a7 100644
--- a/sw/source/uibase/utlui/unotools.cxx
+++ b/sw/source/uibase/utlui/unotools.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -143,8 +144,7 @@ void SwOneExampleFrame::Paint(vcl::RenderContext& 
rRenderContext, const tools::R
 Color aBgColor = 
SW_MOD()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor;
 m_xVirDev->DrawWallpaper(tools::Rectangle(Point(), aSize), aBgColor);
 
-auto pCursor = dynamic_cast(m_xCursor.get());
-if (pCursor)
+if (m_xCursor)
 {
 uno::Reference xSettings(m_xController, 
uno::UNO_QUERY);
 uno::Reference  xViewProps = 
xSettings->getViewSettings();
@@ -156,7 +156,7 @@ void SwOneExampleFrame::Paint(vcl::RenderContext& 
rRenderContext, const tools::R
 
 m_xVirDev->Push(vcl::PushFlags::ALL);
 m_xVirDev->SetMapMode(MapMode(MapUnit::MapTwip));
-SwDoc *pDoc = pCursor->GetDoc();
+SwDoc *pDoc = m_xCursor->GetDoc();
 SwDocShell* pShell = pDoc->GetDocShell();
 tools::Rectangle aRect(Point(), m_xVirDev->PixelToLogic(aSize));
 pShell->SetVisArea(tools::Rectangle(Point(), Size(aR

[Libreoffice-commits] core.git: compilerplugins/clang sc/source

2023-11-23 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/fieldcast.results   |3 ---
 sc/source/filter/inc/pivottablebuffer.hxx |4 +++-
 sc/source/filter/oox/pivottablebuffer.cxx |   15 +--
 3 files changed, 8 insertions(+), 14 deletions(-)

New commits:
commit b9312a055ab7759fba68a9353ae64d37b460a2d3
Author: Noel Grandin 
AuthorDate: Thu Nov 23 20:27:35 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Nov 24 06:27:18 2023 +0100

loplugin:fieldcast in oox::xls::PivotTable

Change-Id: Ie50626b2e24bba2ee67827afcdf42c1c0ed2c9d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159870
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/fieldcast.results 
b/compilerplugins/clang/fieldcast.results
index 6b16aeb370f9..b3a206434484 100644
--- a/compilerplugins/clang/fieldcast.results
+++ b/compilerplugins/clang/fieldcast.results
@@ -298,9 +298,6 @@ sc/source/filter/excel/xeformula.cxx:60
 sc/source/filter/inc/eeimport.hxx:43
 ScEEImport mpParser std::unique_ptr
 ScHTMLParser
-sc/source/filter/inc/pivottablebuffer.hxx:382
-oox::xls::PivotTable mxDPDescriptor 
css::uno::Reference
-ScDataPilotDescriptorBase
 sc/source/filter/xml/xmlimprt.hxx:156
 ScXMLImport xSheetCellRanges 
css::uno::Reference
 ScCellRangesObj
diff --git a/sc/source/filter/inc/pivottablebuffer.hxx 
b/sc/source/filter/inc/pivottablebuffer.hxx
index 04db017bfefc..a4ba60022dea 100644
--- a/sc/source/filter/inc/pivottablebuffer.hxx
+++ b/sc/source/filter/inc/pivottablebuffer.hxx
@@ -21,6 +21,7 @@
 
 #include "pivotcachebuffer.hxx"
 #include "stylesbuffer.hxx"
+#include 
 
 namespace com::sun::star {
 namespace sheet { class XDataPilotDescriptor; }
@@ -28,6 +29,7 @@ namespace com::sun::star {
 }
 
 class ScDPObject;
+class ScDataPilotDescriptorBase;
 
 namespace oox::xls {
 
@@ -378,7 +380,7 @@ private:
 PTDefinitionModel maDefModel; /// Global pivot table settings.
 PTLocationModel   maLocationModel;/// Location settings of the 
pivot table.
 PivotCache*   mpPivotCache;   /// The pivot cache this table 
is based on.
-css::uno::Reference< css::sheet::XDataPilotDescriptor >
+rtl::Reference< ScDataPilotDescriptorBase > // 
css::sheet::XDataPilotDescriptor
   mxDPDescriptor; /// Descriptor of the DataPilot 
object.
 std::map maInteropGrabBag;
 
diff --git a/sc/source/filter/oox/pivottablebuffer.cxx 
b/sc/source/filter/oox/pivottablebuffer.cxx
index 637637eb378c..252b4773ccf2 100644
--- a/sc/source/filter/oox/pivottablebuffer.cxx
+++ b/sc/source/filter/oox/pivottablebuffer.cxx
@@ -1247,7 +1247,7 @@ void PivotTable::finalizeImport()
 // create a new data pilot descriptor based on the source data
 Reference< XDataPilotTablesSupplier > xDPTablesSupp( getSheetFromDoc( 
maLocationModel.maRange.aStart.Tab() ), UNO_QUERY_THROW );
 Reference< XDataPilotTables > xDPTables( 
xDPTablesSupp->getDataPilotTables(), UNO_SET_THROW );
-mxDPDescriptor.set( xDPTables->createDataPilotDescriptor(), 
UNO_SET_THROW );
+mxDPDescriptor = static_cast( 
xDPTables->createDataPilotDescriptor().get() );
 ScRange aRange = mpPivotCache->getSourceRange();
 CellRangeAddress aCellRangeAddress( aRange.aStart.Tab(),
 aRange.aStart.Col(), 
aRange.aStart.Row(),
@@ -1255,17 +1255,12 @@ void PivotTable::finalizeImport()
 mxDPDescriptor->setSourceRange( aCellRangeAddress );
 mxDPDescriptor->setTag( maDefModel.maTag );
 
-// TODO: This is a hack. Eventually we need to convert the whole thing 
to the internal API.
-auto pImpl = 
dynamic_cast(mxDPDescriptor.get());
-if (!pImpl)
-return;
-
-mpDPObject = pImpl->GetDPObject();
+mpDPObject = mxDPDescriptor->GetDPObject();
 if (!mpDPObject)
 return;
 
 // global data pilot properties
-PropertySet aDescProp( mxDPDescriptor );
+PropertySet aDescProp(( css::uno::Reference< css::beans::XPropertySet 
>(mxDPDescriptor) ));
 aDescProp.setProperty( PROP_ColumnGrand, maDefModel.mbColGrandTotals );
 aDescProp.setProperty( PROP_RowGrand, maDefModel.mbRowGrandTotals );
 aDescProp.setProperty( PROP_ShowFilterButton, false );
@@ -1411,8 +1406,8 @@ Reference< XDataPilotField > 
PivotTable::getDataLayoutField() const
 Reference< XDataPilotField > xDPField;
 try
 {
-Reference< XDataPilotDataLayoutFieldSupplier > xDPDataFieldSupp( 
mxDPDescriptor, UNO_QUERY_THROW );
-xDPField = xDPDataFieldSupp->getDataLayoutField();
+if (mxDPDescriptor)
+xDPField = mxDPDescriptor->getDataLayoutField();
 }
 catch( Exception& )
 {


[Libreoffice-commits] core.git: compilerplugins/clang include/svx svx/source

2023-11-23 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/fieldcast.results |6 --
 include/svx/gridctrl.hxx|4 +
 svx/source/fmcomp/gridctrl.cxx  |   69 
 3 files changed, 22 insertions(+), 57 deletions(-)

New commits:
commit 2b403a8ddce089689ed3baefa75e0ea5c77724e1
Author: Noel Grandin 
AuthorDate: Wed Nov 22 22:16:35 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 23 09:31:53 2023 +0100

loplugin:fieldcast in DbGridControl

Change-Id: I87b1aa0326cbd4270ca54831b3388a5da9c9416d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159842
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/fieldcast.results 
b/compilerplugins/clang/fieldcast.results
index c794886ec751..6b16aeb370f9 100644
--- a/compilerplugins/clang/fieldcast.results
+++ b/compilerplugins/clang/fieldcast.results
@@ -88,9 +88,6 @@ editeng/source/editeng/impedit.hxx:506
 extensions/source/update/check/updatecheck.hxx:164
 UpdateCheck m_pThread WorkerThread *
 (anonymous namespace)::UpdateCheckThread
-framework/inc/uielement/uielement.hxx:89
-framework::UIElement m_xUIElement css::uno::Reference
-framework::AddonsToolBarWrapper
 i18npool/inc/calendarImpl.hxx:103
 i18npool::CalendarImpl xCalendar css::uno::Reference
 i18npool::Calendar_gregorian
@@ -178,9 +175,6 @@ include/svx/AccessibleShape.hxx:391
 include/svx/fmsrcimp.hxx:161
 FmSearchEngine m_xSearchCursor CursorWrapper
 com::sun::star::uno::Reference
-include/svx/gridctrl.hxx:255
-DbGridControl m_pFieldListeners void *
-std::map
 include/svx/svdhdl.hxx:136
 SdrHdl m_pObj SdrObject *
 SdrEdgeObj
diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx
index b8057fd61823..f47520090fba 100644
--- a/include/svx/gridctrl.hxx
+++ b/include/svx/gridctrl.hxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -40,6 +41,7 @@ namespace com::sun::star::util { class XNumberFormatter; }
 namespace weld { class Menu; }
 
 class CursorWrapper;
+class GridFieldValueListener;
 
 bool CompareBookmark(const css::uno::Any& aLeft, const css::uno::Any& aRight);
 
@@ -252,7 +254,7 @@ private:
 css::uno::Reference< css::sdb::XRowsChangeListener>
 m_xRowSetListener; // get 
notification when rows were changed
 
-void*   m_pFieldListeners;
+std::map   m_aFieldListeners;
 // property listeners for field values
 
 std::unique_ptr  m_pCursorDisposeListener;
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index fce266d26a6c..627c41c5468d 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -60,7 +60,6 @@
 
 #include 
 #include 
-#include 
 #include 
 
 using namespace ::dbtools;
@@ -121,9 +120,6 @@ private:
 }
 };
 
-class GridFieldValueListener;
-typedef std::map 
ColumnFieldValueListeners;
-
 class GridFieldValueListener : protected ::comphelper::OPropertyChangeListener
 {
 osl::Mutex  m_aMutex;
@@ -693,7 +689,6 @@ DbGridControl::DbGridControl(
 ,m_aBar(VclPtr::Create(this))
 ,m_nAsynAdjustEvent(nullptr)
 ,m_pDataSourcePropListener(nullptr)
-,m_pFieldListeners(nullptr)
 ,m_pGridListener(nullptr)
 ,m_nSeekPos(-1)
 ,m_nTotalCount(-1)
@@ -755,7 +750,7 @@ void DbGridControl::dispose()
 
 m_bWantDestruction = true;
 osl::MutexGuard aGuard(m_aDestructionSafety);
-if (m_pFieldListeners)
+if (!m_aFieldListeners.empty())
 DisconnectFromFields();
 m_pCursorDisposeListener.reset();
 
@@ -3205,15 +3200,11 @@ IMPL_LINK(DbGridControl, OnAsyncAdjust, void*, 
pAdjustWhat, void)
 
 void DbGridControl::BeginCursorAction()
 {
-if (m_pFieldListeners)
+for (const auto& rListener : m_aFieldListeners)
 {
-ColumnFieldValueListeners* pListeners = 
static_cast(m_pFieldListeners);
-for (const auto& rListener : *pListeners)
-{
-GridFieldValueListener* pCurrent = rListener.second;
-if (pCurrent)
-pCurrent->suspend();
-}
+GridFieldValueListener* pCurrent = rListener.second;
+if (pCurrent)
+pCurrent->suspend();
 }
 
 if (m_pDataSourcePropListener)
@@ -3222,15 +3213,11 @@ void DbGridControl::BeginCursorAction()
 
 void DbGridControl::EndCursorAction()
 {
-if (m_pFieldListeners)
+for (const auto& rListener : m_aFieldListeners)
 {
-ColumnFieldValueListeners* pListeners = 
static_cast(m_pFieldListeners);
-for (const auto& rListener : *pListeners)
-{
-GridFieldValueListener* pCurrent = rListener.second;
-if (pCurrent)
-pCurrent->resume();
-}
+GridFieldValueListener* pCurrent = rListener.second;
+if (pCurrent)
+pCurrent->r

[Libreoffice-commits] core.git: compilerplugins/clang framework/inc framework/source

2023-11-22 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/fieldcast.results  |3 ---
 framework/inc/services/layoutmanager.hxx |3 ++-
 framework/source/layoutmanager/layoutmanager.cxx |   14 +-
 3 files changed, 7 insertions(+), 13 deletions(-)

New commits:
commit baafd5aca2fd8cbc9d1d5ae8d0b4b8c8a6b68812
Author: Noel Grandin 
AuthorDate: Wed Nov 22 22:07:01 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 23 08:14:10 2023 +0100

loplugin:fieldcast in LayoutManager

Change-Id: I3fc7a2c690344ee6934111cdffc0b23ff2537b44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159841
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/fieldcast.results 
b/compilerplugins/clang/fieldcast.results
index aa36df627b34..c794886ec751 100644
--- a/compilerplugins/clang/fieldcast.results
+++ b/compilerplugins/clang/fieldcast.results
@@ -88,9 +88,6 @@ editeng/source/editeng/impedit.hxx:506
 extensions/source/update/check/updatecheck.hxx:164
 UpdateCheck m_pThread WorkerThread *
 (anonymous namespace)::UpdateCheckThread
-framework/inc/services/layoutmanager.hxx:256
-framework::LayoutManager m_xProgressBarBackup 
css::uno::Reference
-framework::ProgressBarWrapper
 framework/inc/uielement/uielement.hxx:89
 framework::UIElement m_xUIElement css::uno::Reference
 framework::AddonsToolBarWrapper
diff --git a/framework/inc/services/layoutmanager.hxx 
b/framework/inc/services/layoutmanager.hxx
index 6675737d4b15..f2f32a53a12f 100644
--- a/framework/inc/services/layoutmanager.hxx
+++ b/framework/inc/services/layoutmanager.hxx
@@ -46,6 +46,7 @@ class MenuBar;
 namespace framework
 {
 class MenuBarWrapper;
+class ProgressBarWrapper;
 class ToolbarLayoutManager;
 class GlobalSettings;
 namespace detail
@@ -254,7 +255,7 @@ namespace framework
 rtl::Reference< MenuBarWrapper >   
m_xMenuBar;
 UIElement  
m_aStatusBarElement;
 UIElement  
m_aProgressBarElement;
-css::uno::Reference< css::ui::XUIElement > 
m_xProgressBarBackup;
+rtl::Reference< ProgressBarWrapper >   
m_xProgressBarBackup;
 css::uno::Reference< css::frame::XModuleManager2 > 
m_xModuleManager;
 css::uno::Reference< css::ui::XUIElementFactoryManager >   
m_xUIElementFactoryManager;
 css::uno::Reference< css::container::XNameAccess > 
m_xPersistentWindowState;
diff --git a/framework/source/layoutmanager/layoutmanager.cxx 
b/framework/source/layoutmanager/layoutmanager.cxx
index 3b5a0af3017c..b915e3f82a26 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -868,7 +868,7 @@ void LayoutManager::implts_createProgressBar()
 {
 Reference< XUIElement > xStatusBar;
 Reference< XUIElement > xProgressBar;
-Reference< XUIElement > xProgressBarBackup;
+rtl::Reference< ProgressBarWrapper > xProgressBarBackup;
 Reference< awt::XWindow > xContainerWindow;
 
 SolarMutexResettableGuard aWriteLock;
@@ -879,10 +879,10 @@ void LayoutManager::implts_createProgressBar()
 xContainerWindow = m_xContainerWindow;
 aWriteLock.clear();
 
-boolbRecycled = xProgressBarBackup.is();
+bool bRecycled = xProgressBarBackup.is();
 rtl::Reference pWrapper;
 if ( bRecycled )
-pWrapper = static_cast(xProgressBarBackup.get());
+pWrapper = xProgressBarBackup.get();
 else if ( xProgressBar.is() )
 pWrapper = static_cast(xProgressBar.get());
 else
@@ -931,17 +931,13 @@ void LayoutManager::implts_backupProgressBarWrapper()
 // safe a backup copy of the current progress!
 // This copy will be used automatically inside createProgressBar() which 
is called
 // implicitly from implts_doLayout() .-)
-m_xProgressBarBackup = m_aProgressBarElement.m_xUIElement;
+m_xProgressBarBackup = 
static_cast(m_aProgressBarElement.m_xUIElement.get());
 
 // remove the relation between this old progress bar and our old status 
bar.
 // Otherwise we work on disposed items ...
 // The internal used ProgressBarWrapper can handle a NULL reference.
 if ( m_xProgressBarBackup.is() )
-{
-ProgressBarWrapper* pWrapper = 
static_cast(m_xProgressBarBackup.get());
-if ( pWrapper )
-pWrapper->setStatusBar( Reference< awt::XWindow >() );
-}
+m_xProgressBarBackup->setStatusBar( Reference< awt::XWindow >() );
 
 // prevent us from dispose() the m_aProgressBarElement.m_xUIElement inside 
implts_reset()
 m_aProgressBarElement.m_xUIElement.clear();


[Libreoffice-commits] core.git: compilerplugins/clang sw/source

2023-11-22 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/fieldcast.results |3 ---
 sw/source/uibase/dochdl/swdtflvr.cxx|6 +-
 sw/source/uibase/inc/swdtflvr.hxx   |4 +++-
 3 files changed, 4 insertions(+), 9 deletions(-)

New commits:
commit 68a2e50726e2f16354ff45d6768790e076989cb6
Author: Noel Grandin 
AuthorDate: Wed Nov 22 11:41:26 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 22 18:38:45 2023 +0100

loplugin:fieldcast in SwTransferable

Change-Id: I8e9f157a399f1b305d2e6b6e63da837f0090fd8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159814
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/fieldcast.results 
b/compilerplugins/clang/fieldcast.results
index e65cc5123250..0bdabb345340 100644
--- a/compilerplugins/clang/fieldcast.results
+++ b/compilerplugins/clang/fieldcast.results
@@ -565,9 +565,6 @@ sw/source/ui/dialog/swdlgfact.hxx:562
 sw/source/uibase/inc/fldmgr.hxx:103
 SwFieldMgr m_pCurField SwField *
 SwPageNumberField
-sw/source/uibase/inc/swdtflvr.hxx:81
-SwTransferable m_xDdeLink tools::SvRef
-(anonymous namespace)::SwTransferDdeLink
 sw/source/uibase/inc/swuiccoll.hxx:35
 SwCondCollPage m_pFormat SwFormat *
 SwConditionTextFormatColl
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index 91eb38e0f45c..cb96c08527c6 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -173,8 +173,6 @@ void collectUIInformation(const OUString& rAction, const 
OUString& aParameters)
 
 }
 
-namespace {
-
 class SwTransferDdeLink : public ::sfx2::SvBaseLink
 {
 OUString m_sName;
@@ -204,8 +202,6 @@ public:
 void Disconnect( bool bRemoveDataAdvise );
 };
 
-}
-
 /// Tracks the boundaries of pasted content and notifies listeners.
 class SwPasteContext
 {
@@ -393,7 +389,7 @@ void SwTransferable::DisconnectDDE()
 {
 if( m_xDdeLink.is() )
 {
-static_cast( m_xDdeLink.get() )->Disconnect( true 
);
+m_xDdeLink->Disconnect( true );
 m_xDdeLink.clear();
 }
 }
diff --git a/sw/source/uibase/inc/swdtflvr.hxx 
b/sw/source/uibase/inc/swdtflvr.hxx
index e7e1849a0dc9..6234bd37294b 100644
--- a/sw/source/uibase/inc/swdtflvr.hxx
+++ b/sw/source/uibase/inc/swdtflvr.hxx
@@ -73,12 +73,14 @@ enum class PasteTableType
 PASTE_TABLE// paste table as nested table
 };
 
+class SwTransferDdeLink;
+
 class SW_DLLPUBLIC SwTransferable final : public TransferableHelper
 {
 friend class SwView_Impl;
 SfxObjectShellLock  m_aDocShellRef;
 TransferableObjectDescriptorm_aObjDesc;
-tools::SvRef  m_xDdeLink;
+tools::SvRef  m_xDdeLink;
 
 SwWrtShell  *m_pWrtShell;
 /* #96392# Added pCreatorView to distinguish SwFrameShell from


[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-15 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/ostr.cxx  |   19 +++-
 compilerplugins/clang/test/ostr.cxx |   82 +---
 2 files changed, 75 insertions(+), 26 deletions(-)

New commits:
commit 51d9c9899f54200a2bf9bf49df16c03cca403498
Author: Stephan Bergmann 
AuthorDate: Wed Nov 15 15:05:59 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 15 19:16:51 2023 +0100

Extend a loplugin:ostr check from OUString to OString

Change-Id: I0776ab0ab376d6181461d2c144a4107b06233829
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159470
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/ostr.cxx b/compilerplugins/clang/ostr.cxx
index 16d8f32dbc0e..da68451e6316 100644
--- a/compilerplugins/clang/ostr.cxx
+++ b/compilerplugins/clang/ostr.cxx
@@ -285,10 +285,6 @@ public:
 i->second.explicitConversions.insert(expr);
 return true;
 }
-if (!utf16)
-{
-return true;
-}
 if (expr->getNumArgs() != 2)
 {
 return true;
@@ -306,9 +302,8 @@ public:
 {
 return true;
 }
-if (!compat::isOrdinary(e2))
+if (!(compat::isOrdinary(e2) || e2->isUTF8()))
 {
-assert(!e2->isUTF8()); //TODO
 return true;
 }
 auto const temp = isa(expr)
@@ -369,17 +364,19 @@ public:
 Lexer::MeasureTokenLength(l3, compiler.getSourceManager(), 
compiler.getLangOpts()));
 l4 = l4.getLocWithOffset(
 Lexer::MeasureTokenLength(l4, compiler.getSourceManager(), 
compiler.getLangOpts()));
-if (replaceText(l1, delta(l1, l2), macroBegin ? "u\"\" " : "u")
-&& replaceText(l3, delta(l3, l4), macroEnd ? " \"\"_ustr" : 
"_ustr"))
+if ((!utf16 || replaceText(l1, delta(l1, l2), macroBegin ? "u\"\" 
" : "u"))
+&& replaceText(l3, delta(l3, l4),
+   utf16 ? (macroEnd ? " \"\"_ustr" : "_ustr")
+ : (macroEnd ? " \"\"_ostr" : "_ostr")))
 {
 return true;
 }
 }
 report(DiagnosticsEngine::Warning,
-   "use a _ustr user-defined string literal instead of 
constructing an instance of %0 "
-   "from an ordinary string literal",
+   "use a %select{_ostr|_ustr}0 user-defined string literal 
instead of constructing an"
+   " instance of %1 from an ordinary string literal",
expr->getExprLoc())
-<< expr->getType().getLocalUnqualifiedType() << 
expr->getSourceRange();
+<< utf16 << expr->getType().getLocalUnqualifiedType() << 
expr->getSourceRange();
 return true;
 }
 
diff --git a/compilerplugins/clang/test/ostr.cxx 
b/compilerplugins/clang/test/ostr.cxx
index 22cafc731d3e..8e772b1258a2 100644
--- a/compilerplugins/clang/test/ostr.cxx
+++ b/compilerplugins/clang/test/ostr.cxx
@@ -21,7 +21,9 @@ struct S
 OUString s;
 };
 
-void f(OUString const&);
+void takeOstring(OString const&);
+
+void takeOustring(OUString const&);
 
 void f(OUString const&, OUString const&);
 
@@ -35,30 +37,80 @@ void takeStdView(std::u16string_view);
 
 void f()
 {
+// expected-error-re@+1 {{use a _ostr user-defined string literal instead 
of constructing an instance of '{{(rtl::)?}}OString' from an ordinary string 
literal [loplugin:ostr]}}
+OString s1o = "foo";
+(void)s1o;
+// expected-error-re@+1 {{use a _ostr user-defined string literal instead 
of constructing an instance of '{{(rtl::)?}}OString' from an ordinary string 
literal [loplugin:ostr]}}
+OString s2o = (("foo"));
+(void)s2o;
+// expected-error-re@+1 {{use a _ostr user-defined string literal instead 
of constructing an instance of '{{(rtl::)?}}OString' from an ordinary string 
literal [loplugin:ostr]}}
+OString s3o("foo");
+(void)s3o;
+// expected-error-re@+1 {{use a _ostr user-defined string literal instead 
of constructing an instance of '{{(rtl::)?}}OString' from an ordinary string 
literal [loplugin:ostr]}}
+OString s4o((("foo")));
+(void)s4o;
+// expected-error-re@+1 {{use a _ostr user-defined string literal instead 
of constructing an instance of '{{(rtl::)?}}OString' from an ordinary string 
literal [loplugin:ostr]}}
+takeOstring(OString("foo"));
+// expected-error-re@+1 {{use a _ostr user-defined string literal instead 
of constructing an instance of '{{(rtl::)?}}OString' from an ordinary string 
literal [loplugin:ostr]}}
+takeOstring(((OString((("foo"));
+// expected-error-re@+1 {{use a _ostr user-defined string literal instead 
of constructing an instance of '{{(rtl::)?}}OString' from an ordinary string 
literal [loplugin:ostr]}}
+takeOstring(OString("foo", rtl::libreoffice_internal::Dummy()));
+// expected-error-re@+1 {{use a _ostr user-defined string literal instead 
of constructin

[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-15 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/test/ostr.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 2a242032f9496308eed36d7dd2abb4eed762fa9f
Author: Stephan Bergmann 
AuthorDate: Wed Nov 15 14:51:07 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 15 17:20:38 2023 +0100

Add back test for struct initialization

...that had been removed as part of f99bee8103ad82dac2e53e114527399c4af5485c
"Delete OUString UTF-16 string literal ctor/assignment op"

Change-Id: I22423306ab35dcb580ecc90daea3219b6c1578b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159446
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/test/ostr.cxx 
b/compilerplugins/clang/test/ostr.cxx
index c481fa06ea07..22cafc731d3e 100644
--- a/compilerplugins/clang/test/ostr.cxx
+++ b/compilerplugins/clang/test/ostr.cxx
@@ -60,6 +60,9 @@ void f()
 // expected-error-re@+1 {{use a _ustr user-defined string literal instead 
of constructing an instance of '{{(rtl::)?}}OUString' from an ordinary string 
literal [loplugin:ostr]}}
 f((("foo")));
 
+// expected-error-re@+1 {{use a _ustr user-defined string literal instead 
of constructing an instance of '{{(rtl::)?}}OUString' from an ordinary string 
literal [loplugin:ostr]}}
+S s10 = { "foo" };
+
 // Only generate one warning here, not two, for a macro argument used 
twice in the macro's
 // expansion:
 // expected-error-re@+1 {{use a _ustr user-defined string literal instead 
of constructing an instance of '{{(rtl::)?}}OUString' from an ordinary string 
literal [loplugin:ostr]}}


[Libreoffice-commits] core.git: compilerplugins/clang cui/source include/tools include/ucbhelper include/unotools include/vcl svx/source sw/inc sw/source ucbhelper/Library_ucbhelper.mk ucbhelper/sourc

2023-11-14 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/unusedmethods.results|  286 ++---
 compilerplugins/clang/unusedmethods.unused-returns.results |   74 +--
 cui/source/inc/cuitabarea.hxx  |2 
 include/tools/urlobj.hxx   |   12 
 include/ucbhelper/fd_inputstream.hxx   |   91 
 include/ucbhelper/proxydecider.hxx |   21 
 include/unotools/securityoptions.hxx   |2 
 include/vcl/bitmap.hxx |9 
 svx/source/inc/findtextfield.hxx   |1 
 svx/source/tbxctrls/tbunosearchcontrollers.cxx |5 
 sw/inc/reffld.hxx  |2 
 sw/source/core/fields/reffld.cxx   |   12 
 ucbhelper/Library_ucbhelper.mk |1 
 ucbhelper/source/client/proxydecider.cxx   |   10 
 ucbhelper/source/provider/fd_inputstream.cxx   |  146 --
 vcl/source/bitmap/bitmappaint.cxx  |   39 -
 16 files changed, 191 insertions(+), 522 deletions(-)

New commits:
commit 48e4a871d926b534eb6131d16d04d68b151b2847
Author: Noel Grandin 
AuthorDate: Tue Nov 14 16:01:30 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 15 06:56:06 2023 +0100

loplugin:unusedmethods

Change-Id: I1e125bbd388953491b3f869641484fea737d39ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159423
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index 5927b7e5845f..85caa68bb670 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -118,6 +118,8 @@ cppuhelper/inc/interfacecontainer4.hxx:277
 void 
cppuhelper::OInterfaceContainerHelper4::NotifySingleListener::operator()(const 
Reference &) const
 cui/source/dialogs/SpellAttrib.hxx:73
 _Bool svx::SpellErrorDescription::operator==(const struct 
svx::SpellErrorDescription &) const
+cui/source/inc/cuitabarea.hxx:750
+void SvxColorTabPage::SetCtlPreviewOld(const SfxItemSet &)
 cui/source/inc/CustomNotebookbarGenerator.hxx:30
  CustomNotebookbarGenerator::CustomNotebookbarGenerator()
 cui/source/inc/fileextcheckdlg.hxx:32
@@ -156,6 +158,8 @@ dbaccess/source/ui/inc/unodatbr.hxx:316
 _Bool dbaui::SbaTableQueryBrowser::implCopyObject(ODataClipboard &,const 
weld::TreeIter &,int)
 desktop/inc/lib/init.hxx:142
  desktop::CallbackFlushHandler::CallbackData::CallbackData(const 
tools::Rectangle *,int)
+desktop/qa/desktop_lib/test_desktop_lib.cxx:3712
+int main()
 desktop/source/lib/lokclipboard.hxx:95
  LOKClipboardFactory::LOKClipboardFactory()
 drawinglayer/inc/texture/texture.hxx:39
@@ -188,7 +192,7 @@ editeng/inc/edtspell.hxx:104
 __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator 
>, std::vector > WrongList::end() const
 editeng/source/editeng/impedit.hxx:234
 tools::Rectangle LOKSpecialPositioning::GetWindowPos(const 
tools::Rectangle &,enum MapUnit) const
-editeng/source/editeng/impedit.hxx:761
+editeng/source/editeng/impedit.hxx:757
 double ImpEditEngine::scaleYFontValue(unsigned short) const
 embeddedobj/source/msole/olecomponent.hxx:75
 _Bool OleComponent::InitializeObject_Impl()
@@ -436,27 +440,25 @@ include/comphelper/basicio.hxx:52
 const 
com::sun::star::uno::Reference & 
comphelper::operator>>(const 
com::sun::star::uno::Reference 
&,unsigned int &)
 include/comphelper/basicio.hxx:53
 const 
com::sun::star::uno::Reference & 
comphelper::operator<<(const 
com::sun::star::uno::Reference 
&,unsigned int)
-include/comphelper/configuration.hxx:254
-type-parameter-?-? comphelper::ConfigurationLocalizedProperty::get()
-include/comphelper/configuration.hxx:270
+include/comphelper/configuration.hxx:277
 void comphelper::ConfigurationLocalizedProperty::set(const 
type-parameter-?-? &,const std::shared_ptr &)
-include/comphelper/configuration.hxx:305
+include/comphelper/configuration.hxx:312
 
com::sun::star::uno::Reference
 comphelper::ConfigurationGroup::get(const 
std::shared_ptr &)
-include/comphelper/errcode.hxx:91
+include/comphelper/errcode.hxx:96
 _Bool ErrCode::operator<(const ErrCode &) const
-include/comphelper/errcode.hxx:92
+include/comphelper/errcode.hxx:97
 _Bool ErrCode::operator<=(const ErrCode &) const
-include/comphelper/errcode.hxx:93
+include/comphelper/errcode.hxx:98
 _Bool ErrCode::operator>(const ErrCode &) const
-include/comphelper/errcode.hxx:94
+include/comphelper/errcode.hxx:99
 _Bool ErrCode::operator>=(const ErrCode &) const
-include/comphelper/errcode.hxx:188
- ErrCodeMsg::ErrCodeMsg(ErrCode,const rtl::OUString &,const rtl::OUString 
&,struct std::experimental::source_location)
-include/comphelper/errcode.hxx:215
-const std::optional & 
ErrCodeMsg::GetSourceLocation() const
-i

[Libreoffice-commits] core.git: compilerplugins/clang cui/source desktop/qa sc/source sw/source writerperfect/inc writerperfect/source

2023-11-14 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/unusedfields.only-used-in-constructor.results |  204 
+-
 compilerplugins/clang/unusedfields.readonly.results |  116 
++---
 compilerplugins/clang/unusedfields.untouched.results|  192 
+
 compilerplugins/clang/unusedfields.writeonly.results|  132 
+++---
 cui/source/options/optgdlg.hxx  |1 
 cui/source/options/optsave.cxx  |2 
 cui/source/options/optsave.hxx  |2 
 desktop/qa/desktop_lib/test_desktop_lib.cxx |1 
 sc/source/ui/condformat/condformateasydlg.cxx   |   20 
 sc/source/ui/inc/condformateasydlg.hxx  |1 
 sw/source/ui/config/optpage.cxx |1 
 sw/source/uibase/inc/optpage.hxx|2 
 writerperfect/inc/WPXSvInputStream.hxx  |1 
 writerperfect/source/common/WPXSvInputStream.cxx|   13 
 14 files changed, 340 insertions(+), 348 deletions(-)

New commits:
commit 5e8bc7bda667e994cfbdf9bf4d981175dff71bae
Author: Noel Grandin 
AuthorDate: Tue Nov 14 11:58:56 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Nov 14 15:40:52 2023 +0100

loplugin:unusedfields

Change-Id: I5869e9974c37b1b525d316367f1dc5051d8aa197
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159404
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git 
a/compilerplugins/clang/unusedfields.only-used-in-constructor.results 
b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
index 4169718d1529..a58b37ba0f00 100644
--- a/compilerplugins/clang/unusedfields.only-used-in-constructor.results
+++ b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
@@ -140,7 +140,7 @@ cppu/source/uno/check.cxx:267
 (anonymous namespace)::Char4 chars Char3
 cui/source/dialogs/colorpicker.cxx:748
 cui::(anonymous namespace)::ColorPickerDialog m_aColorPrevious 
ColorPreviewControl
-cui/source/factory/dlgfact.cxx:1244
+cui/source/factory/dlgfact.cxx:1246
 (anonymous namespace)::SvxMacroAssignDialog_Impl m_aItems SfxItemSet
 cui/source/inc/AdditionsDialog.hxx:47
 AdditionInfo sReleaseVersion OUString
@@ -186,6 +186,8 @@ dbaccess/source/core/inc/databasecontext.hxx:82
 dbaccess::ODatabaseContext m_aBasicDLL BasicDLL
 dbaccess/source/core/inc/SingleSelectQueryComposer.hxx:79
 dbaccess::OSingleSelectQueryComposer m_aNeutralContext 
::svxform::ONeutralParseContext
+desktop/qa/desktop_lib/test_desktop_lib.cxx:2143
+(anonymous namespace)::ViewCallback m_aCallbackWindowResult 
boost::property_tree::ptree
 drawinglayer/inc/texture/texture3d.hxx:54
 drawinglayer::texture::GeoTexSvxBitmapEx maBitmapEx BitmapEx
 drawinglayer/inc/texture/texture3d.hxx:55
@@ -196,7 +198,7 @@ drawinglayer/source/tools/emfphelperdata.hxx:198
 emfplushelper::EmfPlusHelperData mnFrameRight sal_Int32
 drawinglayer/source/tools/emfphelperdata.hxx:199
 emfplushelper::EmfPlusHelperData mnFrameBottom sal_Int32
-editeng/source/editeng/impedit.hxx:532
+editeng/source/editeng/impedit.hxx:528
 ImpEditEngine aSelFuncSet EditSelFunctionSet
 embeddedobj/source/msole/olecomponent.hxx:51
 OleComponent m_pInterfaceContainer 
comphelper::OMultiTypeInterfaceContainerHelper2 *
@@ -238,21 +240,21 @@ helpcompiler/inc/HelpCompiler.hxx:200
 HelpCompiler lang const std::string
 include/basic/basmgr.hxx:59
 BasicError nReason BasicErrorReason
-include/comphelper/seqstream.hxx:76
+include/comphelper/seqstream.hxx:75
 comphelper::SequenceInputStream m_aData const css::uno::Sequence
-include/docmodel/theme/FormatScheme.hxx:374
+include/docmodel/theme/FormatScheme.hxx:373
 model::DashStop mnDashLength sal_Int32
-include/docmodel/theme/FormatScheme.hxx:375
+include/docmodel/theme/FormatScheme.hxx:374
 model::DashStop mnStopLength sal_Int32
 include/drawinglayer/primitive2d/textlayoutdevice.hxx:64
 drawinglayer::primitive2d::TextLayouterDevice maSolarGuard SolarMutexGuard
-include/filter/msfilter/svdfppt.hxx:888
-ImplPPTParaPropSet nDontKnow1 sal_uInt32
 include/filter/msfilter/svdfppt.hxx:889
-ImplPPTParaPropSet nDontKnow2 sal_uInt32
+ImplPPTParaPropSet nDontKnow1 sal_uInt32
 include/filter/msfilter/svdfppt.hxx:890
+ImplPPTParaPropSet nDontKnow2 sal_uInt32
+include/filter/msfilter/svdfppt.hxx:891
 ImplPPTParaPropSet nDontKnow2bit06 sal_uInt16
-include/formula/formulahelper.hxx:40
+include/formula/formulahelper.hxx:39
 formula::FormulaHelper m_aSysLocale SvtSysLocale
 include/LibreOfficeKit/LibreOfficeKitGtk.h:40
 _LOKDocView aDrawingArea GtkDrawingArea
@@ -264,131 +266,131 @@ include/registry/registry.hxx:34
 Registry_Api acquire void (*)(RegHandle)
 include/sfx2/classificationhelper.hxx:134
 sfx::ClassificationKeyCreator m_ePolicyType const 
SfxCla

[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-14 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/test/fieldcast.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit b6583a9283e1b57c43dd5a4d8eff54d16c112020
Author: Stephan Bergmann 
AuthorDate: Tue Nov 14 08:28:21 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Nov 14 10:23:46 2023 +0100

Adapt compilerplugins/clang/test/fieldcast.cxx to clang-cl

...where loplugin:locking2 is disabled

Change-Id: Id58cbedab191c59b901ef1a0e0dd82b8f8438c4e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159400
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/test/fieldcast.cxx 
b/compilerplugins/clang/test/fieldcast.cxx
index 98e43d023324..6d0437d04e6f 100644
--- a/compilerplugins/clang/test/fieldcast.cxx
+++ b/compilerplugins/clang/test/fieldcast.cxx
@@ -7,6 +7,10 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#if defined _WIN32 //TODO, #include 
+// expected-no-diagnostics
+#else
+
 #include 
 #include 
 #include 
@@ -53,4 +57,7 @@ class Test5
 std::shared_ptr m_p;
 void test1() { (void)dynamic_cast(m_p.get()); }
 };
+
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-10 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/fieldcast.cxx  |   39 +-
 compilerplugins/clang/fieldcast.results  |  423 +++
 compilerplugins/clang/test/fieldcast.cxx |   22 +
 3 files changed, 93 insertions(+), 391 deletions(-)

New commits:
commit 50add2043752c7b07beccef9a509bea6c09619f8
Author: Noel Grandin 
AuthorDate: Thu Nov 9 15:31:05 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Nov 11 07:22:56 2023 +0100

loplugin:fieldcast improvements

reduce false positives, and also check reinterpret_cast

Change-Id: Ia6f214393f28451d18c16b764a3c2b149d29ba8a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159302
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/fieldcast.cxx 
b/compilerplugins/clang/fieldcast.cxx
index 7f2b728e8e22..0807aef9b3c3 100644
--- a/compilerplugins/clang/fieldcast.cxx
+++ b/compilerplugins/clang/fieldcast.cxx
@@ -61,6 +61,7 @@ public:
 
 bool VisitCXXStaticCastExpr(const CXXStaticCastExpr*);
 bool VisitCXXDynamicCastExpr(const CXXDynamicCastExpr*);
+bool VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr*);
 
 private:
 MyFieldInfo niceName(const FieldDecl*);
@@ -151,25 +152,26 @@ bool FieldCast::VisitCXXStaticCastExpr(const 
CXXStaticCastExpr* expr)
 return true;
 }
 
+bool FieldCast::VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr* expr)
+{
+checkCast(expr);
+return true;
+}
+
 void FieldCast::checkCast(const CXXNamedCastExpr* expr)
 {
 if (ignoreLocation(expr))
 return;
 if 
(isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(expr->getBeginLoc(
 return;
-const QualType exprType = expr->getTypeAsWritten();
-if (!exprType->getPointeeCXXRecordDecl())
+auto castToType = expr->getTypeAsWritten()->getPointeeCXXRecordDecl();
+if (!castToType)
 return;
 const Expr* subExpr = compat::getSubExprAsWritten(expr);
+const FieldDecl* fieldDecl = nullptr;
 if (const MemberExpr* memberExpr = 
dyn_cast_or_null(subExpr->IgnoreImplicit()))
 {
-const FieldDecl* fieldDecl = 
dyn_cast_or_null(memberExpr->getMemberDecl());
-if (!fieldDecl)
-return;
-if (isInUnoIncludeFile(
-
compiler.getSourceManager().getSpellingLoc(fieldDecl->getBeginLoc(
-return;
-castMap.emplace(fieldDecl, exprType->getPointeeCXXRecordDecl());
+fieldDecl = dyn_cast_or_null(memberExpr->getMemberDecl());
 }
 else if (const CXXMemberCallExpr* memberCallExpr
  = dyn_cast_or_null(subExpr->IgnoreImplicit()))
@@ -181,14 +183,19 @@ void FieldCast::checkCast(const CXXNamedCastExpr* expr)
 memberCallExpr->getImplicitObjectArgument()->IgnoreImplicit());
 if (!memberExpr)
 return;
-const FieldDecl* fieldDecl = 
dyn_cast_or_null(memberExpr->getMemberDecl());
-if (!fieldDecl)
-return;
-if (isInUnoIncludeFile(
-
compiler.getSourceManager().getSpellingLoc(fieldDecl->getBeginLoc(
-return;
-castMap.emplace(fieldDecl, exprType->getPointeeCXXRecordDecl());
+fieldDecl = dyn_cast_or_null(memberExpr->getMemberDecl());
 }
+if (!fieldDecl)
+return;
+if 
(isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(fieldDecl->getBeginLoc(
+return;
+
+// ignore casting to a less specific type
+auto castFromType = subExpr->getType()->getPointeeCXXRecordDecl();
+if (castFromType && castFromType->isDerivedFrom(castToType))
+return;
+
+castMap.emplace(fieldDecl, castToType);
 }
 
 loplugin::Plugin::Registration X("fieldcast", false);
diff --git a/compilerplugins/clang/fieldcast.results 
b/compilerplugins/clang/fieldcast.results
index a1ef6accb82b..e65cc5123250 100644
--- a/compilerplugins/clang/fieldcast.results
+++ b/compilerplugins/clang/fieldcast.results
@@ -13,114 +13,57 @@ basctl/source/inc/basidesh.hxx:97
 basic/source/inc/errobject.hxx:27
 SbxErrObject m_xErr css::uno::Reference
 ErrObject
-basic/source/inc/runtime.hxx:68
-SbiForStack refEnd SbxVariableRef
-BasicCollection
 basic/source/inc/runtime.hxx:220
 SbiRuntime pMod SbModule *
 SbClassModuleObject
+bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx:70
+(anonymous namespace)::GeneratedPad pad_ std::unique_ptr
+std::type_info
 bridges/source/jni_uno/jni_info.h:96
 jni_uno::JNI_compound_type_info m_base const JNI_type_info *
 jni_uno::JNI_compound_type_info
 bxml/parser.h:258
 _xmlParserCtxt _private void *
 DOM::CDocumentBuilder
+bxml/tree.h:390
+_xmlNs next struct _xmlNs *
+_xmlNode
 bxml/xpath.h:338
 _xmlXPathContext funcLookupData void *
 CLibxml2XFormsExtension
-chart2/inc/ChartModel.hxx:133
-chart::ChartModel mxChartView rtl::Reference
-cppu::OWeakObject
-chart2/inc/ChartModel.hxx:176
-chart::ChartModel m_xXMLNamespaceMap rtl::Reference< 
::chart:

[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-08 Thread Andrea Gelmini (via logerrit)
 compilerplugins/clang/fieldcast.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 641f91100a30a9faf2d24de1c449b95b62fc37d5
Author: Andrea Gelmini 
AuthorDate: Wed Nov 8 22:57:49 2023 +0100
Commit: Julien Nabet 
CommitDate: Thu Nov 9 08:19:43 2023 +0100

Fix typo

Change-Id: I3933be04cacda3dd271c20b2248561da85a069b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159190
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/compilerplugins/clang/fieldcast.py 
b/compilerplugins/clang/fieldcast.py
index cc6d3f3e5b3c..fc09063571ee 100755
--- a/compilerplugins/clang/fieldcast.py
+++ b/compilerplugins/clang/fieldcast.py
@@ -54,7 +54,7 @@ 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 by both the source-line and the datatype, so the output file ordering 
is stable
-# when we have multiple fieldds declared on the same source line
+# when we have multiple fields declared on the same source line
 def v_sort_key(v):
 return natural_sort_key(v[1]) + [v[0]]
 


[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-08 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/test/ostr.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c3c56b8560e32fa09f6437c755d841152cf3
Author: Stephan Bergmann 
AuthorDate: Wed Nov 8 14:02:40 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 8 18:57:55 2023 +0100

Adapt expected diagnostic output to clang-cl and the MSVC standard library

Change-Id: Ie416e4170280b9f05ecac359655e71f65a525592
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159131
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/test/ostr.cxx 
b/compilerplugins/clang/test/ostr.cxx
index d8ad56201ec3..c481fa06ea07 100644
--- a/compilerplugins/clang/test/ostr.cxx
+++ b/compilerplugins/clang/test/ostr.cxx
@@ -85,9 +85,9 @@ void f()
 
 void passLiteral()
 {
-// expected-error@+1 {{directly use a 'std::string' (aka 
'basic_string') value instead of a _ostr user-defined string literal 
[loplugin:ostr]}}
+// expected-error-re@+1 {{directly use a 'std::string' (aka 
'basic_string, allocator)?}}>') value instead 
of a _ostr user-defined string literal [loplugin:ostr]}}
 takeStdString(std::string(""_ostr));
-// expected-error@+1 {{directly use a 'std::u16string' (aka 
'basic_string') value instead of a _ustr user-defined string literal 
[loplugin:ostr]}}
+// expected-error-re@+1 {{directly use a 'std::u16string' (aka 
'basic_string, allocator)?}}>') 
value instead of a _ustr user-defined string literal [loplugin:ostr]}}
 takeStdString(std::u16string(u""_ustr));
 // expected-error@+1 {{directly use a 'std::string_view' (aka 
'basic_string_view') value instead of a _ostr user-defined string literal 
[loplugin:ostr]}}
 takeStdView(""_ostr);


[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-08 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/test/locking2.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit b1afd3413dabf33d500796d037e85fdb38c4ec5b
Author: Stephan Bergmann 
AuthorDate: Wed Nov 8 08:42:56 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 8 17:05:25 2023 +0100

Adapt compilerplugins/clang/test/locking2.cxx to clang-cl

...where loplugin:locking2 is disabled

Change-Id: Ie6a241ac49670e47001cba67c7af9996623a23ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159109
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/test/locking2.cxx 
b/compilerplugins/clang/test/locking2.cxx
index 3ef1a11228b6..5e6c36d4db26 100644
--- a/compilerplugins/clang/test/locking2.cxx
+++ b/compilerplugins/clang/test/locking2.cxx
@@ -7,6 +7,10 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#if defined _WIN32 //TODO, #include 
+// expected-no-diagnostics
+#else
+
 #include 
 #include 
 #include 
@@ -47,4 +51,6 @@ struct Foo
 };
 }
 
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-08 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/stringconcatliterals.cxx  |   26 +++-
 compilerplugins/clang/test/stringconcatliterals.cxx |1 
 2 files changed, 21 insertions(+), 6 deletions(-)

New commits:
commit 71d9e8d3e403329428edbda747c7d6bbc705c95f
Author: Stephan Bergmann 
AuthorDate: Wed Nov 8 08:49:28 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 8 13:44:52 2023 +0100

Adapt loplugin:stringconcatliterals to clang-cl

...whose handling of PredefinedExpr (representing `__func__`) deliberately
differs in IgnoreParens and IgnoreParenImpCasts, see the comment in
StringConcatLiterals::isStringLiteral

Change-Id: I8b001d65369adc3d2a2c47e0cf32578a72ef4eec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159111
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/stringconcatliterals.cxx 
b/compilerplugins/clang/stringconcatliterals.cxx
index 54ca706e208f..9f6482d218f8 100644
--- a/compilerplugins/clang/stringconcatliterals.cxx
+++ b/compilerplugins/clang/stringconcatliterals.cxx
@@ -78,16 +78,16 @@ bool StringConcatLiterals::VisitCallExpr(CallExpr const * 
expr) {
 if ((oo != OverloadedOperatorKind::OO_Plus
  && oo != OverloadedOperatorKind::OO_LessLess)
 || fdecl->getNumParams() != 2 || expr->getNumArgs() != 2
-|| !isStringLiteral(expr->getArg(1)->IgnoreParenImpCasts()))
+|| !isStringLiteral(expr->getArg(1)))
 {
 return true;
 }
 SourceLocation leftLoc;
-auto const leftExpr = expr->getArg(0)->IgnoreParenImpCasts();
+auto const leftExpr = expr->getArg(0);
 if (isStringLiteral(leftExpr)) {
-leftLoc = leftExpr->getBeginLoc();
+leftLoc = leftExpr->IgnoreParenImpCasts()->getBeginLoc();
 } else {
-CallExpr const * left = dyn_cast(leftExpr);
+CallExpr const * left = 
dyn_cast(leftExpr->IgnoreParenImpCasts());
 if (left == nullptr) {
 return true;
 }
@@ -99,7 +99,7 @@ bool StringConcatLiterals::VisitCallExpr(CallExpr const * 
expr) {
 if ((loo != OverloadedOperatorKind::OO_Plus
  && loo != OverloadedOperatorKind::OO_LessLess)
 || ldecl->getNumParams() != 2 || left->getNumArgs() != 2
-|| !isStringLiteral(left->getArg(1)->IgnoreParenImpCasts()))
+|| !isStringLiteral(left->getArg(1)))
 {
 return true;
 }
@@ -140,7 +140,21 @@ bool StringConcatLiterals::VisitCallExpr(CallExpr const * 
expr) {
 }
 
 bool StringConcatLiterals::isStringLiteral(Expr const * expr) {
-expr = stripCtor(expr);
+// Since 

+// "Reland [clang] Make predefined expressions string literals under 
-fms-extensions", in MS
+// compatibility mode only, IgnoreParens and IgnoreParenImpCasts look 
through a PredefinedExpr
+// representing __func__, but which we do not want to do here:
+while (auto const e = dyn_cast(expr)) {
+expr = e->getSubExpr();
+}
+expr = expr->IgnoreImpCasts();
+if (isa(expr)) {
+return false;
+}
+// Once we have filtered out the problematic PredefinedExpr above, still 
call
+// IgnoreParenImpCasts again, because it does more than just ignore 
ParenExpr and call
+// IgnoreImpCasts as is done above:
+expr = stripCtor(expr->IgnoreParenImpCasts());
 if (!isa(expr)) {
 return false;
 }
diff --git a/compilerplugins/clang/test/stringconcatliterals.cxx 
b/compilerplugins/clang/test/stringconcatliterals.cxx
index 8b390f28fbbb..0575eb252bc0 100644
--- a/compilerplugins/clang/test/stringconcatliterals.cxx
+++ b/compilerplugins/clang/test/stringconcatliterals.cxx
@@ -40,6 +40,7 @@ void f(std::ostream& s1)
 s1 << "foo" << OUString(FOO);
 // expected-error@-1 {{replace '<<' between string literals with 
juxtaposition}}
 s1 << "foo" << OUString(foo);
+s1 << "foo" << __func__;
 OString s2;
 s2 = "foo" + OString("foo");
 // expected-error@-1 {{replace '+' between string literals with 
juxtaposition}}


[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-06 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/check.hxx |   16 ++-
 compilerplugins/clang/compat.hxx|   40 
 compilerplugins/clang/mergeclasses.cxx  |3 +-
 compilerplugins/clang/privatebase.cxx   |3 +-
 compilerplugins/clang/redundantcast.cxx |2 -
 compilerplugins/clang/salunicodeliteral.cxx |3 +-
 compilerplugins/clang/vclwidgets.cxx|3 +-
 7 files changed, 58 insertions(+), 12 deletions(-)

New commits:
commit c9cedde7c0ba396dadfabbf644c6329e65afebf9
Author: Stephan Bergmann 
AuthorDate: Mon Nov 6 10:51:31 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Nov 6 21:17:59 2023 +0100

Adapt to various Clang 18 trunk enum rework



"[clang][NFC] Refactor `CXXConstructExpr::ConstructionKind`",


"[clang][NFC] Refactor `CharacterLiteral::CharacterKind`",


"[clang][NFC] Refactor `StringLiteral::StringKind`",


"[clang][NFC] Refactor `TagTypeKind` (#71160)"

Change-Id: Ice802f6d662494781ad22fcf11ea5006de918254
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158983
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/check.hxx b/compilerplugins/clang/check.hxx
index a7b7ba820d09..af6cd355a416 100644
--- a/compilerplugins/clang/check.hxx
+++ b/compilerplugins/clang/check.hxx
@@ -16,6 +16,8 @@
 #include 
 #include 
 
+#include "compat.hxx"
+
 namespace loplugin {
 
 class ContextCheck;
@@ -188,7 +190,7 @@ ContextCheck TypeCheck::Class(llvm::StringRef id)
 if (!type_.isNull()) {
 auto const t = type_->getAs();
 if (t != nullptr) {
-return detail::checkRecordDecl(t->getDecl(), clang::TTK_Class, id);
+return detail::checkRecordDecl(t->getDecl(), 
compat::TagTypeKind::Class, id);
 }
 }
 return ContextCheck();
@@ -199,7 +201,7 @@ ContextCheck TypeCheck::Struct(llvm::StringRef id) const
 if (!type_.isNull()) {
 auto const t = type_->getAs();
 if (t != nullptr) {
-return detail::checkRecordDecl(t->getDecl(), clang::TTK_Struct, 
id);
+return detail::checkRecordDecl(t->getDecl(), 
compat::TagTypeKind::Struct, id);
 }
 }
 return ContextCheck();
@@ -231,12 +233,12 @@ ContextCheck TypeCheck::Typedef(llvm::StringRef id) const
 
 ContextCheck DeclCheck::Class(llvm::StringRef id) const
 {
-return detail::checkRecordDecl(decl_, clang::TTK_Class, id);
+return detail::checkRecordDecl(decl_, compat::TagTypeKind::Class, id);
 }
 
 ContextCheck DeclCheck::Struct(llvm::StringRef id) const
 {
-return detail::checkRecordDecl(decl_, clang::TTK_Struct, id);
+return detail::checkRecordDecl(decl_, compat::TagTypeKind::Struct, id);
 }
 
 ContextCheck DeclCheck::ClassOrStruct(llvm::StringRef id) const
@@ -250,7 +252,7 @@ ContextCheck DeclCheck::ClassOrStruct(llvm::StringRef id) 
const
 
 ContextCheck DeclCheck::Union(llvm::StringRef id) const
 {
-return detail::checkRecordDecl(decl_, clang::TTK_Union, id);
+return detail::checkRecordDecl(decl_, compat::TagTypeKind::Union, id);
 }
 
 ContextCheck DeclCheck::Function(llvm::StringRef id) const
@@ -294,13 +296,13 @@ ContextCheck ContextCheck::Namespace(llvm::StringRef id) 
const
 ContextCheck ContextCheck::Class(llvm::StringRef id) const
 {
 return detail::checkRecordDecl(
-llvm::dyn_cast_or_null(context_), clang::TTK_Class, id);
+llvm::dyn_cast_or_null(context_), 
compat::TagTypeKind::Class, id);
 }
 
 ContextCheck ContextCheck::Struct(llvm::StringRef id) const
 {
 return detail::checkRecordDecl(
-llvm::dyn_cast_or_null(context_), clang::TTK_Struct, id);
+llvm::dyn_cast_or_null(context_), 
compat::TagTypeKind::Struct, id);
 }
 
 bool isExtraWarnUnusedType(clang::QualType type);
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index df4052ef108a..d122933eeaaf 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -82,6 +82,24 @@ constexpr clang::ExprValueKind VK_PRValue = 
clang::VK_PRValue;
 constexpr clang::ExprValueKind VK_PRValue = clang::VK_RValue;
 #endif
 
+namespace CXXConstructionKind
+{
+#if CLANG_VERSION >= 18
+constexpr clang::CXXConstructionKind Complete = 
clang::CXXConstructionKind::Complete;
+#else
+constexpr clang::CXXConstructExpr::ConstructionKind Complete = 
clang::CXXConstructExpr::CK_Complete;
+#endif
+}
+
+namespace CharacterLiteralKind
+{
+#if CLANG_VERSION >= 18
+constexpr clang::CharacterLiteralKind Ascii = 
clang::CharacterLiteralKind::Ascii;
+#else
+constexpr clang::CharacterLiteral::CharacterKind A

[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-05 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/ostr.cxx  |   32 
 compilerplugins/clang/test/ostr.cxx |   23 +++
 2 files changed, 55 insertions(+)

New commits:
commit 5fb20ede2fb47ef91d70b49288129adf8015f34b
Author: Stephan Bergmann 
AuthorDate: Sun Nov 5 17:07:52 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Sun Nov 5 23:20:55 2023 +0100

loplugin:ostr: Warn about literals that could be string_view

...inspired by d4f4a401861e7c908b6ab7f72563d5ab911edcf0 "This function 
takes a
string view - no need in OUString literal", but this found no further cases

Change-Id: I1429950afdb6fff8ed1d28f5fbb4c445fb6bfb12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158954
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/ostr.cxx b/compilerplugins/clang/ostr.cxx
index d0290aad1f90..16d8f32dbc0e 100644
--- a/compilerplugins/clang/ostr.cxx
+++ b/compilerplugins/clang/ostr.cxx
@@ -383,6 +383,38 @@ public:
 return true;
 }
 
+bool VisitCastExpr(CastExpr const* expr)
+{
+if (ignoreLocation(expr))
+{
+return true;
+}
+auto const t1 = expr->getType().getNonReferenceType();
+auto const tc1 = loplugin::TypeCheck(t1);
+if (!(tc1.ClassOrStruct("basic_string").StdNamespace()
+  || tc1.ClassOrStruct("basic_string_view").StdNamespace()))
+{
+return true;
+}
+auto const e2 = 
dyn_cast(expr->getSubExprAsWritten());
+if (e2 == nullptr)
+{
+return true;
+}
+auto const tc2 = loplugin::TypeCheck(e2->getType());
+if (!(tc2.Class("OString").Namespace("rtl").GlobalNamespace()
+  || tc2.Class("OUString").Namespace("rtl").GlobalNamespace()))
+{
+return true;
+}
+report(DiagnosticsEngine::Warning,
+   "directly use a %0 value instead of a %select{_ostr|_ustr}1 
user-defined string"
+   " literal",
+   expr->getExprLoc())
+<< t1.getUnqualifiedType() << bool(tc2.Class("OUString")) << 
expr->getSourceRange();
+return true;
+}
+
 private:
 bool isSpellingRange(SourceLocation loc1, SourceLocation loc2)
 {
diff --git a/compilerplugins/clang/test/ostr.cxx 
b/compilerplugins/clang/test/ostr.cxx
index 28e2d746a447..d8ad56201ec3 100644
--- a/compilerplugins/clang/test/ostr.cxx
+++ b/compilerplugins/clang/test/ostr.cxx
@@ -9,6 +9,9 @@
 
 #include "sal/config.h"
 
+#include 
+#include 
+
 #include "rtl/ustring.hxx"
 
 #define M(arg) f(arg, arg)
@@ -22,6 +25,14 @@ void f(OUString const&);
 
 void f(OUString const&, OUString const&);
 
+void takeStdString(std::string const&);
+
+void takeStdString(std::u16string const&);
+
+void takeStdView(std::string_view);
+
+void takeStdView(std::u16string_view);
+
 void f()
 {
 // expected-error-re@+1 {{use a _ustr user-defined string literal instead 
of constructing an instance of '{{(rtl::)?}}OUString' from an ordinary string 
literal [loplugin:ostr]}}
@@ -72,4 +83,16 @@ void f()
 (void)l4;
 }
 
+void passLiteral()
+{
+// expected-error@+1 {{directly use a 'std::string' (aka 
'basic_string') value instead of a _ostr user-defined string literal 
[loplugin:ostr]}}
+takeStdString(std::string(""_ostr));
+// expected-error@+1 {{directly use a 'std::u16string' (aka 
'basic_string') value instead of a _ustr user-defined string literal 
[loplugin:ostr]}}
+takeStdString(std::u16string(u""_ustr));
+// expected-error@+1 {{directly use a 'std::string_view' (aka 
'basic_string_view') value instead of a _ostr user-defined string literal 
[loplugin:ostr]}}
+takeStdView(""_ostr);
+// expected-error@+1 {{directly use a 'std::u16string_view' (aka 
'basic_string_view') value instead of a _ustr user-defined string 
literal [loplugin:ostr]}}
+takeStdView(u""_ustr);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-04 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/compat.hxx  |   11 +++
 compilerplugins/clang/external.cxx|3 ++-
 compilerplugins/clang/externandnotdefined.cxx |3 ++-
 compilerplugins/clang/plugin.cxx  |2 +-
 compilerplugins/clang/redundantinline.cxx |3 ++-
 compilerplugins/clang/unreffun.cxx|3 ++-
 6 files changed, 20 insertions(+), 5 deletions(-)

New commits:
commit 5323c18753504ae99e271f98052b13271343de6f
Author: Stephan Bergmann 
AuthorDate: Fri Nov 3 22:42:51 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Sat Nov 4 09:51:18 2023 +0100

Adapt to Clang 18 trunk Linkage rework



"[clang][NFC] Refactor clang::Linkage"

Change-Id: I35e3a3c7e3de29e4f3b9ee8dfc34e39ba2aa1c70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158919
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 21a3c4ae4018..df4052ef108a 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -91,6 +91,17 @@ constexpr clang::ElaboratedTypeKeyword None = 
clang::ETK_None;
 #endif
 }
 
+namespace Linkage
+{
+#if CLANG_VERSION >= 18
+constexpr clang::Linkage External = clang::Linkage::External;
+constexpr clang::Linkage Module = clang::Linkage::Module;
+#else
+constexpr clang::Linkage External = clang::ExternalLinkage;
+constexpr clang::Linkage Module = clang::ModuleLinkage;
+#endif
+}
+
 inline bool EvaluateAsInt(clang::Expr const * expr, llvm::APSInt& intRes, 
const clang::ASTContext& ctx) {
 clang::Expr::EvalResult res;
 bool b = expr->EvaluateAsInt(res, ctx);
diff --git a/compilerplugins/clang/external.cxx 
b/compilerplugins/clang/external.cxx
index de2b51ff82bc..8c8733553907 100644
--- a/compilerplugins/clang/external.cxx
+++ b/compilerplugins/clang/external.cxx
@@ -17,6 +17,7 @@
 #include "clang/Sema/SemaDiagnostic.h"
 
 #include "check.hxx"
+#include "compat.hxx"
 #include "plugin.hxx"
 
 namespace
@@ -468,7 +469,7 @@ private:
 {
 return true;
 }
-if (decl->getLinkageInternal() < ModuleLinkage)
+if (decl->getLinkageInternal() < compat::Linkage::Module)
 {
 return true;
 }
diff --git a/compilerplugins/clang/externandnotdefined.cxx 
b/compilerplugins/clang/externandnotdefined.cxx
index 5fd59ca4b58c..5d8803a6faaa 100644
--- a/compilerplugins/clang/externandnotdefined.cxx
+++ b/compilerplugins/clang/externandnotdefined.cxx
@@ -11,6 +11,7 @@
 
 #include 
 
+#include "compat.hxx"
 #include "plugin.hxx"
 
 // Having an extern prototype for a method in a module and not actually 
declaring that method is dodgy.
@@ -35,7 +36,7 @@ bool ExternAndNotDefined::VisitFunctionDecl(const 
FunctionDecl * functionDecl) {
 }
 if (functionDecl->isDefined() || functionDecl->isPure()
   || (functionDecl->getLinkageAndVisibility().getLinkage()
-  != ExternalLinkage)) {
+  != compat::Linkage::External)) {
 return true;
 }
 //TODO, filtering out anything template for now:
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index e2d4d7fbf0a4..10102d426079 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -1013,7 +1013,7 @@ int derivedFromCount(QualType subclassQt, QualType 
baseclassQt)
 // a variable declared in an 'extern "..." {...}'-style linkage-specification 
as
 // if it contained the 'extern' specifier:
 bool hasExternalLinkage(VarDecl const * decl) {
-if (decl->getLinkageAndVisibility().getLinkage() != ExternalLinkage) {
+if (decl->getLinkageAndVisibility().getLinkage() != 
compat::Linkage::External) {
 return false;
 }
 for (auto ctx = decl->getLexicalDeclContext();
diff --git a/compilerplugins/clang/redundantinline.cxx 
b/compilerplugins/clang/redundantinline.cxx
index 1172dfec33d3..962a11ed6037 100644
--- a/compilerplugins/clang/redundantinline.cxx
+++ b/compilerplugins/clang/redundantinline.cxx
@@ -10,6 +10,7 @@
 
 #include 
 
+#include "compat.hxx"
 #include "plugin.hxx"
 
 namespace {
@@ -141,7 +142,7 @@ private:
 }
 
 bool handleNonExternalLinkage(FunctionDecl const * decl) {
-if (decl->getLinkageInternal() >= ModuleLinkage) {
+if (decl->getLinkageInternal() >= compat::Linkage::Module) {
 return false;
 }
 if (!compiler.getSourceManager().isInMainFile(decl->getLocation())) {
diff --git a/compilerplugins/clang/unreffun.cxx 
b/compilerplugins/clang/unreffun.cxx
index 353eee5f0b31..fcb6f04016b7 100644
--- a/compilerplugins/clang/unreffun.cxx
+++ b/compilerplugins/clang/unreffun.cxx
@@ -16,6 +16,7 @@
 #include "clang/AST/Attr.h"
 #include "clang/Sema/SemaInternal.h" // warn_unused_function
 
+#include "compat.hxx"
 #include "plugin.hxx"
 
 namespace {
@@ -152,7 +153,7 @@ bool Unre

[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-03 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/redundantfcast.cxx  |   11 +--
 compilerplugins/clang/test/redundantfcast.cxx |   18 ++
 2 files changed, 27 insertions(+), 2 deletions(-)

New commits:
commit d614b08b7ff399bb9275691f811b01483ae03c5b
Author: Stephan Bergmann 
AuthorDate: Thu Nov 2 17:27:34 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Nov 3 08:11:59 2023 +0100

Suppress loplugin:redundantfcast also around C++20 CXXParenListInitExpr

...which is used by


"[clang] Reland parenthesized aggregate init patches" for the
__cpp_aggregate_paren_init feature implemented since Clang 16, and which had
caused bogus warnings in patch set 1 of
 "tdf#157028 vcl: PDF 
export:
inline OBJR dictionaries"

Change-Id: Id4118ce8d53902388ca3a80ad03f12b59e3a35e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158842
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/redundantfcast.cxx 
b/compilerplugins/clang/redundantfcast.cxx
index 5e74b22fe937..3a4dea0fd591 100644
--- a/compilerplugins/clang/redundantfcast.cxx
+++ b/compilerplugins/clang/redundantfcast.cxx
@@ -16,6 +16,8 @@
 #include 
 #include 
 
+#include "config_clang.h"
+
 namespace
 {
 class RedundantFCast final : public loplugin::FilteringPlugin
@@ -288,10 +290,15 @@ public:
 if (ignoreLocation(expr))
 return true;
 // specifying the name for an init-list is necessary sometimes
-if (isa(compat::IgnoreParenImplicit(expr->getSubExpr(
+auto const e = compat::IgnoreParenImplicit(expr->getSubExpr());
+if (isa(e))
+return true;
+if (isa(e))
 return true;
-if 
(isa(compat::IgnoreParenImplicit(expr->getSubExpr(
+#if CLANG_VERSION >= 16
+if (isa(e))
 return true;
+#endif
 auto const t1 = expr->getTypeAsWritten();
 auto const t2 = compat::getSubExprAsWritten(expr)->getType();
 if (!(t1.getCanonicalType().getTypePtr() == 
t2.getCanonicalType().getTypePtr()
diff --git a/compilerplugins/clang/test/redundantfcast.cxx 
b/compilerplugins/clang/test/redundantfcast.cxx
index a477e48f5308..1d13d8bea238 100644
--- a/compilerplugins/clang/test/redundantfcast.cxx
+++ b/compilerplugins/clang/test/redundantfcast.cxx
@@ -9,6 +9,7 @@
 
 #include "sal/config.h"
 
+#include "config_clang.h"
 #include "rtl/ustring.hxx"
 #include "tools/color.hxx"
 
@@ -221,4 +222,21 @@ void foo()
 (void)aGroup;
 }
 }
+
+namespace test9
+{
+struct S
+{
+int n;
+};
+
+void f()
+{
+(void)S{ 0 };
+#if CLANG_VERSION >= 16
+(void)S(0);
+#endif
+}
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-02 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/compat.hxx |2 +-
 compilerplugins/clang/cstylecast.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c1f95f01e0239a16a3b904864a2b5310016b93a7
Author: Stephan Bergmann 
AuthorDate: Thu Nov 2 08:14:56 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Nov 2 09:31:55 2023 +0100

Fix typo

...spotted by Ilmari

Change-Id: I7414d77d91a4d11d16de1417e60cddf72a0746c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158782
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 650d187070e0..21a3c4ae4018 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -82,7 +82,7 @@ constexpr clang::ExprValueKind VK_PRValue = clang::VK_PRValue;
 constexpr clang::ExprValueKind VK_PRValue = clang::VK_RValue;
 #endif
 
-namespace ElabortatedTypeKeyword
+namespace ElaboratedTypeKeyword
 {
 #if CLANG_VERSION >= 18
 constexpr clang::ElaboratedTypeKeyword None = 
clang::ElaboratedTypeKeyword::None;
diff --git a/compilerplugins/clang/cstylecast.cxx 
b/compilerplugins/clang/cstylecast.cxx
index 2360606aff55..d51eb75b3df2 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -161,7 +161,7 @@ bool canBeUsedForFunctionalCast(TypeSourceInfo const * 
info) {
 return true;
 }
 if (auto const t = dyn_cast(type)) {
-return t->getKeyword() == compat::ElabortatedTypeKeyword::None;
+return t->getKeyword() == compat::ElaboratedTypeKeyword::None;
 }
 return false;
 }


[Libreoffice-commits] core.git: compilerplugins/clang

2023-11-01 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/compat.hxx |9 +
 compilerplugins/clang/cstylecast.cxx |2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 5f0e243159cae738dee65303f61b5a5f1b3bdf28
Author: Stephan Bergmann 
AuthorDate: Wed Nov 1 16:46:43 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Nov 2 07:46:28 2023 +0100

Adapt to Clang 18 trunk ElaboratedTypeKeyword rework



"[clang][NFC] Refactor ElaboratedTypeKeyword"

Change-Id: I1ee6592fe76bb484441ca859986e7217eaba58f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158764
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index a836aa0af1ed..650d187070e0 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -82,6 +82,15 @@ constexpr clang::ExprValueKind VK_PRValue = 
clang::VK_PRValue;
 constexpr clang::ExprValueKind VK_PRValue = clang::VK_RValue;
 #endif
 
+namespace ElabortatedTypeKeyword
+{
+#if CLANG_VERSION >= 18
+constexpr clang::ElaboratedTypeKeyword None = 
clang::ElaboratedTypeKeyword::None;
+#else
+constexpr clang::ElaboratedTypeKeyword None = clang::ETK_None;
+#endif
+}
+
 inline bool EvaluateAsInt(clang::Expr const * expr, llvm::APSInt& intRes, 
const clang::ASTContext& ctx) {
 clang::Expr::EvalResult res;
 bool b = expr->EvaluateAsInt(res, ctx);
diff --git a/compilerplugins/clang/cstylecast.cxx 
b/compilerplugins/clang/cstylecast.cxx
index 35292ecd8fb6..2360606aff55 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -161,7 +161,7 @@ bool canBeUsedForFunctionalCast(TypeSourceInfo const * 
info) {
 return true;
 }
 if (auto const t = dyn_cast(type)) {
-return t->getKeyword() == ETK_None;
+return t->getKeyword() == compat::ElabortatedTypeKeyword::None;
 }
 return false;
 }


[Libreoffice-commits] core.git: compilerplugins/clang cui/source include/vcl vcl/source

2023-11-01 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/fieldcanbelocal.cxx |  464 ++
 compilerplugins/clang/fieldcanbelocal.py  |  123 ++
 compilerplugins/clang/fieldcanbelocal.results |  123 ++
 cui/source/inc/chardlg.hxx|1 
 cui/source/tabpages/chardlg.cxx   |4 
 include/vcl/tabpage.hxx   |2 
 vcl/source/window/tabpage.cxx |   10 
 7 files changed, 717 insertions(+), 10 deletions(-)

New commits:
commit 43464d9f31c4aaea07cc84c03d5ce67ce2cdc142
Author: Noel Grandin 
AuthorDate: Tue Oct 31 13:53:55 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 1 18:40:07 2023 +0100

new loplugin:fieldcanbelocal

Change-Id: I33fe8afcbba1d461bee98c92507c878e4e5d41d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158756
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/fieldcanbelocal.cxx 
b/compilerplugins/clang/fieldcanbelocal.cxx
new file mode 100644
index ..ae1af187befb
--- /dev/null
+++ b/compilerplugins/clang/fieldcanbelocal.cxx
@@ -0,0 +1,464 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#if !defined _WIN32 //TODO, #include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "config_clang.h"
+
+#include "plugin.hxx"
+#include "compat.hxx"
+#include "check.hxx"
+
+#include "clang/AST/ParentMapContext.h"
+
+/**
+ Look for fields on objects that can be local variables.
+ Not a particularly smart plugin, generates a lot of false positives, and 
requires review of the output.
+ Mostly looks for fields that are only accessed within a single method.
+*/
+
+namespace
+{
+struct MyFuncInfo
+{
+std::string returnType;
+std::string nameAndParams;
+std::string sourceLocation;
+};
+
+struct MyFieldInfo
+{
+std::string parentClass;
+std::string fieldName;
+std::string fieldType;
+std::string sourceLocation;
+};
+
+// try to limit the voluminous output a little
+// if the value is nullptr, that indicates that we touched that field from 
more than one function
+static std::unordered_map touchedMap;
+
+class FieldCanBeLocal : public loplugin::FilteringPlugin
+{
+public:
+explicit FieldCanBeLocal(loplugin::InstantiationData const& data)
+: FilteringPlugin(data)
+{
+}
+
+virtual void run() override;
+
+bool shouldVisitTemplateInstantiations() const { return true; }
+bool shouldVisitImplicitCode() const { return true; }
+
+bool TraverseCXXConstructorDecl(CXXConstructorDecl*);
+bool TraverseCXXMethodDecl(CXXMethodDecl*);
+bool TraverseFunctionDecl(FunctionDecl*);
+
+bool VisitMemberExpr(const MemberExpr*);
+bool VisitDeclRefExpr(const DeclRefExpr*);
+bool VisitInitListExpr(const InitListExpr*);
+bool VisitCXXConstructorDecl(const CXXConstructorDecl*);
+
+private:
+MyFieldInfo niceName(const FieldDecl*);
+MyFuncInfo niceName(const FunctionDecl*);
+std::string toString(SourceLocation loc);
+void checkTouched(const FieldDecl* fieldDecl, const FunctionDecl*);
+bool isSomeKindOfConstant(const Expr* arg);
+
+RecordDecl* insideMoveOrCopyOrCloneDeclParent = nullptr;
+RecordDecl* insideStreamOutputOperator = nullptr;
+// For reasons I do not understand, parentFunctionDecl() is not reliable, 
so
+// we store the parent function on the way down the AST.
+FunctionDecl* insideFunctionDecl = nullptr;
+};
+
+void FieldCanBeLocal::run()
+{
+handler.enableTreeWideAnalysisMode();
+
+TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+
+if (!isUnitTestMode())
+{
+// 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;
+output.reserve(64 * 1024);
+for (const auto& pair : touchedMap)
+{
+if (pair.first->getParent()->isLambda())
+continue;
+MyFieldInfo s = niceName(pair.first);
+output += "definition:\t" + s.parentClass //
+  + "\t" + s.fieldName //
+  + "\t" + s.fieldType //
+  + "\t" + s.sourceLocation //
+  + "\n";
+// we have to output a negative, in case, in some other file, it 
is touched only once
+if (!pair.second)
+output += "touched:\t" + s.parentClass //
+  + "\t" + s.fieldName //
+  + "\tNegative" //
+  + "\tnowhere.cxx" //
+  + "\n";
+ 

[Libreoffice-commits] core.git: compilerplugins/clang

2023-10-20 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/ostr.cxx  |  237 +++-
 compilerplugins/clang/test/ostr.cxx |   17 ++
 2 files changed, 248 insertions(+), 6 deletions(-)

New commits:
commit 769899853557831ae53d020497e81c8fe572874b
Author: Stephan Bergmann 
AuthorDate: Thu Oct 19 10:33:19 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Oct 21 08:54:33 2023 +0200

Extended loplugin:ostr: Automatic rewrite some O[U]StringLiteral -> 
O[U]String

Change-Id: I8c08bf41b96d4a6085e7d72cb39e629efa556d09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158300
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/ostr.cxx b/compilerplugins/clang/ostr.cxx
index 462916641421..9675913c8576 100644
--- a/compilerplugins/clang/ostr.cxx
+++ b/compilerplugins/clang/ostr.cxx
@@ -37,9 +37,125 @@ public:
 
 void run() override
 {
-if (compiler.getLangOpts().CPlusPlus)
+if (compiler.getLangOpts().CPlusPlus
+&& TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()))
 {
-TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+for (auto const& i : vars_)
+{
+auto const utf16
+= 
bool(loplugin::TypeCheck(i.first->getType()).Class("OUStringLiteral"));
+if (i.second.singleUse == nullptr)
+{
+if (!(i.first->getDeclContext()->isFunctionOrMethod()
+  || 
compiler.getSourceManager().isInMainFile(i.first->getLocation())
+  || compiler.getDiagnosticOpts().VerifyDiagnostics))
+{
+//TODO, rewriting these in include files could trigger
+// loplugin:redundantfcast in other translation units:
+continue;
+}
+if (rewriter != nullptr)
+{
+auto e = i.first->getInit()->IgnoreParenImpCasts();
+if (auto const e2 = dyn_cast(e))
+{
+e = e2->getSubExpr()->IgnoreParenImpCasts();
+}
+if (auto const e2 = dyn_cast(e))
+{
+assert(e2->getNumArgs() == 1);
+e = e2->getArg(0)->IgnoreParenImpCasts();
+}
+e = dyn_cast(e);
+// e is null when this OUStringLiteral is initialized 
with another
+// OUStringLiteral:
+if (e == nullptr
+|| insertTextAfterToken(e->getEndLoc(), utf16 ? 
"_ustr" : "_ostr"))
+{
+auto ok = true;
+for (auto d = i.first->getMostRecentDecl(); d != 
nullptr;
+ d = d->getPreviousDecl())
+{
+auto const l1 = d->getTypeSpecStartLoc();
+auto l2 = d->getTypeSpecEndLoc();
+l2 = 
l2.getLocWithOffset(Lexer::MeasureTokenLength(
+l2, compiler.getSourceManager(), 
compiler.getLangOpts()));
+if (!replaceText(l1, delta(l1, l2), utf16 ? 
"OUString" : "OString"))
+{
+ok = false;
+}
+}
+for (auto const i : i.second.explicitConversions)
+{
+auto const e2 = i->getArg(0);
+auto l1 = i->getBeginLoc();
+auto l2 = e2->getBeginLoc();
+auto l3 = e2->getEndLoc();
+auto l4 = i->getEndLoc();
+while 
(compiler.getSourceManager().isMacroArgExpansion(l1)
+   && 
compiler.getSourceManager().isMacroArgExpansion(l2)
+   && 
compiler.getSourceManager().isMacroArgExpansion(l3)
+   && 
compiler.getSourceManager().isMacroArgExpansion(l4))
+//TODO: check all four locations are part of 
the same macro argument
+// expansion
+{
+l1 = 
compiler.getSourceManager().getImmediateMacroCallerLoc(l1);
+l2 = 
compiler.getSourceManager().getImmediateMacroCallerLoc(l2);
+l3 = 
compiler.getSourceManager().getImmediateMacroCallerLoc(l3);
+l4 = 
compiler.getSourceMa

[Libreoffice-commits] core.git: compilerplugins/clang include/rtl

2023-10-11 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/test/stringconstant.cxx |4 
 include/rtl/strbuf.hxx|2 --
 include/rtl/string.hxx|2 --
 include/rtl/stringutils.hxx   |2 +-
 include/rtl/ustrbuf.hxx   |2 --
 5 files changed, 1 insertion(+), 11 deletions(-)

New commits:
commit af9c3ed6f748781f2a77e676ffe740992788969b
Author: Stephan Bergmann 
AuthorDate: Wed Oct 11 10:01:50 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Oct 11 14:33:45 2023 +0200

__cpp_char8_t is generally available now

...after 1eef07805021b7ca26a1a8894809b6d995747ba1 "Bump baseline to C++20"

Change-Id: I75509f3731357e0e3ae73c3774abd6e4070f605b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157806
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/test/stringconstant.cxx 
b/compilerplugins/clang/test/stringconstant.cxx
index 1c9fbf192f6d..f5982e2a4977 100644
--- a/compilerplugins/clang/test/stringconstant.cxx
+++ b/compilerplugins/clang/test/stringconstant.cxx
@@ -102,10 +102,6 @@ int main() {
 
 (void) OUString("xxx", 2, RTL_TEXTENCODING_ASCII_US); // expected-error 
{{suspicious 'rtl::OUString' constructor with literal of length 3 and 
non-matching length argument 2 [loplugin:stringconstant]}}
 
-#if !defined __cpp_char8_t
-(void) OUString(u8"xxx", 3, RTL_TEXTENCODING_ASCII_US); // expected-error 
{{simplify construction of 'OUString' with string constant argument 
[loplugin:stringconstant]}}
-#endif
-
 (void) OUString("\x80", 1, RTL_TEXTENCODING_UTF8); // expected-error 
{{suspicious 'rtl::OUString' constructor with text encoding 
'RTL_TEXTENCODING_UTF8' but non-UTF-8 content [loplugin:stringconstant]}}
 
 (void) OUString("\xC2\x80", 2, RTL_TEXTENCODING_UTF8); // expected-error 
{{simplify construction of 'OUString' with UTF-8 content as OUString(u"\u0080") 
[loplugin:stringconstant]}}
diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx
index 780923ebf67b..bb7f72e78cb5 100644
--- a/include/rtl/strbuf.hxx
+++ b/include/rtl/strbuf.hxx
@@ -122,9 +122,7 @@ public:
 explicit OStringBuffer(bool) = delete;
 explicit OStringBuffer(char) = delete;
 explicit OStringBuffer(wchar_t) = delete;
-#if defined __cpp_char8_t
 explicit OStringBuffer(char8_t) = delete;
-#endif
 explicit OStringBuffer(char16_t) = delete;
 explicit OStringBuffer(char32_t) = delete;
 #endif
diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx
index 72b046e26a0b..bb67c2f46354 100644
--- a/include/rtl/string.hxx
+++ b/include/rtl/string.hxx
@@ -104,7 +104,6 @@ public:
 }
 }
 
-#if defined __cpp_char8_t
 #if HAVE_CPP_CONSTEVAL
 consteval
 #else
@@ -118,7 +117,6 @@ public:
 more.buffer[i] = literal[i];
 }
 }
-#endif
 
 constexpr sal_Int32 getLength() const { return more.length; }
 
diff --git a/include/rtl/stringutils.hxx b/include/rtl/stringutils.hxx
index 2c5d05c82784..b8a978efbcc6 100644
--- a/include/rtl/stringutils.hxx
+++ b/include/rtl/stringutils.hxx
@@ -246,7 +246,7 @@ struct ConstCharArrayDetector< const char[ 1 ], T >
 };
 #endif
 
-#if defined LIBO_INTERNAL_ONLY && defined __cpp_char8_t
+#if defined LIBO_INTERNAL_ONLY
 template
 struct ConstCharArrayDetector {
 using Type = T;
diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx
index 54a4b3730b8b..41af86e13119 100644
--- a/include/rtl/ustrbuf.hxx
+++ b/include/rtl/ustrbuf.hxx
@@ -124,9 +124,7 @@ public:
 explicit OUStringBuffer(bool) = delete;
 explicit OUStringBuffer(char) = delete;
 explicit OUStringBuffer(wchar_t) = delete;
-#if defined __cpp_char8_t
 explicit OUStringBuffer(char8_t) = delete;
-#endif
 explicit OUStringBuffer(char16_t) = delete;
 explicit OUStringBuffer(char32_t) = delete;
 #endif


[Libreoffice-commits] core.git: compilerplugins/clang extensions/source include/rtl oox/source sal/qa sw/qa sw/source unotools/source vcl/qa

2023-10-11 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/ostr.cxx  |   90 -
 compilerplugins/clang/test/ostr.cxx |   40 --
 compilerplugins/clang/test/stringconstant.cxx   |2 
 compilerplugins/clang/test/stringliteralvar.cxx |6 
 compilerplugins/clang/test/stringstatic.cxx |7 
 compilerplugins/clang/test/stringview.cxx   |2 
 extensions/source/propctrlr/eventhandler.cxx|2 
 include/rtl/ustring.hxx |   40 --
 oox/source/drawingml/fontworkhelpers.cxx|4 
 sal/qa/osl/file/osl_old_test_file.cxx   |   32 +-
 sal/qa/rtl/strings/nonconstarray.cxx|   10 
 sal/qa/rtl/strings/test_oustring_stringliterals.cxx |   32 +-
 sw/qa/extras/indexing/SearchResultLocatorTest.cxx   |2 
 sw/source/core/text/porexp.cxx  |4 
 sw/source/filter/ww8/ww8par.cxx |2 
 unotools/source/misc/fontdefs.cxx   |  313 ++--
 vcl/qa/cppunit/lifecycle.cxx|2 
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |2 
 18 files changed, 223 insertions(+), 369 deletions(-)

New commits:
commit f99bee8103ad82dac2e53e114527399c4af5485c
Author: Stephan Bergmann 
AuthorDate: Tue Oct 10 13:41:35 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Oct 11 09:19:35 2023 +0200

Delete OUString UTF-16 string literal ctor/assignment op

...that have been made unused by 7ef3d937415185ef66e32dd3043783eddcd03db5
"loplugin:ostr: Rewrite some uses of O[U]String to use ""_ostr/u""_ustr
literals".  (And which means we can remove the relevant code from that 
plugin
again.)

(This also found a handful of remaining uses that had been hard for the 
plugin
to discover, along the lines of

> std::map m = {{u"foo", 0}};

being represented by a

> DeclStmt 0xdaca578 
> `-VarDecl 0xdac9150  col:29 s11 'std::map':'std::map' cinit destroyed
>   `-ExprWithCleanups 0xdaca548  'std::map':'std::map'
> `-CXXConstructExpr 0xdaca508  'std::map':'std::map' 'void (initializer_list, const 
std::less &, const allocator_type &)' list std::initializer_list
>   |-CXXStdInitializerListExpr 0xdaca480  
'initializer_list':'std::initializer_list>'
>   | `-MaterializeTemporaryExpr 0xdaca468  'const 
std::pair[1]' xvalue
>   |   `-CXXBindTemporaryExpr 0xdaca448  'const 
std::pair[1]' (CXXTemporary 0xdaca448)
>   | `-InitListExpr 0xdac9df0  'const 
std::pair[1]'
>   |   `-CXXConstructExpr 0xdaca408  'const 
std::pair' 'void (const char16_t (&)[4], int &&) 
noexcept(_S_nothrow_constructible())' list
>   | |-StringLiteral 0xdac91b8  'const char16_t[4]' 
lvalue u"foo"
>   | `-MaterializeTemporaryExpr 0xdaca3f0  'int' xvalue
>   |   `-IntegerLiteral 0xdac91d8  'int' 0
>   |-CXXDefaultArgExpr 0xdaca498 <> 'const 
std::less':'const std::less' lvalue
>   `-CXXDefaultArgExpr 0xdaca4b8 <> 'const 
allocator_type':'const std::allocator>' 
lvalue

Clang AST.)

Change-Id: I496fe9d4d5e1a033cb7b27b4e04b303f8ddbed4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157756
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/ostr.cxx b/compilerplugins/clang/ostr.cxx
index 13fd5df0b29a..462916641421 100644
--- a/compilerplugins/clang/ostr.cxx
+++ b/compilerplugins/clang/ostr.cxx
@@ -97,7 +97,7 @@ public:
 {
 return true;
 }
-if (!(compat::isOrdinary(e2) || e2->isUTF16()))
+if (!compat::isOrdinary(e2))
 {
 assert(!e2->isUTF8()); //TODO
 return true;
@@ -148,7 +148,7 @@ public:
 {
 return true;
 }
-if (!(e2->isUTF16() || compiler.getDiagnosticOpts().VerifyDiagnostics))
+if (!compiler.getDiagnosticOpts().VerifyDiagnostics)
 {
 //TODO: Leave rewriting these uses of ordinary string literals for 
later (but already
 // cover them when verifying CompilerTest_compilerplugins_clang):
@@ -160,8 +160,7 @@ public:
 Lexer::MeasureTokenLength(l3, compiler.getSourceManager(), 
compiler.getLangOpts()));
 l4 = l4.getLocWithOffset(
 Lexer::MeasureTokenLength(l4, compiler.getSourceManager(), 
compiler.getLangOpts()));
-if ((e2->isUTF16() ? removeText(l1, delta(l1, l2))
-   : replaceText(l1, delta(l1, l2), macroBegin ? 
"u\"\" " : "u"))
+if (replaceText(l1, delta(l1, l2), macroBegin ? "u\"\" " : "u")
 && replaceText(l3, delta(l3, l4), macroEnd ? " \"\"_ustr" : 
"_ustr"))
 {
 return true;
@@ -169,88 +168,9 @@ public:
 }
 report(DiagnosticsEngine::Warning,
"use a _ustr user-defined string literal instead of 
constructing an in

[Libreoffice-commits] core.git: compilerplugins/clang solenv/CompilerTest_compilerplugins_clang.mk

2023-10-07 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/ostr.cxx   |  286 +++
 compilerplugins/clang/test/ostr.cxx  |   98 +
 solenv/CompilerTest_compilerplugins_clang.mk |1 
 3 files changed, 385 insertions(+)

New commits:
commit 7ef3d937415185ef66e32dd3043783eddcd03db5
Author: Stephan Bergmann 
AuthorDate: Fri Oct 6 09:50:54 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Oct 7 22:34:09 2023 +0200

loplugin:ostr: Rewrite some uses of O[U]String to use ""_ostr/u""_ustr 
literals

This is a first cut at rewriting uses of OUString constructed from u"..." as
u"..."_ustr.  It covers the same changes as
 "WIP: Delete OUString 
UTF-16
string literal ctor/assignment op", but does so with automatic rewriting 
(see
e0c33ec15f53a01fa3ee07489871bbe09bb5c9c3 "loplugin:ostr: automatic rewrite",
plus a handful of 002b0a9d5793e07609f953b9961b04bcab7a7e3f "loplugin:ostr:
manual modifications" where automatic rewriting wasn't set up to handle 
macro
bodies).

The compilation-time impact of all those changes appears to be negligible:  
For
some Windows build of mine, just touching the files that would be affected 
by
002b0a9d5793e07609f953b9961b04bcab7a7e3f and
e0c33ec15f53a01fa3ee07489871bbe09bb5c9c3 (but without actually applying 
those
changes yet) and doing `time /opt/lo/bin/make -O check screenshot PKGFORMAT=
gb_SUPPRESS_TESTS=x`, three times in a row reported sample real times of

  21m15.438s  23m17.840s  23m41.529s

and repeating all that with the two changes actually applied reported sample
real times of

  22m43.547s  21m42.687s  23m1.813s

The plugin itself is already prepared to do further rewrites (see the 
TODOs),
which will be done in follow-up commits.

Change-Id: I408ecf056dce1b9da683d7c377b8d9058df1558d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157676
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/ostr.cxx b/compilerplugins/clang/ostr.cxx
new file mode 100644
index ..13fd5df0b29a
--- /dev/null
+++ b/compilerplugins/clang/ostr.cxx
@@ -0,0 +1,286 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include 
+#include 
+#include 
+
+#include "check.hxx"
+#include "compat.hxx"
+#include "plugin.hxx"
+
+// Rewrite some uses of O[U]String to use ""_ostr/u""_ustr literals.
+
+namespace
+{
+class Ostr : public loplugin::FilteringRewritePlugin
+{
+public:
+explicit Ostr(loplugin::InstantiationData const& data)
+: FilteringRewritePlugin(data)
+{
+}
+
+// Needed so that e.g.
+//
+//   struct S { OUString s; };
+//   S s = {u"foo"};
+//
+// is caught:
+bool shouldVisitImplicitCode() const { return true; }
+
+void run() override
+{
+if (compiler.getLangOpts().CPlusPlus)
+{
+TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+}
+}
+
+bool TraverseParmVarDecl(ParmVarDecl* decl)
+{
+// Otherwise,
+//
+//   struct S { void f(int = 0); };
+//   void S::f(int) {}
+//
+// would visit the default argument twice:
+if (decl->hasDefaultArg() && !decl->hasUninstantiatedDefaultArg()
+&& !decl->hasUnparsedDefaultArg() && 
!defaultArgs_.insert(decl->getDefaultArg()).second)
+{
+return true;
+}
+return RecursiveASTVisitor::TraverseParmVarDecl(decl);
+}
+
+bool TraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr* expr)
+{
+functionalCasts_.push(expr);
+auto const ret = 
RecursiveASTVisitor::TraverseCXXFunctionalCastExpr(expr);
+functionalCasts_.pop();
+return ret;
+}
+
+bool VisitCXXConstructExpr(CXXConstructExpr const* expr)
+{
+if (ignoreLocation(expr))
+{
+return true;
+}
+if (!loplugin::DeclCheck(expr->getConstructor()->getParent())
+ .Class("OUString")
+ .Namespace("rtl")
+ .GlobalNamespace())
+{
+return true;
+}
+if (expr->getNumArgs() != 2)
+{
+return true;
+}
+if (!loplugin::TypeCheck(expr->getArg(1)->getType())
+ .Struct("Dummy")
+ .Namespace("libreoffice_internal")
+ .Namespace("rtl")
+ .GlobalNamespace())
+{
+return true;
+}
+auto const e2 = 
dyn_cast(expr->getArg(0)->IgnoreParenImpCasts());
+if 

[Libreoffice-commits] core.git: compilerplugins/clang desktop/source filter/Configuration_filter.mk filter/source icon-themes/colibre icon-themes/colibre_dark icon-themes/colibre_dark_svg icon-themes/

2023-09-23 Thread Xisco Fauli (via logerrit)
 compilerplugins/clang/singlevalfields.could-be-bool.results |3 
 compilerplugins/clang/singlevalfields.results   |3 
 compilerplugins/clang/writeonlyvars.cxx |2 
 desktop/source/lib/init.cxx |2 
 dev/null|binary
 filter/Configuration_filter.mk  |2 
 filter/source/config/fragments/filters/draw_html_Export.xcu |   30 
 filter/source/config/fragments/filters/impress_html_Export.xcu  |   30 
 icon-themes/colibre_dark_svg/sd/res/pubdes.svg  |1 
 icon-themes/colibre_dark_svg/sd/res/pubdes2.svg |1 
 icon-themes/colibre_dark_svg/sd/res/pubdes3.svg |1 
 icon-themes/colibre_dark_svg/sd/res/pubdes4.svg |1 
 icon-themes/colibre_svg/sd/res/pubdes.svg   |1 
 icon-themes/colibre_svg/sd/res/pubdes2.svg  |1 
 icon-themes/colibre_svg/sd/res/pubdes3.svg  |1 
 icon-themes/colibre_svg/sd/res/pubdes4.svg  |1 
 officecfg/registry/data/org/openoffice/TypeDetection/UISort.xcu |2 
 sd/Library_sd.mk|3 
 sd/Library_sdui.mk  |1 
 sd/Module_sd.mk |1 
 sd/Package_web.mk   |   37 
 sd/UIConfig_simpress.mk |1 
 sd/inc/sdabstdlg.hxx|9 
 sd/inc/sdhtmlfilter.hxx |   34 
 sd/qa/unit/HtmlExportTest.cxx   |   29 
 sd/qa/unit/data/dialogs-test.txt|1 
 sd/qa/unit/dialogs-test.cxx |   99 
 sd/source/filter/html/HtmlOptionsDialog.cxx |  203 
 sd/source/filter/html/htmlex.cxx| 3176 
--
 sd/source/filter/html/htmlex.hxx|  237 
 sd/source/filter/html/pubdlg.cxx| 1461 
 sd/source/filter/html/sdhtmlfilter.cxx  |   49 
 sd/source/ui/dlg/sddlgfact.cxx  |   27 
 sd/source/ui/dlg/sddlgfact.hxx  |   19 
 sd/source/ui/docshell/docshel4.cxx  |7 
 sd/source/ui/inc/pubdlg.hxx |  205 
 sd/uiconfig/simpress/ui/publishingdialog.ui | 1831 -
 sd/util/sd.component|4 
 solenv/bin/native-code.py   |1 
 solenv/clang-format/excludelist |2 
 vcl/workben/cgmfuzzer.cxx   |2 
 41 files changed, 170 insertions(+), 7351 deletions(-)

New commits:
commit 28b6480c6bdd179f3943f768926b7f196226c768
Author: Xisco Fauli 
AuthorDate: Fri Sep 22 20:54:05 2023 +0200
Commit: Xisco Fauli 
CommitDate: Sat Sep 23 11:03:38 2023 +0200

tdf#105303: Drop html export wizard

Done during the conference hackfest

Change-Id: I765e6dc839a98038c4071c8444ce3db9293c8a6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157173
Tested-by: Xisco Fauli 
Reviewed-by: Xisco Fauli 

diff --git a/compilerplugins/clang/singlevalfields.could-be-bool.results 
b/compilerplugins/clang/singlevalfields.could-be-bool.results
index a724683a6b2f..9b2fdf51b0f5 100644
--- a/compilerplugins/clang/singlevalfields.could-be-bool.results
+++ b/compilerplugins/clang/singlevalfields.could-be-bool.results
@@ -181,9 +181,6 @@ sd/qa/unit/tiledrendering/tiledrendering.cxx:895
 sd/source/filter/html/htmlex.hxx:142
 HtmlExport meScript
 PublishingScript
-sd/source/filter/html/HtmlOptionsDialog.cxx:54
-(anonymous namespace)::SdHtmlOptionsDialog meDocType
-DocumentType
 sd/source/ui/slideshow/slideshowimpl.hxx:304
 sd::SlideshowImpl meAnimationMode
 AnimationMode
diff --git a/compilerplugins/clang/singlevalfields.results 
b/compilerplugins/clang/singlevalfields.results
index f625c11ff833..f64d36563bf9 100644
--- a/compilerplugins/clang/singlevalfields.results
+++ b/compilerplugins/clang/singlevalfields.results
@@ -754,9 +754,6 @@ sd/source/filter/html/htmlex.hxx:117
 sd/source/ui/inc/CustomAnimationPane.hxx:144
 sd::CustomAnimationPane maIdle
 sd idle treeview select
-sd/source/ui/inc/pubdlg.hxx:157
-SdPublishingDlg aAssistentFunc
-6
 sd/source/ui/inc/View.hxx:271
 sd::View maDropErrorIdle
 sd View DropError
diff --git a/compilerplugins/clang/writeonlyvars.cxx 
b/compilerplugins/clang/writeonlyvars.cxx
index 068d4058e09d..3fb3f769b72d 100644
--- a/compilerplugins/clang/writeonlyvars.cxx
+++ b/com

[Libreoffice-commits] core.git: compilerplugins/clang writerperfect/inc writerperfect/source

2023-09-19 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/unusedfields.only-used-in-constructor.results |  108 ++--
 compilerplugins/clang/unusedfields.readonly.results |   64 +-
 compilerplugins/clang/unusedfields.untouched.results|   72 +--
 compilerplugins/clang/unusedfields.writeonly.results|  222 
+-
 writerperfect/inc/WPXSvInputStream.hxx  |2 
 writerperfect/source/common/WPXSvInputStream.cxx|   27 -
 6 files changed, 242 insertions(+), 253 deletions(-)

New commits:
commit 55afdf6d1748edd50be3fa6a67a5e36e74013815
Author: Noel Grandin 
AuthorDate: Mon Sep 18 11:26:03 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Sep 19 11:24:38 2023 +0200

loplugin:unusedfields

Change-Id: Ic102ae992fc2fbfd187149b9d20bf1d2202ba5c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157042
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git 
a/compilerplugins/clang/unusedfields.only-used-in-constructor.results 
b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
index a81c93483c6c..4169718d1529 100644
--- a/compilerplugins/clang/unusedfields.only-used-in-constructor.results
+++ b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
@@ -140,7 +140,7 @@ cppu/source/uno/check.cxx:267
 (anonymous namespace)::Char4 chars Char3
 cui/source/dialogs/colorpicker.cxx:748
 cui::(anonymous namespace)::ColorPickerDialog m_aColorPrevious 
ColorPreviewControl
-cui/source/factory/dlgfact.cxx:1245
+cui/source/factory/dlgfact.cxx:1244
 (anonymous namespace)::SvxMacroAssignDialog_Impl m_aItems SfxItemSet
 cui/source/inc/AdditionsDialog.hxx:47
 AdditionInfo sReleaseVersion OUString
@@ -184,6 +184,8 @@ dbaccess/source/core/dataaccess/connection.hxx:101
 dbaccess::OConnection m_nInAppend std::atomic
 dbaccess/source/core/inc/databasecontext.hxx:82
 dbaccess::ODatabaseContext m_aBasicDLL BasicDLL
+dbaccess/source/core/inc/SingleSelectQueryComposer.hxx:79
+dbaccess::OSingleSelectQueryComposer m_aNeutralContext 
::svxform::ONeutralParseContext
 drawinglayer/inc/texture/texture3d.hxx:54
 drawinglayer::texture::GeoTexSvxBitmapEx maBitmapEx BitmapEx
 drawinglayer/inc/texture/texture3d.hxx:55
@@ -194,7 +196,7 @@ drawinglayer/source/tools/emfphelperdata.hxx:198
 emfplushelper::EmfPlusHelperData mnFrameRight sal_Int32
 drawinglayer/source/tools/emfphelperdata.hxx:199
 emfplushelper::EmfPlusHelperData mnFrameBottom sal_Int32
-editeng/source/editeng/impedit.hxx:530
+editeng/source/editeng/impedit.hxx:532
 ImpEditEngine aSelFuncSet EditSelFunctionSet
 embeddedobj/source/msole/olecomponent.hxx:51
 OleComponent m_pInterfaceContainer 
comphelper::OMultiTypeInterfaceContainerHelper2 *
@@ -238,17 +240,17 @@ include/basic/basmgr.hxx:59
 BasicError nReason BasicErrorReason
 include/comphelper/seqstream.hxx:76
 comphelper::SequenceInputStream m_aData const css::uno::Sequence
-include/docmodel/theme/FormatScheme.hxx:375
+include/docmodel/theme/FormatScheme.hxx:374
 model::DashStop mnDashLength sal_Int32
-include/docmodel/theme/FormatScheme.hxx:376
+include/docmodel/theme/FormatScheme.hxx:375
 model::DashStop mnStopLength sal_Int32
 include/drawinglayer/primitive2d/textlayoutdevice.hxx:64
 drawinglayer::primitive2d::TextLayouterDevice maSolarGuard SolarMutexGuard
-include/filter/msfilter/svdfppt.hxx:889
+include/filter/msfilter/svdfppt.hxx:888
 ImplPPTParaPropSet nDontKnow1 sal_uInt32
-include/filter/msfilter/svdfppt.hxx:890
+include/filter/msfilter/svdfppt.hxx:889
 ImplPPTParaPropSet nDontKnow2 sal_uInt32
-include/filter/msfilter/svdfppt.hxx:891
+include/filter/msfilter/svdfppt.hxx:890
 ImplPPTParaPropSet nDontKnow2bit06 sal_uInt16
 include/formula/formulahelper.hxx:40
 formula::FormulaHelper m_aSysLocale SvtSysLocale
@@ -386,7 +388,7 @@ include/sfx2/msg.hxx:147
 SfxType23 nAttribs sal_uInt16
 include/sfx2/msg.hxx:147
 SfxType23 pType const std::type_info *
-include/svl/itemset.hxx:281
+include/svl/itemset.hxx:326
 SfxItemSetFixed m_aItems const SfxPoolItem *[NITEMS]
 include/svx/ClassificationDialog.hxx:35
 svx::ClassificationDialog maInternationalHelper SfxClassificationHelper
@@ -506,25 +508,25 @@ pyuno/source/module/pyuno_impl.hxx:237
 pyuno::stRuntimeImpl ob_base PyObject
 reportdesign/source/core/api/ReportDefinition.cxx:241
 reportdesign::(anonymous namespace)::OStyle m_aSize awt::Size
-sal/qa/osl/condition/osl_Condition.cxx:72
+sal/qa/osl/condition/osl_Condition.cxx:78
 osl_Condition::ctors bRes1 _Bool
-sal/qa/osl/condition/osl_Condition.cxx:202
+sal/qa/osl/condition/osl_Condition.cxx:208
 osl_Condition::wait bRes2 _Bool
-sal/qa/osl/condition/osl_Condition.cxx:273
+sal/qa/osl/condition/osl_Condition.cxx:279
 osl_Condition::check bRes2 _Bool
-sal/qa/osl/file/osl_File.cxx:1387
+sal/qa/osl/file/osl_File.cxx:1383
 osl_FileStatus::isValid rItem_link DirectoryItem
-sal/qa/osl/file/osl_File.c

[Libreoffice-commits] core.git: compilerplugins/clang sw/inc sw/source

2023-09-17 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/refcounting.cxx|   42 +++
 sw/inc/unoparagraph.hxx  |5 +--
 sw/inc/unotext.hxx   |4 ++
 sw/inc/unotextbodyhf.hxx |2 -
 sw/inc/unotextrange.hxx  |3 +
 sw/source/core/access/AccessibilityCheck.cxx |   22 ++
 sw/source/core/doc/rdfhelper.cxx |9 +++--
 sw/source/core/edit/edfcol.cxx   |8 ++---
 sw/source/core/inc/unocontentcontrol.hxx |7 ++--
 sw/source/core/inc/unometa.hxx   |   11 +++
 sw/source/core/inc/unoport.hxx   |3 +
 sw/source/core/layout/atrfrm.cxx |2 -
 sw/source/core/txtnode/fmtatr2.cxx   |3 +
 sw/source/core/txtnode/ndtxt.cxx |3 +
 sw/source/core/unocore/unocoll.cxx   |2 -
 sw/source/core/unocore/unocontentcontrol.cxx |   18 +--
 sw/source/core/unocore/unocrsrhelper.cxx |2 -
 sw/source/core/unocore/unoobj2.cxx   |   10 +++---
 sw/source/core/unocore/unoparagraph.cxx  |   12 +++
 sw/source/core/unocore/unoportenum.cxx   |   14 +
 sw/source/core/unocore/unorefmk.cxx  |   21 ++---
 sw/source/core/unocore/unosect.cxx   |7 ++--
 sw/source/core/unocore/unotext.cxx   |6 +--
 23 files changed, 116 insertions(+), 100 deletions(-)

New commits:
commit 8ad66ed2c5345f63e0581b6053222c80a9c612c3
Author: Noel Grandin 
AuthorDate: Thu Sep 14 15:57:11 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Sep 17 17:24:52 2023 +0200

remove unnecessary dynamic_cast around SwXText

Unusually, we cannot use rtl::Reference to hold SwXText,
because rtl::Reference assumes that its pointee is a subclass
of OWeakObject, which SwXText is not (and we cannot make
it so because the UNO bridge does not support virtual base
classes).

So we have to use css::uno::Reference and carve
out an exception in loplugin:refcounting.

Change-Id: If3a1307e30fdcd3b47aa665252be081fb5063400
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156982
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/refcounting.cxx 
b/compilerplugins/clang/refcounting.cxx
index ca6c0d97d9f0..801173ce6488 100644
--- a/compilerplugins/clang/refcounting.cxx
+++ b/compilerplugins/clang/refcounting.cxx
@@ -378,24 +378,30 @@ static bool containsStaticTypeMethod(const CXXRecordDecl* 
x)
 
 void RefCounting::checkUnoReference(QualType qt, const Decl* decl, const 
RecordDecl* parent, const std::string& rDeclName)
 {
-if 
(loplugin::TypeCheck(qt).Class("Reference").Namespace("uno").Namespace("star").Namespace("sun").Namespace("com").GlobalNamespace())
 {
-const CXXRecordDecl* pRecordDecl = qt->getAsCXXRecordDecl();
-const ClassTemplateSpecializationDecl* pTemplate = 
dyn_cast(pRecordDecl);
-const TemplateArgument& rArg = pTemplate->getTemplateArgs()[0];
-const CXXRecordDecl* templateParam = 
rArg.getAsType()->getAsCXXRecordDecl()->getDefinition();
-if (templateParam && !containsStaticTypeMethod(templateParam)) {
-report(
-DiagnosticsEngine::Warning,
-("uno::Reference %0 with template parameter that does not"
- " contain ::static_type() %1%select{|, parent is %3,}2 should"
- " probably be using rtl::Reference instead"),
-decl->getLocation())
-  << rDeclName << qt << (parent != nullptr)
-  << (parent != nullptr
-  ? parent->getQualifiedNameAsString() : std::string())
-  << decl->getSourceRange();
-}
-}
+if 
(!loplugin::TypeCheck(qt).Class("Reference").Namespace("uno").Namespace("star").Namespace("sun").Namespace("com").GlobalNamespace())
+return;
+const CXXRecordDecl* pRecordDecl = qt->getAsCXXRecordDecl();
+const ClassTemplateSpecializationDecl* pTemplate = 
dyn_cast(pRecordDecl);
+const TemplateArgument& rArg = pTemplate->getTemplateArgs()[0];
+const CXXRecordDecl* templateParam = 
rArg.getAsType()->getAsCXXRecordDecl()->getDefinition();
+if (!templateParam)
+return;
+// SwXText is a special case. It is a mixin class that does not inherit 
from OWeakObject, so
+// we cannot use rtl::Reference.
+if (loplugin::DeclCheck(templateParam).Class("SwXText"))
+return;
+if (containsStaticTypeMethod(templateParam))
+return;
+report(
+DiagnosticsEngine::Warning,
+("uno::Reference %0 with template parameter that does not"
+ " contain ::static_type() %1%select{|, parent is %3,}2 should"
+ " probably be using rtl::Reference instead"),
+decl->getLocation())
+  << rDeclName << qt << (parent != nullptr)
+  << (parent != nullptr
+  ? parent->getQualifiedNameAsString() : std::string())
+  << decl

[Libreoffice-commits] core.git: compilerplugins/clang solenv/clang-format solenv/CompilerTest_compilerplugins_clang.mk

2023-09-15 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/test/weakbase.cxx  |   51 +++-
 compilerplugins/clang/test/weakobject.cxx|   31 -
 compilerplugins/clang/weakbase.cxx   |   74 ---
 compilerplugins/clang/weakobject.cxx |   85 ---
 solenv/CompilerTest_compilerplugins_clang.mk |1 
 solenv/clang-format/excludelist  |1 
 6 files changed, 113 insertions(+), 130 deletions(-)

New commits:
commit 2876b31eee9b2946dfaa74b17645c6812c7a20db
Author: Noel Grandin 
AuthorDate: Fri Sep 15 11:03:18 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 15 12:48:29 2023 +0200

loplugin, merge weakobject into weakbase

and make them support virtual bases, even though the bridge code does
not support that (yet)

Change-Id: I247e795391fa452dea2922869b15ab043eb2bdd1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156941
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/test/weakbase.cxx 
b/compilerplugins/clang/test/weakbase.cxx
index a59a5372891e..3d5284ef543c 100644
--- a/compilerplugins/clang/test/weakbase.cxx
+++ b/compilerplugins/clang/test/weakbase.cxx
@@ -25,10 +25,59 @@ struct Foo2 : public tools::WeakBase
 virtual ~Foo2();
 };
 
-// expected-error@+1 {{multiple copies of WeakBase, through inheritance paths 
Bar->Foo1->WeakBase, Bar->Foo2->WeakBase [loplugin:weakbase]}}
+// expected-error@+1 {{found multiple copies of tools::WeakBase, through 
inheritance paths Bar->Foo1->WeakBase, Bar->Foo2->WeakBase [loplugin:weakbase]}}
 struct Bar : public Foo1, public Foo2
 {
 virtual ~Bar();
 };
 
+namespace cppu
+{
+class OWeakObject
+{
+};
+}
+
+namespace test2
+{
+class Foo1 : public cppu::OWeakObject
+{
+};
+class Foo2 : public cppu::OWeakObject
+{
+};
+// expected-error@+1 {{found multiple copies of cppu::OWeakObject, through 
inheritance paths Foo3->Foo1->OWeakObject, Foo3->Foo2->OWeakObject 
[loplugin:weakbase]}}
+class Foo3 : public Foo1, public Foo2
+{
+};
+}
+
+namespace test3
+{
+class Foo1 : public virtual cppu::OWeakObject
+{
+};
+class Foo2 : public virtual cppu::OWeakObject
+{
+};
+// no warning expected
+class Foo3 : public Foo1, public Foo2
+{
+};
+}
+
+namespace test4
+{
+class Foo1 : public cppu::OWeakObject
+{
+};
+class Foo2 : public virtual cppu::OWeakObject
+{
+};
+// expected-error@+1 {{found one virtual base and one or more normal bases of 
cppu::OWeakObject, through inheritance paths Foo3->Foo1->OWeakObject, 
Foo3->Foo2->OWeakObject [loplugin:weakbase]}}
+class Foo3 : public Foo1, public Foo2
+{
+};
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/weakobject.cxx 
b/compilerplugins/clang/test/weakobject.cxx
deleted file mode 100644
index 7c7da55664d2..
--- a/compilerplugins/clang/test/weakobject.cxx
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include "config_clang.h"
-
-namespace cppu
-{
-class OWeakObject
-{
-};
-}
-
-class Foo1 : public cppu::OWeakObject
-{
-};
-class Foo2 : public cppu::OWeakObject
-{
-};
-
-// expected-error@+1 {{more than one copy of cppu::OWeakObject inherited 
[loplugin:weakobject]}}
-class Foo3 : public Foo1, public Foo2
-{
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/compilerplugins/clang/weakbase.cxx 
b/compilerplugins/clang/weakbase.cxx
index 666444ff7ffb..f6f7c8db01be 100644
--- a/compilerplugins/clang/weakbase.cxx
+++ b/compilerplugins/clang/weakbase.cxx
@@ -15,6 +15,7 @@
 #include 
 
 #include "plugin.hxx"
+#include "check.hxx"
 #include "clang/AST/CXXInheritance.h"
 
 /**
@@ -69,7 +70,11 @@ bool WeakBase::VisitCXXRecordDecl(CXXRecordDecl const* 
recordDecl)
 return true;
 
 int noWeakBases = 0;
-std::string basePaths;
+int noWeakObjects = 0;
+bool foundVirtualWeakBase = false;
+bool foundVirtualOWeakObject = false;
+std::string basePaths1;
+std::string basePaths2;
 auto BaseMatchesCallback = [&](const CXXBaseSpecifier* cxxBaseSpecifier, 
CXXBasePath& Paths) {
 if (!cxxBaseSpecifier->getType().getTypePtr())
 return false;
@@ -78,9 +83,30 @@ bool WeakBase::VisitCXXRecordDecl(CXXRecordDecl const* 
recordDecl)
 return false;
 if (baseCXXRecordDecl->isInvalidDecl())
 return false;
-if (baseCXXRecordDecl->getName() != "WeakBase")
+bool isWeakBase(loplugin::DeclCheck(baseCXXRecordDecl)
+.Struct("WeakBase")
+.Namespace("tools")
+

[Libreoffice-commits] core.git: compilerplugins/clang

2023-09-14 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/plugin.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit eb2e7483727c060b0aa735f401aaa89cc0505200
Author: Stephan Bergmann 
AuthorDate: Thu Sep 14 12:44:14 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Sep 14 13:56:45 2023 +0200

Improve Plugin::checkIdenticalDefaultArguments

...to avoid

> In file included from 
/home/sbergman/lo/core/cui/source/factory/cuiexp.cxx:20:
> /home/sbergman/lo/core/cui/source/factory/dlgfact.hxx:524:116: fatal 
error: TODO: Unexpected 'IdenticalDefaultArgumentsResult::Maybe' 
[loplugin:overrideparam]
>   524 | const OUString& 
rName, const OUString& rDesc, const OUString& rTitle = "") override;
>   |   
 ^~
> /home/sbergman/lo/core/include/svx/svxdlg.hxx:380:116: note: TODO: second 
argument is here [loplugin:overrideparam]
>   380 | const OUString& 
rName, const OUString& rDesc, const OUString& rTitle = "" ) = 0;
>   |   
 ^~
> MaterializeTemporaryExpr 0x7f6fd76d4218 'const OUString':'const class 
rtl::OUString' lvalue
> `-CXXBindTemporaryExpr 0x7f6fd76d41f8 'const OUString':'const class 
rtl::OUString' (CXXTemporary 0x7f6fd76d41f8)
>   `-CXXConstructExpr 0x7f6fd76d41b8 'const OUString':'const class 
rtl::OUString' 'void (const char &[1], typename 
libreoffice_internal::ConstCharArrayDetector::Type)'
> |-StringLiteral 0x7f6fd76d3e48 'const char[1]' lvalue ""
> `-CXXDefaultArgExpr 0x7f6fd76d4170 
'libreoffice_internal::Dummy':'struct rtl::libreoffice_internal::Dummy'
> MaterializeTemporaryExpr 0x7f6fe30b5f58 'const OUString':'const class 
rtl::OUString' lvalue
> `-CXXBindTemporaryExpr 0x7f6fe30b5f38 'const OUString':'const class 
rtl::OUString' (CXXTemporary 0x7f6fe30b5f38)
>   `-CXXConstructExpr 0x7f6fe30b5ef8 'const OUString':'const class 
rtl::OUString' 'void (const char &[1], typename 
libreoffice_internal::ConstCharArrayDetector::Type)'
> |-StringLiteral 0x7f6fe30b48f8 'const char[1]' lvalue ""
> `-CXXDefaultArgExpr 0x7f6fe30b5ea8 
'libreoffice_internal::Dummy':'struct rtl::libreoffice_internal::Dummy'

after c7a608a6691c790783c63f504010bc796c36af25 "tdf#155503 Add title to 
document
title dialog" in an --enable-compiler-plugins=debug build.

(Instead of trying to inspect deeper into the code that compares two
StringLiteral directly in Plugin::checkIdenticalDefaultArguments, it looked
simpler to just extend structurallyIdentical.)

Change-Id: Ie1eecff210413f0a29213d867aad249420c1c278
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156916
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index 94c5809ab730..e2d4d7fbf0a4 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -94,10 +94,14 @@ bool structurallyIdentical(Stmt const * stmt1, Stmt const * 
stmt2) {
 break;
 case Stmt::MaterializeTemporaryExprClass:
 case Stmt::CXXBindTemporaryExprClass:
+case Stmt::CXXDefaultArgExprClass:
 case Stmt::ParenExprClass:
 break;
 case Stmt::CXXNullPtrLiteralExprClass:
 return true;
+case Stmt::StringLiteralClass:
+return cast(stmt1)->getBytes()
+== cast(stmt2)->getBytes();
 default:
 // Conservatively assume non-identical for expressions that don't 
happen for us in practice
 // when compiling the LO code base (and for which the above set of 
supported classes would


[Libreoffice-commits] core.git: compilerplugins/clang

2023-08-29 Thread Andrea Gelmini (via logerrit)
 compilerplugins/clang/unnecessaryparen.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 988851cb5cc8d435581f8018f664f31da67d5785
Author: Andrea Gelmini 
AuthorDate: Tue Aug 29 14:09:05 2023 +0200
Commit: Julien Nabet 
CommitDate: Tue Aug 29 14:54:13 2023 +0200

Fix typo

Change-Id: I76773e5273579536aef330d5eb83887bba7e7be8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156247
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/compilerplugins/clang/unnecessaryparen.cxx 
b/compilerplugins/clang/unnecessaryparen.cxx
index f31d570b9bdd..d24986f0b669 100644
--- a/compilerplugins/clang/unnecessaryparen.cxx
+++ b/compilerplugins/clang/unnecessaryparen.cxx
@@ -166,7 +166,7 @@ private:
 if (d->getValue().isStruct() || 
d->getValue().isUnion()) {
 //TODO: There appears to be no way currently 
to get at the original
 // clang::StringLiteral expression from which 
this struct/union
-// non-type template argument was 
constructued, so no way to tell
+// non-type template argument was constructed, 
so no way to tell
 // whether it was written as a single literal 
(=> in which case we
 // should warn about unnecessary parentheses) 
or as a concatenation
 // of multiple literals (=> in which case we 
should not warn).  So


[Libreoffice-commits] core.git: compilerplugins/clang

2023-08-28 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/test/unnecessaryparen.cxx |   23 +
 compilerplugins/clang/unnecessaryparen.cxx  |   59 ++--
 2 files changed, 79 insertions(+), 3 deletions(-)

New commits:
commit e235e4bb7ce79d6738e1e6267c965f71960466a6
Author: Stephan Bergmann 
AuthorDate: Wed Aug 23 22:09:07 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Aug 28 19:55:57 2023 +0200

Adapt loplugin:unnecessaryparen to user-defined string literals

Change-Id: Ieab59fa456bce13145b61cb5e8b2fb9ff9b4c573
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156193
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/test/unnecessaryparen.cxx 
b/compilerplugins/clang/test/unnecessaryparen.cxx
index ccc2b4ce6556..89ca84da6ab2 100644
--- a/compilerplugins/clang/test/unnecessaryparen.cxx
+++ b/compilerplugins/clang/test/unnecessaryparen.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -34,6 +35,13 @@ template <> struct typed_flags : 
is_typed_flags
 };
 }
 
+void f(char const *);
+char const * operator ""_s1(char const *, std::size_t);
+#if __cplusplus >= 202002L
+struct Str { constexpr Str(char const *) {} };
+template char const * operator ""_s2();
+#endif
+
 int main()
 {
 int x = 1;
@@ -115,6 +123,21 @@ int main()
 (void)nBits;
 
 OUString::number((v2+1)); // expected-error {{parentheses immediately 
inside single-arg call [loplugin:unnecessaryparen]}}
+
+(void) ("foo"); // expected-error {{unnecessary parentheses around 
single-token string literal [loplugin:unnecessaryparen]}}
+(void) ("foo" "bar");
+f(("foo")); // expected-error {{parentheses immediately inside single-arg 
call [loplugin:unnecessaryparen]}}
+f(("foo" "bar"));
+(void) ("foo"_s1); // expected-error {{unnecessary parentheses around 
single-token string literal [loplugin:unnecessaryparen]}}
+(void) ("foo" "bar"_s1);
+f(("foo"_s1)); // expected-error {{parentheses immediately inside 
single-arg call [loplugin:unnecessaryparen]}}
+f(("foo" "bar"_s1));
+#if __cplusplus >= 202002L
+(void) ("foo"_s2); //TODO: expected error {{unnecessary parentheses around 
single-token string literal [loplugin:unnecessaryparen]}}
+(void) ("foo" "bar"_s2);
+f(("foo"_s2)); // TODO: expected error {{parentheses immediately inside 
single-arg call [loplugin:unnecessaryparen]}}
+f(("foo" "bar"_s2));
+#endif
 };
 
 struct B { operator bool() const; };
diff --git a/compilerplugins/clang/unnecessaryparen.cxx 
b/compilerplugins/clang/unnecessaryparen.cxx
index 1d11aca4ab47..f31d570b9bdd 100644
--- a/compilerplugins/clang/unnecessaryparen.cxx
+++ b/compilerplugins/clang/unnecessaryparen.cxx
@@ -143,6 +143,55 @@ private:
 
 bool removeParens(ParenExpr const * expr);
 
+// Returns 0 if not a string literal at all:
+unsigned getStringLiteralTokenCount(Expr const * expr, Expr const * 
parenExpr) {
+if (auto const e = dyn_cast(expr)) {
+if (parenExpr == nullptr || !isPrecededBy_BAD_CAST(parenExpr)) {
+return e->getNumConcatenated();
+}
+} else if (auto const e = dyn_cast(expr)) {
+clang::StringLiteral const * lit = nullptr;
+switch (e->getLiteralOperatorKind()) {
+case UserDefinedLiteral::LOK_Template:
+{
+auto const decl = e->getDirectCallee();
+assert(decl != nullptr);
+auto const args = decl->getTemplateSpecializationArgs();
+assert(args != nullptr);
+if (args->size() == 1 && (*args)[0].getKind() == 
TemplateArgument::Declaration)
+{
+if (auto const d
+= 
dyn_cast((*args)[0].getAsDecl()))
+{
+if (d->getValue().isStruct() || 
d->getValue().isUnion()) {
+//TODO: There appears to be no way currently 
to get at the original
+// clang::StringLiteral expression from which 
this struct/union
+// non-type template argument was 
constructued, so no way to tell
+// whether it was written as a single literal 
(=> in which case we
+// should warn about unnecessary parentheses) 
or as a concatenation
+// of multiple literals (=> in which case we 
should not warn).  So
+// be conservative and not warn at all (by 
pretending to have more
+// than one token):
+return 2;
+}
+}
+}
+break;
+}
+case UserDefinedLiteral::LOK_String:
+  

[Libreoffice-commits] core.git: compilerplugins/clang cppcanvas/source cui/source dbaccess/source oox/source reportdesign/source sc/inc sc/source sd/source sfx2/source solenv/CompilerTest_compilerplug

2023-08-28 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/optionalbool.cxx |   88 +
 compilerplugins/clang/test/optionalbool.cxx|   27 +
 cppcanvas/source/mtfrenderer/implrenderer.cxx  |4 
 cui/source/options/treeopt.cxx |2 
 dbaccess/source/core/dataaccess/documentdefinition.cxx |4 
 dbaccess/source/ui/browser/genericcontroller.cxx   |6 -
 dbaccess/source/ui/browser/unodatbr.cxx|8 -
 dbaccess/source/ui/dlg/advancedsettings.cxx|2 
 dbaccess/source/ui/dlg/optionalboolitem.hxx|2 
 dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx   |6 -
 oox/source/drawingml/misccontexts.cxx  |2 
 oox/source/vml/vmltextboxcontext.cxx   |6 -
 reportdesign/source/ui/report/ReportController.cxx |2 
 sc/inc/fonthelper.hxx  |   10 -
 sc/source/core/data/dptabsrc.cxx   |2 
 sc/source/core/data/patattr.cxx|2 
 sc/source/filter/oox/autofilterbuffer.cxx  |2 
 sc/source/filter/orcus/interface.cxx   |2 
 sc/source/ui/unoobj/miscuno.cxx|2 
 sc/source/ui/view/editsh.cxx   |2 
 sd/source/ui/view/drviews7.cxx |2 
 sfx2/source/sidebar/SidebarController.cxx  |   12 +-
 solenv/CompilerTest_compilerplugins_clang.mk   |1 
 starmath/source/unomodel.cxx   |8 -
 svx/source/form/fmmodel.cxx|2 
 svx/source/xoutdev/xattr.cxx   |4 
 sw/source/core/text/frmpaint.cxx   |2 
 sw/source/core/txtnode/attrcontentcontrol.cxx  |2 
 sw/source/core/unocore/unofield.cxx|4 
 sw/source/core/unocore/unoobj.cxx  |8 -
 sw/source/filter/html/htmlforw.cxx |8 -
 sw/source/filter/xml/swxml.cxx |4 
 sw/source/ui/vba/vbacontentcontrol.cxx |8 -
 sw/source/uibase/uno/unomod.cxx|4 
 sw/source/uibase/uno/unotxdoc.cxx  |   12 +-
 ucb/source/ucp/ext/ucpext_content.cxx  |2 
 vcl/source/font/LogicalFontInstance.cxx|2 
 37 files changed, 191 insertions(+), 75 deletions(-)

New commits:
commit 68e797402692c5c8abf1b2c4374e12a8d2707d07
Author: Noel Grandin 
AuthorDate: Wed Aug 23 13:47:40 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Aug 28 09:43:40 2023 +0200

new loplugin:optionalbool

which warns against using the 'operator bool' conversion of
std::optional which can lead to interesting bugs

The bugs that this plugin have been submitted independantly,
so this change is just using has_value() in relevant places.

Change-Id: I259b837feeecddcb8cd1d7e5db1e85bf505907cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155978
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/optionalbool.cxx 
b/compilerplugins/clang/optionalbool.cxx
new file mode 100644
index ..013bf1b4725c
--- /dev/null
+++ b/compilerplugins/clang/optionalbool.cxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef LO_CLANG_SHARED_PLUGINS
+
+#include 
+#include 
+
+#include "check.hxx"
+#include "plugin.hxx"
+#include "config_clang.h"
+
+// Check for uses of std::optional being assigned to bool, which 
generally does not do
+// what you would expect.
+
+namespace
+{
+class OptionalBool final : public loplugin::FilteringPlugin
+{
+public:
+explicit OptionalBool(loplugin::InstantiationData const& data)
+: FilteringPlugin(data)
+{
+}
+
+bool preRun() override
+{
+if (!compiler.getLangOpts().CPlusPlus)
+return false;
+return true;
+}
+
+void run() override
+{
+if (preRun())
+TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+}
+
+bool VisitIfStmt(const IfStmt* ifStmt)
+{
+if (ignoreLocation(ifStmt))
+return true;
+m_ignoreIfCondition = ifStmt->getCond()->IgnoreImplicit();
+return true;
+}
+
+bool VisitCXXMemberCallExpr(const CXXMemberCallExpr* memberCall)
+{
+if (ignoreLocation(memberCall))
+return true;
+if (m_ignoreIfCondition == memberCall)
+return true;
+// check if we are calling a 'operator bool' conversion method
+auto conversionDecl = 
dyn_ca

[Libreoffice-commits] core.git: compilerplugins/clang vcl/CppunitTest_vcl_bitmap_test.mk vcl/Executable_icontest.mk vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/Library_vclplug_win.mk vcl/source

2023-08-25 Thread Gabor Kelemen (via logerrit)
 compilerplugins/clang/unusedmethods.results |6 -
 vcl/CppunitTest_vcl_bitmap_test.mk  |1 
 vcl/Executable_icontest.mk  |6 -
 vcl/Library_vcl.mk  |2 -
 vcl/Library_vclplug_gen.mk  |1 
 vcl/Library_vclplug_win.mk  |1 
 vcl/source/opengl/GLMHelper.hxx |   21 
 vcl/source/opengl/OpenGLHelper.cxx  |   29 
 8 files changed, 67 deletions(-)

New commits:
commit 16cd8cf06f23696fc057dd3469f7698154825886
Author: Gabor Kelemen 
AuthorDate: Mon Aug 21 22:38:39 2023 +0200
Commit: Thorsten Behrens 
CommitDate: Sat Aug 26 01:04:20 2023 +0200

Drop glm dependency from vcl

Serious use of glm was removed from vcl in
commit db89f53c31af997b9bf422b0e784afba8d62a42e
remove OpenGL VCL backend code

This is a bit of leftover from that

Change-Id: I019279cd0cc804d3fa4535a651704bccca38b9db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155909
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index a4b5e3d3dcd5..335a54622235 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -3464,12 +3464,6 @@ vcl/source/fontsubset/xlat.hxx:33
 unsigned short vcl::TranslateChar15(unsigned short)
 vcl/source/fontsubset/xlat.hxx:34
 unsigned short vcl::TranslateChar16(unsigned short)
-vcl/source/opengl/GLMHelper.hxx:17
-std::basic_ostream & operator<<(std::basic_ostream &,const 
struct glm::mat<4, 4, float> &)
-vcl/source/opengl/GLMHelper.hxx:18
-std::basic_ostream & operator<<(std::basic_ostream &,const 
struct glm::vec<4, float> &)
-vcl/source/opengl/GLMHelper.hxx:19
-std::basic_ostream & operator<<(std::basic_ostream &,const 
struct glm::vec<3, float> &)
 vcl/source/window/menuitemlist.hxx:123
 void MenuItemList::Clear()
 vcl/unx/generic/dtrans/X11_clipboard.hxx:106
diff --git a/vcl/CppunitTest_vcl_bitmap_test.mk 
b/vcl/CppunitTest_vcl_bitmap_test.mk
index 1c51a8d02cbe..0edaabc9f9d9 100644
--- a/vcl/CppunitTest_vcl_bitmap_test.mk
+++ b/vcl/CppunitTest_vcl_bitmap_test.mk
@@ -23,7 +23,6 @@ $(eval $(call 
gb_CppunitTest_add_exception_objects,vcl_bitmap_test, \
 $(eval $(call gb_CppunitTest_use_externals,vcl_bitmap_test,\
boost_headers \
 epoxy \
-   glm_headers \
 ))
 
 $(eval $(call gb_CppunitTest_set_include,vcl_bitmap_test,\
diff --git a/vcl/Executable_icontest.mk b/vcl/Executable_icontest.mk
index 60a69bc7a156..0f8a3b60b09b 100644
--- a/vcl/Executable_icontest.mk
+++ b/vcl/Executable_icontest.mk
@@ -15,12 +15,6 @@ $(eval $(call gb_Executable_use_externals,icontest,\
 ))
 endif
 
-ifeq ($(SYSTEM_GLM),TRUE)
-$(eval $(call gb_Executable_add_defs,icontest,\
--DGLM_ENABLE_EXPERIMENTAL \
-))
-endif
-
 $(eval $(call gb_Executable_add_defs,icontest,\
 -DVCL_INTERNALS \
 ))
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index f56c913f656f..7776ced51b56 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -48,7 +48,6 @@ $(eval $(call gb_Library_add_defs,vcl,\
 -DCUI_DLL_NAME=\"$(call gb_Library_get_runtime_filename,$(call 
gb_Library__get_name,cui))\" \
 -DDESKTOP_DETECTOR_DLL_NAME=\"$(call 
gb_Library_get_runtime_filename,$(call 
gb_Library__get_name,desktop_detector))\" \
 -DTK_DLL_NAME=\"$(call gb_Library_get_runtime_filename,$(call 
gb_Library__get_name,tk))\" \
-$(if $(SYSTEM_GLM),-DGLM_ENABLE_EXPERIMENTAL) \
 $(if $(SYSTEM_LIBFIXMATH),-DSYSTEM_LIBFIXMATH) \
 ))
 
@@ -84,7 +83,6 @@ $(eval $(call gb_Library_use_externals,vcl,\
 expat \
 frozen \
 gio \
-glm_headers \
 graphite \
 harfbuzz \
 icu_headers \
diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk
index e0086e6c4dcb..2d314017bb8b 100644
--- a/vcl/Library_vclplug_gen.mk
+++ b/vcl/Library_vclplug_gen.mk
@@ -56,7 +56,6 @@ $(eval $(call gb_Library_use_externals,vclplug_gen,\
graphite \
epoxy \
expat \
-   glm_headers \
harfbuzz \
icu_headers \
icuuc \
diff --git a/vcl/Library_vclplug_win.mk b/vcl/Library_vclplug_win.mk
index 2627914cc15c..d4656302d4ce 100644
--- a/vcl/Library_vclplug_win.mk
+++ b/vcl/Library_vclplug_win.mk
@@ -60,7 +60,6 @@ $(eval $(call gb_Library_use_libraries,vclplug_win,\
 $(eval $(call gb_Library_use_externals,vclplug_win,\
 boost_headers \
 epoxy \
-glm_headers \
 harfbuzz \
 $(if $(filter SKIA,$(BUILD_TYPE)),skia) \
 ))
diff --git a/vcl/source/opengl/GLMHelper.hxx b/vcl/source/opengl/GLMHelper.hxx
deleted file mode 100644
index 9694a3c34625..
--- a/vcl/source/opengl/GLMHelper.hxx
+++ /dev/null
@@ -1,21 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code

[Libreoffice-commits] core.git: compilerplugins/clang sal/IwyuFilter_sal.yaml sal/qa

2023-08-21 Thread Gabor Kelemen (via logerrit)
 compilerplugins/clang/singlevalfields.results |3 
 compilerplugins/clang/unusedvarsglobal.writeonly.results  |4 
 sal/IwyuFilter_sal.yaml   |   21 

 sal/qa/ByteSequence/ByteSequence.cxx  |1 
 sal/qa/OStringBuffer/rtl_OStringBuffer.cxx|1 
 sal/qa/osl/condition/osl_Condition.cxx|   10 +-
 sal/qa/osl/condition/osl_Condition_Const.h|   47 
--
 sal/qa/osl/file/osl_File.cxx  |6 -
 sal/qa/osl/file/test_cpy_wrt_file.cxx |2 
 sal/qa/osl/getsystempathfromfileurl/test-getsystempathfromfileurl.cxx |1 
 sal/qa/osl/module/osl_Module_DLL.cxx  |5 -
 sal/qa/osl/mutex/osl_Mutex.cxx|1 
 sal/qa/osl/pipe/osl_Pipe.cxx  |5 -
 sal/qa/osl/process/osl_Thread.cxx |5 -
 sal/qa/osl/process/osl_process.cxx|   10 --
 sal/qa/osl/process/osl_process_child.cxx  |1 
 sal/qa/osl/profile/osl_old_testprofile.cxx|2 
 sal/qa/osl/security/osl_Security.cxx  |2 
 sal/qa/osl/setthreadname/test-setthreadname.cxx   |2 
 sal/qa/rtl/alloc/rtl_alloc.cxx|2 
 sal/qa/rtl/bootstrap/expand.cxx   |1 
 sal/qa/rtl/cipher/rtl_cipher.cxx  |3 
 sal/qa/rtl/crc32/rtl_crc32.cxx|1 
 sal/qa/rtl/digest/rtl_digest.cxx  |3 
 sal/qa/rtl/doublelock/rtl_doublelocking.cxx   |4 
 sal/qa/rtl/locale/rtl_locale.cxx  |1 
 sal/qa/rtl/math/test-rtl-math.cxx |2 
 sal/qa/rtl/math/test-std-math.cxx |7 -
 sal/qa/rtl/ostring/rtl_str.cxx|1 
 sal/qa/rtl/oustring/rtl_OUString2.cxx |4 
 sal/qa/rtl/oustring/rtl_ustr.cxx  |1 
 sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx|1 
 sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx   |1 
 sal/qa/rtl/process/rtl_Process.cxx|2 
 sal/qa/rtl/random/rtl_random.cxx  |1 
 sal/qa/rtl/ref/rtl_ref.cxx|2 
 sal/qa/rtl/strings/test_oustring_compare.cxx  |1 
 sal/qa/rtl/strings/test_oustring_startswith.cxx   |1 
 sal/qa/rtl/strings/test_oustring_stringliterals.cxx   |2 
 sal/qa/rtl/strings/test_strings_replace.cxx   |2 
 sal/qa/rtl/strings/test_strings_valuex.cxx|1 
 sal/qa/rtl/textenc/rtl_tencinfo.cxx   |3 
 sal/qa/rtl/textenc/rtl_textcvt.cxx|3 
 sal/qa/rtl/uri/rtl_Uri.cxx|4 
 sal/qa/rtl/uri/rtl_testuri.cxx|4 
 sal/qa/rtl/uuid/rtl_Uuid.cxx  |8 -
 46 files changed, 34 insertions(+), 161 deletions(-)

New commits:
commit b2f7fa71af28c2095d42396306cf7818e9e73175
Author: Gabor Kelemen 
AuthorDate: Fri Aug 18 01:35:58 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Aug 22 08:06:09 2023 +0200

tdf#146619 Remove unused includes from sal/qa

also drop now-unused osl_Condition_Const.h

Change-Id: I40beb5b1ad49c126a126bb444d5f66703664d56d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155820
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/compilerplugins/clang/singlevalfields.results 
b/compilerplugins/clang/singlevalfields.results
index ca2067a31351..f625c11ff833 100644
--- a/compilerplugins/clang/singlevalfields.results
+++ b/compilerplugins/clang/singlevalfields.results
@@ -583,9 +583,6 @@ sal/osl/unx/signal.cxx:59
 sal/osl/unx/sockimpl.hxx:39
 oslSocketImpl m_bIsInShutdown
 1
-sal/qa/osl/condition/osl_Condition_Const.h:41
-/home/noel/libo/sal/qa/osl/condition/osl_Condition.cxx aTestCon
-testcondition
 sal/qa/osl/file/osl_File_Const.h:118
 extern aPreURL
 file:///
diff --git a/compilerplugins/clang/unusedvarsglobal.writeonly.results 
b/compilerplugins/clang/unusedvarsglobal.writeonly.results
index 3e0bfbfd39f2..cf3e1e27bd0c 100644
--- a/compilerplugins/clang/unusedvarsglobal.writeonly

[Libreoffice-commits] core.git: compilerplugins/clang sfx2/source

2023-08-08 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/test/unnecessarygetstr.cxx |8 
 compilerplugins/clang/unnecessarygetstr.cxx  |   20 +---
 sfx2/source/view/viewsh.cxx  |9 +++--
 3 files changed, 24 insertions(+), 13 deletions(-)

New commits:
commit dddbb8a219f13344213b0ef6183529922bca7d50
Author: Noel Grandin 
AuthorDate: Fri Jun 2 08:56:39 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 8 15:31:57 2023 +0200

loplugin:unnecessarygetstr fix false +

encountering when we need to pass a std::string to an OString

Change-Id: I91d2aa1f20e7c2407c708c9ce4ae82fb52934c85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152526
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/test/unnecessarygetstr.cxx 
b/compilerplugins/clang/test/unnecessarygetstr.cxx
index bb5fcc20d2ef..c0960557a89b 100644
--- a/compilerplugins/clang/test/unnecessarygetstr.cxx
+++ b/compilerplugins/clang/test/unnecessarygetstr.cxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -120,4 +121,11 @@ void test(std::string v, OString o)
 }
 }
 
+// no warning expected
+namespace test6
+{
+void foo(const OString&);
+void test(std::string v) { foo(v.c_str()); }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/compilerplugins/clang/unnecessarygetstr.cxx 
b/compilerplugins/clang/unnecessarygetstr.cxx
index 681070356108..c80877a78554 100644
--- a/compilerplugins/clang/unnecessarygetstr.cxx
+++ b/compilerplugins/clang/unnecessarygetstr.cxx
@@ -49,7 +49,8 @@ public:
 .Namespace("rtl")
 .GlobalNamespace())
 {
-checkForGetStr(callExpr->getArg(0), "OUString::createFromAscii");
+checkForGetStr(callExpr->getArg(0), "OUString::createFromAscii",
+   /*isOStringConstructor*/ false);
 }
 return true;
 }
@@ -62,22 +63,26 @@ public:
 if (tc.ClassOrStruct("basic_string").StdNamespace())
 {
 if (constructExpr->getNumArgs() == 1 || 
constructExpr->getNumArgs() == 2)
-checkForGetStr(constructExpr->getArg(0), "string constructor");
+checkForGetStr(constructExpr->getArg(0), "string constructor",
+   /*isOStringConstructor*/ false);
 }
 else if (tc.ClassOrStruct("basic_string_view").StdNamespace())
 {
 if (constructExpr->getNumArgs() == 1)
-checkForGetStr(constructExpr->getArg(0), "string_view 
constructor");
+checkForGetStr(constructExpr->getArg(0), "string_view 
constructor",
+   /*isOStringConstructor*/ false);
 }
 else if (tc.Class("OString").Namespace("rtl").GlobalNamespace())
 {
 if (constructExpr->getNumArgs() == 1 || 
constructExpr->getNumArgs() == 2)
-checkForGetStr(constructExpr->getArg(0), "OString 
constructor");
+checkForGetStr(constructExpr->getArg(0), "OString constructor",
+   /*isOStringConstructor*/ true);
 }
 else if (tc.Class("OUString").Namespace("rtl").GlobalNamespace())
 {
 if (constructExpr->getNumArgs() == 2)
-checkForGetStr(constructExpr->getArg(0), "OUString 
constructor");
+checkForGetStr(constructExpr->getArg(0), "OUString 
constructor",
+   /*isOStringConstructor*/ false);
 }
 return true;
 }
@@ -94,7 +99,7 @@ public:
 }
 
 private:
-void checkForGetStr(const Expr* arg, const char* msg)
+void checkForGetStr(const Expr* arg, const char* msg, bool 
isOStringConstructor)
 {
 auto e = dyn_cast(arg->IgnoreImplicit());
 if (!e)
@@ -117,7 +122,8 @@ private:
 << msg << e->getSourceRange();
 }
 }
-else if (tc2.Class("basic_string").StdNamespace())
+// we do need to use c_str() when passing to an OString
+else if (!isOStringConstructor && 
tc2.Class("basic_string").StdNamespace())
 {
 if (loplugin::DeclCheck(e->getMethodDecl()).Function("c_str"))
 report(DiagnosticsEngine::Warning, "unnecessary call to 
'c_str' when passing to %0",
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index a1dc50fc2fdf..cef69764bb14 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -363,8 +363,7 @@ void 
LOKDocumentFocusListener::notifyFocusedParagraphChanged()
 {
 SAL_INFO("lok.a11y", 
"LOKDocumentFocusListener::notifyFocusedParagraphChanged: " << 
m_sFocusedParagraph);
 m_bFocusedParagraphNotified = true;
-const char* pPayload = aPayload.c_str();
-
m_pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_A11Y_FOCUS_CHANGED, 
pPayload);
+
m_pViewShell->l

[Libreoffice-commits] core.git: compilerplugins/clang

2023-08-04 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/test/redundantcast.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit be58058b0e49cceff1732535b5a9ab57aeb9aa7c
Author: Stephan Bergmann 
AuthorDate: Fri Aug 4 20:21:25 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Aug 4 23:07:32 2023 +0200

Avoid "function 'testDynamicCast()::S1::~S1' has internal linkage...

...but is not defined"

Change-Id: Ib1350d5d34eef0d544ca8f436ae63c693b7d2f5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155354
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/test/redundantcast.cxx 
b/compilerplugins/clang/test/redundantcast.cxx
index f3573d0ad20d..47a155c64b37 100644
--- a/compilerplugins/clang/test/redundantcast.cxx
+++ b/compilerplugins/clang/test/redundantcast.cxx
@@ -348,7 +348,7 @@ void testSuspiciousReinterpretCast() {
 
 void testDynamicCast() {
 
-struct S1 { virtual ~S1(); };
+struct S1 { virtual ~S1() {} };
 struct S2 final: S1 {};
 struct S3: S1 {};
 


[Libreoffice-commits] core.git: compilerplugins/clang include/svl svl/source sw/inc sw/source

2023-08-02 Thread Bjoern Michaelsen (via logerrit)
 compilerplugins/clang/unusedmethods.results |2 -
 include/svl/hint.hxx|1 
 svl/source/items/poolitem.cxx   |1 
 sw/inc/hintids.hxx  |3 --
 sw/inc/hints.hxx|   42 +---
 sw/source/core/attr/hints.cxx   |   14 ++---
 sw/source/core/inc/pagefrm.hxx  |6 ++--
 sw/source/core/inc/tabfrm.hxx   |1 
 sw/source/core/inc/txtfrm.hxx   |1 
 sw/source/core/layout/pagechg.cxx   |6 ++--
 sw/source/core/layout/tabfrm.cxx|   19 +---
 sw/source/core/layout/trvlfrm.cxx   |   14 -
 sw/source/core/text/txtfrm.cxx  |   20 ++---
 13 files changed, 68 insertions(+), 62 deletions(-)

New commits:
commit 7f85415a2f07d62bf688cb33680054940d4dd7f1
Author: Bjoern Michaelsen 
AuthorDate: Sun Jul 30 09:01:30 2023 +0200
Commit: Bjoern Michaelsen 
CommitDate: Thu Aug 3 08:01:55 2023 +0200

move SwVirtPageNumInfo to SfxHint

- also remove now obsolete GetInfo overrides

Change-Id: Iaac75ed2e53daead06242ce4620fd2b879909e02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155061
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index 77d563e9d719..a4b5e3d3dcd5 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -1934,8 +1934,6 @@ include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
-include/svl/typedwhich.hxx:31
- TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index 5967d834ceeb..ba230f92b817 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -152,6 +152,7 @@ enum class SfxHintId {
 SwDocPosUpdate,
 SwDocPosUpdateAtIndex,
 SwTableHeadingChange,
+SwVirtPageNumHint,
 
 ThisIsAnSdrHint
 };
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index dfa584f6114a..cb1bec15159c 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -437,7 +437,6 @@
 // class SwTableFormulaUpdate : public SwMsgPoolItem
 // class SwAutoFormatGetDocNode: public SwMsgPoolItem
 // class SwAttrSetChg: public SwMsgPoolItem
-// class SwVirtPageNumInfo: public SwMsgPoolItem
 // class SwFindNearestNode : public SwMsgPoolItem
 // class SwStringMsgPoolItem : public SwMsgPoolItem
 // class SwFormatDrop: public SfxPoolItem, public SwClient
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 1046dab3e1ca..339a73068162 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -141,7 +141,7 @@ class SwTransparencyGrf;
 class SwFormatRuby;
 class SwTableFormulaUpdate;
 class SwAutoFormatGetDocNode;
-class SwVirtPageNumInfo;
+class VirtPageNumHint;
 class SwFindNearestNode;
 class SwFltAnchor;
 class SwFltTOX;
@@ -433,7 +433,6 @@ constexpr TypedWhichId RES_ATTRSET_CHG(169);
 constexpr TypedWhichId RES_UPDATE_ATTR(170);
 constexpr TypedWhichId RES_AUTOFMT_DOCNODE(176);
 constexpr TypedWhichId RES_HIDDENPARA_PRINT(178);
-constexpr TypedWhichId RES_VIRTPAGENUM_INFO(180);
 constexpr TypedWhichId RES_REMOVE_UNO_OBJECT(181);
 // empty
 constexpr TypedWhichId RES_FINDNEARESTNODE(184);
diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 46a3c586771f..eb3ba5a2cdc2 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -261,6 +261,32 @@ class TableHeadingChange final: public SfxHint
 public:
 TableHeadingChange() : SfxHint(SfxHintId::SwTableHeadingChange) {};
 };
+class VirtPageNumHint final: public SfxHint
+{
+const SwPageFrame* m_pPage;
+const SwPageFrame* m_pOrigPage;
+const SwFrame* m_pFrame;
+bool m_bFound;
+/** Multiple attributes can be attached to a single paragraph / table
+ The frame, in the end, has to decide which attribute takes effect and 
which physical page it involves */
+public:
+VirtPageNumHint(const SwPageFrame* pPg);
+const SwPageFrame* GetPage() const
+{ return m_pPage; }
+const SwPageFrame* GetOrigPage() const
+{ return m_pOrigPage; }
+const SwFrame* GetFrame() const
+{ return m_pFrame; }
+void SetInfo(const SwPageFrame* pPg, const SwFrame *pF)
+{ m_pFrame = pF; m_pPage = pPg; }
+void SetFound()
+{
+assert(!m_bFound);
+m_bFound = true;
+}
+bool IsFound()
+{ return m_bFound; }
+};
 }
 
 class SwUpdateAttr final : public SwMsgPoolItem
@@ -359,22 +385,6 @@ public:
 #endif
 };
 
-class SwVirtPageN

[Libreoffice-commits] core.git: compilerplugins/clang config_host/config_atspi.h.in config_host.mk.in configure.ac distro-configs/Jenkins include/test test/source vcl/CppunitTest_vcl_gtk3_a11y.mk vcl/

2023-07-27 Thread Colomban Wendling (via logerrit)
 compilerplugins/clang/staticmethods.cxx |4 
 config_host.mk.in   |5 
 config_host/config_atspi.h.in   |   14 
 configure.ac|   62 
 distro-configs/Jenkins/linux_clang_dbgutil_64   |1 
 distro-configs/Jenkins/linux_gcc_release_64 |1 
 include/test/a11y/AccessibilityTools.hxx|2 
 test/source/a11y/AccessibilityTools.cxx |6 
 vcl/CppunitTest_vcl_gtk3_a11y.mk|   61 
 vcl/Module_vcl.mk   |6 
 vcl/qa/cppunit/a11y/atspi2/atspi2.cxx   |  498 +++
 vcl/qa/cppunit/a11y/atspi2/atspi2.hxx   |   45 
 vcl/qa/cppunit/a11y/atspi2/atspi2testbase.hxx   |   94 +
 vcl/qa/cppunit/a11y/atspi2/atspi2text.cxx   | 1017 
 vcl/qa/cppunit/a11y/atspi2/atspiwrapper.cxx |   22 
 vcl/qa/cppunit/a11y/atspi2/atspiwrapper.hxx |  784 
 vcl/qa/cppunit/a11y/atspi2/testdocuments/ecclectic.fodt |  258 
 17 files changed, 2879 insertions(+), 1 deletion(-)

New commits:
commit 3426dcfec2b4d5c755024c355f323ecc9f656e4a
Author: Colomban Wendling 
AuthorDate: Wed Apr 5 15:39:25 2023 +0200
Commit: Michael Weghorn 
CommitDate: Thu Jul 27 20:01:17 2023 +0200

vcl gtk3: Introduce AT-SPI2 tests for the GTK3 accessibility layer

Add tests for the GTK3 accessibility platform layer.  These tests
compare the internal LO representation with what is visible to the
platform, and thus the user's accessibility tools.

In most cases the tests are fairly trivial as LO's internals are not
far off AT-SPI2's expectations.  There are however notable exceptions
like for example the text attributes, that have a wildly different
representation and require more complex checks matching what LO's
platform layer does, the other way around.

These tests use libatspi2 directly, but as the C API is awful to work
with regarding resource management, there are wrappers to handle the
complexity using RAII.  The resulting API is fairly trivial to use.

As these tests require using the GTK3 VCL plugin and for the a11y tree
to be visible to AT-SPI2, they are run under XVFB using a separate dbus
session through dbus-launch.

Working on this has already lead to reporting and/or solving some
issues:

* https://gerrit.libreoffice.org/c/core/+/151303
* https://gerrit.libreoffice.org/c/core/+/151650
* https://gerrit.libreoffice.org/c/core/+/152456
* https://gerrit.libreoffice.org/c/core/+/152457
* https://bugs.documentfoundation.org/show_bug.cgi?id=155625
* https://bugs.documentfoundation.org/show_bug.cgi?id=155705
* https://gerrit.libreoffice.org/c/core/+/152748

Only a subset of the a11y APIs are covered for the moment, but the
current state should make it easy to extend upon.

Change-Id: I1a047864ce8dc1f1bc3056ad00159f7fd5e5b7d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153069
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/compilerplugins/clang/staticmethods.cxx 
b/compilerplugins/clang/staticmethods.cxx
index 4651a4a3d060..38180c1daa2c 100644
--- a/compilerplugins/clang/staticmethods.cxx
+++ b/compilerplugins/clang/staticmethods.cxx
@@ -184,7 +184,9 @@ bool StaticMethods::TraverseCXXMethodDecl(const 
CXXMethodDecl * pCXXMethodDecl)
 .GlobalNamespace())
 || (fdc.Function("Read_Majority").Class("SwWW8ImplReader")
 .GlobalNamespace())
-|| fdc.Function("Ignore").Class("SwWrtShell").GlobalNamespace())
+|| fdc.Function("Ignore").Class("SwWrtShell").GlobalNamespace()
+|| 
(cdc.Class("AttributesChecker").AnonymousNamespace().GlobalNamespace()
+&& startsWith(pCXXMethodDecl->getNameAsString(), "check")))
 {
 return true;
 }
diff --git a/config_host.mk.in b/config_host.mk.in
index acb868b8f05f..85089efb254e 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -31,6 +31,8 @@ export ASSERT_ALWAYS_ABORT=@ASSERT_ALWAYS_ABORT@
 export ATL_INCLUDE=@ATL_INCLUDE@
 export ATL_LIB=@ATL_LIB@
 export ATOMIC_LIB=@ATOMIC_LIB@
+export ATSPI2_CFLAGS=$(gb_SPACE)@ATSPI2_CFLAGS@
+export ATSPI2_LIBS=$(gb_SPACE)@ATSPI2_LIBS@
 export AVAHI_CFLAGS=$(gb_SPACE)@AVAHI_CFLAGS@
 export AVAHI_LIBS=$(gb_SPACE)@AVAHI_LIBS@
 export LIBATOMIC_OPS_CFLAGS=$(gb_SPACE)@LIBATOMIC_OPS_CFLAGS@
@@ -123,6 +125,7 @@ export DBUS_LIBS=$(gb_SPACE)@DBUS_LIBS@
 export DBUS_GLIB_CFLAGS=$(gb_SPACE)@DBUS_GLIB_CFLAGS@
 export DBUS_GLIB_LIBS=$(gb_SPACE)@DBUS_GLIB_LIBS@
 export DBUS_HAVE_GLIB=@DBUS_HAVE_GLIB@
+export DBUS_LAUNCH=@DBUS_LAUNCH@
 export DCONF_CFLAGS=@DCONF_CFLAGS@
 export DCONF_LIBS=@DCONF_LIBS@
 export DEFAULT_BRAND_IMAGES=@DEFAULT_BRAND_IMAGES@
@@ -153,6 +156,7 @@ export ENABLE_COINMP=@ENABLE_COINMP@
 S

[Libreoffice-commits] core.git: compilerplugins/clang vcl/inc vcl/unx

2023-07-24 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/unusedfields.only-used-in-constructor.results |6 
++
 compilerplugins/clang/unusedfields.writeonly.results|6 
++
 vcl/inc/unx/glyphcache.hxx  |1 -
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx  |9 
-
 4 files changed, 4 insertions(+), 18 deletions(-)

New commits:
commit dabedcaf27b0af1e38a611b8d8e48444f848e01d
Author: Noel Grandin 
AuthorDate: Sun Jul 23 16:27:45 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 25 07:56:37 2023 +0200

loplugin:unusedfields

Change-Id: If9c76b9c500a5bee0fbf20a44597a250b7fa2af0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154808
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git 
a/compilerplugins/clang/unusedfields.only-used-in-constructor.results 
b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
index 01db79dd80aa..a81c93483c6c 100644
--- a/compilerplugins/clang/unusedfields.only-used-in-constructor.results
+++ b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
@@ -910,6 +910,8 @@ vcl/inc/sft.hxx:177
 vcl::TTGlobalFontInfo_ fsSelection sal_uInt16
 vcl/inc/svimpbox.hxx:118
 SvImpLBox m_aFctSet ImpLBSelEng
+vcl/inc/unx/glyphcache.hxx:146
+FreetypeFont mnLoadFlags FT_Int
 vcl/inc/unx/i18n_ic.hxx:40
 SalI18N_InputContext maPreeditStartCallback XIMCallback
 vcl/inc/unx/i18n_ic.hxx:41
@@ -938,8 +940,6 @@ vcl/source/gdi/jobset.cxx:39
 (anonymous namespace)::ImplOldJobSetupData cDeviceName char[32]
 vcl/source/gdi/jobset.cxx:40
 (anonymous namespace)::ImplOldJobSetupData cPortName char[32]
-vcl/source/gdi/pdfextoutdevdata.cxx:107
-vcl::GlobalSyncData mStructIdMap std::vector
 vcl/source/pdf/PDFiumLibrary.cxx:430
 vcl::pdf::(anonymous namespace)::PDFiumDocumentImpl m_aFormCallbacks 
FPDF_FORMFILLINFO
 vcl/unx/gtk3/a11y/atkhypertext.cxx:31
@@ -972,5 +972,3 @@ xmloff/inc/XMLThemeContext.hxx:46
 XMLThemeColorsContext m_aColorScheme std::vector
 xmloff/source/text/XMLTextListBlockContext.hxx:40
 XMLTextListBlockContext mbSetDefaults _Bool
-xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx:87
-(anonymous namespace)::SaveODFItem m_nODF sal_Int16
diff --git a/compilerplugins/clang/unusedfields.writeonly.results 
b/compilerplugins/clang/unusedfields.writeonly.results
index 098cd9e859a5..09664da6ea79 100644
--- a/compilerplugins/clang/unusedfields.writeonly.results
+++ b/compilerplugins/clang/unusedfields.writeonly.results
@@ -1248,6 +1248,8 @@ vcl/inc/svdata.hxx:464
 ImplSVEvent mpInstanceRef VclPtr
 vcl/inc/toolbarvalue.hxx:47
 ToolbarValue mbIsTopDockingArea _Bool
+vcl/inc/unx/glyphcache.hxx:146
+FreetypeFont mnLoadFlags FT_Int
 vcl/inc/unx/gtk/gtkdata.hxx:226
 DocumentFocusListener m_aRefList 
o3tl::sorted_vector >
 vcl/inc/unx/gtk/gtkframe.hxx:81
@@ -1260,8 +1262,6 @@ vcl/source/components/dtranscomp.cxx:210
 vcl::(anonymous namespace)::GenericDragSource m_xTrans 
css::uno::Reference
 vcl/source/fontsubset/sft.cxx:109
 vcl::(anonymous namespace)::TTGlyphMetrics lsb sal_Int16
-vcl/source/gdi/pdfextoutdevdata.cxx:107
-vcl::GlobalSyncData mStructIdMap std::vector
 vcl/unx/generic/app/wmadaptor.cxx:1268
 _mwmhints deco unsigned long
 vcl/unx/generic/app/wmadaptor.cxx:1268
@@ -1332,8 +1332,6 @@ xmlsecurity/inc/certificateviewer.hxx:51
 CertificateViewer mxGeneralPage std::unique_ptr
 xmlsecurity/inc/certificateviewer.hxx:52
 CertificateViewer mxDetailsPage std::unique_ptr
-xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx:87
-(anonymous namespace)::SaveODFItem m_nODF sal_Int16
 xmlsecurity/source/helper/pdfsignaturehelper.cxx:237
 (anonymous namespace)::PageChecksum m_nPageContent BitmapChecksum
 xmlsecurity/source/helper/pdfsignaturehelper.cxx:238
diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index f5ce328b0aa1..6d778d15d6c7 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -143,7 +143,6 @@ private:
 int mnWidth;
 int mnPrioAntiAlias;
 std::shared_ptr mxFontInfo;
-FT_Int  mnLoadFlags;
 double  mfStretch;
 FT_FaceRec_*maFaceFT;
 FT_SizeRec_*maSizeFT;
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx 
b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 2543b76b5719..5745f94a223e 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -394,13 +394,10 @@ FreetypeFont::FreetypeFont(FreetypeFontInstance& 
rFontInstance, std::shared_ptr<
 mnSin( 0 ),
 mnPrioAntiAlias(nDefaultPrioAntiAlias),
 mxFontInfo(std::move(xFI)),
-mnLoadFlags( 0 ),
 maFaceFT( nullptr ),
 maSizeFT( nullptr ),
 mbFaceOk( false )
 {
-int nPrioEmbedded = nDefaultPrioEmbedded;
-
 maFaceFT = mxFontInfo->GetFaceFT();
 
 const vcl

[Libreoffice-commits] core.git: compilerplugins/clang include/registry vcl/inc vcl/source

2023-07-05 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/unusedenumconstants.readonly.results  | 1050 +-
 compilerplugins/clang/unusedenumconstants.untouched.results |  466 -
 compilerplugins/clang/unusedenumconstants.writeonly.results | 5324 +++-
 include/registry/regtype.h  |9 
 vcl/inc/unx/sessioninhibitor.hxx|2 
 vcl/source/filter/graphicfilter2.cxx|   14 
 6 files changed, 4134 insertions(+), 2731 deletions(-)

New commits:
commit f98296117b2c27af73c093525ad828909fd8fb31
Author: Noel Grandin 
AuthorDate: Wed Jul 5 11:44:46 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 5 14:21:51 2023 +0200

loplugin:unusedenumconstants

Change-Id: I53817a6b017203d8694032320869d11412c57ee9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154027
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/unusedenumconstants.readonly.results 
b/compilerplugins/clang/unusedenumconstants.readonly.results
index 02ec1e8a728f..6d82ee1cd1dd 100644
--- a/compilerplugins/clang/unusedenumconstants.readonly.results
+++ b/compilerplugins/clang/unusedenumconstants.readonly.results
@@ -1,55 +1,53 @@
-bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx:79
-enum (anonymous namespace)::x86_64_reg_class X86_64_SSEUP_CLASS
-bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx:80
-enum (anonymous namespace)::x86_64_reg_class X86_64_X87_CLASS
-bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx:81
-enum (anonymous namespace)::x86_64_reg_class X86_64_X87UP_CLASS
+chart2/source/controller/main/DrawCommandDispatch.h:31
+enum DrawCommandID COMMAND_ID_DRAW_TEXT_VERTICAL
+chart2/source/controller/main/DrawCommandDispatch.h:33
+enum DrawCommandID COMMAND_ID_DRAW_CAPTION_VERTICAL
 chart2/source/inc/CharacterProperties.hxx:120
-enum chart::CharacterProperties::(anonymous at 
/home/noel/libo2/chart2/source/inc/CharacterProperties.hxx:41:5) 
FAST_PROPERTY_ID_END_CHAR_PROP
-chart2/source/inc/TitleHelper.hxx:47
+enum chart::CharacterProperties::(unnamed at 
/home/noel/libo-plugin/chart2/source/inc/CharacterProperties.hxx:41:5) 
FAST_PROPERTY_ID_END_CHAR_PROP
+chart2/source/inc/TitleHelper.hxx:49
 enum chart::TitleHelper::eTitleType NORMAL_TITLE_END
-chart2/source/view/inc/ShapeFactory.hxx:49
+chart2/source/view/inc/ShapeFactory.hxx:51
 enum chart::SymbolEnum Symbol_Square
-chart2/source/view/inc/ShapeFactory.hxx:50
+chart2/source/view/inc/ShapeFactory.hxx:52
 enum chart::SymbolEnum Symbol_Diamond
-chart2/source/view/inc/ShapeFactory.hxx:51
+chart2/source/view/inc/ShapeFactory.hxx:53
 enum chart::SymbolEnum Symbol_DownArrow
-chart2/source/view/inc/ShapeFactory.hxx:52
+chart2/source/view/inc/ShapeFactory.hxx:54
 enum chart::SymbolEnum Symbol_UpArrow
-chart2/source/view/inc/ShapeFactory.hxx:53
+chart2/source/view/inc/ShapeFactory.hxx:55
 enum chart::SymbolEnum Symbol_RightArrow
-chart2/source/view/inc/ShapeFactory.hxx:54
+chart2/source/view/inc/ShapeFactory.hxx:56
 enum chart::SymbolEnum Symbol_LeftArrow
-chart2/source/view/inc/ShapeFactory.hxx:55
+chart2/source/view/inc/ShapeFactory.hxx:57
 enum chart::SymbolEnum Symbol_Bowtie
-chart2/source/view/inc/ShapeFactory.hxx:56
+chart2/source/view/inc/ShapeFactory.hxx:58
 enum chart::SymbolEnum Symbol_Sandglass
-chart2/source/view/inc/ShapeFactory.hxx:57
+chart2/source/view/inc/ShapeFactory.hxx:59
 enum chart::SymbolEnum Symbol_Circle
-chart2/source/view/inc/ShapeFactory.hxx:58
+chart2/source/view/inc/ShapeFactory.hxx:60
 enum chart::SymbolEnum Symbol_Star
-chart2/source/view/inc/ShapeFactory.hxx:59
+chart2/source/view/inc/ShapeFactory.hxx:61
 enum chart::SymbolEnum Symbol_X
-chart2/source/view/inc/ShapeFactory.hxx:60
+chart2/source/view/inc/ShapeFactory.hxx:62
 enum chart::SymbolEnum Symbol_Plus
-chart2/source/view/inc/ShapeFactory.hxx:61
+chart2/source/view/inc/ShapeFactory.hxx:63
 enum chart::SymbolEnum Symbol_Asterisk
-chart2/source/view/inc/ShapeFactory.hxx:62
+chart2/source/view/inc/ShapeFactory.hxx:64
 enum chart::SymbolEnum Symbol_HorizontalBar
-chart2/source/view/inc/ShapeFactory.hxx:63
+chart2/source/view/inc/ShapeFactory.hxx:65
 enum chart::SymbolEnum Symbol_VerticalBar
 configmgr/source/access.hxx:443
-enum configmgr::Access::(anonymous at 
/home/noel/libo2/configmgr/source/access.hxx:441:5) IS_GROUP_MEMBER
+enum configmgr::Access::(unnamed at 
/home/noel/libo-plugin/configmgr/source/access.hxx:441:5) IS_GROUP_MEMBER
 configmgr/source/access.hxx:443
-enum configmgr::Access::(anonymous at 
/home/noel/libo2/configmgr/source/access.hxx:441:5) IS_SET_MEMBER
+enum configmgr::Access::(unnamed at 
/home/noel/libo-plugin/configmgr/source/access.hxx:441:5) IS_SET_MEMBER
 configmgr/source/components.hxx:149
 enum configmgr::Components::ModificationTarget Dconf
 configmgr/source/parsemanager.hxx:43
-enum configmgr::ParseManager::(anonymous at 
/home/noel/libo2/configmgr/source/pa

[Libreoffice-commits] core.git: compilerplugins/clang forms/source sd/inc sw/inc xmloff/inc xmloff/source

2023-07-04 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/unusedvarsglobal.untouched.results |   84 ++---
 compilerplugins/clang/unusedvarsglobal.writeonly.results |  218 +--
 forms/source/inc/frm_strings.hxx |2 
 sd/inc/bitmaps.hlst  |3 
 sw/inc/unoprnms.hxx  |2 
 xmloff/inc/xmlprop.hxx   |1 
 xmloff/source/forms/strings.hxx  |1 
 7 files changed, 118 insertions(+), 193 deletions(-)

New commits:
commit 77befddec9486403c471b2beafd4ca0fd2429c5a
Author: Noel Grandin 
AuthorDate: Mon Jul 3 13:27:18 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 4 19:16:40 2023 +0200

loplugin:unusedvarsglobal

Change-Id: Ia86c8bd0bdc85c375eb3837ba97f9e171d9dac6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153974
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/unusedvarsglobal.untouched.results 
b/compilerplugins/clang/unusedvarsglobal.untouched.results
index 9a9216a208a3..490665af3b1c 100644
--- a/compilerplugins/clang/unusedvarsglobal.untouched.results
+++ b/compilerplugins/clang/unusedvarsglobal.untouched.results
@@ -1,5 +1,5 @@
 canvas/workben/canvasdemo.cxx:666
-(anonymous namespace)::DemoApp aApp
+DemoApp aApp
 connectivity/source/drivers/evoab2/EApi.h:51
 gconstpointer (*)(EContact *, EContactField) e_contact_get_const
 connectivity/source/drivers/evoab2/EApi.h:55
@@ -17,80 +17,82 @@ connectivity/source/drivers/evoab2/EApi.h:93
 connectivity/source/drivers/evoab2/EApi.h:101
 gboolean (*)(EBook *, const char *, const char *, const char *, GError **) 
e_book_authenticate_user
 cppu/source/uno/check.cxx:329
-(anonymous namespace)::BinaryCompatible_Impl aTest
-desktop/source/lib/init.cxx:6493
+BinaryCompatible_Impl aTest
+desktop/source/lib/init.cxx:7376
 SvtOptionsDialogOptions aDialogOptions
-desktop/source/lib/init.cxx:6494
+desktop/source/lib/init.cxx:7377
 SvtCTLOptions aSvtCTLOptions
-desktop/source/lib/init.cxx:6495
+desktop/source/lib/init.cxx:7378
 SvtAccessibilityOptions aSvtAccessibilityOptions
-desktop/source/lib/init.cxx:6496
+desktop/source/lib/init.cxx:7379
 svtools::ColorConfig aColorConfig
-desktop/source/lib/init.cxx:6497
+desktop/source/lib/init.cxx:7380
 SvtMiscOptions aSvtMiscOptions
-desktop/source/lib/init.cxx:6498
+desktop/source/lib/init.cxx:7381
 SvtSlideSorterBarOptions aSvtSlideSorterBarOptions
-desktop/source/lib/init.cxx:6499
+desktop/source/lib/init.cxx:7382
 SvtCommandOptions aSvtCommandOptions
-desktop/source/lib/init.cxx:6500
+desktop/source/lib/init.cxx:7383
 SvtCompatibilityOptions aSvtCompatibilityOptions
-desktop/source/lib/init.cxx:6501
+desktop/source/lib/init.cxx:7384
 SvtFilterOptions aSvtFilterOptions
-desktop/source/lib/init.cxx:6502
+desktop/source/lib/init.cxx:7385
 SvtLinguConfig aSvtLinguConfig
-desktop/source/lib/init.cxx:6503
+desktop/source/lib/init.cxx:7386
 SvtModuleOptions aSvtModuleOptions
-desktop/source/lib/init.cxx:6504
+desktop/source/lib/init.cxx:7387
 SvtPathOptions aSvtPathOptions
-desktop/source/lib/init.cxx:6505
+desktop/source/lib/init.cxx:7388
 SvtSearchOptions aSvtSearchOptions
-desktop/source/lib/init.cxx:6506
+desktop/source/lib/init.cxx:7389
 SvtSysLocaleOptions aSvtSysLocaleOptions
-desktop/source/lib/init.cxx:6507
+desktop/source/lib/init.cxx:7390
 SvtUserOptions aSvtUserOptions
-desktop/source/lib/init.cxx:6509
+desktop/source/lib/init.cxx:7392
 MouseSettings aMouseSettings
-desktop/source/lib/init.cxx:6510
+desktop/source/lib/init.cxx:7393
 StyleSettings aStyleSettings
-desktop/source/lib/init.cxx:6511
+desktop/source/lib/init.cxx:7394
 MiscSettings aMiscSettings
-desktop/source/lib/init.cxx:6512
+desktop/source/lib/init.cxx:7395
 HelpSettings aHelpSettings
-desktop/source/lib/init.cxx:6513
+desktop/source/lib/init.cxx:7396
 AllSettings aAllSettings
-framework/source/services/ContextChangeEventMultiplexer.cxx:352
-framework::(anonymous namespace)::Hook g_hook
+framework/source/services/ContextChangeEventMultiplexer.cxx:353
+Hook g_hook
 hwpfilter/source/nodes.h:89
 int count
 pyuno/source/module/pyuno_gc.cxx:45
-pyuno::(anonymous namespace)::StaticDestructorGuard guard
+StaticDestructorGuard guard
 sal/osl/all/utility.cxx:45
-osl::(anonymous namespace)::OGlobalTimer aGlobalTimer
+OGlobalTimer aGlobalTimer
 sal/qa/osl/file/osl_File.cxx:4978
-(anonymous namespace)::GlobalObject theGlobalObject
+GlobalObject theGlobalObject
 sal/rtl/cmdargs.cxx:46
-(anonymous namespace)::ArgHolder argHolder
-sal/rtl/strtmpl.hxx:890
-IMPL_RTL_STRINGDATA data
-sc/source/core/inc/sharedstringpoolpurge.hxx:43
-sc::SharedStringPoolPurge * self
-sfx2/source/bastyp/fltfnc.cxx:80
+ArgHolder argHolder
+sal/rtl/strtmpl.hxx:772
+rtl_tString data
+sfx2/source/bastyp/fltfnc.cxx:81
 SfxFilterListe

[Libreoffice-commits] core.git: compilerplugins/clang editeng/source include/editeng include/svtools include/vcl sd/source sw/inc sw/qa sw/source vcl/inc vcl/source vcl/unx

2023-06-30 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/unusedfields.only-used-in-constructor.results |  172 ++--
 compilerplugins/clang/unusedfields.readonly.results |  278 
+++---
 compilerplugins/clang/unusedfields.untouched.results|   94 +-
 compilerplugins/clang/unusedfields.writeonly.results|  406 
++
 editeng/source/editeng/editeng.cxx  |6 
 editeng/source/editeng/impedit.hxx  |1 
 include/editeng/editeng.hxx |1 
 include/svtools/colorcfg.hxx|2 
 include/vcl/ctrl.hxx|2 
 sd/source/ui/slidesorter/controller/SlsPageSelector.cxx |9 
 sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx |7 
 sw/inc/viewopt.hxx  |3 
 sw/qa/extras/rtfimport/rtfimport.cxx|3 
 sw/source/uibase/config/viewopt.cxx |8 
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx   |1 
 vcl/inc/unx/saldisp.hxx |   17 
 vcl/source/control/ctrl.cxx |8 
 vcl/unx/generic/app/saldisp.cxx |  176 
 18 files changed, 596 insertions(+), 598 deletions(-)

New commits:
commit c33e81615c85eb9acd5956973e3bbc27ea068b41
Author: Noel Grandin 
AuthorDate: Thu Jun 29 16:34:49 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jun 30 15:14:14 2023 +0200

loplugin:unusedmethods

Change-Id: I8d3402a69237b665462e04440ad73fe29e2133db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153807
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git 
a/compilerplugins/clang/unusedfields.only-used-in-constructor.results 
b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
index b50c4546394b..d897f095b3c2 100644
--- a/compilerplugins/clang/unusedfields.only-used-in-constructor.results
+++ b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
@@ -1,8 +1,8 @@
 basegfx/source/polygon/b2dpolygontriangulator.cxx:112
 basegfx::(anonymous namespace)::Triangulator maStartEntries EdgeEntries
-basegfx/source/polygon/b2dtrapezoid.cxx:205
+basegfx/source/polygon/b2dtrapezoid.cxx:208
 basegfx::trapezoidhelper::(anonymous namespace)::PointBlockAllocator 
maFirstStackBlock B2DPoint[32]
-basegfx/source/polygon/b2dtrapezoid.cxx:256
+basegfx/source/polygon/b2dtrapezoid.cxx:259
 basegfx::trapezoidhelper::(anonymous namespace)::TrapezoidSubdivider 
maPoints std::vector
 basic/qa/cppunit/basictest.hxx:27
 MacroSnippet maDll BasicDLL
@@ -22,6 +22,22 @@ 
chart2/source/controller/accessibility/AccessibleChartShape.hxx:78
 chart::AccessibleChartShape m_aShapeTreeInfo 
::accessibility::AccessibleShapeTreeInfo
 chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx:70
 chart::ThreeD_SceneIllumination_TabPage m_aModelChangeListener 
ModifyListenerCallBack
+chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx:76
+chart::ThreeD_SceneIllumination_TabPage m_aBtn_Light1 LightButton
+chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx:77
+chart::ThreeD_SceneIllumination_TabPage m_aBtn_Light2 LightButton
+chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx:78
+chart::ThreeD_SceneIllumination_TabPage m_aBtn_Light3 LightButton
+chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx:79
+chart::ThreeD_SceneIllumination_TabPage m_aBtn_Light4 LightButton
+chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx:80
+chart::ThreeD_SceneIllumination_TabPage m_aBtn_Light5 LightButton
+chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx:81
+chart::ThreeD_SceneIllumination_TabPage m_aBtn_Light6 LightButton
+chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx:82
+chart::ThreeD_SceneIllumination_TabPage m_aBtn_Light7 LightButton
+chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx:83
+chart::ThreeD_SceneIllumination_TabPage m_aBtn_Light8 LightButton
 chart2/source/controller/inc/dlg_View3D.hxx:46
 chart::View3DDialog m_aControllerLocker ControllerLockHelper
 chart2/source/controller/inc/RangeSelectionListener.hxx:65
@@ -74,11 +90,11 @@ connectivity/source/inc/flat/EResultSet.hxx:39
 connectivity::flat::OFlatResultSet m_bBookmarkable _Bool
 connectivity/source/inc/java/lang/Object.hxx:37
 connectivity::SDBThreadAttach m_aGuard jvmaccess::class 
VirtualMachine::AttachGuard
-cppcanvas/source/mtfrenderer/textaction.cxx:806
+cppcanvas/source/mtfrenderer/textaction.cxx:812
 cppcanvas::internal::(anonymous namespace)::EffectTextAction 
maTextLineInfo const tools::TextLineInfo
-cppcanvas/source/mtfrenderer/textaction.cxx:1627
+cppcanvas/source/mtfrenderer/textaction.cxx:1645
 cppca

[Libreoffice-commits] core.git: compilerplugins/clang solenv/CompilerTest_compilerplugins_clang.mk

2023-06-06 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/test/staticmethods.cxx |   16 
 solenv/CompilerTest_compilerplugins_clang.mk |1 +
 2 files changed, 17 insertions(+)

New commits:
commit c28819ace52704494018f14744674fe09af2d593
Author: Noel Grandin 
AuthorDate: Tue Jun 6 10:16:22 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jun 6 11:35:08 2023 +0200

add unit test for loplugin:staticmethods

Change-Id: Ied72c83dbc364f96e5b78a3cb915b23a1751ac0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152646
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/test/staticmethods.cxx 
b/compilerplugins/clang/test/staticmethods.cxx
new file mode 100644
index ..cd87c930dc23
--- /dev/null
+++ b/compilerplugins/clang/test/staticmethods.cxx
@@ -0,0 +1,16 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+class foo
+{
+// expected-error@+1 {{this member function can be declared static 
[loplugin:staticmethods]}}
+int method1() { return 5; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk 
b/solenv/CompilerTest_compilerplugins_clang.mk
index 05d0d6f3d088..a4bf3dbf45a9 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -77,6 +77,7 @@ $(eval $(call 
gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
 compilerplugins/clang/test/singlevalfields \
 compilerplugins/clang/test/staticconstfield \
 compilerplugins/clang/test/staticdynamic \
+compilerplugins/clang/test/staticmethods \
 compilerplugins/clang/test/stdfunction \
 compilerplugins/clang/test/stringadd \
 compilerplugins/clang/test/stringconcatauto \


[Libreoffice-commits] core.git: compilerplugins/clang

2023-06-05 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/colorcheck.cxx   |5 ++---
 compilerplugins/clang/compat.hxx   |   18 +++---
 compilerplugins/clang/elidestringvar.cxx   |5 ++---
 compilerplugins/clang/flatten.cxx  |   15 ---
 compilerplugins/clang/intvsfloat.cxx   |   16 
 compilerplugins/clang/noexceptmove.cxx |   13 ++---
 compilerplugins/clang/pointerbool.cxx  |8 
 compilerplugins/clang/unusedfields.cxx |6 +++---
 compilerplugins/clang/unusedvarsglobal.cxx |6 +++---
 compilerplugins/clang/writeonlyvars.cxx|8 
 10 files changed, 55 insertions(+), 45 deletions(-)

New commits:
commit 6f33d21fdd85f49cd15b2770c6557e87f05b7dba
Author: Stephan Bergmann 
AuthorDate: Mon Jun 5 14:19:55 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Jun 5 19:46:50 2023 +0200

Adapt compilerplugins to Clang 17 trunk "Remove llvm::Optional"


()

Change-Id: I51acda5951f8250d1a1b47e1c2612199ae7338a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152618
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/colorcheck.cxx 
b/compilerplugins/clang/colorcheck.cxx
index c3670598810f..69bcaa0cd9cc 100644
--- a/compilerplugins/clang/colorcheck.cxx
+++ b/compilerplugins/clang/colorcheck.cxx
@@ -15,11 +15,10 @@
 #include 
 #include 
 
-#include "llvm/ADT/Optional.h"
-
 #include "config_clang.h"
 
 #include "check.hxx"
+#include "compat.hxx"
 #include "plugin.hxx"
 
 /**
@@ -74,7 +73,7 @@ bool ColorCheck::VisitCXXConstructExpr(const 
CXXConstructExpr* constructExpr)
 {
 if (!arg0->isValueDependent())
 {
-llvm::Optional xVal
+compat::optional xVal
 = arg0->getIntegerConstantExpr(compiler.getASTContext());
 if (xVal && *xVal > 0xff)
 report(DiagnosticsEngine::Warning,
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 5ad8ac9e98eb..a836aa0af1ed 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -16,17 +16,29 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Specifiers.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/FileSystem.h"
 
 #include "config_clang.h"
 
+#if CLANG_VERSION >= 17
+#include 
+#else
+#include "llvm/ADT/Optional.h"
+#endif
+
 // Compatibility wrapper to abstract over (trivial) changes in the Clang API:
 namespace compat {
 
 template
-constexpr bool has_value(llvm::Optional const & o) {
+#if CLANG_VERSION >= 17
+using optional = std::optional;
+#else
+using optional = llvm::Optional;
+#endif
+
+template
+constexpr bool has_value(optional const & o) {
 #if CLANG_VERSION >= 15
 return o.has_value();
 #else
@@ -35,7 +47,7 @@ constexpr bool has_value(llvm::Optional const & o) {
 }
 
 template
-constexpr T const & value(llvm::Optional const & o) {
+constexpr T const & value(optional const & o) {
 #if CLANG_VERSION >= 15
 return *o;
 #else
diff --git a/compilerplugins/clang/elidestringvar.cxx 
b/compilerplugins/clang/elidestringvar.cxx
index 172d7e8d81c0..c14eaf027b0f 100644
--- a/compilerplugins/clang/elidestringvar.cxx
+++ b/compilerplugins/clang/elidestringvar.cxx
@@ -13,9 +13,8 @@
 #include 
 #include 
 
-#include "llvm/ADT/Optional.h"
-
 #include "check.hxx"
+#include "compat.hxx"
 #include "plugin.hxx"
 
 // Find cases where a variable of a OString/OUString type is initialized
@@ -447,7 +446,7 @@ private:
 {
 }
 Stmt const* innermostLoop;
-llvm::Optional singleUse;
+compat::optional singleUse;
 };
 
 std::stack innermostLoop_;
diff --git a/compilerplugins/clang/flatten.cxx 
b/compilerplugins/clang/flatten.cxx
index 58492e71fb7a..a3d57812d924 100644
--- a/compilerplugins/clang/flatten.cxx
+++ b/compilerplugins/clang/flatten.cxx
@@ -7,8 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include "compat.hxx"
 #include "plugin.hxx"
-#include "llvm/ADT/Optional.h"
 #include 
 #include 
 #include 
@@ -49,7 +49,8 @@ private:
 SourceRange ignoreMacroExpansions(SourceRange range);
 SourceRange extendOverComments(SourceRange range);
 std::string getSourceAsString(SourceRange range);
-llvm::Optional invertCondition(Expr const * condExpr, 
SourceRange conditionRange);
+compat::optional invertCondition(
+Expr const * condExpr, SourceRange conditionRange);
 bool isLargeCompoundStmt(Stmt const *);
 
 Stmt const * lastStmtInCompoundStmt = nullptr;
@@ -302,7 +303,7 @@ bool Flatten::rewrite1(IfStmt const * ifStmt)
 
 // in adjusting the formatting I assume that "{" starts on a new line
 
-llvm::Optional conditionString = 
invertCondition(ifStmt->getCond(), conditionRange);
+com

[Libreoffice-commits] core.git: compilerplugins/clang starmath/inc starmath/source

2023-06-04 Thread Julien Nabet (via logerrit)
 compilerplugins/clang/unusedmethods.results |2 --
 starmath/inc/mathml/starmathdatabase.hxx|8 
 starmath/source/mathml/starmathdatabase.cxx |   11 ---
 3 files changed, 21 deletions(-)

New commits:
commit ca595a7d7e35ca814e4eb6cb5d7afbc88f85c850
Author: Julien Nabet 
AuthorDate: Sun Jun 4 09:36:02 2023 +0200
Commit: Julien Nabet 
CommitDate: Sun Jun 4 11:02:34 2023 +0200

Remove unused starmathdatabase::Identify_Color_HTML

Seems to be unused since 88c343b50a1de197394e3e22bf82ff455386a80b
"Corrected my previous mess on mathml export with color export 2.

Now only exports HTML4 colors and others are treated as #RRGGBB.
Now mathml can import #RGB colors.
"
in 2020

Change-Id: Iac006383146afaa62775e6e76fa203925dce51d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152585
Reviewed-by: Julien Nabet 
Tested-by: Jenkins

diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index 8c0beae1aa23..fcda4538fe36 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -3026,8 +3026,6 @@ starmath/inc/mathml/mathmlMo.hxx:88
 enum moOpDF operator&(enum moOpDF,enum moOpDF)
 starmath/inc/mathml/mathmlMo.hxx:98
 enum moOpDP operator&(enum moOpDP,enum moOpDP)
-starmath/inc/mathml/starmathdatabase.hxx:274
-struct SmColorTokenTableEntry 
starmathdatabase::Identify_Color_HTML(unsigned int)
 starmath/inc/mathml/starmathdatabase.hxx:294
 struct SmColorTokenTableEntry 
starmathdatabase::Identify_Color_DVIPSNAMES(unsigned int)
 starmath/inc/node.hxx:508
diff --git a/starmath/inc/mathml/starmathdatabase.hxx 
b/starmath/inc/mathml/starmathdatabase.hxx
index b4d3d6d3f8b5..cd5fe8ecdbdd 100644
--- a/starmath/inc/mathml/starmathdatabase.hxx
+++ b/starmath/inc/mathml/starmathdatabase.hxx
@@ -265,14 +265,6 @@ SmToken 
Identify_Postfix_SmXMLOperatorContext_Impl(sal_Unicode cChar);
   */
 SmColorTokenTableEntry Identify_Color_Parser(sal_uInt32 cColor);
 
-/**
-  * Identifies color from color code cColor.
-  * It will be returned with the HTML syntax.
-  * @param cColor
-  * @param parser color
-  */
-SmColorTokenTableEntry Identify_Color_HTML(sal_uInt32 cColor);
-
 /**
   * Identifies color from color code cColor.
   * It will be returned with the MATHML syntax.
diff --git a/starmath/source/mathml/starmathdatabase.cxx 
b/starmath/source/mathml/starmathdatabase.cxx
index 66bdf3f3400c..cc6614cee4f1 100644
--- a/starmath/source/mathml/starmathdatabase.cxx
+++ b/starmath/source/mathml/starmathdatabase.cxx
@@ -710,17 +710,6 @@ SmColorTokenTableEntry 
starmathdatabase::Identify_Color_Parser(sal_uInt32 cColor
 return SmColorTokenTableEntry("", TRGBA, cColor);
 }
 
-SmColorTokenTableEntry starmathdatabase::Identify_Color_HTML(sal_uInt32 cColor)
-{
-for (auto i = std::begin(aColorTokenTableHTML); i < 
std::end(aColorTokenTableHTML); ++i)
-if (i->equals(cColor))
-return i;
-if ((cColor & 0x00FF) == cColor)
-return SmColorTokenTableEntry("", TRGB, cColor);
-else
-return SmColorTokenTableEntry("", TRGBA, cColor);
-}
-
 SmColorTokenTableEntry starmathdatabase::Identify_Color_MATHML(sal_uInt32 
cColor)
 {
 for (auto i = std::begin(aColorTokenTableMATHML); i < 
std::end(aColorTokenTableMATHML); ++i)


[Libreoffice-commits] core.git: compilerplugins/clang starmath/inc starmath/source

2023-06-03 Thread Julien Nabet (via logerrit)
 compilerplugins/clang/unusedmethods.results |2 --
 starmath/inc/node.hxx   |   10 --
 starmath/source/node.cxx|   27 ---
 3 files changed, 39 deletions(-)

New commits:
commit df6e819a8f76f927bd7a568a95a535299e795a06
Author: Julien Nabet 
AuthorDate: Sat Jun 3 22:16:44 2023 +0200
Commit: Julien Nabet 
CommitDate: Sat Jun 3 23:15:02 2023 +0200

Remove unused SmStructureNode::SetSubNodesBinMo with plain pointers 
(starmath)

and keep the remaining one which uses unique_ptr

Change-Id: I0e4e4aff5c202897a27dfef97750c14c3c5736bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152581
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index b7a344496442..8c0beae1aa23 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -3034,8 +3034,6 @@ starmath/inc/node.hxx:508
 SmNode * SmStructureNode::GetSubNodeBinMo(unsigned long) const
 starmath/inc/node.hxx:533
 void SmStructureNode::SetSubNodes(SmNode *,SmNode *,SmNode *)
-starmath/inc/node.hxx:554
-void SmStructureNode::SetSubNodesBinMo(SmNode *,SmNode *,SmNode *)
 starmath/inc/nodetype.hxx:59
 _Bool starmathdatabase::isStructuralNode(enum SmNodeType)
 starmath/inc/nodetype.hxx:71
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index f162b83aa754..e0b597306509 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -543,16 +543,6 @@ public:
 void SetSubNodesBinMo(std::unique_ptr pFirst, 
std::unique_ptr pSecond,
   std::unique_ptr pThird = nullptr);
 
-/**
- * Sets subnodes, used for operators.
- * The data is reordered so the items are correctly ordered.
- * @param pFirst
- * @param pSecond
- * @param pThird
- * @return
- */
-void SetSubNodesBinMo(SmNode* pFirst, SmNode* pSecond, SmNode* pThird);
-
 /**
  * Sets subnodes.
  * @param rNodeArray
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 5beab34c731d..7a9d42bd4fe1 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -416,33 +416,6 @@ void 
SmStructureNode::SetSubNodesBinMo(std::unique_ptr pFirst, std::uniq
 ClaimPaternity();
 }
 
-void SmStructureNode::SetSubNodesBinMo(SmNode* pFirst, SmNode* pSecond, 
SmNode* pThird)
-{
-if(GetType()==SmNodeType::BinDiagonal)
-{
-size_t nSize = pSecond ? 3 : (pThird ? 2 : (pFirst ? 1 : 0));
-maSubNodes.resize( nSize );
-if (pFirst)
-maSubNodes[0] = pFirst;
-if (pSecond)
-maSubNodes[2] = pSecond;
-if (pThird)
-maSubNodes[1] = pThird;
-}
-else
-{
-size_t nSize = pThird ? 3 : (pSecond ? 2 : (pFirst ? 1 : 0));
-maSubNodes.resize( nSize );
-if (pFirst)
-maSubNodes[0] = pFirst;
-if (pSecond)
-maSubNodes[1] = pSecond;
-if (pThird)
-maSubNodes[2] = pThird;
-}
-ClaimPaternity();
-}
-
 void SmStructureNode::SetSubNodes(SmNodeArray&& rNodeArray)
 {
 maSubNodes = std::move(rNodeArray);


[Libreoffice-commits] core.git: compilerplugins/clang include/svx svx/inc svx/Library_svxcore.mk svx/source

2023-05-09 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/mergeclasses.results  |1 
 include/svx/gallery1.hxx|4 
 include/svx/galtheme.hxx|6 
 svx/Library_svxcore.mk  |1 
 svx/inc/gallerybinaryengine.hxx |  109 ---
 svx/inc/galleryfilestorage.hxx  |   85 ++
 svx/inc/galleryfilestorageentry.hxx |5 
 svx/inc/galobj.hxx  |2 
 svx/source/gallery2/gallery1.cxx|2 
 svx/source/gallery2/gallerybinaryengine.cxx |  811 
 svx/source/gallery2/galleryfilestorage.cxx  |  789 +++
 svx/source/gallery2/galleryfilestorageentry.cxx |6 
 svx/source/gallery2/galtheme.cxx|4 
 svx/source/unogallery/unogalitem.cxx|2 
 14 files changed, 886 insertions(+), 941 deletions(-)

New commits:
commit c9b0a6010e96d22844cdab6c1e8e67fbf14ab142
Author: Noel Grandin 
AuthorDate: Mon May 8 12:56:36 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue May 9 13:53:47 2023 +0200

merge GalleryFileStorage with GalleryBinaryEngine

Change-Id: Id948627873db9c646d1a81784dd16f6aa1c2063b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151553
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/mergeclasses.results 
b/compilerplugins/clang/mergeclasses.results
index a1e8c6be6e3d..9d4e9d583926 100644
--- a/compilerplugins/clang/mergeclasses.results
+++ b/compilerplugins/clang/mergeclasses.results
@@ -54,7 +54,6 @@ merge FmRecordCountListener_Base with FmRecordCountListener
 merge FmXDisposeListener with DisposeListenerGridBridge
 merge FmXFormShell_Base_Disambiguation with FmXFormShell
 merge GLWindow with GLX11Window
-merge GalleryFileStorage with GalleryBinaryEngine
 merge GroupTable with PPTWriterBase
 merge HostDetailsContainer with DavDetailsContainer
 merge IDocumentChartDataProviderAccess with 
sw::DocumentChartDataProviderManager
diff --git a/include/svx/gallery1.hxx b/include/svx/gallery1.hxx
index 49427be4d723..6f159e3b5139 100644
--- a/include/svx/gallery1.hxx
+++ b/include/svx/gallery1.hxx
@@ -30,7 +30,7 @@
 #include 
 
 class Gallery;
-class GalleryBinaryEngine;
+class GalleryFileStorage;
 class GalleryFileStorageEntry;
 class GalleryObjectCollection;
 class GalleryStorageLocations;
@@ -61,7 +61,7 @@ public:
 
 GalleryTheme* createGalleryTheme(Gallery* pGallery);
 
-std::unique_ptr 
createGalleryStorageEngine(GalleryObjectCollection& mrGalleryObjectCollection);
+std::unique_ptr 
createGalleryStorageEngine(GalleryObjectCollection& mrGalleryObjectCollection);
 
 const OUString& GetThemeName() const { return aName; }
 
diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx
index e3ef7f7d991f..e14372066f51 100644
--- a/include/svx/galtheme.hxx
+++ b/include/svx/galtheme.hxx
@@ -31,7 +31,7 @@
 #include 
 #include 
 
-class GalleryBinaryEngine;
+class GalleryFileStorage;
 class GalleryThemeEntry;
 class SgaObject;
 class SotStorageStream;
@@ -57,7 +57,7 @@ class SVXCORE_DLLPUBLIC GalleryTheme final : public 
SfxBroadcaster
 
 private:
 
-std::unique_ptr mpGalleryStorageEngine;
+std::unique_ptr mpGalleryStorageEngine;
 GalleryObjectCollection maGalleryObjectCollection;
 Gallery*pParent;
 GalleryThemeEntry*  pThm;
@@ -67,7 +67,7 @@ private:
 boolbDragging;
 boolbAbortActualize;
 
-const std::unique_ptr& getGalleryStorageEngine() 
const { return mpGalleryStorageEngine; }
+const std::unique_ptr& getGalleryStorageEngine() const 
{ return mpGalleryStorageEngine; }
 
 SAL_DLLPRIVATE void ImplSetModified( bool bModified );
 SAL_DLLPRIVATE void ImplBroadcast(sal_uInt32 nUpdatePos);
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 8dd99ef5484b..b0ce4a15165f 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -204,7 +204,6 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
 svx/source/gallery2/galobj \
 svx/source/gallery2/galtheme \
 svx/source/gallery2/GalleryControl \
-svx/source/gallery2/gallerybinaryengine \
 svx/source/gallery2/galleryobjectcollection \
 svx/source/gallery2/galleryfilestorage \
 svx/source/gallery2/galleryfilestorageentry \
diff --git a/svx/inc/gallerybinaryengine.hxx b/svx/inc/gallerybinaryengine.hxx
deleted file mode 100644
index f1f221e34447..
--- a/svx/inc/gallerybinaryengine.hxx
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file i

[Libreoffice-commits] core.git: compilerplugins/clang include/svx svx/inc svx/Library_svxcore.mk svx/source

2023-05-09 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/mergeclasses.results   |1 
 include/svx/gallery1.hxx |6 
 svx/Library_svxcore.mk   |1 
 svx/inc/gallerybinaryengineentry.hxx |   66 
 svx/inc/galleryfilestorageentry.hxx  |   42 +
 svx/source/gallery2/galini.cxx   |4 
 svx/source/gallery2/gallery1.cxx |8 -
 svx/source/gallery2/gallerybinaryengineentry.cxx |  181 ---
 svx/source/gallery2/galleryfilestorageentry.cxx  |  159 
 9 files changed, 207 insertions(+), 261 deletions(-)

New commits:
commit afccbe23cecc04a08281a91e02bb25dd7b0ffdcf
Author: Noel Grandin 
AuthorDate: Mon May 8 12:30:36 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue May 9 12:31:56 2023 +0200

merge GalleryFileStorageEntry with GalleryBinaryEngineEntry

Change-Id: I21b3f49cdf04b021931ab9e1171bfffa5cd76e1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151552
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/mergeclasses.results 
b/compilerplugins/clang/mergeclasses.results
index e92d1bfc19b7..a1e8c6be6e3d 100644
--- a/compilerplugins/clang/mergeclasses.results
+++ b/compilerplugins/clang/mergeclasses.results
@@ -55,7 +55,6 @@ merge FmXDisposeListener with DisposeListenerGridBridge
 merge FmXFormShell_Base_Disambiguation with FmXFormShell
 merge GLWindow with GLX11Window
 merge GalleryFileStorage with GalleryBinaryEngine
-merge GalleryFileStorageEntry with GalleryBinaryEngineEntry
 merge GroupTable with PPTWriterBase
 merge HostDetailsContainer with DavDetailsContainer
 merge IDocumentChartDataProviderAccess with 
sw::DocumentChartDataProviderManager
diff --git a/include/svx/gallery1.hxx b/include/svx/gallery1.hxx
index 7b6fe2b23dc5..49427be4d723 100644
--- a/include/svx/gallery1.hxx
+++ b/include/svx/gallery1.hxx
@@ -31,7 +31,7 @@
 
 class Gallery;
 class GalleryBinaryEngine;
-class GalleryBinaryEngineEntry;
+class GalleryFileStorageEntry;
 class GalleryObjectCollection;
 class GalleryStorageLocations;
 class GalleryTheme;
@@ -40,7 +40,7 @@ class SVXCORE_DLLPUBLIC GalleryThemeEntry
 {
 private:
 
-std::unique_ptr mpGalleryStorageEngineEntry;
+std::unique_ptr mpGalleryStorageEngineEntry;
 OUStringaName;
 sal_uInt32  nId;
 boolbReadOnly;
@@ -55,7 +55,7 @@ public:
sal_uInt32 nId, bool 
bThemeNameFromResource );
 ~GalleryThemeEntry();
 
-const std::unique_ptr& 
getGalleryStorageEngineEntry() const { return mpGalleryStorageEngineEntry; }
+const std::unique_ptr& 
getGalleryStorageEngineEntry() const { return mpGalleryStorageEngineEntry; }
 
 GalleryStorageLocations& getGalleryStorageLocations() const;
 
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 757244f5f6d0..8dd99ef5484b 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -205,7 +205,6 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
 svx/source/gallery2/galtheme \
 svx/source/gallery2/GalleryControl \
 svx/source/gallery2/gallerybinaryengine \
-svx/source/gallery2/gallerybinaryengineentry \
 svx/source/gallery2/galleryobjectcollection \
 svx/source/gallery2/galleryfilestorage \
 svx/source/gallery2/galleryfilestorageentry \
diff --git a/svx/inc/gallerybinaryengineentry.hxx 
b/svx/inc/gallerybinaryengineentry.hxx
deleted file mode 100644
index e21d6a64fea7..
--- a/svx/inc/gallerybinaryengineentry.hxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#pragma once
-
-#include 
-#include 
-#include "gallerybinaryengine.hxx"
-#include "gallerystoragelocations.hxx"
-#include "galleryfilestorageentry.hxx"
-
-class GalleryObjectCollection;
-class GalleryBinaryEngine;
-
-class GalleryBinaryEngineEntry final : public GalleryFileStorageEntry
-{
-private:
-std::unique_ptr mpGalleryStorageLocations;
-
-public:
-GalleryBinaryEngineEntry();
-static void CreateUniqueUR

[Libreoffice-commits] core.git: compilerplugins/clang svx/inc svx/Library_svxcore.mk svx/qa svx/source

2023-05-09 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/mergeclasses.results|1 
 svx/Library_svxcore.mk|3 
 svx/inc/gallerybinaryengine.hxx   |8 -
 svx/inc/gallerybinaryengineentry.hxx  |7 -
 svx/inc/gallerybinarystoragelocations.hxx |   52 
 svx/inc/gallerystoragelocations.hxx   |   26 +-
 svx/qa/unit/gallery/test_gallery.cxx  |   13 +--
 svx/source/gallery2/gallerybinaryengine.cxx   |2 
 svx/source/gallery2/gallerybinaryengineentry.cxx  |5 -
 svx/source/gallery2/gallerybinarystoragelocations.cxx |   75 --
 svx/source/gallery2/gallerystoragelocations.cxx   |   53 
 11 files changed, 91 insertions(+), 154 deletions(-)

New commits:
commit 440c23ee678442fc64aa9fcca13b137738e10a04
Author: Noel Grandin 
AuthorDate: Mon May 8 12:18:42 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue May 9 09:11:48 2023 +0200

merge GalleryStorageLocations with GalleryBinaryStorageLocations

Change-Id: Icf9a942047f212132d7b543cd1b1a857f8f95223
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151551
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/mergeclasses.results 
b/compilerplugins/clang/mergeclasses.results
index 7b002c436974..e92d1bfc19b7 100644
--- a/compilerplugins/clang/mergeclasses.results
+++ b/compilerplugins/clang/mergeclasses.results
@@ -56,7 +56,6 @@ merge FmXFormShell_Base_Disambiguation with FmXFormShell
 merge GLWindow with GLX11Window
 merge GalleryFileStorage with GalleryBinaryEngine
 merge GalleryFileStorageEntry with GalleryBinaryEngineEntry
-merge GalleryStorageLocations with GalleryBinaryStorageLocations
 merge GroupTable with PPTWriterBase
 merge HostDetailsContainer with DavDetailsContainer
 merge IDocumentChartDataProviderAccess with 
sw::DocumentChartDataProviderManager
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 270a2056ef60..757244f5f6d0 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -206,11 +206,10 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
 svx/source/gallery2/GalleryControl \
 svx/source/gallery2/gallerybinaryengine \
 svx/source/gallery2/gallerybinaryengineentry \
-svx/source/gallery2/gallerystoragelocations \
-svx/source/gallery2/gallerybinarystoragelocations \
 svx/source/gallery2/galleryobjectcollection \
 svx/source/gallery2/galleryfilestorage \
 svx/source/gallery2/galleryfilestorageentry \
+svx/source/gallery2/gallerystoragelocations \
 svx/source/items/chrtitem \
 svx/source/items/clipfmtitem \
 svx/source/items/customshapeitem \
diff --git a/svx/inc/gallerybinaryengine.hxx b/svx/inc/gallerybinaryengine.hxx
index 2863e8dc9d69..f1f221e34447 100644
--- a/svx/inc/gallerybinaryengine.hxx
+++ b/svx/inc/gallerybinaryengine.hxx
@@ -22,7 +22,7 @@
 #include 
 #include 
 #include 
-#include "gallerybinarystoragelocations.hxx"
+#include "gallerystoragelocations.hxx"
 #include "galleryfilestorage.hxx"
 #include 
 #include 
@@ -32,8 +32,6 @@
 
 #include 
 
-class GalleryStorageLocations;
-class GalleryBinaryStorageLocations;
 class GalleryObjectCollection;
 class SgaObjectSvDraw;
 class SgaObjectBmp;
@@ -48,7 +46,7 @@ class SVXCORE_DLLPUBLIC GalleryBinaryEngine final : public 
GalleryFileStorage
 {
 private:
 tools::SvRef m_aSvDrawStorageRef;
-const GalleryBinaryStorageLocations& maGalleryStorageLocations;
+const GalleryStorageLocations& maGalleryStorageLocations;
 GalleryObjectCollection& mrGalleryObjectCollection;
 bool mbReadOnly;
 OUString m_aDestDir;
@@ -60,7 +58,7 @@ private:
 const INetURLObject& GetThmURL() const { return 
maGalleryStorageLocations.GetThmURL(); }
 
 public:
-GalleryBinaryEngine(const GalleryBinaryStorageLocations& 
rGalleryStorageLocations,
+GalleryBinaryEngine(const GalleryStorageLocations& 
rGalleryStorageLocations,
 GalleryObjectCollection& rGalleryObjectCollection, 
bool bReadOnly);
 SAL_DLLPRIVATE ~GalleryBinaryEngine();
 
diff --git a/svx/inc/gallerybinaryengineentry.hxx 
b/svx/inc/gallerybinaryengineentry.hxx
index 8b5b3d3f607b..e21d6a64fea7 100644
--- a/svx/inc/gallerybinaryengineentry.hxx
+++ b/svx/inc/gallerybinaryengineentry.hxx
@@ -22,17 +22,16 @@
 #include 
 #include 
 #include "gallerybinaryengine.hxx"
-#include "gallerybinarystoragelocations.hxx"
+#include "gallerystoragelocations.hxx"
 #include "galleryfilestorageentry.hxx"
 
-class GalleryBinaryStorageLocations;
 class GalleryObjectCollection;
 class GalleryBinaryEngine;
 
 class GalleryBinaryEngineEntry final : public GalleryFileStorageEntry
 {
 private:
-std::unique_ptr mpGalleryStorageLocations;
+std::unique_ptr mpGalleryStorageLocations;
 
 public:
 GalleryBinaryEngineEntry();
@@ -45,7 +44,7 @@ public:
 const INetURLObject& GetSdvURL() const { return 
mpGalleryStorageLocations->Ge

[Libreoffice-commits] core.git: compilerplugins/clang

2023-05-04 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/unnecessarygetstr.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 671d1c6cd14b28b5960ad56086299bd69533dfd8
Author: Stephan Bergmann 
AuthorDate: Thu May 4 15:28:35 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Fri May 5 08:05:09 2023 +0200

Adapt loplugin:unnecessarygetstr to libc++

> [CPT] compilerplugins/clang/test/unnecessarygetstr.cxx
> error: 'error' diagnostics expected but not seen:
>   File compilerplugins/clang/test/unnecessarygetstr.cxx Line 119 
(directive at compilerplugins/clang/test/unnecessarygetstr.cxx:118): 
unnecessary call to 'getStr' when passing to string constructor 
[loplugin:unnecessarygetstr]

because libcxx's  declares

> template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0>
> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const 
_CharT* __s)

and

> template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0>
> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const 
_CharT* __s, const _Allocator& __a)

instead of single

> basic_string(const charT* s, const Allocator& a = Allocator())

Change-Id: I8d64b140618337adfba01c02d5d02fda093628f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151392
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/unnecessarygetstr.cxx 
b/compilerplugins/clang/unnecessarygetstr.cxx
index 7a9610f7618b..681070356108 100644
--- a/compilerplugins/clang/unnecessarygetstr.cxx
+++ b/compilerplugins/clang/unnecessarygetstr.cxx
@@ -61,7 +61,7 @@ public:
 auto tc = loplugin::TypeCheck(constructExpr->getType());
 if (tc.ClassOrStruct("basic_string").StdNamespace())
 {
-if (constructExpr->getNumArgs() == 2)
+if (constructExpr->getNumArgs() == 1 || 
constructExpr->getNumArgs() == 2)
 checkForGetStr(constructExpr->getArg(0), "string constructor");
 }
 else if (tc.ClassOrStruct("basic_string_view").StdNamespace())


[Libreoffice-commits] core.git: compilerplugins/clang

2023-05-04 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/rangedforcopy.cxx  |   10 ++
 compilerplugins/clang/test/rangedforcopy.cxx |   10 ++
 2 files changed, 20 insertions(+)

New commits:
commit cd3f8acc4dc803fef4453ae31037eba15acfefa7
Author: Stephan Bergmann 
AuthorDate: Thu May 4 15:33:00 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Thu May 4 19:09:55 2023 +0200

Adapt loplugin:randedforcopy to libc++ std::vector

Seen unhelpful

> sc/source/core/data/dpoutput.cxx:882:10: error: Loop variable passed by 
value, pass by reference instead, e.g. 'const const reference&' 
[loplugin:rangedforcopy]
> for (const auto bCompact: aRowCompactFlags)
>  ^~~~

on macOS

Change-Id: I9854e2498950951efc640bf31741229631e00e87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151393
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/rangedforcopy.cxx 
b/compilerplugins/clang/rangedforcopy.cxx
index b0ab6bf35027..2de4766dab04 100644
--- a/compilerplugins/clang/rangedforcopy.cxx
+++ b/compilerplugins/clang/rangedforcopy.cxx
@@ -12,6 +12,7 @@
 #include 
 #include 
 
+#include "check.hxx"
 #include "plugin.hxx"
 #include "clang/AST/CXXInheritance.h"
 
@@ -54,6 +55,15 @@ bool RangedForCopy::VisitCXXForRangeStmt( const 
CXXForRangeStmt* stmt )
 const QualType type = varDecl->getType();
 if (type->isRecordType() && !type->isReferenceType() && 
!type->isPointerType())
 {
+if 
(loplugin::TypeCheck(type).Class("__bit_const_reference").StdNamespace())
+{
+// With libc++ without 
_LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL,
+// iterating over a const std::vector non-compliantly uses a 
variable of some
+// internal __bit_const_reference class type, rather than of type 
bool (see
+//  "[libc++] Change
+// vector::const_iterator::reference to bool in ABIv2"):
+return true;
+}
 std::string name = type.getAsString();
 report(
DiagnosticsEngine::Warning,
diff --git a/compilerplugins/clang/test/rangedforcopy.cxx 
b/compilerplugins/clang/test/rangedforcopy.cxx
index f4346b18111d..e9a836e2489c 100644
--- a/compilerplugins/clang/test/rangedforcopy.cxx
+++ b/compilerplugins/clang/test/rangedforcopy.cxx
@@ -7,6 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
+
 struct S
 {
 int i1;
@@ -27,4 +29,12 @@ void f(S const (&a)[2])
 }
 }
 
+void f(std::vector const& v)
+{
+for (auto b : v)
+{
+(void)b;
+}
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


[Libreoffice-commits] core.git: compilerplugins/clang connectivity/source desktop/qa desktop/source lingucomponent/source lotuswordpro/source sc/qa sd/qa tools/source vcl/source

2023-04-24 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/test/unnecessarygetstr.cxx |   10 ++
 compilerplugins/clang/unnecessarygetstr.cxx  |   71 ---
 connectivity/source/commontools/dbconversion.cxx |6 -
 desktop/qa/desktop_lib/test_desktop_lib.cxx  |6 -
 desktop/source/lib/init.cxx  |   10 +-
 lingucomponent/source/languageguessing/guesslang.cxx |   16 ++--
 lotuswordpro/source/filter/xfilter/xfutil.cxx|4 -
 sc/qa/unit/tiledrendering/tiledrendering.cxx |   12 +--
 sd/qa/unit/tiledrendering/tiledrendering.cxx |6 -
 tools/source/generic/color.cxx   |4 -
 vcl/source/control/field2.cxx|4 -
 vcl/source/gdi/mtfxmldump.cxx|8 +-
 12 files changed, 93 insertions(+), 64 deletions(-)

New commits:
commit dba55c304a330a355147a39e53ec4c7cf5c5c3f5
Author: Noel Grandin 
AuthorDate: Mon Apr 24 11:01:43 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Apr 24 12:45:22 2023 +0200

loplugin:unnecessarygetstr extend to createFromAscii

idea from mike kaganski

Change-Id: I0ecb9cad091d7a048d2ddae73165bf22748f3872
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150907
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/test/unnecessarygetstr.cxx 
b/compilerplugins/clang/test/unnecessarygetstr.cxx
index 12905ec5d233..68ed153649ad 100644
--- a/compilerplugins/clang/test/unnecessarygetstr.cxx
+++ b/compilerplugins/clang/test/unnecessarygetstr.cxx
@@ -85,4 +85,14 @@ void test3(Foo2& foo)
 }
 }
 
+namespace test4
+{
+void test()
+{
+std::string s;
+// expected-error@+1 {{unnecessary call to 'c_str' when passing to 
OUString::createFromAscii [loplugin:unnecessarygetstr]}}
+OUString::createFromAscii(s.c_str());
+}
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/compilerplugins/clang/unnecessarygetstr.cxx 
b/compilerplugins/clang/unnecessarygetstr.cxx
index 66f2fa2851fe..3caf3776e5f7 100644
--- a/compilerplugins/clang/unnecessarygetstr.cxx
+++ b/compilerplugins/clang/unnecessarygetstr.cxx
@@ -14,6 +14,7 @@
 
 #include "check.hxx"
 #include "plugin.hxx"
+#include "config_clang.h"
 
 // Find matches of
 //
@@ -82,39 +83,57 @@ public:
 auto const tc1 = 
loplugin::TypeCheck(cxxConstruct->getConstructor()->getParent());
 if (!(tc1.ClassOrStruct("basic_string_view").StdNamespace()))
 continue;
-auto e = 
dyn_cast(cxxConstruct->getArg(0)->IgnoreImplicit());
-if (!e)
-continue;
-auto const t = e->getObjectType();
-auto const tc2 = loplugin::TypeCheck(t);
-if (tc2.Class("OString").Namespace("rtl").GlobalNamespace()
-|| tc2.Class("OUString").Namespace("rtl").GlobalNamespace()
-|| 
tc2.Class("OStringBuffer").Namespace("rtl").GlobalNamespace()
-|| 
tc2.Class("OUStringBuffer").Namespace("rtl").GlobalNamespace()
-|| 
tc2.ClassOrStruct("StringNumber").Namespace("rtl").GlobalNamespace())
-{
-if 
(loplugin::DeclCheck(e->getMethodDecl()).Function("getStr"))
-report(DiagnosticsEngine::Warning,
-   "unnecessary call to 'getStr' when passing to 
string_view arg",
-   e->getExprLoc())
-<< e->getSourceRange();
-}
-else if (tc2.Class("basic_string").StdNamespace())
-{
-if 
(loplugin::DeclCheck(e->getMethodDecl()).Function("c_str"))
-report(DiagnosticsEngine::Warning,
-   "unnecessary call to 'c_str' when passing to 
string_view arg",
-   e->getExprLoc())
-<< e->getSourceRange();
-}
+checkForGetStr(cxxConstruct->getArg(0), "string_view arg");
 }
 }
+if (loplugin::DeclCheck(func)
+.Function("createFromAscii")
+.Class("OUString")
+.Namespace("rtl"))
+{
+checkForGetStr(callExpr->getArg(0), "OUString::createFromAscii");
+}
 return true;
 }
 
-bool preRun() override { return compiler.getLangOpts().CPlusPlus; }
+bool preRun() override
+{
+if (!compiler.getLangOpts().CPlusPlus)
+return false;
+std::string fn(handler.getMainFileName());
+loplugin::normalizeDotDotInFilePath(fn);
+if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/"))
+return false;
+return true;
+}
 
 private:
+void checkForGetStr(Expr* arg, const char* msg)
+{
+auto e = dyn_cast(arg->IgnoreImplicit());
+if (!e)
+

[Libreoffice-commits] core.git: compilerplugins/clang

2023-04-17 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/stringadd.cxx  |   14 ++
 compilerplugins/clang/test/stringadd.cxx |   15 +++
 2 files changed, 25 insertions(+), 4 deletions(-)

New commits:
commit 856fc80439c23d4473930b92e201ebd33b20fc8b
Author: Stephan Bergmann 
AuthorDate: Mon Apr 17 09:09:14 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Apr 17 10:48:52 2023 +0200

loplugin:stringadd: Adapt O[U]StringBuffer ctor detection for Windows

...where sal_Int32 is not int, so a literal argument like 16 actually calls 
the

  O[U]StringBuffer(T length, std::enable_if_t, int> = 
0)

overload

Change-Id: I1d151efbc723cbfa76690e02491b05a9a4147e91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150473
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/stringadd.cxx 
b/compilerplugins/clang/stringadd.cxx
index bf00ef2dc1d9..022bffa804fc 100644
--- a/compilerplugins/clang/stringadd.cxx
+++ b/compilerplugins/clang/stringadd.cxx
@@ -160,10 +160,16 @@ StringAdd::VarDeclAndSummands 
StringAdd::findAssignOrAdd(Stmt const* stmt)
 // ignore the constructor that gives the buffer a default 
size
 if (auto cxxConstructor = 
dyn_cast(varDeclLHS->getInit()))
 if (auto constructorDecl = 
cxxConstructor->getConstructor())
-if (constructorDecl->getNumParams() == 1
-&& 
loplugin::TypeCheck(constructorDecl->getParamDecl(0)->getType())
-   .Typedef("sal_Int32")
-   .GlobalNamespace())
+if ((constructorDecl->getNumParams() == 1
+ && 
loplugin::TypeCheck(constructorDecl->getParamDecl(0)->getType())
+.Typedef("sal_Int32")
+.GlobalNamespace())
+|| (constructorDecl->getNumParams() == 2
+&& 
constructorDecl->getParamDecl(0)->getType()->isIntegralType(
+   compiler.getASTContext())
+&& constructorDecl->getParamDecl(1)
+   ->getType()
+   
->isSpecificBuiltinType(BuiltinType::Int)))
 return {};
 }
 return { varDeclLHS, 
(isCompileTimeConstant(varDeclLHS->getInit())
diff --git a/compilerplugins/clang/test/stringadd.cxx 
b/compilerplugins/clang/test/stringadd.cxx
index 3ac2bb60ebe8..7c1193643303 100644
--- a/compilerplugins/clang/test/stringadd.cxx
+++ b/compilerplugins/clang/test/stringadd.cxx
@@ -297,4 +297,19 @@ void f1()
 }
 }
 
+namespace test14
+{
+void f1()
+{
+OUStringBuffer b(16);
+b.append("...");
+}
+
+void f2(long long n)
+{
+OUStringBuffer b(n);
+b.append("...");
+}
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


[Libreoffice-commits] core.git: compilerplugins/clang

2023-04-17 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/test/stringview.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5955a453165f6d8117b44e8ad37fb5ca0134add4
Author: Stephan Bergmann 
AuthorDate: Mon Apr 17 09:13:26 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Apr 17 10:23:27 2023 +0200

Adapt expected diagnostics to Windows

...where std::size_t is unsigned long long

Change-Id: Icfe3927deaf4ffe57ac218ec109864852913cf31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150474
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/test/stringview.cxx 
b/compilerplugins/clang/test/stringview.cxx
index 73032c4273dd..b7284cd5ed57 100644
--- a/compilerplugins/clang/test/stringview.cxx
+++ b/compilerplugins/clang/test/stringview.cxx
@@ -164,7 +164,7 @@ void f5(char const* s1, sal_Int32 n1, char16_t const* s2, 
sal_Int32 n2, OString
 call_view(OString(l1));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed 
from a 'std::string_view' (aka 'basic_string_view'), pass a 
'std::string_view' [loplugin:stringview]}}
 call_view(OString(std::string_view("foo")));
-// expected-error-re@+1 {{instead of an {{'(rtl::)?}}OString' constructed 
from a {{'(rtl::)?StringNumber'|'OStringNumber<33>' \(aka 
'StringNumber'\)}}, pass a 'std::string_view' 
[loplugin:stringview]}}
+// expected-error-re@+1 {{instead of an {{'(rtl::)?}}OString' constructed 
from a {{'(rtl::)?StringNumber'|'OStringNumber<33>' \(aka 
'StringNumber'\)}}, pass a 'std::string_view' 
[loplugin:stringview]}}
 call_view(OString(OString::number(0)));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed 
from a 'OStringConcat<{{(rtl::)?}}OString, {{(rtl::)?}}OString>' (aka 
'StringConcat'), pass a 'std::string_view' 
via 'rtl::Concat2View' [loplugin:stringview]}}
 call_view(OString(s3 + s3));
@@ -188,7 +188,7 @@ void f5(char const* s1, sal_Int32 n1, char16_t const* s2, 
sal_Int32 n2, OString
 call_view(OUString(l2));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a 'std::u16string_view' (aka 'basic_string_view'), pass a 
'std::u16string_view' [loplugin:stringview]}}
 call_view(OUString(std::u16string_view(u"foo")));
-// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a {{'(rtl::)?StringNumber'|'OUStringNumber<33>' \(aka 
'StringNumber'\)}}, pass a 'std::u16string_view' 
[loplugin:stringview]}}
+// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a {{'(rtl::)?StringNumber'|'OUStringNumber<33>' \(aka 
'StringNumber'\)}}, pass a 'std::u16string_view' 
[loplugin:stringview]}}
 call_view(OUString(OUString::number(0)));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a 'OUStringConcat<{{(rtl::)?}}OUString, {{(rtl::)?}}OUString>' (aka 
'StringConcat'), pass a 
'std::u16string_view' via 'rtl::Concat2View' [loplugin:stringview]}}
 call_view(OUString(s4 + s4));


[Libreoffice-commits] core.git: compilerplugins/clang connectivity/source dbaccess/source editeng/qa i18npool/source l10ntools/source oox/source reportdesign/source starmath/source svtools/source svx/

2023-04-12 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/stringview.cxx  |   16 +---
 connectivity/source/drivers/firebird/Connection.cxx   |2 +-
 dbaccess/source/ui/dlg/ConnectionPage.cxx |8 
 dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx |8 
 dbaccess/source/ui/dlg/detailpages.cxx|6 +++---
 editeng/qa/unit/core-test.cxx |2 +-
 i18npool/source/textconversion/textconversion_zh.cxx  |4 ++--
 l10ntools/source/xmlparse.cxx |3 ++-
 oox/source/dump/dumperbase.cxx|2 +-
 reportdesign/source/filter/xml/xmlGroup.cxx   |2 +-
 starmath/source/edit.cxx  |4 ++--
 svtools/source/dialogs/PlaceEditDialog.cxx|   12 ++--
 svx/source/tbxctrls/tbcontrl.cxx  |3 ++-
 sw/source/core/access/AccessibilityCheck.cxx  |3 ++-
 sw/source/core/layout/fly.cxx |3 ++-
 vcl/source/control/field.cxx  |4 ++--
 vcl/source/treelist/svtabbx.cxx   |6 +++---
 xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx |2 +-
 xmloff/source/forms/propertyimport.cxx|4 ++--
 19 files changed, 46 insertions(+), 48 deletions(-)

New commits:
commit c45bc08dc6e64352e11cf632b8ad868c312a62fe
Author: Noel Grandin 
AuthorDate: Wed Apr 12 08:29:04 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Apr 12 12:57:22 2023 +0200

loplugin:stringview whitelist getLength and isEmpty

Change-Id: I38f3410c0b25ff579879b9de1f266af4d8fd51e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150256
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/stringview.cxx 
b/compilerplugins/clang/stringview.cxx
index b5d533b115cb..d59d1dc68555 100644
--- a/compilerplugins/clang/stringview.cxx
+++ b/compilerplugins/clang/stringview.cxx
@@ -43,16 +43,9 @@ public:
 bool preRun() override
 {
 auto const fn = handler.getMainFileName();
-return !(
-loplugin::isSamePathname(fn, SRCDIR 
"/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx")
-|| loplugin::isSamePathname(fn, SRCDIR 
"/sal/qa/rtl/strings/test_ostring_concat.cxx")
-|| loplugin::isSamePathname(fn, SRCDIR 
"/sal/qa/rtl/strings/test_oustring_concat.cxx")
-|| loplugin::isSamePathname(fn, SRCDIR 
"/sal/qa/rtl/oustring/rtl_OUString2.cxx")
-|| loplugin::isSamePathname(fn, SRCDIR 
"/sal/qa/rtl/strings/test_oustring_compare.cxx")
-|| loplugin::isSamePathname(fn,
-SRCDIR 
"/sal/qa/rtl/strings/test_oustring_startswith.cxx")
-|| loplugin::isSamePathname(fn, SRCDIR
-
"/sal/qa/rtl/strings/test_strings_defaultstringview.cxx"));
+return !(loplugin::isSamePathname(fn, SRCDIR 
"/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx")
+ || loplugin::hasPathnamePrefix(fn, SRCDIR 
"/sal/qa/rtl/strings/")
+ || loplugin::hasPathnamePrefix(fn, SRCDIR 
"/sal/qa/rtl/oustring/"));
 }
 
 virtual void run() override
@@ -368,7 +361,8 @@ bool StringView::VisitCXXMemberCallExpr(CXXMemberCallExpr 
const* expr)
 || dc.Function("toDouble") || dc.Function("equalsAscii") || 
dc.Function("equalsAsciiL")
 || dc.Function("equalsIgnoreAsciiCase") || 
dc.Function("compareToIgnoreAsciiCase")
 || dc.Function("matchIgnoreAsciiCase") || dc.Function("trim")
-|| dc.Function("startsWith") || dc.Function("endsWith") || 
dc.Function("match"))
+|| dc.Function("startsWith") || dc.Function("endsWith") || 
dc.Function("match")
+|| dc.Function("isEmpty") || dc.Function("getLength"))
 {
 handleSubExprThatCouldBeView(expr->getImplicitObjectArgument());
 }
diff --git a/connectivity/source/drivers/firebird/Connection.cxx 
b/connectivity/source/drivers/firebird/Connection.cxx
index 62e54caa4468..5b8cdb7b16d6 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -196,7 +196,7 @@ void Connection::construct(const OUString& url, const 
Sequence< PropertyValue >&
 // External file AND/OR remote connection
 else if (url.startsWith("sdbc:firebird:"))
 {
-m_sFirebirdURL = url.copy(OUString("sdbc:firebird:").getLength());
+m_sFirebirdURL = url.copy(strlen("sdbc:firebird:"));
 if (m_sFirebirdURL.startsWith("file://"))
 {
 m_bIsFile = true;
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx 
b/dbaccess/source/ui/dlg/ConnectionPage.cxx
index e867ba266688..fa485a97b2df 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -204,7 +204,7 @@ namespace dbaui
 m_xJavaDr

[Libreoffice-commits] core.git: compilerplugins/clang

2023-04-11 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/test/unnecessarygetstr.cxx |8 
 compilerplugins/clang/unnecessarygetstr.cxx  |6 --
 2 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit de7ec4141d07d11330ffae8caafaa259fc8016b4
Author: Noel Grandin 
AuthorDate: Tue Apr 11 10:08:29 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Apr 11 14:19:13 2023 +0200

loplugin:unnecessarygetstr check for OUString::number facilities

These were fixed by mike kaganski, but add to the plugin to prevent
future mistakes

Change-Id: I09b4b094a74e02399e017ccf5631c0d68052344a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150215
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/test/unnecessarygetstr.cxx 
b/compilerplugins/clang/test/unnecessarygetstr.cxx
index 68175872a4ea..d04d2ca28402 100644
--- a/compilerplugins/clang/test/unnecessarygetstr.cxx
+++ b/compilerplugins/clang/test/unnecessarygetstr.cxx
@@ -30,6 +30,10 @@ void test1(Foo& foo)
 f1(true, s.getStr());
 // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
OString arg [loplugin:unnecessarygetstr]}}
 foo.f1(true, s.getStr());
+// expected-error@+1 {{unnecessary call to 'getStr' when passing to 
OString arg [loplugin:unnecessarygetstr]}}
+foo.f1(true, OString::boolean(true).getStr());
+// expected-error@+1 {{unnecessary call to 'getStr' when passing to 
OString arg [loplugin:unnecessarygetstr]}}
+foo.f1(true, OString::number(12).getStr());
 
 // avoid false +
 OString aVal = "xx";
@@ -51,5 +55,9 @@ void test2(Foo2& foo)
 f2(true, s.getStr());
 // expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view arg [loplugin:unnecessarygetstr]}}
 foo.f2(true, s.getStr());
+// expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view arg [loplugin:unnecessarygetstr]}}
+foo.f2(true, OString::boolean(true).getStr());
+// expected-error@+1 {{unnecessary call to 'getStr' when passing to 
string_view arg [loplugin:unnecessarygetstr]}}
+foo.f2(true, OString::number(12).getStr());
 }
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/compilerplugins/clang/unnecessarygetstr.cxx 
b/compilerplugins/clang/unnecessarygetstr.cxx
index 7ef5de6932d1..c72c9ae7598d 100644
--- a/compilerplugins/clang/unnecessarygetstr.cxx
+++ b/compilerplugins/clang/unnecessarygetstr.cxx
@@ -64,7 +64,8 @@ public:
 if (!(tc2.Class("OString").Namespace("rtl").GlobalNamespace()
   || 
tc2.Class("OUString").Namespace("rtl").GlobalNamespace()
   || 
tc2.Class("OStringBuffer").Namespace("rtl").GlobalNamespace()
-  || 
tc2.Class("OUStringBuffer").Namespace("rtl").GlobalNamespace()))
+  || 
tc2.Class("OUStringBuffer").Namespace("rtl").GlobalNamespace()
+  || 
tc2.ClassOrStruct("StringNumber").Namespace("rtl").GlobalNamespace()))
 continue;
 if 
(!loplugin::DeclCheck(e->getMethodDecl()).Function("getStr"))
 continue;
@@ -89,7 +90,8 @@ public:
 if (!(tc2.Class("OString").Namespace("rtl").GlobalNamespace()
   || 
tc2.Class("OUString").Namespace("rtl").GlobalNamespace()
   || 
tc2.Class("OStringBuffer").Namespace("rtl").GlobalNamespace()
-  || 
tc2.Class("OUStringBuffer").Namespace("rtl").GlobalNamespace()))
+  || 
tc2.Class("OUStringBuffer").Namespace("rtl").GlobalNamespace()
+  || 
tc2.ClassOrStruct("StringNumber").Namespace("rtl").GlobalNamespace()))
 continue;
 if 
(!loplugin::DeclCheck(e->getMethodDecl()).Function("getStr"))
 continue;


[Libreoffice-commits] core.git: compilerplugins/clang connectivity/source dbaccess/source desktop/source editeng/source fpicker/source l10ntools/source oox/source sc/source sdext/source sd/source sfx2

2023-04-09 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/test/unnecessarygetstr.cxx|   55 +++
 compilerplugins/clang/unnecessarygetstr.cxx |  122 
 connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx |3 
 dbaccess/source/ui/misc/TokenWriter.cxx |4 
 desktop/source/lib/init.cxx |4 
 editeng/source/editeng/editview.cxx |4 
 editeng/source/editeng/impedit.cxx  |6 
 fpicker/source/office/commonpicker.cxx  |2 
 l10ntools/source/localize.cxx   |2 
 oox/source/core/relationshandler.cxx|   12 +
 sc/source/core/data/documen3.cxx|4 
 sc/source/core/tool/prnsave.cxx |2 
 sc/source/filter/html/htmlexp.cxx   |   16 +-
 sc/source/filter/orcus/xmlcontext.cxx   |6 
 sc/source/ui/app/inputhdl.cxx   |   10 -
 sc/source/ui/unoobj/docuno.cxx  |2 
 sc/source/ui/view/cellsh3.cxx   |2 
 sc/source/ui/view/formatsh.cxx  |2 
 sc/source/ui/view/gridwin.cxx   |   22 +-
 sc/source/ui/view/tabcont.cxx   |2 
 sc/source/ui/view/tabvwshc.cxx  |4 
 sc/source/ui/view/viewfun2.cxx  |4 
 sd/source/ui/func/fusel.cxx |2 
 sd/source/ui/remotecontrol/Communicator.cxx |2 
 sd/source/ui/unoidl/unomodel.cxx|2 
 sd/source/ui/view/Outliner.cxx  |   14 -
 sd/source/ui/view/drviews1.cxx  |2 
 sdext/source/pdfimport/filterdet.cxx|4 
 sdext/source/pdfimport/wrapper/wrapper.cxx  |4 
 sfx2/source/appl/openuriexternally.cxx  |2 
 sfx2/source/appl/sfxhelp.cxx|4 
 sfx2/source/control/unoctitm.cxx|2 
 sfx2/source/doc/guisaveas.cxx   |3 
 sfx2/source/view/ipclient.cxx   |2 
 sfx2/source/view/lokhelper.cxx  |   22 +-
 solenv/CompilerTest_compilerplugins_clang.mk|1 
 starmath/source/view.cxx|4 
 svx/source/svdraw/svdedtv1.cxx  |2 
 svx/source/svdraw/svdmrkv.cxx   |2 
 svx/source/table/tablecontroller.cxx|4 
 sw/qa/extras/layout/layout3.cxx |4 
 sw/source/core/crsr/bookmark.cxx|6 
 sw/source/core/crsr/crsrsh.cxx  |4 
 sw/source/core/crsr/viscrs.cxx  |4 
 sw/source/filter/html/wrthtml.cxx   |2 
 sw/source/uibase/app/apphdl.cxx |2 
 sw/source/uibase/shells/tabsh.cxx   |4 
 sw/source/uibase/uiview/view2.cxx   |   10 -
 sw/source/uibase/uiview/viewsrch.cxx|   10 -
 sw/source/uibase/uiview/viewstat.cxx|4 
 sw/source/uibase/wrtsh/wrtsh2.cxx   |2 
 test/source/helper/transferable.cxx |2 
 test/source/lokcallback.cxx |4 
 tools/source/xml/XmlWriter.cxx  |2 
 ucb/source/ucp/ftp/ftpurl.cxx   |6 
 vcl/jsdialog/jsdialogbuilder.cxx|2 
 vcl/source/control/edit.cxx |5 
 vcl/source/window/DocWindow.cxx |3 
 xmlhelp/source/cxxhelp/provider/urlparameter.cxx|   13 -
 59 files changed, 314 insertions(+), 143 deletions(-)

New commits:
commit eaf071397a1ff30536616f2ed76051f77fd38ed6
Author: Noel Grandin 
AuthorDate: Fri Apr 7 10:02:18 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Apr 9 20:51:44 2023 +0200

new loplugin:unnecessarygetstr

which prevents constructing unnecessary temporaries via getStr()

Change-Id: I9ca70893a10e954b5ee0e6ad6098660ee24c2bef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150170
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/test/unnecessarygetstr.cxx 
b/compilerplugins/clang/test/unnecessarygetstr.cxx
new file mode 100644
index ..68175872a4ea
--- /dev/null
+++ b/compilerplugins/clang/test/unnecessarygetstr.cxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one 

[Libreoffice-commits] core.git: compilerplugins/clang l10ntools/source vcl/source

2023-04-06 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/collapseif.cxx |   24 -
 compilerplugins/clang/plugin.cxx |   26 ++
 compilerplugins/clang/plugin.hxx |2 
 compilerplugins/clang/stringadd.cxx  |   93 +++---
 compilerplugins/clang/test/stringadd.cxx |  104 +
 l10ntools/source/localize.cxx|   20 +---
 vcl/source/gdi/pdfwriter_impl.cxx|  126 +++
 7 files changed, 247 insertions(+), 148 deletions(-)

New commits:
commit bd17c9c9495f555ea27f7debfabeb2407ac2b9b6
Author: Noel Grandin 
AuthorDate: Tue Mar 14 08:50:39 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Apr 6 13:51:06 2023 +0200

loplugin:stringadd also check O[U]StringBuffers

For similar code sequences that can be improved.

Also move containsComment from collapseif plugin code to
plugin.cxx so we can use it from stringadd.

Change-Id: Ie07d9aedf2c31cb0b2080e1b8584294d7046a8e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149217
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/collapseif.cxx 
b/compilerplugins/clang/collapseif.cxx
index c50bf3352440..aecf10f5e0e9 100644
--- a/compilerplugins/clang/collapseif.cxx
+++ b/compilerplugins/clang/collapseif.cxx
@@ -38,7 +38,6 @@ public:
 
 private:
 int getNoCharsInSourceCodeOfExpr(IfStmt const*);
-bool containsComment(Stmt const* stmt);
 };
 
 bool CollapseIf::VisitIfStmt(IfStmt const* ifStmt)
@@ -73,7 +72,7 @@ bool CollapseIf::VisitIfStmt(IfStmt const* ifStmt)
 
 // Sometimes there is a comment between the first and second if, so
 // merging them would make the comment more awkward to write.
-if (containsComment(ifStmt))
+if (containsComment(ifStmt->getSourceRange()))
 return true;
 
 report(DiagnosticsEngine::Warning, "nested if should be collapsed into one 
statement %0 %1",
@@ -101,27 +100,6 @@ int CollapseIf::getNoCharsInSourceCodeOfExpr(IfStmt const* 
ifStmt)
 return count;
 }
 
-bool CollapseIf::containsComment(Stmt const* stmt)
-{
-SourceManager& SM = compiler.getSourceManager();
-auto range = stmt->getSourceRange();
-SourceLocation startLoc = range.getBegin();
-SourceLocation endLoc = range.getEnd();
-char const* p1 = SM.getCharacterData(startLoc);
-char const* p2 = SM.getCharacterData(endLoc);
-p2 += Lexer::MeasureTokenLength(endLoc, SM, compiler.getLangOpts());
-
-// check for comments
-constexpr char const comment1[] = "/*";
-constexpr char const comment2[] = "//";
-if (std::search(p1, p2, comment1, comment1 + strlen(comment1)) != p2)
-return true;
-if (std::search(p1, p2, comment2, comment2 + strlen(comment2)) != p2)
-return true;
-
-return false;
-}
-
 /** Off by default because some places are a judgement call if it should be 
collapsed or not. */
 loplugin::Plugin::Registration X("collapseif", false);
 }
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index 727eda589548..94c5809ab730 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -543,6 +543,32 @@ bool 
Plugin::containsPreprocessingConditionalInclusion(SourceRange range)
 return false;
 }
 
+bool Plugin::containsComment(SourceRange range)
+{
+SourceManager& SM = compiler.getSourceManager();
+SourceLocation startLoc = range.getBegin();
+SourceLocation endLoc = range.getEnd();
+char const* p1 = SM.getCharacterData(startLoc);
+char const* p2 = SM.getCharacterData(endLoc);
+p2 += Lexer::MeasureTokenLength(endLoc, SM, compiler.getLangOpts());
+
+// when doing 'make solenv.check' we don't want the special comments in the
+// unit test files to trigger this check
+constexpr char const comment0[] = "// expected-error";
+if (std::search(p1, p2, comment0, comment0 + strlen(comment0)) != p2)
+return false;
+
+// check for comments
+constexpr char const comment1[] = "/*";
+constexpr char const comment2[] = "//";
+if (std::search(p1, p2, comment1, comment1 + strlen(comment1)) != p2)
+return true;
+if (std::search(p1, p2, comment2, comment2 + strlen(comment2)) != p2)
+return true;
+
+return false;
+}
+
 Plugin::IdenticalDefaultArgumentsResult Plugin::checkIdenticalDefaultArguments(
 Expr const * argument1, Expr const * argument2)
 {
diff --git a/compilerplugins/clang/plugin.hxx b/compilerplugins/clang/plugin.hxx
index cd272dc520f8..7980e79f7b45 100644
--- a/compilerplugins/clang/plugin.hxx
+++ b/compilerplugins/clang/plugin.hxx
@@ -102,6 +102,8 @@ protected:
 
 bool containsPreprocessingConditionalInclusion(SourceRange range);
 
+bool containsComment(SourceRange range);
+
 enum class IdenticalDefaultArgumentsResult { No, Yes, Maybe };
 IdenticalDefaultArgumentsResult checkIdenticalDefaultArguments(
 Expr const * argument1, Expr const * argument2);
diff --git a/compilerplu

[Libreoffice-commits] core.git: compilerplugins/clang

2023-04-05 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/test/stringview.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 8b4af1eb0549b6832361da85ddaa1e13be34ec76
Author: Stephan Bergmann 
AuthorDate: Wed Apr 5 10:19:41 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Apr 5 14:23:18 2023 +0200

Adapt expected test output to recent Clang

...after 90c590812eecb3a0eb2748a132e304fa6c0ea0ad "Simplify 
O(U)String::number
implementation"

Change-Id: I3f5d7b1ff41a6d55293f15f15fd67bd5d2e69d69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150045
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/test/stringview.cxx 
b/compilerplugins/clang/test/stringview.cxx
index d9e0508c0835..73032c4273dd 100644
--- a/compilerplugins/clang/test/stringview.cxx
+++ b/compilerplugins/clang/test/stringview.cxx
@@ -164,7 +164,7 @@ void f5(char const* s1, sal_Int32 n1, char16_t const* s2, 
sal_Int32 n2, OString
 call_view(OString(l1));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed 
from a 'std::string_view' (aka 'basic_string_view'), pass a 
'std::string_view' [loplugin:stringview]}}
 call_view(OString(std::string_view("foo")));
-// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed 
from a '{{(rtl::)?}}StringNumber', pass a 'std::string_view' 
[loplugin:stringview]}}
+// expected-error-re@+1 {{instead of an {{'(rtl::)?}}OString' constructed 
from a {{'(rtl::)?StringNumber'|'OStringNumber<33>' \(aka 
'StringNumber'\)}}, pass a 'std::string_view' 
[loplugin:stringview]}}
 call_view(OString(OString::number(0)));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed 
from a 'OStringConcat<{{(rtl::)?}}OString, {{(rtl::)?}}OString>' (aka 
'StringConcat'), pass a 'std::string_view' 
via 'rtl::Concat2View' [loplugin:stringview]}}
 call_view(OString(s3 + s3));
@@ -188,7 +188,7 @@ void f5(char const* s1, sal_Int32 n1, char16_t const* s2, 
sal_Int32 n2, OString
 call_view(OUString(l2));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a 'std::u16string_view' (aka 'basic_string_view'), pass a 
'std::u16string_view' [loplugin:stringview]}}
 call_view(OUString(std::u16string_view(u"foo")));
-// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a '{{(rtl::)?}}StringNumber', pass a 'std::u16string_view' 
[loplugin:stringview]}}
+// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a {{'(rtl::)?StringNumber'|'OUStringNumber<33>' \(aka 
'StringNumber'\)}}, pass a 'std::u16string_view' 
[loplugin:stringview]}}
 call_view(OUString(OUString::number(0)));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a 'OUStringConcat<{{(rtl::)?}}OUString, {{(rtl::)?}}OUString>' (aka 
'StringConcat'), pass a 
'std::u16string_view' via 'rtl::Concat2View' [loplugin:stringview]}}
 call_view(OUString(s4 + s4));


[Libreoffice-commits] core.git: compilerplugins/clang include/com include/rtl sal/qa

2023-04-05 Thread Mike Kaganski (via logerrit)
 compilerplugins/clang/stringview.cxx|4 
 compilerplugins/clang/test/stringview.cxx   |4 
 include/com/sun/star/uno/Any.h  |4 
 include/com/sun/star/uno/Any.hxx|   16 +--
 include/rtl/strbuf.hxx  |   12 +-
 include/rtl/string.hxx  |   47 +
 include/rtl/stringconcat.hxx|  132 +++-
 include/rtl/ustrbuf.hxx |   16 +--
 include/rtl/ustring.hxx |   51 +-
 sal/qa/rtl/strings/test_ostring_concat.cxx  |   10 +-
 sal/qa/rtl/strings/test_oustring_concat.cxx |   10 +-
 11 files changed, 105 insertions(+), 201 deletions(-)

New commits:
commit 90c590812eecb3a0eb2748a132e304fa6c0ea0ad
Author: Mike Kaganski 
AuthorDate: Wed Apr 5 07:22:35 2023 +0300
Commit: Mike Kaganski 
CommitDate: Wed Apr 5 09:57:04 2023 +0200

Simplify O(U)String::number implementation

Change-Id: I059f0324597a90aee01c95170a48ac5578f3caee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150037
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/compilerplugins/clang/stringview.cxx 
b/compilerplugins/clang/stringview.cxx
index 7d6d38ba3b60..4978c802c55b 100644
--- a/compilerplugins/clang/stringview.cxx
+++ b/compilerplugins/clang/stringview.cxx
@@ -196,9 +196,7 @@ void StringView::handleCXXConstructExpr(CXXConstructExpr 
const* expr)
 break;
 }
 loplugin::TypeCheck tc(t);
-if 
(tc.RvalueReference().Struct("StringNumberBase").Namespace("rtl").GlobalNamespace()
-|| 
tc.RvalueReference().Struct("OStringNumber").Namespace("rtl").GlobalNamespace()
-|| 
tc.RvalueReference().Struct("OUStringNumber").Namespace("rtl").GlobalNamespace()
+if 
(tc.RvalueReference().Struct("StringNumber").Namespace("rtl").GlobalNamespace()
 || tc.ClassOrStruct("basic_string_view").StdNamespace())
 {
 argType = expr->getArg(0)->IgnoreImplicit()->getType();
diff --git a/compilerplugins/clang/test/stringview.cxx 
b/compilerplugins/clang/test/stringview.cxx
index f1a63a058bdf..d9e0508c0835 100644
--- a/compilerplugins/clang/test/stringview.cxx
+++ b/compilerplugins/clang/test/stringview.cxx
@@ -164,7 +164,7 @@ void f5(char const* s1, sal_Int32 n1, char16_t const* s2, 
sal_Int32 n2, OString
 call_view(OString(l1));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed 
from a 'std::string_view' (aka 'basic_string_view'), pass a 
'std::string_view' [loplugin:stringview]}}
 call_view(OString(std::string_view("foo")));
-// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed 
from a 'OStringNumber', pass a 'std::string_view' [loplugin:stringview]}}
+// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed 
from a '{{(rtl::)?}}StringNumber', pass a 'std::string_view' 
[loplugin:stringview]}}
 call_view(OString(OString::number(0)));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed 
from a 'OStringConcat<{{(rtl::)?}}OString, {{(rtl::)?}}OString>' (aka 
'StringConcat'), pass a 'std::string_view' 
via 'rtl::Concat2View' [loplugin:stringview]}}
 call_view(OString(s3 + s3));
@@ -188,7 +188,7 @@ void f5(char const* s1, sal_Int32 n1, char16_t const* s2, 
sal_Int32 n2, OString
 call_view(OUString(l2));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a 'std::u16string_view' (aka 'basic_string_view'), pass a 
'std::u16string_view' [loplugin:stringview]}}
 call_view(OUString(std::u16string_view(u"foo")));
-// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a 'OUStringNumber', pass a 'std::u16string_view' 
[loplugin:stringview]}}
+// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a '{{(rtl::)?}}StringNumber', pass a 'std::u16string_view' 
[loplugin:stringview]}}
 call_view(OUString(OUString::number(0)));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a 'OUStringConcat<{{(rtl::)?}}OUString, {{(rtl::)?}}OUString>' (aka 
'StringConcat'), pass a 
'std::u16string_view' via 'rtl::Concat2View' [loplugin:stringview]}}
 call_view(OUString(s4 + s4));
diff --git a/include/com/sun/star/uno/Any.h b/include/com/sun/star/uno/Any.h
index 181b58ae4b4a..14eb9035495f 100644
--- a/include/com/sun/star/uno/Any.h
+++ b/include/com/sun/star/uno/Any.h
@@ -87,8 +87,8 @@ public:
 explicit inline Any(rtl::OUStringConcat && value);
 template
 explicit Any(rtl::OUStringConcat const &) = delete;
-template explicit inline Any(rtl::OUStringNumber && value);
-template explicit Any(rtl::OUStringNumber const &) = delete;
+template explicit inline 
Any(rtl::StringNumber && value);
+template explicit Any(rtl::StringNumber const &) = delete;
 template  explicit inline Any(const 

[Libreoffice-commits] core.git: compilerplugins/clang

2023-03-23 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/stringview.cxx  |   15 +--
 compilerplugins/clang/test/stringview.cxx |2 --
 2 files changed, 1 insertion(+), 16 deletions(-)

New commits:
commit fe3234718539ef65e384f1393cfd859cb81b8233
Author: Stephan Bergmann 
AuthorDate: Thu Mar 23 10:35:31 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Mar 23 10:51:14 2023 +

loplugin:stringview: Constructing O[U]String from O[U]StringLiteral is cheap

...so don't warn about those, as requested in the comment at


"tdf#154319: fix TOC field codes parsing"

Change-Id: I25989cd4b42bc3fe9062a8a0d6896d32a18635d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149417
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/stringview.cxx 
b/compilerplugins/clang/stringview.cxx
index feb91ccc253c..7d6d38ba3b60 100644
--- a/compilerplugins/clang/stringview.cxx
+++ b/compilerplugins/clang/stringview.cxx
@@ -196,20 +196,7 @@ void StringView::handleCXXConstructExpr(CXXConstructExpr 
const* expr)
 break;
 }
 loplugin::TypeCheck tc(t);
-if (tc.LvalueReference()
-.Const()
-.Class("OStringLiteral")
-.Namespace("rtl")
-.GlobalNamespace()
-|| tc.LvalueReference()
-   .Const()
-   .Class("OUStringLiteral")
-   .Namespace("rtl")
-   .GlobalNamespace()
-|| tc.RvalueReference()
-   .Struct("StringNumberBase")
-   .Namespace("rtl")
-   .GlobalNamespace()
+if 
(tc.RvalueReference().Struct("StringNumberBase").Namespace("rtl").GlobalNamespace()
 || 
tc.RvalueReference().Struct("OStringNumber").Namespace("rtl").GlobalNamespace()
 || 
tc.RvalueReference().Struct("OUStringNumber").Namespace("rtl").GlobalNamespace()
 || tc.ClassOrStruct("basic_string_view").StdNamespace())
diff --git a/compilerplugins/clang/test/stringview.cxx 
b/compilerplugins/clang/test/stringview.cxx
index 2ba87c13c31d..f1a63a058bdf 100644
--- a/compilerplugins/clang/test/stringview.cxx
+++ b/compilerplugins/clang/test/stringview.cxx
@@ -161,7 +161,6 @@ void f5(char const* s1, sal_Int32 n1, char16_t const* s2, 
sal_Int32 n2, OString
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed 
from a 'const char *', pass a 'std::string_view' [loplugin:stringview]}}
 call_view(OString(s1, n1));
 constexpr OStringLiteral l1("foo");
-// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed 
from a 'const {{(rtl::)?}}OStringLiteral<4>'{{( \(aka 'const 
rtl::OStringLiteral<4>'\))?}}, pass a 'std::string_view' [loplugin:stringview]}}
 call_view(OString(l1));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed 
from a 'std::string_view' (aka 'basic_string_view'), pass a 
'std::string_view' [loplugin:stringview]}}
 call_view(OString(std::string_view("foo")));
@@ -186,7 +185,6 @@ void f5(char const* s1, sal_Int32 n1, char16_t const* s2, 
sal_Int32 n2, OString
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a 'const char16_t *', pass a 'std::u16string_view' (or an 
'rtl::OUStringChar') [loplugin:stringview]}}
 call_view(OUString(s2, 1));
 constexpr OUStringLiteral l2(u"foo");
-// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a 'const {{(rtl::)?}}OUStringLiteral<4>'{{( \(aka 'const 
rtl::OUStringLiteral<4>'\))?}}, pass a 'std::u16string_view' 
[loplugin:stringview]}}
 call_view(OUString(l2));
 // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed 
from a 'std::u16string_view' (aka 'basic_string_view'), pass a 
'std::u16string_view' [loplugin:stringview]}}
 call_view(OUString(std::u16string_view(u"foo")));


[Libreoffice-commits] core.git: compilerplugins/clang cui/source i18npool/source include/sfx2 oox/source sax/source sc/source sfx2/source svl/source svtools/source sw/qa sw/source tools/source ucb/sou

2023-03-18 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/stringadd.cxx   |8 -
 cui/source/options/optgdlg.cxx|2 
 i18npool/source/breakiterator/breakiterator_unicode.cxx   |7 -
 i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |2 
 include/sfx2/bindings.hxx |9 -
 oox/source/drawingml/lineproperties.cxx   |4 
 oox/source/dump/dumperbase.cxx|4 
 oox/source/export/vmlexport.cxx   |2 
 oox/source/ole/vbamodule.cxx  |2 
 oox/source/vml/vmlinputstream.cxx |2 
 sax/source/tools/converter.cxx|6 
 sc/source/core/tool/compiler.cxx  |2 
 sc/source/core/tool/interpr2.cxx  |2 
 sc/source/filter/excel/xehelper.cxx   |8 -
 sc/source/filter/excel/xicontent.cxx  |2 
 sc/source/filter/excel/xiescher.cxx   |6 
 sc/source/filter/excel/xipivot.cxx|2 
 sc/source/filter/html/htmlexp.cxx |   28 
++--
 sc/source/filter/html/htmlexp2.cxx|   16 +-
 sc/source/filter/oox/autofilterbuffer.cxx |4 
 sc/source/filter/oox/drawingfragment.cxx  |4 
 sc/source/filter/oox/formulabase.cxx  |   12 -
 sc/source/filter/oox/numberformatsbuffer.cxx  |6 
 sc/source/filter/oox/pagesettings.cxx |6 
 sc/source/filter/oox/worksheethelper.cxx  |2 
 sc/source/ui/vba/vbahyperlink.cxx |2 
 sc/source/ui/view/cellsh1.cxx |2 
 sc/source/ui/view/editsh.cxx  |2 
 sfx2/source/appl/newhelp.cxx  |   18 --
 sfx2/source/bastyp/frmhtmlw.cxx   |   12 -
 sfx2/source/control/bindings.cxx  |8 -
 sfx2/source/view/lokhelper.cxx|2 
 svl/source/numbers/zforlist.cxx   |2 
 svtools/source/svhtml/htmlout.cxx |   65 
--
 sw/qa/uibase/fldui/fldui.cxx  |2 
 sw/source/core/fields/cellfml.cxx |8 -
 sw/source/filter/html/htmldrawwriter.cxx  |3 
 sw/source/filter/html/htmlfldw.cxx|   21 
+--
 sw/source/filter/html/htmlflywriter.cxx   |   12 -
 sw/source/filter/html/htmlplug.cxx|4 
 sw/source/filter/html/htmltabw.cxx|7 -
 sw/source/filter/ww8/rtfsdrexport.cxx |8 -
 sw/source/ui/index/swuiidxmrk.cxx |2 
 sw/source/uibase/docvw/edtwin2.cxx|2 
 tools/source/inet/inetmime.cxx|   44 
+++---
 ucb/source/ucp/ftp/ftpurl.cxx |   18 --
 vcl/unx/generic/fontmanager/fontconfig.cxx|2 
 47 files changed, 182 insertions(+), 212 deletions(-)

New commits:
commit 4b9acb48b1ea45c82dbd8df3faa35cabd3bb9b4d
Author: Noel Grandin 
AuthorDate: Fri Mar 17 19:06:45 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Mar 18 07:20:51 2023 +

loplugin:stringadd use more O[U]StringChar

Change-Id: I196e4539ad430a39415eff9d7170b33df7228230
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149062
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/stringadd.cxx 
b/compilerplugins/clang/stringadd.cxx
index f090455e280f..1bf414e6d261 100644
--- a/compilerplugins/clang/stringadd.cxx
+++ b/compilerplugins/clang/stringadd.cxx
@@ -276,10 +276,6 @@ bool StringAdd::VisitCXXMemberCallExpr(CXXMemberCallExpr 
const* methodCall)
 if (!tc1.Class("OUStringBuffer").Namespace("rtl").GlobalNamespace()
 && !tc1.Class("OStringBuffer").Namespace("rtl").GlobalNamespace())
 return true;
-auto paramType = methodDecl->getParamDecl(0)->getType();
-// char is still a pain to work with, when constructing a chained +
-if (paramType->isCharType() || 
loplugin::TypeCheck(paramType).Typedef("sal_Unicode"))
-return true;
 auto arg = methodCall->

[Libreoffice-commits] core.git: compilerplugins/clang solenv/CompilerTest_compilerplugins_clang.mk

2023-03-17 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/rangedforcopy.cxx  |5 
 compilerplugins/clang/test/rangedforcopy.cxx |   30 +++
 solenv/CompilerTest_compilerplugins_clang.mk |1 
 3 files changed, 36 insertions(+)

New commits:
commit d9f591bcd99f23d6dbf259107a9985f5e851a541
Author: Stephan Bergmann 
AuthorDate: Fri Mar 17 14:23:40 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Mar 17 16:47:09 2023 +

loplugin:rangedforcopy: Assume non-reference structured binding is 
intentional

See pending  "tdf#148008: 
do not
proceed after the marked range" for a use case.

Change-Id: Ief7cbb215068b6f5428c16a72896ef5612204128
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149056
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/rangedforcopy.cxx 
b/compilerplugins/clang/rangedforcopy.cxx
index 01124bb4d117..b0ab6bf35027 100644
--- a/compilerplugins/clang/rangedforcopy.cxx
+++ b/compilerplugins/clang/rangedforcopy.cxx
@@ -45,6 +45,11 @@ bool RangedForCopy::VisitCXXForRangeStmt( const 
CXXForRangeStmt* stmt )
 const VarDecl* varDecl = stmt->getLoopVariable();
 if (!varDecl)
   return true;
+if (isa(varDecl))
+{
+// Assume that use of a non-reference structured binding is 
intentional:
+return true;
+}
 
 const QualType type = varDecl->getType();
 if (type->isRecordType() && !type->isReferenceType() && 
!type->isPointerType())
diff --git a/compilerplugins/clang/test/rangedforcopy.cxx 
b/compilerplugins/clang/test/rangedforcopy.cxx
new file mode 100644
index ..f4346b18111d
--- /dev/null
+++ b/compilerplugins/clang/test/rangedforcopy.cxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+struct S
+{
+int i1;
+int i2;
+};
+
+void f(S const (&a)[2])
+{
+// expected-error-re@+1 {{Loop variable passed by value, pass by reference 
instead, e.g. 'const {{(struct )?}}S&' [loplugin:rangedforcopy]}}
+for (auto i : a)
+{
+(void)i;
+}
+for (auto[i1, i2] : a)
+{
+(void)i1;
+(void)i2;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk 
b/solenv/CompilerTest_compilerplugins_clang.mk
index afa7621df37d..8e31cfdfc8f8 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -57,6 +57,7 @@ $(eval $(call 
gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
 compilerplugins/clang/test/passparamsbyref \
 compilerplugins/clang/test/passstuffbyref \
 compilerplugins/clang/test/pointerbool \
+compilerplugins/clang/test/rangedforcopy \
 compilerplugins/clang/test/reducevarscope \
 compilerplugins/clang/test/redundantcast \
 compilerplugins/clang/test/redundantfcast \


[Libreoffice-commits] core.git: compilerplugins/clang

2023-03-17 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/test/unusedmember.cxx |   29 
 compilerplugins/clang/unusedmember.cxx  |4 +++
 2 files changed, 33 insertions(+)

New commits:
commit f0ff4243d45b11f372a2ed824fbb8806de9cb595
Author: Stephan Bergmann 
AuthorDate: Fri Mar 17 09:58:21 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Mar 17 10:27:01 2023 +

Avoid loplugin:unusedmember crash for templated offsetof

Change-Id: I6cbac308d2911a502381067398d72136ca2b5ae3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149045
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/test/unusedmember.cxx 
b/compilerplugins/clang/test/unusedmember.cxx
index a495b786919e..90f3051b98ee 100644
--- a/compilerplugins/clang/test/unusedmember.cxx
+++ b/compilerplugins/clang/test/unusedmember.cxx
@@ -7,6 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
+
 namespace Enum
 {
 namespace
@@ -223,6 +225,31 @@ void f()
 }
 }
 
+namespace Offsetof
+{
+namespace
+{
+struct S
+{
+int i;
+};
+}
+void f() { (void)offsetof(S, i); }
+}
+
+namespace OffsetofTemplate
+{
+namespace
+{
+template  struct S
+{
+int i;
+};
+template  void f1() { (void)offsetof(T, i); }
+}
+void f() { f1>(); }
+}
+
 int main()
 {
 (void)&Enum::f;
@@ -233,6 +260,8 @@ int main()
 (void)&Aligned::f;
 (void)&Bases::f;
 (void)&Unnamed::f;
+(void)&Offsetof::f;
+(void)&OffsetofTemplate::f;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/compilerplugins/clang/unusedmember.cxx 
b/compilerplugins/clang/unusedmember.cxx
index 7ee433ca2387..9cf40d721259 100644
--- a/compilerplugins/clang/unusedmember.cxx
+++ b/compilerplugins/clang/unusedmember.cxx
@@ -220,6 +220,10 @@ public:
 return true;
 }
 auto const t1 = expr->getTypeSourceInfo()->getType();
+if (t1->isTemplateTypeParmType())
+{
+return true;
+}
 RecordDecl const* d;
 if (auto const t2 = t1->getAs())
 {


[Libreoffice-commits] core.git: compilerplugins/clang

2023-03-16 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/simplifydynamiccast.cxx   |   18 +++---
 compilerplugins/clang/simplifypointertobool.cxx |   14 ++
 compilerplugins/clang/unnecessaryparen.cxx  |6 --
 3 files changed, 25 insertions(+), 13 deletions(-)

New commits:
commit 3a1fbb70a39cff9eea852f6709ecb63f45b29c40
Author: Stephan Bergmann 
AuthorDate: Thu Mar 16 12:06:43 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Mar 16 16:05:29 2023 +

Prepare compilerplugins for C++23 `if consteval`

...for which clang::IfStmt::getCond returns null

Change-Id: I8b86a033d52de87dedbdf6d867f2b3d3f57c1b5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148979
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/simplifydynamiccast.cxx 
b/compilerplugins/clang/simplifydynamiccast.cxx
index ffb81658d8c8..3b94f284de1e 100644
--- a/compilerplugins/clang/simplifydynamiccast.cxx
+++ b/compilerplugins/clang/simplifydynamiccast.cxx
@@ -46,15 +46,19 @@ private:
 
 bool SimplifyDynamicCast::TraverseIfStmt(IfStmt* ifStmt)
 {
-auto condExpr = ifStmt->getCond()->IgnoreParenImpCasts();
-auto dynamicCastExpr = dyn_cast(condExpr);
-if (!dynamicCastExpr)
+CXXDynamicCastExpr const* dynamicCastExpr = nullptr;
+if (Expr const* condExpr = ifStmt->getCond())
 {
-if (auto binaryOp = dyn_cast(condExpr))
+condExpr = condExpr->IgnoreParenImpCasts();
+dynamicCastExpr = dyn_cast(condExpr);
+if (!dynamicCastExpr)
 {
-if (binaryOp->getOpcode() == BO_NE)
-dynamicCastExpr
-= 
dyn_cast(binaryOp->getLHS()->IgnoreParenImpCasts());
+if (auto binaryOp = dyn_cast(condExpr))
+{
+if (binaryOp->getOpcode() == BO_NE)
+dynamicCastExpr
+= 
dyn_cast(binaryOp->getLHS()->IgnoreParenImpCasts());
+}
 }
 }
 Decl const* subExprDecl = nullptr;
diff --git a/compilerplugins/clang/simplifypointertobool.cxx 
b/compilerplugins/clang/simplifypointertobool.cxx
index 097a78e16f67..11aed0f317b7 100644
--- a/compilerplugins/clang/simplifypointertobool.cxx
+++ b/compilerplugins/clang/simplifypointertobool.cxx
@@ -131,14 +131,20 @@ public:
 
 bool PreTraverseIfStmt(IfStmt* stmt)
 {
-
contextuallyConvertedExprs_.push_back(stmt->getCond()->IgnoreParenImpCasts());
+if (auto const cond = stmt->getCond())
+{
+contextuallyConvertedExprs_.push_back(cond->IgnoreParenImpCasts());
+}
 return true;
 }
 
-bool PostTraverseIfStmt(IfStmt*, bool)
+bool PostTraverseIfStmt(IfStmt* stmt, bool)
 {
-assert(!contextuallyConvertedExprs_.empty());
-contextuallyConvertedExprs_.pop_back();
+if (stmt->getCond() != nullptr)
+{
+assert(!contextuallyConvertedExprs_.empty());
+contextuallyConvertedExprs_.pop_back();
+}
 return true;
 }
 
diff --git a/compilerplugins/clang/unnecessaryparen.cxx 
b/compilerplugins/clang/unnecessaryparen.cxx
index 11655d51389e..1d11aca4ab47 100644
--- a/compilerplugins/clang/unnecessaryparen.cxx
+++ b/compilerplugins/clang/unnecessaryparen.cxx
@@ -262,8 +262,10 @@ bool UnnecessaryParen::VisitParenExpr(const ParenExpr* 
parenExpr)
 
 bool UnnecessaryParen::VisitIfStmt(const IfStmt* ifStmt)
 {
-handleUnreachableCodeConditionParens(ifStmt->getCond());
-VisitSomeStmt(ifStmt, ifStmt->getCond(), "if");
+if (auto const cond = ifStmt->getCond()) {
+handleUnreachableCodeConditionParens(cond);
+VisitSomeStmt(ifStmt, cond, "if");
+}
 return true;
 }
 


[Libreoffice-commits] core.git: compilerplugins/clang

2023-03-16 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/unnecessaryparen.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 251135b308fa7a9a5842c0abe7128311579d603b
Author: Stephan Bergmann 
AuthorDate: Thu Mar 16 10:57:37 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Mar 16 12:41:38 2023 +

Remove empty comment

...which I had added as part of 0025fa723afb9f6a0d94b9b3185ea14da18f1bd5 
"Enable
loplugin:unnecessaryparen for integer and Boolean literals", and where I
apparently wanted to include a link but forgot to do so (and no longer know 
what
link that would have been)

Change-Id: I245725fea80ee0e13d76026656d433d5c42e4c19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148975
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/unnecessaryparen.cxx 
b/compilerplugins/clang/unnecessaryparen.cxx
index 3b9e5f14..11655d51389e 100644
--- a/compilerplugins/clang/unnecessaryparen.cxx
+++ b/compilerplugins/clang/unnecessaryparen.cxx
@@ -552,7 +552,6 @@ bool UnnecessaryParen::VisitMemberExpr(const MemberExpr* 
memberExpr)
 // in Clang's lib/Analysis/ReachableCode.cpp looks for, descending into 
certain unary and binary
 // operators):
 void UnnecessaryParen::handleUnreachableCodeConditionParens(Expr const * expr) 
{
-// Cf. :
 auto const e = ignoreAllImplicit(expr);
 if (auto const e1 = dyn_cast(e)) {
 auto const sub = e1->getSubExpr();


[Libreoffice-commits] core.git: compilerplugins/clang

2023-03-16 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/implicitboolconversion.cxx |   30 +++
 1 file changed, 25 insertions(+), 5 deletions(-)

New commits:
commit c7aee57724828c4b9d67deb930f09c494ff4d811
Author: Stephan Bergmann 
AuthorDate: Thu Mar 16 08:33:07 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Mar 16 09:15:49 2023 +

Adapt loplugin:implicitboolconversion to _G_STR_NONNULL

...from glib2-devel-2.76.0-1.fc38.x86_64, causing

> libreofficekit/source/gtk/lokdocview.cxx:390:28: error: implicit 
conversion (IntegralCast) from 'bool' to 'int' [loplugin:implicitboolconversion]
> pLOEvent->m_pCommand = g_strdup(pCommand);
>^~
> /usr/include/glib-2.0/glib/gstrfuncs.h:212:35: note: expanded from macro 
'g_strdup'
> const char *const __str = _G_STR_NONNULL (___str);
\
>   ^~~
> /usr/include/glib-2.0/glib/gstrfuncs.h:157:34: note: expanded from macro 
'_G_STR_NONNULL'
> #define _G_STR_NONNULL(x) ((x) + !(x))
>  ^~~~

Change-Id: Iec20b20992a61fd48155f338a10dc313411448f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148948
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/implicitboolconversion.cxx 
b/compilerplugins/clang/implicitboolconversion.cxx
index cdf1d762cb5b..64bc97ff4999 100644
--- a/compilerplugins/clang/implicitboolconversion.cxx
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -691,13 +691,33 @@ bool ImplicitBoolConversion::VisitImplicitCastExpr(
 if (isBool(compat::getSubExprAsWritten(expr)) && !isBool(expr)) {
 // Ignore NoOp from 'sal_Bool' (aka 'unsigned char') to 'const unsigned
 // char' in makeAny(b) with b of type sal_Bool:
-if (expr->getCastKind() != CK_NoOp) {
-if (nested.empty()) {
-reportWarning(expr);
-} else {
-nested.top().push_back(expr);
+if (expr->getCastKind() == CK_NoOp) {
+return true;
+}
+// Ignore implicit conversions from bool to int in
+//
+//   #define _G_STR_NONNULL(x) (x + !x)
+//
+// from
+// 

+// "gstrfuncs: Add back x + !x warning workaround":
+if (auto const sub = 
dyn_cast(compat::getSubExprAsWritten(expr))) {
+if (sub->getOpcode() == UO_LNot) {
+auto const l = expr->getBeginLoc();
+if (compiler.getSourceManager().isMacroBodyExpansion(l)
+&& Lexer::getImmediateMacroName(
+l, compiler.getSourceManager(), 
compiler.getLangOpts())
+== "_G_STR_NONNULL")
+{
+return true;
+}
 }
 }
+if (nested.empty()) {
+reportWarning(expr);
+} else {
+nested.top().push_back(expr);
+}
 return true;
 }
 if (auto const sub = dyn_cast(


[Libreoffice-commits] core.git: compilerplugins/clang

2023-03-08 Thread Andrea Gelmini (via logerrit)
 compilerplugins/clang/store/unique2optional.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a7952b339e73d203ba7d2b4f701d3279bb581d16
Author: Andrea Gelmini 
AuthorDate: Wed Mar 8 13:14:56 2023 +0100
Commit: Julien Nabet 
CommitDate: Thu Mar 9 06:21:24 2023 +

Fix typo

Change-Id: Ie69dd2bacbd1f1680d82ad113b707cca24950d2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148471
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/compilerplugins/clang/store/unique2optional.cxx 
b/compilerplugins/clang/store/unique2optional.cxx
index cc1dc66f193c..e4b8efa1e110 100644
--- a/compilerplugins/clang/store/unique2optional.cxx
+++ b/compilerplugins/clang/store/unique2optional.cxx
@@ -205,7 +205,7 @@ bool Unique2Optional::doDecl(const DeclaratorDecl* 
fieldDecl)
 auto paramRecordDecl = firstTemplateParamType->getAsCXXRecordDecl();
 if (paramRecordDecl)
 {
-// if the pointed-to type has a virtual destructor, then we dont know 
for sure
+// if the pointed-to type has a virtual destructor, then we don't know 
for sure
 // what size type will be stored there
 if (!paramRecordDecl->isEffectivelyFinal())
 if (CXXDestructorDecl* dd = paramRecordDecl->getDestructor())


[Libreoffice-commits] core.git: compilerplugins/clang

2023-03-08 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/store/unique2optional.cxx |  264 
 1 file changed, 264 insertions(+)

New commits:
commit 32cf9f7f0ba674217b809674eb9a951ea1b0c9c3
Author: Noel Grandin 
AuthorDate: Mon Feb 27 09:19:11 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Mar 8 09:32:58 2023 +

new loplugin:unique2optional

I used this plugin to find places where we could inline a small child
object into a parent object, saving allocation overhead.

Moving it directly into store/ because it is not intended
to be run under normal circumstances, needs hand-holding.

Change-Id: I7245eef3dba187988bb9d4a39fd80624f46355d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148455
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/store/unique2optional.cxx 
b/compilerplugins/clang/store/unique2optional.cxx
new file mode 100644
index ..cc1dc66f193c
--- /dev/null
+++ b/compilerplugins/clang/store/unique2optional.cxx
@@ -0,0 +1,264 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include 
+#include 
+
+#include "check.hxx"
+#include "plugin.hxx"
+#include "config_clang.h"
+#include "clang/AST/CXXInheritance.h"
+
+/**
+
+Look for places where we are using std::unique_ptr to hold a small object,
+where we should rather be using std::optional.
+
+*/
+
+namespace
+{
+class Unique2Optional : public loplugin::FilteringPlugin
+{
+public:
+explicit Unique2Optional(loplugin::InstantiationData const& data)
+: FilteringPlugin(data)
+{
+}
+
+virtual bool preRun() override { return true; }
+
+virtual void run() override
+{
+if (preRun())
+TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+}
+
+bool VisitFieldDecl(const FieldDecl*);
+bool VisitVarDecl(const VarDecl*);
+
+private:
+bool doDecl(const DeclaratorDecl*);
+bool isSmall(QualType type);
+};
+
+bool Unique2Optional::VisitFieldDecl(const FieldDecl* fieldDecl) { return 
doDecl(fieldDecl); }
+bool Unique2Optional::VisitVarDecl(const VarDecl*)
+{
+return true; //doDecl(varDecl);
+}
+
+bool Unique2Optional::doDecl(const DeclaratorDecl* fieldDecl)
+{
+if (ignoreLocation(fieldDecl))
+return true;
+
+SourceLocation spellingLocation
+= compiler.getSourceManager().getSpellingLoc(fieldDecl->getBeginLoc());
+StringRef fileName = getFilenameOfLocation(spellingLocation);
+
+// pimpl pattern
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/include/unotools/closeveto.hxx"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR "/include/svl/svdde.hxx"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/include/vcl/toolkit/morebtn.hxx"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/include/vcl/toolkit/morebtn.hxx"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/include/xmloff/xmlexp.hxx"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/include/xmloff/txtparae.hxx"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/include/xmloff/controlpropertyhdl.hxx"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/cui/source/inc/cuitabarea.hxx"))
+return true;
+
+// std::type_info is not movable or copyable
+if (loplugin::isSamePathname(fileName,
+ SRCDIR 
"/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx"))
+return true;
+
+// TODO not sure what is going on here, get a compile error
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/vcl/inc/unx/printerjob.hxx"))
+return true;
+
+// Seems in bad taste to modify these
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/cui/source/tabpages/macroass.cxx"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/cui/source/inc/cuitabline.hxx"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR "/cui/source/inc/page.hxx"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/sd/source/ui/sidebar/SlideBackground.hxx"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR "/hwpfilter/source/nodes.h"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/hwpfilter/source/hwpfile.h"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/sw/source/uibase/inc/bookmark.hxx"))
+return true;
+if (loplugin::isSamePathname(fileName, SRCDIR "/sw/inc/viewsh.hxx"))
+return true;
+if (loplugin::isSamePathname(fileName

[Libreoffice-commits] core.git: compilerplugins/clang

2023-03-06 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/test/unreffun.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit c9b0dcb767343865fc374c712b2fe768cd8aca32
Author: Stephan Bergmann 
AuthorDate: Thu Mar 2 20:53:45 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Mar 6 08:38:39 2023 +

The mentioned bug is fixed in Clang 17 trunk now

Change-Id: Idb62b1b71a9f6fefc9225706655ca016304f1c42
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148191
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/test/unreffun.cxx 
b/compilerplugins/clang/test/unreffun.cxx
index fc202b80f378..315c699b7748 100644
--- a/compilerplugins/clang/test/unreffun.cxx
+++ b/compilerplugins/clang/test/unreffun.cxx
@@ -7,6 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include "config_clang.h"
+
 #include "unreffun.hxx"
 
 template  struct S
@@ -38,10 +40,10 @@ void l() // expected-error {{Unreferenced externally 
visible function definition
 
 void m()
 {
-//TODO: The below would produce a false "Unreferenced externally invisible 
function definition" for
-// Local::f due to the Clang bug addressed at 
 "Call
-// MarkVirtualMembersReferenced on an actual class definition":
-#if 0
+// The below produced a false "Unreferenced externally invisible function 
definition" for Local::f
+// prior to 

+// "Call MarkVirtualMembersReferenced on an actual class definition" in Clang 
17:
+#if CLANG_VERSION >= 17
 struct Local;
 #endif
 struct Local


[Libreoffice-commits] core.git: compilerplugins/clang

2023-03-01 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/test/unreffun.cxx |   16 
 compilerplugins/clang/test/unreffun.hxx |2 ++
 2 files changed, 18 insertions(+)

New commits:
commit 53ad80f72fb1067b975be5ff597f869f05ac97f6
Author: Stephan Bergmann 
AuthorDate: Thu Mar 2 00:11:40 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Mar 2 07:10:19 2023 +

Record loplugin:unreffun false positive caused by a Clang bug

(see the comments at


"test: Use css::awt::XExtentdedToolkit::addTopWindowListener()" for how this
caused an issue in the wild)

Change-Id: Id5ec77885db45d039aedc7e13d714aaa96572e91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148076
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/test/unreffun.cxx 
b/compilerplugins/clang/test/unreffun.cxx
index b61171a87c84..fc202b80f378 100644
--- a/compilerplugins/clang/test/unreffun.cxx
+++ b/compilerplugins/clang/test/unreffun.cxx
@@ -36,4 +36,20 @@ void l() // expected-error {{Unreferenced externally visible 
function definition
 {
 }
 
+void m()
+{
+//TODO: The below would produce a false "Unreferenced externally invisible 
function definition" for
+// Local::f due to the Clang bug addressed at 
 "Call
+// MarkVirtualMembersReferenced on an actual class definition":
+#if 0
+struct Local;
+#endif
+struct Local
+{
+virtual void f() {}
+};
+Local x;
+(void)x;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/unreffun.hxx 
b/compilerplugins/clang/test/unreffun.hxx
index a209dd7b6437..7eea5233fde7 100644
--- a/compilerplugins/clang/test/unreffun.hxx
+++ b/compilerplugins/clang/test/unreffun.hxx
@@ -13,4 +13,6 @@ void f();
 
 extern void i();
 
+void m();
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


[Libreoffice-commits] core.git: compilerplugins/clang solenv/clang-format

2023-02-28 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/test/cppunitassertequals.cxx |6 -
 compilerplugins/clang/test/cppunitassertequals.hxx |   23 -
 solenv/clang-format/excludelist|1 
 3 files changed, 5 insertions(+), 25 deletions(-)

New commits:
commit a7affc26f3ee2c1449c41d88a0b18fd640577b39
Author: Stephan Bergmann 
AuthorDate: Tue Feb 28 16:32:32 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Feb 28 20:12:55 2023 +

Remove compilerplugins/clang/test/cppunitassertequals.hxx

...which isn't needed anymore to suppress warnings from other plugins like
loplugin:external ever since 45c06838e95c94445359536d84c6328fa8b17a66 "only
unit-test one loplugin at a time".  Also, the declaration of the function 
test
in cppunitassertequals.hxx had already started to deviate from its 
definition in
cppunitassertequals.cxx.

Change-Id: I3fbc8a9a805bd5bc4d8afbf958edff04b89add3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148010
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/test/cppunitassertequals.cxx 
b/compilerplugins/clang/test/cppunitassertequals.cxx
index ea68a77e9628..401105465635 100644
--- a/compilerplugins/clang/test/cppunitassertequals.cxx
+++ b/compilerplugins/clang/test/cppunitassertequals.cxx
@@ -9,16 +9,20 @@
 
 #include "sal/config.h"
 
+#include 
+
 #include 
 #include 
 #include 
 #include 
 
-#include "cppunitassertequals.hxx"
+#include "rtl/ustring.hxx"
 
 #define TEST1 CPPUNIT_ASSERT(b1 == b2)
 #define TEST2(x) x
 
+struct T { bool operator ==(T); };
+
 void test(
 bool b1, bool b2, OUString const & s1, OUString const & s2, T t, void * p, 
std::nullptr_t n,
 double d, int i)
diff --git a/compilerplugins/clang/test/cppunitassertequals.hxx 
b/compilerplugins/clang/test/cppunitassertequals.hxx
deleted file mode 100644
index 2448d64e93e7..
--- a/compilerplugins/clang/test/cppunitassertequals.hxx
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#pragma once
-
-#include "sal/config.h"
-
-#include 
-
-#include "rtl/ustring.hxx"
-
-struct T { bool operator ==(T); };
-
-void test(
-bool b1, bool b2, OUString const & s1, OUString const & s2, T t, void * p, 
std::nullptr_t n);
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index a26ac1400c8d..f0f0773d7fef 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -1563,7 +1563,6 @@ compilerplugins/clang/test/commaoperator.cxx
 compilerplugins/clang/test/constmethod.cxx
 compilerplugins/clang/test/constparams.cxx
 compilerplugins/clang/test/cppunitassertequals.cxx
-compilerplugins/clang/test/cppunitassertequals.hxx
 compilerplugins/clang/test/dodgyswitch.cxx
 compilerplugins/clang/test/expressionalwayszero.cxx
 compilerplugins/clang/test/faileddyncast.cxx


[Libreoffice-commits] core.git: compilerplugins/clang

2023-02-28 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/cppunitassertequals.cxx  |   52 +
 compilerplugins/clang/test/cppunitassertequals.cxx |7 ++
 2 files changed, 58 insertions(+), 1 deletion(-)

New commits:
commit 569977cfe1c3be4f5306372d0253924ba6c0
Author: Stephan Bergmann 
AuthorDate: Tue Feb 28 08:06:00 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Feb 28 08:29:10 2023 +

Extend loplugin:cppunitassertequals to CPPUNIT_ASSERT_LESS etc.

(Just in case, even though this doesn't find any actual issues in the code 
for
now.)

Change-Id: I80b8b0a647e89fdb6a4f0f4363fa1c3df8e5ddeb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147942
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/cppunitassertequals.cxx 
b/compilerplugins/clang/cppunitassertequals.cxx
index 26879fae9f95..df50f57537bc 100644
--- a/compilerplugins/clang/cppunitassertequals.cxx
+++ b/compilerplugins/clang/cppunitassertequals.cxx
@@ -145,6 +145,58 @@ bool CppunitAssertEquals::VisitCallExpr(const CallExpr* 
callExpr)
 callExpr->getExprLoc())
 << callExpr->getSourceRange();
 }
+if (loplugin::DeclCheck(decl).Function("assertLess").
+ Namespace("CppUnit").GlobalNamespace())
+{
+// can happen in template test code that both params are compile time 
constants
+if (isCompileTimeConstant(callExpr->getArg(0)))
+return true;
+if (isCompileTimeConstant(callExpr->getArg(1)))
+report(
+DiagnosticsEngine::Warning,
+"CPPUNIT_ASSERT_LESS parameters look switched, expected value 
should be first param",
+callExpr->getExprLoc())
+<< callExpr->getSourceRange();
+}
+if (loplugin::DeclCheck(decl).Function("assertLessEqual").
+ Namespace("CppUnit").GlobalNamespace())
+{
+// can happen in template test code that both params are compile time 
constants
+if (isCompileTimeConstant(callExpr->getArg(0)))
+return true;
+if (isCompileTimeConstant(callExpr->getArg(1)))
+report(
+DiagnosticsEngine::Warning,
+"CPPUNIT_ASSERT_LESSEQUAL parameters look switched, expected 
value should be first param",
+callExpr->getExprLoc())
+<< callExpr->getSourceRange();
+}
+if (loplugin::DeclCheck(decl).Function("assertGreater").
+ Namespace("CppUnit").GlobalNamespace())
+{
+// can happen in template test code that both params are compile time 
constants
+if (isCompileTimeConstant(callExpr->getArg(0)))
+return true;
+if (isCompileTimeConstant(callExpr->getArg(1)))
+report(
+DiagnosticsEngine::Warning,
+"CPPUNIT_ASSERT_GREATER parameters look switched, expected 
value should be first param",
+callExpr->getExprLoc())
+<< callExpr->getSourceRange();
+}
+if (loplugin::DeclCheck(decl).Function("assertGreaterEqual").
+ Namespace("CppUnit").GlobalNamespace())
+{
+// can happen in template test code that both params are compile time 
constants
+if (isCompileTimeConstant(callExpr->getArg(0)))
+return true;
+if (isCompileTimeConstant(callExpr->getArg(1)))
+report(
+DiagnosticsEngine::Warning,
+"CPPUNIT_ASSERT_GREATEREQUAL parameters look switched, 
expected value should be first param",
+callExpr->getExprLoc())
+<< callExpr->getSourceRange();
+}
 return true;
 }
 
diff --git a/compilerplugins/clang/test/cppunitassertequals.cxx 
b/compilerplugins/clang/test/cppunitassertequals.cxx
index 3de01eb2b6eb..ea68a77e9628 100644
--- a/compilerplugins/clang/test/cppunitassertequals.cxx
+++ b/compilerplugins/clang/test/cppunitassertequals.cxx
@@ -21,7 +21,7 @@
 
 void test(
 bool b1, bool b2, OUString const & s1, OUString const & s2, T t, void * p, 
std::nullptr_t n,
-double d)
+double d, int i)
 {
 CppUnit::Asserter::failIf(b1,"");
 CPPUNIT_ASSERT(b1 && b2); // expected-error {{rather split into two 
CPPUNIT_ASSERT [loplugin:cppunitassertequals]}}
@@ -79,6 +79,11 @@ void test(
 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("foo", d, 1.0, 0.1); // 
expected-error {{CPPUNIT_ASSERT_DOUBLES_EQUALS parameters look switched, 
expected value should be first param [loplugin:cppunitassertequals]}}
 CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, d, 0.1);
 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("foo", 1.0, d, 0.1);
+
+CPPUNIT_ASSERT_LESS(i, 1); // expected-error {{CPPUNIT_ASSERT_LESS 
parameters look switched, expected value should be first param 
[loplugin:cppunitassertequals]}}
+CPPUNIT_ASSERT_LESSEQUAL(i, 1); // expected-error 
{{CPPUNIT_ASSERT_LESSEQUAL parameters look switched, expected value should be 
first param [loplugin:cppun

[Libreoffice-commits] core.git: compilerplugins/clang svl/source sw/inc sw/source

2023-02-15 Thread Bjoern Michaelsen (via logerrit)
 compilerplugins/clang/unusedmethods.results  |2 --
 svl/source/items/poolitem.cxx|1 -
 sw/inc/IDocumentFieldsAccess.hxx |2 +-
 sw/inc/SwUndoField.hxx   |4 ++--
 sw/inc/hintids.hxx   |3 +--
 sw/inc/hints.hxx |   15 ---
 sw/source/core/attr/hints.cxx|7 ---
 sw/source/core/doc/DocumentFieldsManager.cxx |2 +-
 sw/source/core/edit/edfld.cxx|   25 -
 sw/source/core/inc/DocumentFieldsManager.hxx |2 +-
 sw/source/core/undo/SwUndoField.cxx  |2 +-
 11 files changed, 23 insertions(+), 42 deletions(-)

New commits:
commit 4f4f2f0502881fc1a26c600e84c94c62808169eb
Author: Bjoern Michaelsen 
AuthorDate: Tue Feb 14 23:38:29 2023 +0100
Commit: Bjoern Michaelsen 
CommitDate: Wed Feb 15 18:56:41 2023 +

clean up SwRefMarkFieldUpdate a bit

- remove SwRefMarkFieldUpdate:
  * it has only one unused field
  * replace with a plain SwPtrMsgPoolItem
- hint constness:
  * SwUndoFieldFromDoc: make ctor arg hint const
  * DocumentFieldsManager: make UpdateField arg hint const
  * however, seeing this hint is:
a/ constructed on the stack, but
b/ stored as pointer in undo
likely it would be best to remove it altogether. For now, make it at
least static, so that there is no use after free.

Change-Id: Ica51a2a2ce19e1938c3a367e9b4a9e01bbb75374
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147030
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 

diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index 1c4f2a4119dd..bdac66f71d72 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -1762,8 +1762,6 @@ include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
-include/svl/typedwhich.hxx:31
- TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
  TypedWhichId::TypedWhichId(TypedWhichId,typename 
enable_if, int>::type)
 include/svl/typedwhich.hxx:31
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index 225678340a1c..cac0e80a3a6f 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -435,7 +435,6 @@
 // class SwPtrMsgPoolItem : public SwMsgPoolItem
 // class SwFormatChg: public SwMsgPoolItem
 // class SwUpdateAttr : public SwMsgPoolItem
-// class SwRefMarkFieldUpdate : public SwMsgPoolItem
 // class SwDocPosUpdate : public SwMsgPoolItem
 // class SwTableFormulaUpdate : public SwMsgPoolItem
 // class SwAutoFormatGetDocNode: public SwMsgPoolItem
diff --git a/sw/inc/IDocumentFieldsAccess.hxx b/sw/inc/IDocumentFieldsAccess.hxx
index 237af065ae7c..ee3e2536b921 100644
--- a/sw/inc/IDocumentFieldsAccess.hxx
+++ b/sw/inc/IDocumentFieldsAccess.hxx
@@ -90,7 +90,7 @@ namespace com::sun::star::uno { class Any; }
 @retval true update was successful
 @retval falseelse
 */
-virtual bool UpdateField(SwTextField * rDstFormatField, SwField & 
rSrcField, SwMsgPoolItem * pMsgHint, bool bUpdateTableFields) = 0;
+virtual bool UpdateField(SwTextField * rDstFormatField, SwField & 
rSrcField, const SwMsgPoolItem * pMsgHint, bool bUpdateTableFields) = 0;
 
 virtual void UpdateRefFields() = 0;
 
diff --git a/sw/inc/SwUndoField.hxx b/sw/inc/SwUndoField.hxx
index 5c12c50356ce..95cb676c5de2 100644
--- a/sw/inc/SwUndoField.hxx
+++ b/sw/inc/SwUndoField.hxx
@@ -44,7 +44,7 @@ public:
 class SwUndoFieldFromDoc final : public SwUndoField
 {
 std::unique_ptr m_pOldField, m_pNewField;
-SwMsgPoolItem * m_pHint;
+const SwMsgPoolItem * m_pHint;
 bool m_bUpdate;
 
 void DoImpl();
@@ -52,7 +52,7 @@ class SwUndoFieldFromDoc final : public SwUndoField
 public:
 SwUndoFieldFromDoc(const SwPosition & rPos, const SwField & aOldField,
const SwField & aNewField,
-   SwMsgPoolItem * pHint, bool bUpdate);
+   const SwMsgPoolItem * pHint, bool bUpdate);
 
 virtual ~SwUndoFieldFromDoc() override;
 
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 891815c3cd1a..4766d0799375 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -134,7 +134,6 @@ class SwTableBoxNumFormat;
 class SwTextGridItem;
 class SwTransparencyGrf;
 class SwFormatRuby;
-class SwRefMarkFieldUpdate;
 class SwTableFormulaUpdate;
 class SwAutoFormatGetDocNode;
 class SwVirtPageNumInfo;
@@ -423,7 +422,7 @@ constexpr TypedWhichId 
RES_OBJECTDYING(RES_MSG_BEGIN); // 161
 constexpr TypedWhichId RES_FMT_CHG(162);
 constexpr TypedWhichId RES_ATTRSET_CHG(

[Libreoffice-commits] core.git: compilerplugins/clang

2023-02-03 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/sfxpoolitem.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 17cf2c278d9545dd6c9a9f132e52eae0ae482279
Author: Stephan Bergmann 
AuthorDate: Fri Feb 3 15:28:14 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Feb 3 15:38:03 2023 +

Fix misuse of TagDecl::hasDefinition

...that started to cause false

> In file included from svl/source/items/itemiter.cxx:20:
> include/svl/itemiter.hxx:25:1: error: SfxPoolItem subclass SfxPoolItem 
declares new fields, but does not override operator== [loplugin:sfxpoolitem]
> class SfxPoolItem;
> ^

etc. now as a side effect of


"[C++20] Fix a crash with modules."

Change-Id: Ibbf7a7c840ecea2605d6ea76afd04a2c2720e54d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146544
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/sfxpoolitem.cxx 
b/compilerplugins/clang/sfxpoolitem.cxx
index 801689f0f3de..79ef64dd243e 100644
--- a/compilerplugins/clang/sfxpoolitem.cxx
+++ b/compilerplugins/clang/sfxpoolitem.cxx
@@ -93,7 +93,7 @@ bool SfxPoolItem::VisitCXXRecordDecl(const CXXRecordDecl* 
decl)
 if (ignoreLocation(decl)) {
return true;
 }
-if (!decl->hasDefinition()) {
+if (!decl->isThisDeclarationADefinition()) {
return true;
 }
 // check if this class is derived from Window


[Libreoffice-commits] core.git: compilerplugins/clang sfx2/source vcl/inc vcl/skia vcl/unx

2023-01-31 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/unusedfields.only-used-in-constructor.results |   88 ++--
 compilerplugins/clang/unusedfields.readonly.results |  130 
+++---
 compilerplugins/clang/unusedfields.untouched.results|   54 +-
 compilerplugins/clang/unusedfields.writeonly.results|  210 
--
 sfx2/source/doc/docmacromode.cxx|2 
 vcl/inc/pdf/pdfwriter_impl.hxx  |   10 
 vcl/inc/unx/saldisp.hxx |   13 
 vcl/inc/unx/salgdi.h|3 
 vcl/skia/x11/salvd.cxx  |3 
 vcl/unx/generic/app/saldisp.cxx |   17 
 vcl/unx/generic/gdi/salgdi.cxx  |7 
 vcl/unx/generic/gdi/salvd.cxx   |3 
 12 files changed, 252 insertions(+), 288 deletions(-)

New commits:
commit fbfe06dcbda005ed35747ca5ba30b3891c2717d1
Author: Noel Grandin 
AuthorDate: Mon Jan 30 15:02:00 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jan 31 12:59:22 2023 +

loplugin:unusedfields

Change-Id: I6acce1578d21da0ac014410289def3dd500b4de3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146356
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git 
a/compilerplugins/clang/unusedfields.only-used-in-constructor.results 
b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
index 84c03e089975..b50c4546394b 100644
--- a/compilerplugins/clang/unusedfields.only-used-in-constructor.results
+++ b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
@@ -144,7 +144,7 @@ cui/source/inc/tabstpge.hxx:86
 SvxTabulatorTabPage m_aCenterWin TabWin_Impl
 cui/source/inc/tabstpge.hxx:87
 SvxTabulatorTabPage m_aDezWin TabWin_Impl
-cui/source/options/optcolor.cxx:241
+cui/source/options/optcolor.cxx:240
 (anonymous namespace)::ColorConfigWindow_Impl::Entry m_aDefaultColor Color
 dbaccess/source/core/api/RowSet.hxx:108
 dbaccess::ORowSet m_aURL OUString
@@ -158,15 +158,15 @@ dbaccess/source/core/api/RowSet.hxx:139
 dbaccess::ORowSet m_bIsBookmarkable _Bool
 dbaccess/source/core/api/RowSet.hxx:141
 dbaccess::ORowSet m_bCanUpdateInsertedRows _Bool
-dbaccess/source/core/api/RowSet.hxx:457
+dbaccess/source/core/api/RowSet.hxx:453
 dbaccess::ORowSetClone m_nFetchDirection sal_Int32
-dbaccess/source/core/api/RowSet.hxx:458
+dbaccess/source/core/api/RowSet.hxx:454
 dbaccess::ORowSetClone m_nFetchSize sal_Int32
-dbaccess/source/core/api/RowSet.hxx:459
+dbaccess/source/core/api/RowSet.hxx:455
 dbaccess::ORowSetClone m_bIsBookmarkable _Bool
 dbaccess/source/core/dataaccess/connection.hxx:101
 dbaccess::OConnection m_nInAppend std::atomic
-dbaccess/source/core/inc/databasecontext.hxx:84
+dbaccess/source/core/inc/databasecontext.hxx:82
 dbaccess::ODatabaseContext m_aBasicDLL BasicDLL
 drawinglayer/inc/texture/texture3d.hxx:54
 drawinglayer::texture::GeoTexSvxBitmapEx maBitmapEx BitmapEx
@@ -368,6 +368,8 @@ include/svx/ClassificationDialog.hxx:35
 svx::ClassificationDialog maInternationalHelper SfxClassificationHelper
 include/svx/ClassificationDialog.hxx:37
 svx::ClassificationDialog m_bPerParagraph const _Bool
+include/svx/dialog/ThemeDialog.hxx:25
+svx::ThemeDialog mpTheme model::Theme *
 include/svx/imapdlg.hxx:91
 SvxIMapDlg aIMapItem SvxIMapDlgItem
 include/test/screenshot_test.hxx:36
@@ -534,15 +536,15 @@ sal/qa/osl/security/osl_Security.cxx:188
 osl_Security::getConfigDir bRes1 _Bool
 sal/textenc/textenc.cxx:405
 (anonymous namespace)::FullTextEncodingData module_ osl::Module
-sc/inc/compiler.hxx:268
+sc/inc/compiler.hxx:267
 ScCompiler::AddInMap pODFF const char *
-sc/inc/compiler.hxx:269
+sc/inc/compiler.hxx:268
 ScCompiler::AddInMap pEnglish const char *
-sc/inc/compiler.hxx:271
+sc/inc/compiler.hxx:270
 ScCompiler::AddInMap pUpper const char *
 sc/inc/editutil.hxx:113
 ScEnginePoolHelper bDeleteEnginePool _Bool
-sc/inc/mtvelements.hxx:156
+sc/inc/mtvelements.hxx:171
 sc::ColumnBlockConstPosition miSparklinePos 
SparklineStoreType::const_iterator
 sc/inc/queryevaluator.hxx:61
 ScQueryEvaluator mnEntryCount const SCSIZE
@@ -552,7 +554,7 @@ sc/inc/queryevaluator.hxx:66
 ScQueryEvaluator maTest _Bool[32]
 sc/inc/token.hxx:402
 SingleDoubleRefModifier aDub ScComplexRefData
-sc/qa/unit/tiledrendering/tiledrendering.cxx:584
+sc/qa/unit/tiledrendering/tiledrendering.cxx:585
 (anonymous namespace)::ViewCallback m_callbackWrapper 
TestLokCallbackWrapper
 sc/source/core/data/document.cxx:1246
 (anonymous namespace)::BroadcastRecalcOnRefMoveGuard aSwitch 
sc::AutoCalcSwitch
@@ -642,20 +644,14 @@ sd/source/ui/remotecontrol/ZeroconfService.hxx:33
 sd::ZeroconfService port uint
 sd/source/ui/view/DocumentRenderer.cxx:1318
 sd::DocumentRenderer::

[Libreoffice-commits] core.git: compilerplugins/clang include/svx svx/source sw/inc sw/source

2023-01-30 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/virtualdead.results  |   22 +++--
 compilerplugins/clang/virtualdead.unusedparams.results |   41 -
 include/svx/svdobj.hxx |2 
 svx/source/sdr/contact/viewobjectcontact.cxx   |3 -
 svx/source/svdraw/svdobj.cxx   |2 
 sw/inc/dcontact.hxx|2 
 sw/source/core/text/EnhancedPDFExportHelper.cxx|2 
 7 files changed, 53 insertions(+), 21 deletions(-)

New commits:
commit 7ba513361df3cdde639f80757a299721023d46a1
Author: Noel Grandin 
AuthorDate: Mon Jan 30 14:48:38 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Jan 30 17:29:08 2023 +

loplugin:virtualdead

GetPDFAnchorStructureElementId was added in commit 6e5d59c2ca696, but
was unused even there

Change-Id: Id0624cac2854f5406ca93a4c495632fc3c1d0e74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146354
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/virtualdead.results 
b/compilerplugins/clang/virtualdead.results
index 1a7b0add3948..d3b3e8435745 100644
--- a/compilerplugins/clang/virtualdead.results
+++ b/compilerplugins/clang/virtualdead.results
@@ -31,7 +31,7 @@ include/basegfx/utils/unopolypolygon.hxx:93
 include/connectivity/sdbcx/IRefreshable.hxx:29
 void connectivity::sdbcx::IRefreshableGroups::refreshGroups()
 empty
-include/filter/msfilter/msdffimp.hxx:545
+include/filter/msfilter/msdffimp.hxx:547
 _Bool SvxMSDffManager::ShapeHasText(unsigned long,unsigned long,)const
 1
 include/svl/svdde.hxx:236
@@ -67,12 +67,12 @@ include/unotools/desktopterminationobserver.hxx:36
 include/vbahelper/vbahelperinterface.hxx:75
 int InheritedHelperInterfaceImpl::getCreator()
 1400204879
-sc/source/core/opencl/formulagroupcl.cxx:1075
-void sc::opencl::(anonymous 
namespace)::DynamicKernelSlidingArgument::GenSlidingWindowFunction(class 
sc::opencl::outputstream &,)
-empty
-sc/source/core/opencl/opbase.hxx:212
+sc/source/core/opencl/opbase.hxx:333
 _Bool sc::opencl::OpBase::takeNumeric()const
 1
+sc/source/core/opencl/opbase.hxx:447
+void 
sc::opencl::DynamicKernelSlidingArgument::GenSlidingWindowFunction(class 
sc::opencl::outputstream &,)
+empty
 sc/source/ui/vba/vbasheetobject.hxx:116
 class rtl::OUString ScVbaSheetObjectBase::implGetBaseName()const
 "Button"
@@ -82,15 +82,27 @@ sc/source/ui/vba/vbasheetobjects.cxx:145
 slideshow/source/engine/animationfactory.cxx:617
 void slideshow::internal::(anonymous 
namespace)::GenericAnimation::prefetch()
 empty
+unoxml/inc/node.hxx:137
+_Bool DOM::CNode::IsChildTypeAllowed(const enum 
com::sun::star::xml::dom::NodeType,const enum 
com::sun::star::xml::dom::NodeType *const,)
+0
+vcl/inc/font/LogicalFontInstance.hxx:126
+void LogicalFontInstance::ImplInitHbFont(struct hb_font_t *,)
+empty
 vcl/inc/qt5/QtFilePicker.hxx:182
 void QtFilePicker::updateAutomaticFileExtension()
 empty
+vcl/inc/salbmp.hxx:71
+_Bool SalBitmap::Create(const class com::sun::star::uno::Reference &,class Size &,_Bool,)
+0
 vcl/inc/salframe.hxx:145
 void SalFrame::SetRepresentedURL(const class rtl::OUString &,)
 empty
 vcl/inc/salframe.hxx:204
 _Bool SalFrame::MapUnicodeToKeyCode(char16_t,struct 
o3tl::strong_int,class vcl::KeyCode &,)
 0
+vcl/inc/salgdiimpl.hxx:79
+void SalGraphicsImpl::freeResources()
+empty
 vcl/inc/salinst.hxx:95
 _Bool SalInstance::SVMainHook(int *,)
 0
diff --git a/compilerplugins/clang/virtualdead.unusedparams.results 
b/compilerplugins/clang/virtualdead.unusedparams.results
index df9931e68826..0fa4b4b31bd3 100644
--- a/compilerplugins/clang/virtualdead.unusedparams.results
+++ b/compilerplugins/clang/virtualdead.unusedparams.results
@@ -70,7 +70,7 @@ include/drawinglayer/primitive2d/textbreakuphelper.hxx:58
 include/editeng/editeng.hxx:494
 void EditEngine::ParagraphConnected(int,int,)
 01
-include/filter/msfilter/msdffimp.hxx:545
+include/filter/msfilter/msdffimp.hxx:547
 _Bool SvxMSDffManager::ShapeHasText(unsigned long,unsigned long,)const
 00
 include/oox/dump/dumperbase.hxx:473
@@ -112,6 +112,9 @@ include/svx/IAccessibleParent.hxx:81
 include/svx/selectioncontroller.hxx:48
 _Bool sdr::SelectionController::onMouseButtonUp(const class MouseEvent 
&,class vcl::Window *,)
 10
+include/svx/svdobj.hxx:133
+int SdrObjUserCall::GetPDFAnchorStructureElementId(const class SdrObject 
&,const class OutputDevice &,)
+10
 include/vcl/accessibletable.hxx:90
 class tools::Rectangle 
vcl::table::IAccessibleTable::GetFieldCharacterBounds(int,int,int,)
 001
@@ -139,9 +142,15 @@ sc/inc/filter.hxx:83
 sc/inc/formulagroup.hxx:144
 class boost::intrusive_ptr 
sc::FormulaGroupInterpreter::inverseMatrix(const class ScMatrix &,)
 0
-sc/source/core/opencl/formulagroupcl.cxx:1075
-void sc::opencl::(anonymous 
namespac

[Libreoffice-commits] core.git: compilerplugins/clang

2023-01-30 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/colorcheck.cxx |2 ++
 compilerplugins/clang/elidestringvar.cxx |2 ++
 compilerplugins/clang/flatten.cxx|1 +
 compilerplugins/clang/intvsfloat.cxx |1 +
 compilerplugins/clang/noexceptmove.cxx   |2 ++
 compilerplugins/clang/writeonlyvars.cxx  |1 +
 6 files changed, 9 insertions(+)

New commits:
commit 5d22865a140ebdc307d39226f1eedb955a7dafee
Author: Stephan Bergmann 
AuthorDate: Mon Jan 30 11:33:11 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Jan 30 14:55:14 2023 +

Missing include for llvm::Optional

...with recent Clang 17 trunk after


"[clang] Remove clang::Optional"

Change-Id: If33406604a614a65dd17e269a0a5c167ea263328
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146347
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/colorcheck.cxx 
b/compilerplugins/clang/colorcheck.cxx
index 55f9034c675a..c3670598810f 100644
--- a/compilerplugins/clang/colorcheck.cxx
+++ b/compilerplugins/clang/colorcheck.cxx
@@ -15,6 +15,8 @@
 #include 
 #include 
 
+#include "llvm/ADT/Optional.h"
+
 #include "config_clang.h"
 
 #include "check.hxx"
diff --git a/compilerplugins/clang/elidestringvar.cxx 
b/compilerplugins/clang/elidestringvar.cxx
index 89e740d21904..172d7e8d81c0 100644
--- a/compilerplugins/clang/elidestringvar.cxx
+++ b/compilerplugins/clang/elidestringvar.cxx
@@ -13,6 +13,8 @@
 #include 
 #include 
 
+#include "llvm/ADT/Optional.h"
+
 #include "check.hxx"
 #include "plugin.hxx"
 
diff --git a/compilerplugins/clang/flatten.cxx 
b/compilerplugins/clang/flatten.cxx
index 8d7eac9d92b0..58492e71fb7a 100644
--- a/compilerplugins/clang/flatten.cxx
+++ b/compilerplugins/clang/flatten.cxx
@@ -8,6 +8,7 @@
  */
 
 #include "plugin.hxx"
+#include "llvm/ADT/Optional.h"
 #include 
 #include 
 #include 
diff --git a/compilerplugins/clang/intvsfloat.cxx 
b/compilerplugins/clang/intvsfloat.cxx
index 771e2bca0db5..1a57eb928b30 100644
--- a/compilerplugins/clang/intvsfloat.cxx
+++ b/compilerplugins/clang/intvsfloat.cxx
@@ -10,6 +10,7 @@
 
 #include "plugin.hxx"
 #include "check.hxx"
+#include "llvm/ADT/Optional.h"
 #include 
 
 /**
diff --git a/compilerplugins/clang/noexceptmove.cxx 
b/compilerplugins/clang/noexceptmove.cxx
index 4f242848a3c4..24d12f51fa34 100644
--- a/compilerplugins/clang/noexceptmove.cxx
+++ b/compilerplugins/clang/noexceptmove.cxx
@@ -13,6 +13,8 @@
 
 #include "config_clang.h"
 
+#include "llvm/ADT/Optional.h"
+
 #include 
 #include 
 
diff --git a/compilerplugins/clang/writeonlyvars.cxx 
b/compilerplugins/clang/writeonlyvars.cxx
index 3ea5356e4071..6aac4eaf997e 100644
--- a/compilerplugins/clang/writeonlyvars.cxx
+++ b/compilerplugins/clang/writeonlyvars.cxx
@@ -25,6 +25,7 @@
 #include "check.hxx"
 
 #include "clang/AST/ParentMapContext.h"
+#include "llvm/ADT/Optional.h"
 
 /**
   Finds variables that are effectively write-only.


[Libreoffice-commits] core.git: compilerplugins/clang sd/source sw/source

2023-01-20 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/refcounting.cxx  |   68 +
 compilerplugins/clang/test/refcounting.cxx |   23 -
 sd/source/ui/view/Outliner.cxx |2 
 sw/source/uibase/uiview/uivwimp.cxx|2 
 4 files changed, 89 insertions(+), 6 deletions(-)

New commits:
commit 32c8b03f6172acf3a19c5d1938b9935369f536f1
Author: Noel Grandin 
AuthorDate: Fri Jan 20 12:55:25 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 20 12:58:40 2023 +

improve loplugin:refcounting

to catch places where we are converting a weak reference to a strong
reference, and then using a pointer to store the result

Change-Id: I69b132907b574e5c6974fadf18bd9658107d3a0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145877
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/refcounting.cxx 
b/compilerplugins/clang/refcounting.cxx
index e65772f71e7d..ca6c0d97d9f0 100644
--- a/compilerplugins/clang/refcounting.cxx
+++ b/compilerplugins/clang/refcounting.cxx
@@ -75,6 +75,7 @@ private:
 
 bool visitTemporaryObjectExpr(Expr const * expr);
 bool isCastingReference(const Expr* expr);
+bool isCallingGetOnWeakRef(const Expr* expr);
 };
 
 bool containsXInterfaceSubclass(const clang::Type* pType0);
@@ -714,6 +715,17 @@ bool RefCounting::VisitVarDecl(const VarDecl * varDecl) {
 << pointeeType
 << varDecl->getSourceRange();
 }
+if (isCallingGetOnWeakRef(varDecl->getInit()))
+{
+auto pointeeType = varDecl->getType()->getPointeeType();
+if (containsOWeakObjectSubclass(pointeeType))
+report(
+DiagnosticsEngine::Warning,
+"weak object being converted to strong, and then the 
reference dropped, and managed via raw pointer, should be managed via 
rtl::Reference",
+varDecl->getLocation())
+<< pointeeType
+<< varDecl->getSourceRange();
+}
 }
 return true;
 }
@@ -762,6 +774,47 @@ bool RefCounting::isCastingReference(const Expr* expr)
 return true;
 }
 
+/**
+Look for code like
+makeFoo().get();
+or
+cast(makeFoo().get().get());
+or
+foo.get();
+where makeFoo() returns a unotools::WeakReference
+and foo is a unotools::WeakReference var.
+*/
+bool RefCounting::isCallingGetOnWeakRef(const Expr* expr)
+{
+expr = expr->IgnoreImplicit();
+// unwrap the cast (if any)
+if (auto castExpr = dyn_cast(expr))
+expr = castExpr->getSubExpr()->IgnoreImplicit();
+// unwrap outer get (if any)
+if (auto memberCallExpr = dyn_cast(expr))
+{
+auto methodDecl = memberCallExpr->getMethodDecl();
+if (methodDecl && methodDecl->getIdentifier() && methodDecl->getName() 
== "get")
+{
+QualType objectType = 
memberCallExpr->getImplicitObjectArgument()->getType();
+if 
(loplugin::TypeCheck(objectType).Class("Reference").Namespace("rtl"))
+expr = 
memberCallExpr->getImplicitObjectArgument()->IgnoreImplicit();
+}
+}
+// check for converting a WeakReference to a strong reference via get()
+if (auto memberCallExpr = dyn_cast(expr))
+{
+auto methodDecl = memberCallExpr->getMethodDecl();
+if (methodDecl && methodDecl->getIdentifier() && methodDecl->getName() 
== "get")
+{
+QualType objectType = 
memberCallExpr->getImplicitObjectArgument()->getType();
+if 
(loplugin::TypeCheck(objectType).Class("WeakReference").Namespace("unotools"))
+return true;
+}
+}
+return false;
+}
+
 bool RefCounting::VisitBinaryOperator(const BinaryOperator * binaryOperator)
 {
 if (ignoreLocation(binaryOperator))
@@ -801,6 +854,21 @@ bool RefCounting::VisitBinaryOperator(const BinaryOperator 
* binaryOperator)
 << pointeeType
 << binaryOperator->getSourceRange();
 }
+if (isCallingGetOnWeakRef(binaryOperator->getRHS()))
+{
+// TODO Very dodgy code, but I see no simple way of fixing it
+StringRef fileName = 
getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(binaryOperator->getBeginLoc()));
+if (loplugin::isSamePathname(fileName, SRCDIR 
"/sd/source/ui/view/Outliner.cxx"))
+return true;
+auto pointeeType = 
binaryOperator->getLHS()->getType()->getPointeeType();
+if (containsOWeakObjectSubclass(pointeeType))
+report(
+DiagnosticsEngine::Warning,
+"weak object being converted to strong, and then the reference 
dropped, and managed via raw pointer, should be managed via rtl::Reference",
+binaryOperator->getBeginLoc())
+<< pointeeType
+<< binaryOperator->getSourceRange();
+}
 return true;
 }
 
diff --git a/compilerp

[Libreoffice-commits] core.git: compilerplugins/clang

2023-01-13 Thread Andrea Gelmini (via logerrit)
 compilerplugins/clang/constantparam.booleans.results |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a5e092b53f91d314fd79b48ceaca88030865ac3b
Author: Andrea Gelmini 
AuthorDate: Thu Jan 12 10:06:52 2023 +0100
Commit: Julien Nabet 
CommitDate: Fri Jan 13 16:31:45 2023 +

Fix typo to complete commit 613baf157375

See https://gerrit.libreoffice.org/c/core/+/145241

Change-Id: Ic9c229fc891ce81c52c7886055a0a3474020f233
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145392
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/compilerplugins/clang/constantparam.booleans.results 
b/compilerplugins/clang/constantparam.booleans.results
index 8f04e67d03ec..763d19b7c2a0 100644
--- a/compilerplugins/clang/constantparam.booleans.results
+++ b/compilerplugins/clang/constantparam.booleans.results
@@ -1191,7 +1191,7 @@ include/svx/nbdtmg.hxx:130
 unsigned short nFromIndex
 0
 include/svx/nbdtmg.hxx:131
-void svx::sidebar::NBOTypeMgrBase::RelplaceNumRule(class SvxNumRule 
&,unsigned short,unsigned short)
+void svx::sidebar::NBOTypeMgrBase::ReplaceNumRule(class SvxNumRule 
&,unsigned short,unsigned short)
 unsigned short mLevel
 1
 include/svx/nbdtmg.hxx:133


[Libreoffice-commits] core.git: compilerplugins/clang cppuhelper/source

2023-01-12 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/mergeclasses.results |1 
 cppuhelper/source/factory.cxx  |  327 +++--
 2 files changed, 127 insertions(+), 201 deletions(-)

New commits:
commit e001703df46d601a9ba21512a259c1caf266edac
Author: Stephan Bergmann 
AuthorDate: Thu Jan 12 22:39:58 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Jan 13 07:50:57 2023 +

Merge OSingleFactoryHelper into OFactoryComponentHelper

Change-Id: I7faf7a3ad54c80bd3c53525c92c26c0f980110f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145423
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/mergeclasses.results 
b/compilerplugins/clang/mergeclasses.results
index 1682b3ea21bf..7b002c436974 100644
--- a/compilerplugins/clang/mergeclasses.results
+++ b/compilerplugins/clang/mergeclasses.results
@@ -289,7 +289,6 @@ merge cppcanvas::PolyPolygon with 
cppcanvas::internal::ImplPolyPolygon
 merge cppcanvas::Renderer with cppcanvas::internal::ImplRenderer
 merge cppcanvas::SpriteCanvas with cppcanvas::internal::ImplSpriteCanvas
 merge cppcanvas::internal::ImplSprite with 
cppcanvas::internal::ImplCustomSprite
-merge cppu::(anonymous namespace)::OSingleFactoryHelper with cppu::(anonymous 
namespace)::OFactoryComponentHelper
 merge cppu::PropertySetMixinImpl with cppu::PropertySetMixin
 merge dbaccess::IPropertyContainer with dbaccess::OColumn
 merge dbaccess::IRefreshListener with dbaccess::OConnection
diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx
index 37ac44ffa1a5..6d5cdc7b23bc 100644
--- a/cppuhelper/source/factory.cxx
+++ b/cppuhelper/source/factory.cxx
@@ -58,192 +58,6 @@ namespace cppu
 
 namespace {
 
-class OSingleFactoryHelper
-: public XServiceInfo
-, public XSingleServiceFactory
-, public lang::XSingleComponentFactory
-, public XUnloadingPreference
-{
-public:
-OSingleFactoryHelper(
-const Reference & rServiceManager,
-OUString aImplementationName_,
-ComponentInstantiation pCreateFunction_,
-ComponentFactoryFunc fptr,
-const Sequence< OUString > * pServiceNames_ )
-: xSMgr( rServiceManager )
-, pCreateFunction( pCreateFunction_ )
-, m_fptr( fptr )
-, aImplementationName(std::move( aImplementationName_ ))
-{
-if( pServiceNames_ )
-aServiceNames = *pServiceNames_;
-}
-
-virtual ~OSingleFactoryHelper();
-
-// XInterface
-Any SAL_CALL queryInterface( const Type & rType ) override;
-
-// XSingleServiceFactory
-Reference SAL_CALL createInstance() override;
-virtual Reference SAL_CALL createInstanceWithArguments(const 
Sequence& Arguments) override;
-// XSingleComponentFactory
-virtual Reference< XInterface > SAL_CALL createInstanceWithContext(
-Reference< XComponentContext > const & xContext ) override;
-virtual Reference< XInterface > SAL_CALL 
createInstanceWithArgumentsAndContext(
-Sequence< Any > const & rArguments,
-Reference< XComponentContext > const & xContext ) override;
-
-// XServiceInfo
-OUString SAL_CALL getImplementationName() override;
-sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
-Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
-
-protected:
-/**
- * Create an instance specified by the factory. The one instance logic is 
implemented
- * in the createInstance and createInstanceWithArguments methods.
- * @return the newly created instance. Do not return a previous (one 
instance) instance.
- * @throw css::uno::Exception
- * @throw css::uno::RuntimeException
- */
-virtual Reference  createInstanceEveryTime(
-Reference< XComponentContext > const & xContext );
-
-Reference xSMgr;
-ComponentInstantiation   pCreateFunction;
-ComponentFactoryFunc m_fptr;
-Sequence< OUString > aServiceNames;
-OUString aImplementationName;
-
-private:
-css::uno::Reference 
createInstanceWithArgumentsEveryTime(
-css::uno::Sequence const & rArguments,
-css::uno::Reference const & xContext);
-};
-
-}
-
-OSingleFactoryHelper::~OSingleFactoryHelper()
-{
-}
-
-
-Any OSingleFactoryHelper::queryInterface( const Type & rType )
-{
-return ::cppu::queryInterface(
-rType,
-static_cast< XSingleComponentFactory * >( this ),
-static_cast< XSingleServiceFactory * >( this ),
-static_cast< XServiceInfo * >( this ) ,
-static_cast< XUnloadingPreference * >( this ));
-}
-
-// OSingleFactoryHelper
-Reference OSingleFactoryHelper::createInstanceEveryTime(
-Reference< XComponentContext > const & xContext )
-{
-if (m_fptr)
-{
-return (*m_fptr)( xContext );
-}
-if( pCreateFunction )
-{
-if (xContext.is())
-{
-Reference< lang::XMultiServiceFactory > xCon

[Libreoffice-commits] core.git: compilerplugins/clang ios/UnitTest solenv/clang-format vcl/headless vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/unx

2023-01-12 Thread Caolán McNamara (via logerrit)
 compilerplugins/clang/reservedid.cxx|4 -
 ios/UnitTest/UnitTest.xcodeproj/project.pbxproj |2 
 solenv/clang-format/excludelist |3 -
 vcl/Library_vcl.mk  |1 
 vcl/Library_vclplug_gen.mk  |1 
 vcl/headless/svpcairotextrender.cxx |   34 
 vcl/headless/svpgdi.cxx |2 
 vcl/inc/headless/svpcairotextrender.hxx |   32 ---
 vcl/inc/headless/svpgdi.hxx |   10 +--
 vcl/inc/unx/cairotextrender.hxx |   16 ++---
 vcl/inc/unx/salgdi.h|   10 ---
 vcl/inc/unx/x11/x11cairotextrender.hxx  |   41 --
 vcl/unx/generic/gdi/cairotextrender.cxx |   24 ++--
 vcl/unx/generic/gdi/salgdi.cxx  |4 -
 vcl/unx/generic/gdi/x11cairotextrender.cxx  |   66 
 15 files changed, 34 insertions(+), 216 deletions(-)

New commits:
commit 4557bd79fe323af6b192e40ba6a035fe06d6adcf
Author: Caolán McNamara 
AuthorDate: Wed Jan 11 09:22:40 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Jan 12 11:33:24 2023 +

merge duplicate CairoTextRender impls

drop getSurfaceOffset because both impls just set these to 0, so its
a no opt

Change-Id: Ie4f28d57fb8a170c7a46d3cafceef3e049c26e2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145325
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/compilerplugins/clang/reservedid.cxx 
b/compilerplugins/clang/reservedid.cxx
index 1c2cd1ebbb00..f0840ace62ed 100644
--- a/compilerplugins/clang/reservedid.cxx
+++ b/compilerplugins/clang/reservedid.cxx
@@ -220,9 +220,7 @@ bool ReservedId::VisitNamedDecl(NamedDecl const * decl) {
 && s != "_SurfaceCellRenderer" // 
vcl/unx/gtk4/surfacecellrenderer.cxx
 && s != "_SurfaceCellRendererClass" // 
vcl/unx/gtk4/surfacecellrenderer.cxx
 && s != "_TransferableContent" // 
vcl/unx/gtk4/transferableprovider.cxx
-&& s != "_TransferableContentClass" // 
vcl/unx/gtk4/transferableprovider.cxx
-&& s != "_XRegion" // vcl/unx/generic/gdi/x11cairotextrender.cxx
-&& s != "_XTrap") // vcl/unx/generic/gdi/xrender_peer.hxx
+&& s != "_TransferableContentClass") // 
vcl/unx/gtk4/transferableprovider.cxx
 {
 report(
 DiagnosticsEngine::Warning,
diff --git a/ios/UnitTest/UnitTest.xcodeproj/project.pbxproj 
b/ios/UnitTest/UnitTest.xcodeproj/project.pbxproj
index 398007d9d2b8..940d62120390 100644
--- a/ios/UnitTest/UnitTest.xcodeproj/project.pbxproj
+++ b/ios/UnitTest/UnitTest.xcodeproj/project.pbxproj
@@ -98,7 +98,6 @@
BEA20D652166596F0032F67B /* svpvd.cxx */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = svpvd.cxx; 
path = ../../vcl/headless/svpvd.cxx; sourceTree = ""; };
BEA20D662166596F0032F67B /* svpframe.cxx */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = svpframe.cxx; 
path = ../../vcl/headless/svpframe.cxx; sourceTree = ""; };
BEA20D672166596F0032F67B /* svpbmp.cxx */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = svpbmp.cxx; 
path = ../../vcl/headless/svpbmp.cxx; sourceTree = ""; };
-   BEA20D682166596F0032F67B /* svpcairotextrender.cxx */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
svpcairotextrender.cxx; path = ../../vcl/headless/svpcairotextrender.cxx; 
sourceTree = ""; };
BEA20D692166596F0032F67B /* svpgdi.cxx */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = svpgdi.cxx; 
path = ../../vcl/headless/svpgdi.cxx; sourceTree = ""; };
BEA20D6A2166596F0032F67B /* svpglyphcache.cxx */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = 
svpglyphcache.cxx; path = ../../vcl/headless/svpglyphcache.cxx; sourceTree = 
""; };
BEA20D6B2166596F0032F67B /* svpinst.cxx */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = svpinst.cxx; 
path = ../../vcl/headless/svpinst.cxx; sourceTree = ""; };
@@ -355,7 +354,6 @@
children = (
BEA20D6D2166596F0032F67B /* headlessinst.cxx */,
BEA20D672166596F0032F67B /* svpbmp.cxx */,
-   BEA20D682166596F0032F67B /* 
svpcairotextrender.cxx */,
BEA20D6E2166596F0032F67B /* svpdata.cxx */,
BEA20D6F2166596F0032F67B /* svpdummies.cxx */,
BEA20D662166596F0032F67B /* svpframe.cxx */,
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index fe6d29b40a68..58d49b46a3b3 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -14380,7 +14380,6

[Libreoffice-commits] core.git: compilerplugins/clang

2023-01-12 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/reservedid.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 1f9317e341e1636c869c465e152f41f5c4037386
Author: Stephan Bergmann 
AuthorDate: Thu Jan 12 08:27:00 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Jan 12 09:01:16 2023 +

loplugin:reservedid (clang-cl)

...after ef533553559fe09b4afab651fc692885d1acf4ed "Rudimentary support for
dynamic_cast on UNO proxy objects" added those

> extern "C" IMAGE_DOS_HEADER const __ImageBase;

Change-Id: I4d9cf2b7617180d66a8527e0e36631f81e0fb18d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145379
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/reservedid.cxx 
b/compilerplugins/clang/reservedid.cxx
index 477f8c3ffda9..1c2cd1ebbb00 100644
--- a/compilerplugins/clang/reservedid.cxx
+++ b/compilerplugins/clang/reservedid.cxx
@@ -169,6 +169,8 @@ bool ReservedId::VisitNamedDecl(NamedDecl const * decl) {
 // vcl/source/window/cairo_cairo.cxx -> include/vcl/sysdata.hxx
 && s != "__CxxDetectRethrow"
 // bridges/source/cpp_uno/msvc_win32_x86-64/mscx.hxx
+&& s != "__ImageBase"
+// bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx, MS 
linker magic
 && s != "__PK11_GetKeyData"
 // xmlsecurity/source/xmlsec/nss/nssrenam.h
 && s != "__current_exception" // bridges/inc/except.hxx, Windows


[Libreoffice-commits] core.git: compilerplugins/clang writerfilter/source

2023-01-05 Thread Vasily Melenchuk (via logerrit)
 compilerplugins/clang/unusedenumconstants.writeonly.results |2 --
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx|9 ++---
 writerfilter/source/dmapper/PropertyMap.hxx |1 -
 3 files changed, 2 insertions(+), 10 deletions(-)

New commits:
commit f011a13b3e9d3edf85fa8cb17d612934e589e672
Author: Vasily Melenchuk 
AuthorDate: Thu Jan 5 18:32:39 2023 +0300
Commit: Vasily Melenchuk 
CommitDate: Fri Jan 6 07:26:15 2023 +

writerfilter: removed remains of GAP_HALF define and its usage

Change-Id: I8dee16f923686f557c8213d9a7870392bd5fe9bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145090
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk 

diff --git a/compilerplugins/clang/unusedenumconstants.writeonly.results 
b/compilerplugins/clang/unusedenumconstants.writeonly.results
index e78ed74414cd..d88a2c0a3c16 100644
--- a/compilerplugins/clang/unusedenumconstants.writeonly.results
+++ b/compilerplugins/clang/unusedenumconstants.writeonly.results
@@ -5884,8 +5884,6 @@ writerfilter/source/dmapper/PropertyMap.hxx:563
 enum writerfilter::dmapper::TablePropertyMap::TablePropertyMapTarget 
TABLE_WIDTH
 writerfilter/source/dmapper/PropertyMap.hxx:564
 enum writerfilter::dmapper::TablePropertyMap::TablePropertyMapTarget 
TABLE_WIDTH_TYPE
-writerfilter/source/dmapper/PropertyMap.hxx:565
-enum writerfilter::dmapper::TablePropertyMap::TablePropertyMapTarget 
GAP_HALF
 writerfilter/source/dmapper/PropertyMap.hxx:566
 enum writerfilter::dmapper::TablePropertyMap::TablePropertyMapTarget 
LEFT_MARGIN
 writerfilter/source/dmapper/PropertyMap.hxx:567
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 2e962260c79c..47a2424c298a 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -354,9 +354,6 @@ TableStyleSheetEntry * 
DomainMapperTableHandler::endTableGetTableStyle(TableInfo
 if( m_aTableProperties )
 {
 //create properties from the table attributes
-//...pPropMap->Insert( PROP_LEFT_MARGIN, uno::makeAny( m_nLeftMargin - 
m_nGapHalf ));
-//pPropMap->Insert( PROP_HORI_ORIENT, uno::makeAny( 
text::HoriOrientation::RIGHT ));
-sal_Int32 nGapHalf = 0;
 sal_Int32 nLeftMargin = 0;
 
 comphelper::SequenceAsHashMap aGrabBag;
@@ -509,8 +506,6 @@ TableStyleSheetEntry * 
DomainMapperTableHandler::endTableGetTableStyle(TableInfo
 m_aTableProperties->Insert( PROP_TABLE_INTEROP_GRAB_BAG, uno::Any( 
aGrabBag.getAsConstPropertyValueList() ) );
 }
 
-m_aTableProperties->getValue( TablePropertyMap::GAP_HALF, nGapHalf );
-
 std::optional oLeftMarginFromStyle = 
m_aTableProperties->getProperty(PROP_LEFT_MARGIN);
 if (oLeftMarginFromStyle)
 {
@@ -625,7 +620,7 @@ TableStyleSheetEntry * 
DomainMapperTableHandler::endTableGetTableStyle(TableInfo
 
 if (((nMode < 0) || (0 < nMode && nMode <= 14)) && rInfo.nNestLevel == 
1)
 {
-const sal_Int32 nAdjustedMargin = nLeftMargin - nGapHalf - 
rInfo.nLeftBorderDistance;
+const sal_Int32 nAdjustedMargin = nLeftMargin - 
rInfo.nLeftBorderDistance;
 m_aTableProperties->Insert( PROP_LEFT_MARGIN, uno::Any( 
nAdjustedMargin ) );
 }
 else
@@ -635,7 +630,7 @@ TableStyleSheetEntry * 
DomainMapperTableHandler::endTableGetTableStyle(TableInfo
 // so emulate that by adding the half the width. (also see 
docxattributeoutput)
 if ( rInfo.nNestLevel > 1 && nLeftMargin < 0 )
 nLeftMargin = 0;
-const sal_Int32 nAdjustedMargin = nLeftMargin - nGapHalf + 
(aLeftBorder.LineWidth / 2);
+const sal_Int32 nAdjustedMargin = nLeftMargin + 
(aLeftBorder.LineWidth / 2);
 m_aTableProperties->Insert( PROP_LEFT_MARGIN, uno::Any( 
nAdjustedMargin ) );
 }
 
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx 
b/writerfilter/source/dmapper/PropertyMap.hxx
index f9f66e3dcc0b..719233d1ee73 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -575,7 +575,6 @@ public:
 CELL_MAR_BOTTOM,
 TABLE_WIDTH,
 TABLE_WIDTH_TYPE,
-GAP_HALF,
 LEFT_MARGIN,
 HORI_ORIENT,
 TablePropertyMapTarget_MAX


[Libreoffice-commits] core.git: compilerplugins/clang

2023-01-01 Thread Bogdan B (via logerrit)
 compilerplugins/clang/constantparam.py   |1 -
 compilerplugins/clang/expandablemethods.py   |1 -
 compilerplugins/clang/finalclasses.py|1 -
 compilerplugins/clang/mergeclasses.py|2 --
 compilerplugins/clang/methodcycles.py|1 -
 compilerplugins/clang/pahole-all-classes.py  |1 -
 compilerplugins/clang/singlevalfields.py |1 -
 compilerplugins/clang/store/constfields.py   |1 -
 compilerplugins/clang/store/countusersofdefaultparams.py |1 -
 compilerplugins/clang/store/inlinefields.py  |1 -
 compilerplugins/clang/unnecessaryvirtual.py  |1 -
 compilerplugins/clang/unusedenumconstants.py |1 -
 compilerplugins/clang/unusedfields.py|1 -
 compilerplugins/clang/unusedmethods.py   |1 -
 compilerplugins/clang/unusedvarsglobal.py|1 -
 compilerplugins/clang/virtualdead.py |1 -
 compilerplugins/clang/virtualdown.py |1 -
 17 files changed, 18 deletions(-)

New commits:
commit 06468a15d5d53b932e65f0ba044d15387be68904
Author: Bogdan B 
AuthorDate: Sun Jan 1 11:03:03 2023 +0100
Commit: Hossein 
CommitDate: Mon Jan 2 04:39:16 2023 +

Remove unused imports from compilerplugins/clang

Change-Id: I923ace7bedf022d49222e71c96c7e4c20f90e6cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142521
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/compilerplugins/clang/constantparam.py 
b/compilerplugins/clang/constantparam.py
index 4a363eadede0..1371a6d9d7f3 100755
--- a/compilerplugins/clang/constantparam.py
+++ b/compilerplugins/clang/constantparam.py
@@ -1,6 +1,5 @@
 #!/usr/bin/python3
 
-import sys
 import re
 import io
 
diff --git a/compilerplugins/clang/expandablemethods.py 
b/compilerplugins/clang/expandablemethods.py
index 0fa61747d368..707215f96828 100755
--- a/compilerplugins/clang/expandablemethods.py
+++ b/compilerplugins/clang/expandablemethods.py
@@ -1,6 +1,5 @@
 #!/usr/bin/python
 
-import sys
 import re
 import io
 
diff --git a/compilerplugins/clang/finalclasses.py 
b/compilerplugins/clang/finalclasses.py
index 05a1d0c43c8c..5e9f25a24a51 100755
--- a/compilerplugins/clang/finalclasses.py
+++ b/compilerplugins/clang/finalclasses.py
@@ -1,7 +1,6 @@
 #!/usr/bin/python3
 
 import re
-import sys
 
 definitionSet = set()
 inheritFromSet = set()
diff --git a/compilerplugins/clang/mergeclasses.py 
b/compilerplugins/clang/mergeclasses.py
index bc6d129eeb3f..bbd469724218 100755
--- a/compilerplugins/clang/mergeclasses.py
+++ b/compilerplugins/clang/mergeclasses.py
@@ -1,7 +1,5 @@
 #!/usr/bin/python3
 
-import sys
-
 instantiatedSet = set()
 definitionSet = set()
 parentChildDict = {}
diff --git a/compilerplugins/clang/methodcycles.py 
b/compilerplugins/clang/methodcycles.py
index 52b950b86f76..5a1b731cc9d5 100755
--- a/compilerplugins/clang/methodcycles.py
+++ b/compilerplugins/clang/methodcycles.py
@@ -4,7 +4,6 @@ from collections import defaultdict
 import io
 import re
 import subprocess
-import sys
 
 # 

 # globals
diff --git a/compilerplugins/clang/pahole-all-classes.py 
b/compilerplugins/clang/pahole-all-classes.py
index 6037287a82ca..4163adc6a8da 100755
--- a/compilerplugins/clang/pahole-all-classes.py
+++ b/compilerplugins/clang/pahole-all-classes.py
@@ -16,7 +16,6 @@ import _thread
 import io
 import os
 import subprocess
-import time
 import re
 
 # search for all the class names in the file produced by the unusedfields 
loplugin
diff --git a/compilerplugins/clang/singlevalfields.py 
b/compilerplugins/clang/singlevalfields.py
index fbb4e2d061b5..c9df813cf3da 100755
--- a/compilerplugins/clang/singlevalfields.py
+++ b/compilerplugins/clang/singlevalfields.py
@@ -1,6 +1,5 @@
 #!/usr/bin/python3
 
-import sys
 import re
 import io
 
diff --git a/compilerplugins/clang/store/constfields.py 
b/compilerplugins/clang/store/constfields.py
index e81d3f3043f5..311b372bc958 100755
--- a/compilerplugins/clang/store/constfields.py
+++ b/compilerplugins/clang/store/constfields.py
@@ -1,6 +1,5 @@
 #!/usr/bin/python
 
-import sys
 import re
 import io
 
diff --git a/compilerplugins/clang/store/countusersofdefaultparams.py 
b/compilerplugins/clang/store/countusersofdefaultparams.py
index a53c17283c14..64ef6604af65 100755
--- a/compilerplugins/clang/store/countusersofdefaultparams.py
+++ b/compilerplugins/clang/store/countusersofdefaultparams.py
@@ -1,6 +1,5 @@
 #!/usr/bin/python
 
-import sys
 import re
 import io
 
diff --git a/compilerplugins/clang/store/inlinefields.py 
b/compilerplugins/clang/store/inlinefields.py
index 1a0dbda34189..e569431d37f7 100755
--- a/compilerplugins/clang/store/inlinefields.py
+++ b/compilerplugins/clang/store/inlinefields.py
@@ -1,6 +1,5 @@
 #!/usr/bi

[Libreoffice-commits] core.git: compilerplugins/clang

2022-12-20 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/includeform.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 1bd8f26a914c4d5811fd063618aff8e8bf72e023
Author: Stephan Bergmann 
AuthorDate: Tue Dec 20 08:50:39 2022 +
Commit: Stephan Bergmann 
CommitDate: Tue Dec 20 10:24:14 2022 +

Revert "fix compile error in compilerplugins"

This reverts commit 99b5e216f107259d6e402896800282948997c4fa.  It should 
only
have been necessary after


"Revert '[clang] Convert OptionalFileEntryRefDegradesToFileEntryPtr to
std::optional'" dropped the #include  from
clang/include/clang/Lex/PPCallbacks.h, and has been obsoleted by
3d7181caf3444d086be910545047550bac618968 "Adapt to
PPCallbacks::InclusionDirective change in Clang 16 trunk".

Change-Id: I89238a779fdda4c3ba15de93a4e647051e5844b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144594
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/includeform.cxx 
b/compilerplugins/clang/includeform.cxx
index 583cb059bc40..da955c20d3bb 100644
--- a/compilerplugins/clang/includeform.cxx
+++ b/compilerplugins/clang/includeform.cxx
@@ -8,7 +8,6 @@
  */
 
 #include 
-#include 
 
 #include "config_clang.h"
 


[Libreoffice-commits] core.git: compilerplugins/clang

2022-12-19 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/includeform.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8fe55893af1f62219f9ebb1da9527ce8aa0fbd81
Author: Noel Grandin 
AuthorDate: Tue Dec 20 09:08:29 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Dec 20 07:52:20 2022 +

Adapt to PPCallbacks::InclusionDirective change in Clang 16 trunk

Attempt to follow the unfolding debate here, it was std::optional
briefly, but then that was reverted with

commit 205c0589f918f95d2f2c586a01bea2716d73d603
Revert "[clang] Convert OptionalFileEntryRefDegradesToFileEntryPtr
to std::optional"

and then a different changed landed with

commit 854c10f8d185286d941307e1033eb492e085c203
Date:   Tue Dec 20 00:15:11 2022 +0100
[Clang] Prepare for llvm::Optional becoming std::optional.

Change-Id: I0068960a45695014405437206d8d4565562b0af9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144575
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/includeform.cxx 
b/compilerplugins/clang/includeform.cxx
index 558c9b423345..583cb059bc40 100644
--- a/compilerplugins/clang/includeform.cxx
+++ b/compilerplugins/clang/includeform.cxx
@@ -31,7 +31,7 @@ private:
 SourceLocation HashLoc, Token const & IncludeTok, StringRef,
 bool IsAngled, CharSourceRange FilenameRange,
 #if CLANG_VERSION >= 16
-std::optional File,
+OptionalFileEntryRef File,
 #elif CLANG_VERSION >= 15
 Optional File,
 #else


[Libreoffice-commits] core.git: compilerplugins/clang

2022-12-19 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/includeform.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 99b5e216f107259d6e402896800282948997c4fa
Author: Noel Grandin 
AuthorDate: Tue Dec 20 08:18:41 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Dec 20 07:25:27 2022 +

fix compile error in compilerplugins

home/noel/libo2/compilerplugins/clang/includeform.cxx:33:9: error: no
template named 'optional' in namespace 'std'; did you mean 'Optional'?
std::optional File,

after
commit b5023fa9abea248831271df99df0810351bd8c21
Date:   Mon Dec 19 13:16:29 2022 +0100
Adapt to clang::PPCallbacks::InclusionDirective change in Clang 16
trunk

Change-Id: I7acbfeac4fd138a1f6ae89f8b4b8cf918da04e30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144574
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/includeform.cxx 
b/compilerplugins/clang/includeform.cxx
index e640e14b6859..558c9b423345 100644
--- a/compilerplugins/clang/includeform.cxx
+++ b/compilerplugins/clang/includeform.cxx
@@ -8,6 +8,7 @@
  */
 
 #include 
+#include 
 
 #include "config_clang.h"
 


[Libreoffice-commits] core.git: compilerplugins/clang

2022-12-19 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/compat.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6c63fca23fdf0072f7455cb42157cc3cb6187466
Author: Stephan Bergmann 
AuthorDate: Mon Dec 19 13:17:52 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Dec 19 19:27:56 2022 +

Avoid -Werror,-Wdeprecated-declarations

...when building against recent Clang 16 trunk,

> In file included from 
compilerplugins/clang/sharedvisitor/sharedvisitor.cxx:30:
> In file included from compilerplugins/clang/cppunitassertequals.cxx:13:
> compilerplugins/clang/compat.hxx:40:14: error: 'value' is deprecated: 
std::optional::value is throwing. Use *X instead 
[-Werror,-Wdeprecated-declarations]
> return o.value();
>  ^
>  *X
> compilerplugins/clang/pointerbool.cxx:118:52: note: in instantiation of 
function template specialization 'compat::value' requested here
> if (compat::has_value(ret) && (compat::value(ret) == 1 || 
compat::value(ret) == 0))
>^
> ~/llvm/inst/include/llvm/ADT/Optional.h:273:3: note: 'value' has been 
explicitly marked deprecated here
>   LLVM_DEPRECATED("std::optional::value is throwing. Use *X instead", 
"*X")
>   ^
> ~/llvm/inst/include/llvm/Support/Compiler.h:143:50: note: expanded from 
macro 'LLVM_DEPRECATED'
> #define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
>  ^

Change-Id: I4320c279a464e52ad608df2a340f62795558a7b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144472
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 60888c15b1c9..5ad8ac9e98eb 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -37,7 +37,7 @@ constexpr bool has_value(llvm::Optional const & o) {
 template
 constexpr T const & value(llvm::Optional const & o) {
 #if CLANG_VERSION >= 15
-return o.value();
+return *o;
 #else
 return o.getValue();
 #endif


[Libreoffice-commits] core.git: compilerplugins/clang

2022-12-19 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/includeform.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit b5023fa9abea248831271df99df0810351bd8c21
Author: Stephan Bergmann 
AuthorDate: Mon Dec 19 13:16:29 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Dec 19 19:27:36 2022 +

Adapt to clang::PPCallbacks::InclusionDirective change in Clang 16 trunk



"[clang] Convert OptionalFileEntryRefDegradesToFileEntryPtr to 
std::optional"

Change-Id: I60bf4a770d6037edcfe0129591fd46941c8903db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144471
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/includeform.cxx 
b/compilerplugins/clang/includeform.cxx
index 7b2c0feb07ea..e640e14b6859 100644
--- a/compilerplugins/clang/includeform.cxx
+++ b/compilerplugins/clang/includeform.cxx
@@ -29,7 +29,9 @@ private:
 void InclusionDirective(
 SourceLocation HashLoc, Token const & IncludeTok, StringRef,
 bool IsAngled, CharSourceRange FilenameRange,
-#if CLANG_VERSION >= 15
+#if CLANG_VERSION >= 16
+std::optional File,
+#elif CLANG_VERSION >= 15
 Optional File,
 #else
 FileEntry const * File,


[Libreoffice-commits] core.git: compilerplugins/clang solenv/clang-format svx/source

2022-12-16 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/mergeclasses.results |1 
 solenv/clang-format/excludelist|1 
 svx/source/inc/celltypes.hxx   |9 --
 svx/source/table/sdrtableobjimpl.hxx   |  103 +
 svx/source/table/svdotable.cxx |   64 --
 svx/source/table/tabledesign.cxx   |4 -
 6 files changed, 108 insertions(+), 74 deletions(-)

New commits:
commit a0133459ada8bdc03fd6ae7e509a908ff9581793
Author: Stephan Bergmann 
AuthorDate: Thu Dec 15 21:34:39 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Dec 16 12:45:55 2022 +

Merge sdr::table::TableDesignUser into sdr::table::SdrTableObjImpl

Change-Id: Ia7841447df4a7db1b5dd9fad93cab66fbca48981
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144316
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/mergeclasses.results 
b/compilerplugins/clang/mergeclasses.results
index 6757b4070506..793b6f10bef8 100644
--- a/compilerplugins/clang/mergeclasses.results
+++ b/compilerplugins/clang/mergeclasses.results
@@ -400,7 +400,6 @@ merge sdext::presenter::PresenterScrollBar with 
sdext::presenter::PresenterVerti
 merge sdext::presenter::PresenterSlidePreview with 
sdext::presenter::(anonymous namespace)::NextSlidePreview
 merge sdr::SelectionController with sdr::table::SvxTableController
 merge sdr::contact::ObjectContactOfPagePainter with 
sdr::contact::PagePrimitiveExtractor
-merge sdr::table::TableDesignUser with sdr::table::SdrTableObjImpl
 merge sfx2::IXmlIdRegistry with sfx2::XmlIdRegistry
 merge slideshow::internal::(anonymous namespace)::EventContainer with 
slideshow::internal::ClickEventHandler
 merge slideshow::internal::AnimationFunction with 
slideshow::internal::ExpressionNode
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 2a2788ce34c1..e3079aec34e9 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -11845,6 +11845,7 @@ svx/source/table/cellrange.cxx
 svx/source/table/cellrange.hxx
 svx/source/table/propertyset.cxx
 svx/source/table/propertyset.hxx
+svx/source/table/sdrtableobjimpl.hxx
 svx/source/table/svdotable.cxx
 svx/source/table/tablecolumn.cxx
 svx/source/table/tablecolumn.hxx
diff --git a/svx/source/inc/celltypes.hxx b/svx/source/inc/celltypes.hxx
index acc5bdec7caf..f70e386db8a4 100644
--- a/svx/source/inc/celltypes.hxx
+++ b/svx/source/inc/celltypes.hxx
@@ -39,15 +39,6 @@ typedef std::vector CellVector;
 typedef std::vector RowVector;
 typedef std::vector ColumnVector;
 
-class SAL_LOPLUGIN_ANNOTATE("crosscast") TableDesignUser
-{
-public:
-virtual bool isInUse() = 0;
-
-protected:
-~TableDesignUser() {}
-};
-
 template  class RangeIterator
 {
 public:
diff --git a/svx/source/table/sdrtableobjimpl.hxx 
b/svx/source/table/sdrtableobjimpl.hxx
new file mode 100644
index ..5d9ef6969fbd
--- /dev/null
+++ b/svx/source/table/sdrtableobjimpl.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+namespace sdr::table {
+
+class SVXCORE_DLLPUBLIC SdrTableObjImpl : public ::cppu::WeakImplHelper< 
css::util::XModifyListener >
+{
+public:
+CellRef mxActiveCell;
+TableModelRef mxTable;
+SdrTableObj* mpTableObj;
+std::unique_ptr mpLayouter;
+CellPos maEditPos;
+TableStyleSettings maTableStyle;
+css::uno::Reference< css::container::XIndexAccess > mxTableStyle;
+std::vector> maUndos;
+bool mbSkipChangeLayout;
+
+void CropTableModelToSelection(const CellPos& rStart, const CellPos& rEnd);
+
+CellRef getCell( const CellPos& rPos ) const;
+void LayoutTable( tools::Rectangle& rArea, bool bFitWidth, bool bFitHeight 
);
+
+void ApplyCellStyles();
+void UpdateCells( tools::Rectangle const & rArea );
+
+SdrTableObjImpl();
+virtual ~SdrTableObjImpl() override;
+
+void init( SdrTableObj* pTable, sal_Int32 nColumns, sal_Int

[Libreoffice-commits] core.git: compilerplugins/clang sdext/source

2022-12-07 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/unusedfields.only-used-in-constructor.results |   36 
--
 compilerplugins/clang/unusedfields.readonly.results |   18 +--
 compilerplugins/clang/unusedfields.untouched.results|   38 
---
 compilerplugins/clang/unusedfields.writeonly.results|   52 
--
 sdext/source/minimizer/optimizerdialog.hxx  |2 
 5 files changed, 75 insertions(+), 71 deletions(-)

New commits:
commit 39bb374ad949ed10b71d7f5327607df5bcdd05a6
Author: Noel Grandin 
AuthorDate: Wed Dec 7 13:32:56 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Dec 7 13:37:24 2022 +

loplugin:unusedfields

Change-Id: I4c9c27e5fd8193b87ac46318671f787939f2d64e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143773
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git 
a/compilerplugins/clang/unusedfields.only-used-in-constructor.results 
b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
index 50ec360e4332..84c03e089975 100644
--- a/compilerplugins/clang/unusedfields.only-used-in-constructor.results
+++ b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
@@ -74,9 +74,9 @@ connectivity/source/inc/flat/EResultSet.hxx:39
 connectivity::flat::OFlatResultSet m_bBookmarkable _Bool
 connectivity/source/inc/java/lang/Object.hxx:37
 connectivity::SDBThreadAttach m_aGuard jvmaccess::class 
VirtualMachine::AttachGuard
-cppcanvas/source/mtfrenderer/textaction.cxx:807
+cppcanvas/source/mtfrenderer/textaction.cxx:806
 cppcanvas::internal::(anonymous namespace)::EffectTextAction 
maTextLineInfo const tools::TextLineInfo
-cppcanvas/source/mtfrenderer/textaction.cxx:1628
+cppcanvas/source/mtfrenderer/textaction.cxx:1627
 cppcanvas::internal::(anonymous namespace)::OutlineAction maTextLineInfo 
const tools::TextLineInfo
 cppu/source/threadpool/threadpool.cxx:353
 _uno_ThreadPool dummy sal_Int32
@@ -124,11 +124,11 @@ cppu/source/uno/check.cxx:267
 (anonymous namespace)::Char4 chars Char3
 cui/source/dialogs/colorpicker.cxx:749
 cui::(anonymous namespace)::ColorPickerDialog m_aColorPrevious 
ColorPreviewControl
-cui/source/factory/dlgfact.cxx:1230
+cui/source/factory/dlgfact.cxx:1240
 (anonymous namespace)::SvxMacroAssignDialog_Impl m_aItems SfxItemSet
 cui/source/inc/AdditionsDialog.hxx:47
 AdditionInfo sReleaseVersion OUString
-cui/source/inc/AdditionsDialog.hxx:84
+cui/source/inc/AdditionsDialog.hxx:83
 AdditionsDialog m_sTag OUString
 cui/source/inc/cfgutil.hxx:240
 SvxScriptSelectorDialog m_aStylesInfo SfxStylesInfo_Impl
@@ -218,7 +218,7 @@ filter/source/graphicfilter/icgm/chart.hxx:51
 DataNode nBoxY2 sal_Int16
 helpcompiler/inc/HelpCompiler.hxx:202
 HelpCompiler lang const std::string
-include/basic/basmgr.hxx:58
+include/basic/basmgr.hxx:59
 BasicError nReason BasicErrorReason
 include/drawinglayer/primitive2d/textlayoutdevice.hxx:64
 drawinglayer::primitive2d::TextLayouterDevice maSolarGuard SolarMutexGuard
@@ -554,9 +554,9 @@ sc/inc/token.hxx:402
 SingleDoubleRefModifier aDub ScComplexRefData
 sc/qa/unit/tiledrendering/tiledrendering.cxx:584
 (anonymous namespace)::ViewCallback m_callbackWrapper 
TestLokCallbackWrapper
-sc/source/core/data/document.cxx:1245
-(anonymous namespace)::BroadcastRecalcOnRefMoveGuard aSwitch 
sc::AutoCalcSwitch
 sc/source/core/data/document.cxx:1246
+(anonymous namespace)::BroadcastRecalcOnRefMoveGuard aSwitch 
sc::AutoCalcSwitch
+sc/source/core/data/document.cxx:1247
 (anonymous namespace)::BroadcastRecalcOnRefMoveGuard aBulk ScBulkBroadcast
 sc/source/core/data/table2.cxx:811
 (anonymous namespace)::TransClipHandler mnEndRow size_t
@@ -650,6 +650,12 @@ sd/source/ui/view/viewshel.cxx:1182
 sd::(anonymous namespace)::KeepSlideSorterInSyncWithPageChanges 
m_aUpdateLock sd::slidesorter::controller::class PageSelector::UpdateLock
 sd/source/ui/view/viewshel.cxx:1183
 sd::(anonymous namespace)::KeepSlideSorterInSyncWithPageChanges m_aContext 
sd::slidesorter::controller::class SelectionObserver::Context
+sdext/source/minimizer/optimizerdialog.hxx:191
+OptimizerDialog mnCurrentStep sal_Int16
+sdext/source/minimizer/optimizerdialog.hxx:192
+OptimizerDialog mnTabIndex sal_Int16
+sdext/source/minimizer/optimizerdialog.hxx:202
+OptimizerDialog maControlPages std::vector >
 sdext/source/pdfimport/pdfparse/pdfparse.cxx:266
 (anonymous namespace)::PDFGrammar::definition boolean rule
 sdext/source/pdfimport/pdfparse/pdfparse.cxx:266
@@ -828,7 +834,7 @@ sw/source/uibase/docvw/romenu.hxx:50
 SwReadOnlyPopup m_nReadonlyBackgroundtogallery sal_uInt16
 sw/source/uibase/inc/condedit.hxx:43
 ConditionEdit m_aDropTargetHelper ConditionEditDropTarget
-sw/source/uibase/inc/conttree.hxx:297
+sw/source/uibase/inc/conttree.hxx:307
 SwGlobalTree m_aDropTargetHelper SwGlobalTreeDropTarget
 sw/source/uibase/inc/olmenu.hxx:77
 SwSpellPopup m_aBuilder VclBuil

[Libreoffice-commits] core.git: compilerplugins/clang sdext/source sw/source ucb/source

2022-12-07 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/singlevalfields.could-be-bool.results |  207 ++
 compilerplugins/clang/singlevalfields.py|   14 
 compilerplugins/clang/singlevalfields.results   |  973 +++-
 sdext/source/minimizer/optimizerdialog.cxx  |2 
 sdext/source/minimizer/optimizerdialog.hxx  |2 
 sw/source/uibase/inc/workctrl.hxx   |1 
 sw/source/uibase/ribbar/workctrl.cxx|7 
 ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx|8 
 ucb/source/ucp/webdav-curl/DAVResourceAccess.hxx|1 
 9 files changed, 765 insertions(+), 450 deletions(-)

New commits:
commit 3c140c01748a30da1f83254b28ca7ab7a620197e
Author: Noel Grandin 
AuthorDate: Wed Dec 7 13:24:23 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Dec 7 12:41:15 2022 +

loplugin:singlevalfields

Change-Id: Ic7dd2cb433add02ecc72eee0c85dd7f0efe1d47b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143771
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/singlevalfields.could-be-bool.results 
b/compilerplugins/clang/singlevalfields.could-be-bool.results
index 9e2d1e01bc7a..a724683a6b2f 100644
--- a/compilerplugins/clang/singlevalfields.could-be-bool.results
+++ b/compilerplugins/clang/singlevalfields.could-be-bool.results
@@ -1,11 +1,32 @@
+/Xlib.h:187
+XGCValues line_style
+int
+/Xlib.h:303
+XSetWindowAttributes override_redirect
+int
+canvas/inc/spriteredrawmanager.hxx:170
+canvas::SpriteRedrawManager::SpriteChangeRecord meChangeType
+ChangeType
+configmgr/source/components.hxx:159
+configmgr::Components modificationTarget_
+ModificationTarget
 connectivity/source/inc/dbase/dindexnode.hxx:119
 connectivity::dbase::ONDXPage bNoDelete
 unsigned int
-cui/source/inc/cfg.hxx:234
+cppu/source/AffineBridge/AffineBridge.cxx:46
+(anonymous namespace)::AffineBridge m_message
+Msg
+cui/source/inc/cfg.hxx:236
 SvxConfigEntry nId
 sal_uInt16
-desktop/source/app/main.c:29
-/home/noel/libo2/desktop/source/app/main.c g_Exiting
+dbaccess/source/core/api/query.hxx:67
+dbaccess::OQuery m_eDoingCurrently
+AggregateAction
+dbaccess/source/core/inc/querycontainer.hxx:65
+dbaccess::OQueryContainer m_eDoingCurrently
+AggregateAction
+desktop/source/app/main.c:30
+/home/noel/libo/desktop/source/app/main.c g_Exiting
 int
 editeng/source/misc/hangulhanja.cxx:78
 editeng::HangulHanjaConversion_Impl m_eConvType
@@ -13,9 +34,66 @@ editeng/source/misc/hangulhanja.cxx:78
 editeng/source/misc/svxacorr.cxx:233
 GetIgnoreTranslWrapper bIsInit
 int
+emfio/inc/mtftools.hxx:406
+emfio::WinMtfFillStyle aType
+WinMtfFillStyleType
+filter/source/graphicfilter/icgm/elements.hxx:43
+CGMElements eScalingMode
+ScalingMode
+filter/source/graphicfilter/icgm/elements.hxx:46
+CGMElements eVDCType
+VDCType
+filter/source/graphicfilter/icgm/elements.hxx:48
+CGMElements eVDCRealPrecision
+RealPrecision
+filter/source/graphicfilter/icgm/elements.hxx:55
+CGMElements eDeviceViewPortMap
+DeviceViewPortMap
+filter/source/graphicfilter/icgm/elements.hxx:62
+CGMElements eClipIndicator
+ClipIndicator
+filter/source/graphicfilter/icgm/elements.hxx:65
+CGMElements eColorSelectionMode
+ColorSelectionMode
+filter/source/graphicfilter/icgm/elements.hxx:80
+CGMElements eLineWidthSpecMode
+SpecMode
+filter/source/graphicfilter/icgm/elements.hxx:87
+CGMElements eMarkerSizeSpecMode
+SpecMode
+filter/source/graphicfilter/icgm/elements.hxx:92
+CGMElements eEdgeVisibility
+EdgeVisibility
+filter/source/graphicfilter/icgm/elements.hxx:93
+CGMElements eEdgeWidthSpecMode
+SpecMode
+filter/source/graphicfilter/icgm/elements.hxx:119
+CGMElements eTransparency
+Transparency
+filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx:57
+XmlFilterAdaptor meType
+FilterType
+forms/source/richtext/rtattributehandler.hxx:147
+frm::ParagraphDirectionHandler m_eParagraphDirection
+SvxFrameDirection
+forms/source/richtext/rtattributehandler.hxx:148
+frm::ParagraphDirectionHandler m_eDefaultAdjustment
+SvxAdjust
+forms/source/richtext/rtattributehandler.hxx:149
+frm::ParagraphDirectionHandler m_eOppositeDefaultAdjustment
+SvxAdjust
+fpicker/source/office/iodlgimp.hxx:138
+SvtExpFileDlg_Impl m_eDlgType
+SvtFileDlgType
 include/opencl/openclwrapper.hxx:46
 openclwrapper::GPUEnv mnIsUserCreated
 int
+include/svtools/brwbox.hxx:313
+BrowseBox bHideCursor
+TriState
+include/svtools/ruler.hxx:524
+RulerIndent nStyle
+RulerIndentStyle
 include/svtools/ruler.hxx:621
 Ruler mnBorderWidth
 tools::Long
@@ -34,84 +112,153 @@ include/vcl/headbar.hxx:209
 include/vcl/toolkit/dialog.hxx:54
 Dialog mnMousePositioned
 tools::Long
-jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx:19

[Libreoffice-commits] core.git: compilerplugins/clang sc/qa sd/qa sw/source

2022-11-22 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/redundantcast.cxx  |1 
 compilerplugins/clang/test/redundantcast.cxx |   24 
 sc/qa/unit/bugfix-test.cxx   |   48 +
 sd/qa/unit/export-tests-ooxml1.cxx   |3 -
 sd/qa/unit/export-tests-ooxml3.cxx   |6 --
 sd/qa/unit/import-tests.cxx  |   54 ++-
 sd/qa/unit/import-tests2.cxx |   74 +--
 sw/source/core/txtnode/ndtxt.cxx |   12 ++--
 sw/source/core/unocore/unodraw.cxx   |5 -
 sw/source/filter/ww8/wrtw8sty.cxx|2 
 sw/source/uibase/shells/textsh1.cxx  |2 
 sw/source/uibase/uno/unotxdoc.cxx|   12 ++--
 12 files changed, 103 insertions(+), 140 deletions(-)

New commits:
commit 7255d21f812b7333c83b4548e2b5b102adb606a9
Author: Stephan Bergmann 
AuthorDate: Wed Nov 23 07:37:33 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 23 08:48:46 2022 +0100

Fix loplugin:redundantcast check for same-type dynamic_cast

...when the target type is a reference type and the source and target type 
have
different cv qualifiers.  (And fix the fallout.  And make the tests cover 
that
somewhat more exhaustively; and while at it also test that the plugin can 
cope
with dynamic_cast to void pointers, which is the only legitimate case where 
a
dynamic_cast can involve types that are not (pointers or references to)
non-class types.)

Change-Id: Ia568ddb5dbc4a84c275db172791c345d95964857
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143133
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/redundantcast.cxx 
b/compilerplugins/clang/redundantcast.cxx
index 984b5f003108..80485e0e9bd6 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -901,6 +901,7 @@ bool 
RedundantCast::VisitCXXDynamicCastExpr(CXXDynamicCastExpr const * expr) {
 {
 // casting from 'T&' to 'const T&' is redundant, so compare without 
the qualifiers
 qt1 = qt1->getPointeeType().getUnqualifiedType();
+qt2 = qt2.getUnqualifiedType();
 if (qt1 == qt2)
 {
 report(
diff --git a/compilerplugins/clang/test/redundantcast.cxx 
b/compilerplugins/clang/test/redundantcast.cxx
index 228ccfc25dc2..0c1087ab32af 100644
--- a/compilerplugins/clang/test/redundantcast.cxx
+++ b/compilerplugins/clang/test/redundantcast.cxx
@@ -356,13 +356,37 @@ void testDynamicCast() {
 S2 * s2 = nullptr;
 S3 * s3 = nullptr;
 
+(void) dynamic_cast(s1);
+(void) dynamic_cast(s1);
 (void) dynamic_cast(s1);
+(void) dynamic_cast(*s1);
 (void) dynamic_cast(s2); // expected-error {{redundant dynamic 
upcast from 'S2 *' to 'S1 *' [loplugin:redundantcast]}}
+(void) dynamic_cast(*s2); // expected-error {{redundant dynamic 
upcast from 'S2' to 'S1 &' [loplugin:redundantcast]}}
 (void) dynamic_cast(s2); // expected-error {{redundant dynamic cast 
from 'S2 *' to 'S2 *' [loplugin:redundantcast]}}
+(void) dynamic_cast(*s2); // expected-error {{redundant dynamic cast 
from 'S2' to 'S2 &' [loplugin:redundantcast]}}
 (void) dynamic_cast(s2);
+(void) dynamic_cast(*s2);
 (void) dynamic_cast(s2); // expected-error {{redundant dynamic 
cast from 'S2 *' to 'const S2 *' [loplugin:redundantcast]}}
+(void) dynamic_cast(*s2); // expected-error {{redundant 
dynamic cast from 'S2' to 'const S2 &' [loplugin:redundantcast]}}
 (void) dynamic_cast(s3); // expected-error {{redundant dynamic 
upcast from 'S3 *' to 'S1 *' [loplugin:redundantcast]}}
 (void) dynamic_cast(*s3); // expected-error {{redundant dynamic 
upcast from 'S3' to 'S1 &' [loplugin:redundantcast]}}
+
+S1 const * c1 = nullptr;
+S2 const * c2 = nullptr;
+S3 const * c3 = nullptr;
+
+(void) dynamic_cast(c1);
+(void) dynamic_cast(c1);
+(void) dynamic_cast(*c1);
+(void) dynamic_cast(c2); // expected-error {{redundant dynamic 
upcast from 'const S2 *' to 'const S1 *' [loplugin:redundantcast]}}
+(void) dynamic_cast(*c2); // expected-error {{redundant 
dynamic upcast from 'const S2' to 'const S1 &' [loplugin:redundantcast]}}
+
+(void) dynamic_cast(c2); // expected-error {{redundant dynamic 
cast from 'const S2 *' to 'const S2 *' [loplugin:redundantcast]}}
+(void) dynamic_cast(*c2); // expected-error {{redundant 
dynamic cast from 'const S2' to 'const S2 &' [loplugin:redundantcast]}}
+(void) dynamic_cast(c2);
+(void) dynamic_cast(*c2);
+(void) dynamic_cast(c3); // expected-error {{redundant dynamic 
upcast from 'const S3 *' to 'const S1 *' [loplugin:redundantcast]}}
+(void) dynamic_cast(*c3); // expected-error {{redundant dynamic 
upcast from 'const S3' to 'const S1 &' [loplugin:redundantcast]}}
 }
 
 void overload(int);
diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx
index 7a5e4e2b73b4..fb8137d4099b 100644
--- a/

[Libreoffice-commits] core.git: compilerplugins/clang solenv/CompilerTest_compilerplugins_clang.mk

2022-11-11 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/constmove.cxx  |   85 +++
 compilerplugins/clang/test/constmove.cxx |   25 +++
 solenv/CompilerTest_compilerplugins_clang.mk |1 
 3 files changed, 111 insertions(+)

New commits:
commit 4c9093c95445c154c4ce7db1756ca936ea0752ca
Author: Stephan Bergmann 
AuthorDate: Fri Nov 11 10:09:16 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Nov 11 19:37:16 2022 +0100

New loplugin:constmove

"Find occurrences of std::move on const-qualified types.  While there might
theoretically be legitimate uses for such (for which this plugin would 
generate
false positives and would need to be updated), in practice they tend to 
point at
suspicious code that should be cleaned up in some way."

(All issues found for a Linux build have already been addressed with eleven
recent commits mentioning in their commit messages:  "I came across this 
code
with an upcoming loplugin:constmove that flags suspicious uses of std::move
involving const-qualified types.")

Change-Id: I891a66eb0ec5f9b7d93536bbccea0359893383df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142589
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/constmove.cxx 
b/compilerplugins/clang/constmove.cxx
new file mode 100644
index ..63bafa188979
--- /dev/null
+++ b/compilerplugins/clang/constmove.cxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+// Find occurrences of std::move on const-qualified types.  While there might 
theoretically be
+// legitimate uses for such (for which this plugin would generate false 
positives and would need to
+// be updated), in practice they tend to point at suspicious code that should 
be cleaned up in some
+// way.
+
+#ifndef LO_CLANG_SHARED_PLUGINS
+
+#include "check.hxx"
+#include "plugin.hxx"
+
+namespace
+{
+class ConstMove final : public loplugin::FilteringPlugin
+{
+public:
+explicit ConstMove(loplugin::InstantiationData const& data)
+: FilteringPlugin(data)
+{
+}
+
+bool preRun() override { return compiler.getLangOpts().CPlusPlus; }
+
+void run() override
+{
+if (preRun())
+{
+TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+}
+}
+
+bool VisitCallExpr(CallExpr const* expr)
+{
+if (ignoreLocation(expr))
+{
+return true;
+}
+auto const t = expr->getType();
+if (!t.isConstQualified())
+{
+return true;
+}
+auto const d = expr->getDirectCallee();
+if (d == nullptr)
+{
+return true;
+}
+if (!loplugin::DeclCheck(d).Function("move").StdNamespace())
+{
+return true;
+}
+switch (expr->getNumArgs())
+{
+case 0:
+return true;
+case 1:
+break;
+default:
+if (!isa(expr->getArg(1)))
+{
+return true;
+}
+break;
+}
+report(DiagnosticsEngine::Warning, "suspicious 'std::move' from %0 to 
const-qualified %1",
+   expr->getExprLoc())
+<< expr->getArg(0)->IgnoreImplicit()->getType() << t << 
expr->getSourceRange();
+return true;
+}
+};
+
+static loplugin::Plugin::Registration constmove("constmove");
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/constmove.cxx 
b/compilerplugins/clang/test/constmove.cxx
new file mode 100644
index ..f6d2ed3ac9bf
--- /dev/null
+++ b/compilerplugins/clang/test/constmove.cxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include 
+
+struct S
+{
+};
+
+void f(S const& s1, S s2)
+{
+// expected-error-re@+1 {{suspicious 'std::move' from 'const S' to 
const-qualified '{{.+}}' (aka 'const S') [loplugin:constmove]}}
+S v1(std::move(s1));
+(void)v1;
+S v2(std::move(s2));
+(void)v2;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk 
b/solenv/CompilerTest_compilerplug

[Libreoffice-commits] core.git: compilerplugins/clang

2022-11-05 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/pluginhandler.cxx |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 7533d93cdcf3b6076275167b53450a1cbde045a7
Author: Stephan Bergmann 
AuthorDate: Sat Nov 5 15:55:28 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Sun Nov 6 01:14:05 2022 +0100

-Werror,-Wdeprecated-declarations (sprintf, macOS 13 SDK): compilerplugins

Change-Id: I9a4d20cd42d6c836aa74837688a272f849d9d373
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142322
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/compilerplugins/clang/pluginhandler.cxx 
b/compilerplugins/clang/pluginhandler.cxx
index ffa4e3668def..f5d27dd76b2b 100644
--- a/compilerplugins/clang/pluginhandler.cxx
+++ b/compilerplugins/clang/pluginhandler.cxx
@@ -21,8 +21,8 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
 
 #if defined _WIN32
 #include 
@@ -384,8 +384,7 @@ void PluginHandler::HandleTranslationUnit( ASTContext& 
context )
 report( DiagnosticsEngine::Warning, pathWarning ) << name;
 if( bSkip )
 continue;
-char* filename = new char[ modifyFile.length() + 100 ];
-sprintf( filename, "%s.new.%d", modifyFile.c_str(), getpid());
+auto const filename = modifyFile + ".new." + itostr(getpid());
 std::string error;
 bool bOk = false;
 std::error_code ec;
@@ -395,16 +394,15 @@ void PluginHandler::HandleTranslationUnit( ASTContext& 
context )
 {
 it->second.write( *ostream );
 ostream->close();
-if( !ostream->has_error() && rename( filename, modifyFile.c_str()) 
== 0 )
+if( !ostream->has_error() && rename( filename.c_str(), 
modifyFile.c_str()) == 0 )
 bOk = true;
 }
 else
 error = "error: " + ec.message();
 ostream->clear_error();
-unlink( filename );
+unlink( filename.c_str() );
 if( !bOk )
 report( DiagnosticsEngine::Error, "cannot write modified source to 
%0 (%1)" ) << modifyFile << error;
-delete[] filename;
 }
 #endif
  }


  1   2   3   4   5   6   7   8   9   10   >