[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 sc/source

2021-07-12 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/unusedfields.only-used-in-constructor.results |  364 
+---
 compilerplugins/clang/unusedfields.readonly.results |  282 
+++---
 compilerplugins/clang/unusedfields.untouched.results|  250 
-
 compilerplugins/clang/unusedfields.writeonly.results|  430 
+-
 sc/source/ui/cctrl/checklistmenu.cxx|1 
 sc/source/ui/inc/checklistmenu.hxx  |1 
 6 files changed, 825 insertions(+), 503 deletions(-)

New commits:
commit 0fda7285144fcadd16cc02bf7ecaad20b7d5b971
Author: Noel Grandin 
AuthorDate: Mon Jul 12 15:53:13 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 12 18:45:50 2021 +0200

loplugin:unusedfields

Change-Id: I487ff0211fc1b894950bedc72cd8444c7da36ace
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118781
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 cb65bc2deae1..10564c4dece5 100644
--- a/compilerplugins/clang/unusedfields.only-used-in-constructor.results
+++ b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
@@ -6,6 +6,8 @@ basegfx/source/polygon/b2dtrapezoid.cxx:256
 basegfx::trapezoidhelper::(anonymous namespace)::TrapezoidSubdivider 
maPoints std::vector
 basic/qa/cppunit/basictest.hxx:27
 MacroSnippet maDll class BasicDLL
+basic/qa/cppunit/test_global_as_new.cxx:28
+(anonymous namespace)::GlobalAsNewTest lib class BasicDLL
 binaryurp/source/unmarshal.hxx:86
 binaryurp::Unmarshal buffer_ com::sun::star::uno::Sequence
 binaryurp/source/writer.hxx:147
@@ -34,31 +36,37 @@ connectivity/source/commontools/RowFunctionParser.cxx:375
 connectivity::(anonymous namespace)::ExpressionGrammar::definition 
andExpression ::boost::spirit::classic::rule
 connectivity/source/commontools/RowFunctionParser.cxx:375
 connectivity::(anonymous namespace)::ExpressionGrammar::definition 
orExpression ::boost::spirit::classic::rule
-connectivity/source/inc/component/CResultSet.hxx:42
+connectivity/source/drivers/evoab2/EApi.h:121
+(anonymous) address_format char *
+connectivity/source/drivers/evoab2/EApi.h:125
+(anonymous) ext char *
+connectivity/source/drivers/evoab2/NStatement.hxx:54
+connectivity::evoab::FieldSort bAscending _Bool
+connectivity/source/inc/component/CResultSet.hxx:41
 connectivity::component::OComponentResultSet m_bBookmarkable _Bool
-connectivity/source/inc/dbase/DResultSet.hxx:41
+connectivity/source/inc/dbase/DResultSet.hxx:40
 connectivity::dbase::ODbaseResultSet m_bBookmarkable _Bool
-connectivity/source/inc/file/FStatement.hxx:85
+connectivity/source/inc/file/FStatement.hxx:84
 connectivity::file::OStatement_Base m_aCursorName class rtl::OUString
-connectivity/source/inc/file/FStatement.hxx:86
+connectivity/source/inc/file/FStatement.hxx:85
 connectivity::file::OStatement_Base m_nMaxFieldSize sal_Int32
-connectivity/source/inc/file/FStatement.hxx:87
+connectivity/source/inc/file/FStatement.hxx:86
 connectivity::file::OStatement_Base m_nMaxRows sal_Int32
-connectivity/source/inc/file/FStatement.hxx:88
+connectivity/source/inc/file/FStatement.hxx:87
 connectivity::file::OStatement_Base m_nQueryTimeOut sal_Int32
-connectivity/source/inc/file/FStatement.hxx:89
+connectivity/source/inc/file/FStatement.hxx:88
 connectivity::file::OStatement_Base m_nFetchSize sal_Int32
-connectivity/source/inc/file/FStatement.hxx:90
+connectivity/source/inc/file/FStatement.hxx:89
 connectivity::file::OStatement_Base m_nResultSetType sal_Int32
-connectivity/source/inc/file/FStatement.hxx:91
+connectivity/source/inc/file/FStatement.hxx:90
 connectivity::file::OStatement_Base m_nFetchDirection sal_Int32
-connectivity/source/inc/file/FStatement.hxx:92
+connectivity/source/inc/file/FStatement.hxx:91
 connectivity::file::OStatement_Base m_nResultSetConcurrency sal_Int32
-connectivity/source/inc/file/FStatement.hxx:93
+connectivity/source/inc/file/FStatement.hxx:92
 connectivity::file::OStatement_Base m_bEscapeProcessing _Bool
-connectivity/source/inc/flat/EResultSet.hxx:40
+connectivity/source/inc/flat/EResultSet.hxx:39
 connectivity::flat::OFlatResultSet m_bBookmarkable _Bool
-connectivity/source/inc/java/lang/Object.hxx:38
+connectivity/source/inc/java/lang/Object.hxx:37
 connectivity::SDBThreadAttach m_aGuard jvmaccess::class 
VirtualMachine::AttachGuard
 cppcanvas/source/mtfrenderer/textaction.cxx:808
 cppcanvas::internal::(anonymous namespace)::EffectTextAction 
maTextLineInfo const tools::TextLineInfo
@@ -66,6 +74,8 @@ cppcanvas/source/mtfrenderer/textaction.cxx:1643
 cppcanvas::internal::(anonymous namespace)::OutlineAction maTextLineInfo 
const tools::TextLineInfo
 cppu/source/threadpool/threadpool.cxx:365
 _uno_ThreadPool dummy sal_Int32

[Libreoffice-commits] core.git: compilerplugins/clang sc/source starmath/source svx/source sw/source vcl/source

2021-03-07 Thread Noel (via logerrit)
 compilerplugins/clang/staticdynamic.cxx  |   26 ++
 compilerplugins/clang/test/staticdynamic.cxx |   10 +-
 sc/source/core/tool/interpr4.cxx |9 +++--
 starmath/source/edit.cxx |5 ++---
 svx/source/engine3d/view3d.cxx   |5 +++--
 svx/source/form/fmview.cxx   |6 +++---
 svx/source/form/navigatortree.cxx|8 
 svx/source/sidebar/SelectionAnalyzer.cxx |8 
 svx/source/svdraw/svdmrkv.cxx|3 ++-
 svx/source/unodraw/UnoGraphicExporter.cxx|6 +++---
 sw/source/core/access/acccontext.cxx |8 ++--
 sw/source/core/access/accdoc.cxx |4 +---
 sw/source/core/access/accframebase.cxx   |3 +--
 sw/source/core/access/accpara.cxx|3 +--
 sw/source/core/doc/docfly.cxx|9 -
 sw/source/core/docnode/section.cxx   |   14 +++---
 sw/source/core/layout/frmtool.cxx|7 ---
 sw/source/core/layout/layact.cxx |   12 ++--
 sw/source/core/text/txtftn.cxx   |5 +++--
 sw/source/uibase/uiview/viewdraw.cxx |   21 +++--
 vcl/source/edit/textundo.cxx |5 ++---
 21 files changed, 97 insertions(+), 80 deletions(-)

New commits:
commit e4e80ed313882f9ea1b309054e5aa3e839586516
Author: Noel 
AuthorDate: Sat Mar 6 20:40:58 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Mar 7 13:22:28 2021 +0100

loplugin:staticdynamic now with extra salt

because it wasn't quite there yet - now checks for casts with and
without const, because const doesn't really matter here.

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

diff --git a/compilerplugins/clang/staticdynamic.cxx 
b/compilerplugins/clang/staticdynamic.cxx
index b104b0333fcd..7f3d2bd49aed 100644
--- a/compilerplugins/clang/staticdynamic.cxx
+++ b/compilerplugins/clang/staticdynamic.cxx
@@ -80,6 +80,18 @@ bool StaticDynamic::TraverseCompoundStmt(CompoundStmt* 
compoundStmt)
 return ret;
 }
 
+const clang::Type* strip(QualType qt)
+{
+const clang::Type* varType = qt->getUnqualifiedDesugaredType();
+if (varType->isPointerType())
+varType = varType->getPointeeType()->getUnqualifiedDesugaredType();
+if (varType->isReferenceType())
+varType = varType->getAs()
+  ->getPointeeType()
+  ->getUnqualifiedDesugaredType();
+return varType;
+}
+
 bool StaticDynamic::VisitCXXStaticCastExpr(CXXStaticCastExpr const* 
staticCastExpr)
 {
 if (ignoreLocation(staticCastExpr))
@@ -90,8 +102,8 @@ bool StaticDynamic::VisitCXXStaticCastExpr(CXXStaticCastExpr 
const* staticCastEx
 auto varDecl = dyn_cast_or_null(subExprDecl->getDecl());
 if (!varDecl)
 return true;
-auto it = blockState.dynamicCastVars.find(
-{ varDecl, staticCastExpr->getTypeAsWritten().getTypePtr() });
+auto varType = strip(staticCastExpr->getType());
+auto it = blockState.dynamicCastVars.find({ varDecl, varType });
 if (it != blockState.dynamicCastVars.end())
 {
 StringRef fn = getFilenameOfLocation(
@@ -110,8 +122,7 @@ bool 
StaticDynamic::VisitCXXStaticCastExpr(CXXStaticCastExpr const* staticCastEx
 report(DiagnosticsEngine::Note, "dynamic_cast here", it->second);
 return true;
 }
-blockState.staticCastVars.insert({ { varDecl, 
staticCastExpr->getTypeAsWritten().getTypePtr() },
-   compat::getBeginLoc(staticCastExpr) });
+blockState.staticCastVars.insert({ { varDecl, varType }, 
compat::getBeginLoc(staticCastExpr) });
 return true;
 }
 
@@ -126,8 +137,8 @@ bool 
StaticDynamic::VisitCXXDynamicCastExpr(CXXDynamicCastExpr const* dynamicCas
 auto varDecl = dyn_cast_or_null(subExprDecl->getDecl());
 if (!varDecl)
 return true;
-auto it = blockState.staticCastVars.find(
-{ varDecl, dynamicCastExpr->getTypeAsWritten().getTypePtr() });
+auto varType = strip(dynamicCastExpr->getTypeAsWritten());
+auto it = blockState.staticCastVars.find({ varDecl, varType });
 if (it != blockState.staticCastVars.end())
 {
 report(DiagnosticsEngine::Warning, "dynamic_cast after static_cast",
@@ -145,8 +156,7 @@ bool 
StaticDynamic::VisitCXXDynamicCastExpr(CXXDynamicCastExpr const* dynamicCas
 return true;
 }
 blockState.dynamicCastVars.insert(
-{ { varDecl, dynamicCastExpr->getTypeAsWritten().getTypePtr() },
-  compat::getBeginLoc(dynamicCastExpr) });
+{ { varDecl, varType }, compat::getBeginLoc(dynamicCastExpr) });
 return true;
 }
 
diff --git a/compilerplugins/clang/test/staticdynamic.cxx 
b/compilerplugins/clang/test/staticdynamic.cxx
index d700ea06c435..aa6ca7559b6b 

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

2021-02-02 Thread Noel (via logerrit)
 compilerplugins/clang/redundantcast.cxx   |   37 ++
 compilerplugins/clang/test/redundantcast.cxx  |5 ++
 sc/source/ui/docshell/docsh.cxx   |2 -
 sc/source/ui/docshell/docsh4.cxx  |4 +-
 sc/source/ui/unoobj/docuno.cxx|2 -
 sc/source/ui/view/cellsh1.cxx |2 -
 sc/source/ui/view/gridwin.cxx |5 +-
 sd/qa/unit/misc-tests.cxx |4 +-
 sd/source/core/sdpage.cxx |1 
 sd/source/ui/animations/CustomAnimationPane.cxx   |2 -
 sd/source/ui/presenter/PresenterPreviewCache.cxx  |2 -
 sd/source/ui/view/drviewse.cxx|2 -
 sfx2/source/sidebar/SidebarController.cxx |2 -
 svx/source/engine3d/scene3d.cxx   |1 
 svx/source/sdr/properties/attributeproperties.cxx |8 ++--
 svx/source/svdraw/svdedxv.cxx |5 +-
 svx/source/svdraw/svditer.cxx |4 +-
 svx/source/svdraw/svdmodel.cxx|2 -
 svx/source/table/svdotable.cxx|4 +-
 sw/inc/postithelper.hxx   |2 -
 sw/source/core/doc/docfmt.cxx |6 +--
 sw/source/core/draw/dview.cxx |2 -
 sw/source/core/graphic/grfatr.cxx |7 ++--
 sw/source/core/layout/atrfrm.cxx  |2 -
 sw/source/core/layout/paintfrm.cxx|2 -
 sw/source/core/unocore/unochart.cxx   |   28 
 sw/source/uibase/uno/unotxdoc.cxx |4 +-
 vbahelper/source/vbahelper/vbahelper.cxx  |9 ++---
 28 files changed, 91 insertions(+), 65 deletions(-)

New commits:
commit 068d4108e5ae41ca5bc2bcf22277e6235c6bdd0b
Author: Noel 
AuthorDate: Tue Feb 2 09:41:52 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Feb 2 12:24:00 2021 +0100

loplugin:redundantcast catch more dynamic_cast

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

diff --git a/compilerplugins/clang/redundantcast.cxx 
b/compilerplugins/clang/redundantcast.cxx
index bdac3f3bcc56..afc1cb414681 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -800,16 +800,41 @@ bool 
RedundantCast::VisitCXXDynamicCastExpr(CXXDynamicCastExpr const * expr) {
 if (ignoreLocation(expr)) {
 return true;
 }
-// so far this only deals with dynamic casting from T to T
 auto const sub = compat::getSubExprAsWritten(expr);
 auto const t1 = expr->getTypeAsWritten();
 auto const t2 = sub->getType();
-if (t1.getCanonicalType() != t2.getCanonicalType())
+QualType qt1 = t1.getCanonicalType();
+QualType qt2 = t2.getCanonicalType();
+if (qt1 == qt2)
+{
+report(
+DiagnosticsEngine::Warning,
+"redundant dynamic cast from %0 to %1", expr->getExprLoc())
+<< t2 << t1 << expr->getSourceRange();
 return true;
-report(
-DiagnosticsEngine::Warning,
-"redundant dynamic cast from %0 to %1", expr->getExprLoc())
-<< t2 << t1 << expr->getSourceRange();
+}
+if (qt1->isPointerType() && qt2->isPointerType())
+{
+// casting from 'T*' to 'const T*' is redundant, so compare without 
the qualifiers
+qt1 = qt1->getPointeeType().getUnqualifiedType();
+qt2 = qt2->getPointeeType().getUnqualifiedType();
+if (qt1 == qt2)
+{
+report(
+DiagnosticsEngine::Warning,
+"redundant dynamic cast from %0 to %1", expr->getExprLoc())
+<< t2 << t1 << expr->getSourceRange();
+return true;
+}
+if (qt1->getAsCXXRecordDecl() && 
qt2->getAsCXXRecordDecl()->isDerivedFrom(qt1->getAsCXXRecordDecl()))
+{
+report(
+DiagnosticsEngine::Warning,
+"redundant dynamic upcast from %0 to %1", expr->getExprLoc())
+<< t2 << t1 << expr->getSourceRange();
+return true;
+}
+}
 return true;
 }
 
diff --git a/compilerplugins/clang/test/redundantcast.cxx 
b/compilerplugins/clang/test/redundantcast.cxx
index 03ce47796d65..97f4e6f73777 100644
--- a/compilerplugins/clang/test/redundantcast.cxx
+++ b/compilerplugins/clang/test/redundantcast.cxx
@@ -340,11 +340,14 @@ void testDynamicCast() {
 
 S1 * s1 = nullptr;
 S2 * s2 = nullptr;
+S3 * s3 = nullptr;
 
 (void) dynamic_cast(s1);
-(void) dynamic_cast(s2);
+(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) 

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

2020-12-04 Thread Stephan Bergmann (via logerrit)
 compilerplugins/clang/check.cxx   |   10 
 compilerplugins/clang/check.hxx   |2 
 compilerplugins/clang/stringview.cxx  |   74 +++---
 compilerplugins/clang/test/stringview.cxx |   43 -
 sc/source/ui/docshell/impex.cxx   |4 +
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx |4 -
 6 files changed, 126 insertions(+), 11 deletions(-)

New commits:
commit 6c905fb6430b6ec43630e826f9afd935734f4c91
Author: Stephan Bergmann 
AuthorDate: Fri Dec 4 16:24:56 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Dec 4 17:54:48 2020 +0100

Improve loplugin:stringview detection of unnecessary O[U]String construction

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

diff --git a/compilerplugins/clang/check.cxx b/compilerplugins/clang/check.cxx
index 2ae58504fe3b..003224a21ba1 100644
--- a/compilerplugins/clang/check.cxx
+++ b/compilerplugins/clang/check.cxx
@@ -113,6 +113,16 @@ TypeCheck TypeCheck::LvalueReference() const {
 return TypeCheck();
 }
 
+TypeCheck TypeCheck::RvalueReference() const {
+if (!type_.isNull()) {
+auto const t = type_->getAs();
+if (t != nullptr) {
+return TypeCheck(t->getPointeeType());
+}
+}
+return TypeCheck();
+}
+
 TypeCheck TypeCheck::Pointer() const {
 if (!type_.isNull()) {
 auto const t = type_->getAs();
diff --git a/compilerplugins/clang/check.hxx b/compilerplugins/clang/check.hxx
index 03c5ab1eb1e4..9c35acff7b5e 100644
--- a/compilerplugins/clang/check.hxx
+++ b/compilerplugins/clang/check.hxx
@@ -64,6 +64,8 @@ public:
 
 TypeCheck LvalueReference() const;
 
+TypeCheck RvalueReference() const;
+
 inline ContextCheck Class(llvm::StringRef id) const;
 
 inline ContextCheck Struct(llvm::StringRef id) const;
diff --git a/compilerplugins/clang/stringview.cxx 
b/compilerplugins/clang/stringview.cxx
index 06b2fb8fdf02..26af817659be 100644
--- a/compilerplugins/clang/stringview.cxx
+++ b/compilerplugins/clang/stringview.cxx
@@ -122,21 +122,85 @@ bool StringView::VisitImplicitCastExpr(ImplicitCastExpr 
const* expr)
 {
 handleCXXConstructExpr(e1);
 }
-else if (auto const e2 = dyn_cast(e))
+else if (auto const e2 = dyn_cast(e))
 {
-handleCXXMemberCallExpr(e2);
+auto e3 = e2->getSubExpr();
+if (auto const e4 = dyn_cast(e3))
+{
+e3 = e4->getSubExpr();
+}
+if (auto const e4 = dyn_cast(e3))
+{
+handleCXXConstructExpr(e4);
+}
+}
+else if (auto const e3 = dyn_cast(e))
+{
+handleCXXMemberCallExpr(e3);
 }
 return true;
 }
 
 void StringView::handleCXXConstructExpr(CXXConstructExpr const* expr)
 {
-if (expr->getNumArgs() != 0)
+auto const d = expr->getConstructor();
+switch (d->getNumParams())
 {
-return;
+case 0:
+break;
+case 1:
+{
+auto const t = d->getParamDecl(0)->getType();
+if (t->isAnyCharacterType())
+{
+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("OStringNumber").Namespace("rtl").GlobalNamespace()
+|| 
tc.RvalueReference().Struct("OUStringNumber").Namespace("rtl").GlobalNamespace()
+|| tc.ClassOrStruct("basic_string_view").StdNamespace())
+{
+break;
+}
+return;
+}
+case 2:
+{
+auto const t0 = d->getParamDecl(0)->getType();
+if (t0->isPointerType() && 
t0->getPointeeType()->isAnyCharacterType())
+{
+auto const t = d->getParamDecl(1)->getType();
+if (t->isIntegralType(compiler.getASTContext())
+&& !(t->isBooleanType() || t->isAnyCharacterType()))
+{
+break;
+}
+}
+if (loplugin::TypeCheck(d->getParamDecl(1)->getType())
+.Struct("Dummy")
+.Namespace("libreoffice_internal")
+.Namespace("rtl")
+.GlobalNamespace())
+{
+break;
+}
+return;
+}
+default:
+return;
 }
 report(DiagnosticsEngine::Warning,
-   "instead of an empty %0, pass an empty 

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

2020-11-03 Thread Noel (via logerrit)
 compilerplugins/clang/unusedfields.only-used-in-constructor.results |  214 
+-
 compilerplugins/clang/unusedfields.readonly.results |  114 
++---
 compilerplugins/clang/unusedfields.untouched.results|  138 
+++---
 compilerplugins/clang/unusedfields.writeonly.results|  170 
---
 sc/source/ui/app/inputwin.cxx   |2 
 sc/source/ui/inc/inputwin.hxx   |1 
 sfx2/inc/templatedefaultview.hxx|3 
 sfx2/source/control/templatedefaultview.cxx |6 
 sfx2/source/control/thumbnailviewacc.cxx|7 
 sfx2/source/control/thumbnailviewacc.hxx|2 
 vcl/inc/qt5/Qt5Frame.hxx|2 
 vcl/inc/qt5/Qt5Graphics.hxx |4 
 vcl/inc/unx/gtk/gtkframe.hxx|1 
 vcl/inc/unx/salgdi.h|2 
 vcl/qt5/Qt5Frame.cxx|2 
 vcl/qt5/Qt5Graphics.cxx |1 
 vcl/qt5/Qt5Graphics_Text.cxx|1 
 vcl/unx/generic/gdi/font.cxx|1 
 vcl/unx/generic/gdi/salgdi.cxx  |1 
 vcl/unx/gtk3/gtk3gtkframe.cxx   |2 
 vcl/unx/gtk3/gtk3gtkinst.cxx|3 
 21 files changed, 327 insertions(+), 350 deletions(-)

New commits:
commit 5b7a61a852216f97cc7ff5952e13a6d922bc00b6
Author: Noel 
AuthorDate: Tue Nov 3 15:34:38 2020 +0200
Commit: Noel Grandin 
CommitDate: Tue Nov 3 17:31:21 2020 +0100

loplugin:unusedfields

Change-Id: Ia8e2a7ce75bfded98e85fa583d1404710069d335
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105249
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 3ca3008bd423..09cc4676e06b 100644
--- a/compilerplugins/clang/unusedfields.only-used-in-constructor.results
+++ b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
@@ -30,10 +30,10 @@ connectivity/source/commontools/RowFunctionParser.cxx:374
 connectivity::(anonymous namespace)::ExpressionGrammar::definition integer 
::boost::spirit::classic::rule
 connectivity/source/commontools/RowFunctionParser.cxx:374
 connectivity::(anonymous namespace)::ExpressionGrammar::definition 
argument ::boost::spirit::classic::rule
-connectivity/source/commontools/RowFunctionParser.cxx:375
-connectivity::(anonymous namespace)::ExpressionGrammar::definition 
orExpression ::boost::spirit::classic::rule
 connectivity/source/commontools/RowFunctionParser.cxx:375
 connectivity::(anonymous namespace)::ExpressionGrammar::definition 
andExpression ::boost::spirit::classic::rule
+connectivity/source/commontools/RowFunctionParser.cxx:375
+connectivity::(anonymous namespace)::ExpressionGrammar::definition 
orExpression ::boost::spirit::classic::rule
 connectivity/source/inc/component/CResultSet.hxx:42
 connectivity::component::OComponentResultSet m_bBookmarkable _Bool
 connectivity/source/inc/dbase/DResultSet.hxx:41
@@ -110,12 +110,12 @@ cppu/source/uno/check.cxx:258
 (anonymous namespace)::Char4 chars struct (anonymous namespace)::Char3
 cui/source/dialogs/colorpicker.cxx:736
 cui::(anonymous namespace)::ColorPickerDialog m_aColorPrevious class 
cui::(anonymous namespace)::ColorPreviewControl
-cui/source/factory/dlgfact.cxx:1389
+cui/source/factory/dlgfact.cxx:1390
 (anonymous namespace)::SvxMacroAssignDialog m_aItems class SfxItemSet
 cui/source/inc/AdditionsDialog.hxx:57
 AdditionInfo sReleaseVersion class rtl::OUString
 cui/source/inc/AdditionsDialog.hxx:94
-AdditionsDialog m_sTag class rtl::OString
+AdditionsDialog m_sTag class rtl::OUString
 cui/source/inc/cfgutil.hxx:233
 SvxScriptSelectorDialog m_aStylesInfo struct SfxStylesInfo_Impl
 cui/source/inc/cuitabarea.hxx:223
@@ -154,7 +154,7 @@ dbaccess/source/core/dataaccess/connection.hxx:101
 dbaccess::OConnection m_nInAppend std::atomic
 dbaccess/source/core/inc/databasecontext.hxx:84
 dbaccess::ODatabaseContext m_aBasicDLL class BasicDLL
-desktop/qa/desktop_lib/test_desktop_lib.cxx:2832
+desktop/qa/desktop_lib/test_desktop_lib.cxx:2831
   class AllSettings &
 drawinglayer/inc/texture/texture3d.hxx:57
 drawinglayer::texture::GeoTexSvxBitmapEx maBitmap class Bitmap
@@ -164,7 +164,7 @@ drawinglayer/source/tools/emfphelperdata.hxx:197
 emfplushelper::EmfPlusHelperData mnFrameRight sal_Int32
 drawinglayer/source/tools/emfphelperdata.hxx:198
 emfplushelper::EmfPlusHelperData 

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

2020-09-30 Thread Noel (via logerrit)
 compilerplugins/clang/unusedmethods.py  |6 
 compilerplugins/clang/unusedmethods.results |  506 ++--
 sc/source/ui/inc/inputhdl.hxx   |1 
 sc/source/ui/inc/viewdata.hxx   |5 
 starmath/inc/node.hxx   |8 
 svx/source/sidebar/graphic/GraphicPropertyPanel.hxx |4 
 sw/source/filter/ww8/docxsdrexport.cxx  |5 
 sw/source/filter/ww8/docxsdrexport.hxx  |1 
 8 files changed, 270 insertions(+), 266 deletions(-)

New commits:
commit 2be04eb4de522bc3aac0449721dd38afebf2ec63
Author: Noel 
AuthorDate: Wed Sep 30 14:23:22 2020 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 30 15:56:37 2020 +0200

loplugin:unusedmethods

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

diff --git a/compilerplugins/clang/unusedmethods.py 
b/compilerplugins/clang/unusedmethods.py
index 71d10f82bec2..da12e2a8ef59 100755
--- a/compilerplugins/clang/unusedmethods.py
+++ b/compilerplugins/clang/unusedmethods.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
 
 import sys
 import re
@@ -33,7 +33,7 @@ def normalizeTypeParams( line ):
 # primary input loop
 # 

 
-with io.open("workdir/loplugin.unusedmethods.log", "rb", 
buffering=16*1024*1024) as txt:
+with io.open("workdir/loplugin.unusedmethods.log", "r", 
buffering=16*1024*1024) as txt:
 for line in txt:
 tokens = line.strip().split("\t")
 if tokens[0] == "definition:":
@@ -69,7 +69,7 @@ with io.open("workdir/loplugin.unusedmethods.log", "rb", 
buffering=16*1024*1024)
 
 # Invert the definitionToSourceLocationMap.
 sourceLocationToDefinitionMap = {}
-for k, v in definitionToSourceLocationMap.iteritems():
+for k, v in definitionToSourceLocationMap.items():
 sourceLocationToDefinitionMap[v] = sourceLocationToDefinitionMap.get(v, [])
 sourceLocationToDefinitionMap[v].append(k)
 
diff --git a/compilerplugins/clang/unusedmethods.results 
b/compilerplugins/clang/unusedmethods.results
index 81fa3f339a1c..a87d0d4ebaaf 100644
--- a/compilerplugins/clang/unusedmethods.results
+++ b/compilerplugins/clang/unusedmethods.results
@@ -1,22 +1,22 @@
 basegfx/source/range/b2drangeclipper.cxx:688
 type-parameter-?-? basegfx::(anonymous 
namespace)::eraseFromList(type-parameter-?-? &,const type-parameter-?-? &)
-basic/source/inc/buffer.hxx:41
+basic/source/inc/buffer.hxx:40
 void SbiBuffer::operator+=(signed char)
-basic/source/inc/buffer.hxx:42
+basic/source/inc/buffer.hxx:41
 void SbiBuffer::operator+=(short)
-basic/source/inc/buffer.hxx:46
+basic/source/inc/buffer.hxx:45
 void SbiBuffer::operator+=(int)
 bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx:185
 void CPPU_CURRENT_NAMESPACE::raiseException(struct _uno_Any *,struct 
_uno_Mapping *)
 bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx:188
 void CPPU_CURRENT_NAMESPACE::fillUnoException(struct _uno_Any *,struct 
_uno_Mapping *)
-canvas/inc/rendering/icolorbuffer.hxx:48
+canvas/inc/rendering/icolorbuffer.hxx:47
 unsigned char * canvas::IColorBuffer::lock() const
-canvas/inc/rendering/icolorbuffer.hxx:52
+canvas/inc/rendering/icolorbuffer.hxx:51
 void canvas::IColorBuffer::unlock() const
-canvas/inc/rendering/icolorbuffer.hxx:67
+canvas/inc/rendering/icolorbuffer.hxx:66
 unsigned int canvas::IColorBuffer::getStride() const
-canvas/inc/rendering/icolorbuffer.hxx:71
+canvas/inc/rendering/icolorbuffer.hxx:70
 enum canvas::IColorBuffer::Format canvas::IColorBuffer::getFormat() const
 canvas/inc/rendering/isurfaceproxy.hxx:38
 void canvas::ISurfaceProxy::setColorBufferDirty()
@@ -38,24 +38,14 @@ canvas/inc/vclwrapper.hxx:135
 const type-parameter-?-? & canvas::vcltools::VCLObject::get() const
 canvas/inc/vclwrapper.hxx:137
 void canvas::vcltools::VCLObject::swap(VCLObject &)
-canvas/source/vcl/impltools.hxx:103
+canvas/source/vcl/impltools.hxx:102
  vclcanvas::tools::LocalGuard::LocalGuard()
 connectivity/inc/sdbcx/VGroup.hxx:61
  connectivity::sdbcx::OGroup::OGroup(_Bool)
 connectivity/inc/sdbcx/VGroup.hxx:62
  connectivity::sdbcx::OGroup::OGroup(const class rtl::OUString &,_Bool)
-connectivity/source/drivers/evoab2/NResultSetMetaData.hxx:50
-class com::sun::star::uno::Reference 
connectivity::evoab::OEvoabResultSetMetaData::operator Reference()
-connectivity/source/drivers/firebird/Driver.hxx:60
-const class com::sun::star::uno::Reference & 
connectivity::firebird::FirebirdDriver::getContext() const
-connectivity/source/drivers/firebird/Util.hxx:66
- connectivity::firebird::ColumnTypeInfo::ColumnTypeInfo(short,const class 
rtl::OUString &)
-connectivity/source/drivers/firebird/Util.hxx:71
-short connectivity::firebird::ColumnTypeInfo::getType() const

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

2020-04-25 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/refcounting.cxx |   11 +++
 sc/source/filter/excel/excdoc.cxx |   34 -
 sc/source/filter/excel/excrecds.cxx   |   10 +-
 sc/source/filter/excel/xechart.cxx|  118 +-
 sc/source/filter/excel/xecontent.cxx  |   12 +--
 sc/source/filter/excel/xedbdata.cxx   |8 +-
 sc/source/filter/excel/xeescher.cxx   |   10 +-
 sc/source/filter/excel/xeextlst.cxx   |   18 ++---
 sc/source/filter/excel/xehelper.cxx   |2 
 sc/source/filter/excel/xelink.cxx |   34 -
 sc/source/filter/excel/xename.cxx |   21 +++---
 sc/source/filter/excel/xepivot.cxx|   28 
 sc/source/filter/excel/xeroot.cxx |   18 ++---
 sc/source/filter/excel/xestyle.cxx|   40 +--
 sc/source/filter/excel/xetable.cxx|   60 -
 sc/source/filter/excel/xichart.cxx|   24 +++---
 sc/source/filter/inc/excdoc.hxx   |6 -
 sc/source/filter/inc/excrecds.hxx |6 -
 sc/source/filter/inc/xechart.hxx  |   54 +++
 sc/source/filter/inc/xedbdata.hxx |4 -
 sc/source/filter/inc/xeescher.hxx |8 +-
 sc/source/filter/inc/xeextlst.hxx |   13 ++-
 sc/source/filter/inc/xehelper.hxx |2 
 sc/source/filter/inc/xepivot.hxx  |5 -
 sc/source/filter/inc/xerecord.hxx |   83 ---
 sc/source/filter/inc/xeroot.hxx   |   21 +++---
 sc/source/filter/inc/xetable.hxx  |   22 +++---
 sc/source/filter/inc/xichart.hxx  |   15 +++-
 28 files changed, 370 insertions(+), 317 deletions(-)

New commits:
commit 60694088231234f9c916fb6ea15067b1bf0b9cb2
Author: Noel Grandin 
AuthorDate: Wed Apr 22 13:37:14 2020 +0200
Commit: Noel Grandin 
CommitDate: Sat Apr 25 13:22:33 2020 +0200

convert excel filter in calc from shared_ptr to rtl::Reference

ref-counting traffic here accounts for 10% of the profile on some of my
calc imports.

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

diff --git a/compilerplugins/clang/refcounting.cxx 
b/compilerplugins/clang/refcounting.cxx
index ecd8aa3bfc51..31b1540d391e 100644
--- a/compilerplugins/clang/refcounting.cxx
+++ b/compilerplugins/clang/refcounting.cxx
@@ -255,6 +255,17 @@ bool containsSalhelperReferenceObjectSubclass(const 
clang::Type* pType0) {
 // for performance reasons we sometimes allocate temporaries on the 
stack
 if 
(loplugin::DeclCheck(pRecordDecl).Struct("ScSheetLimits").GlobalNamespace())
 return false;
+
+// the calc excel filter likes storing lots of classes either by 
reference or by value
+if (loplugin::isDerivedFrom(pRecordDecl,
+[](Decl const * decl) -> bool
+{
+return
+
bool(loplugin::DeclCheck(decl).Class("XclExpRecordBase").GlobalNamespace())
+|| 
bool(loplugin::DeclCheck(decl).Class("XclImpChLineFormat").GlobalNamespace());
+}))
+return false;
+
 const ClassTemplateSpecializationDecl* pTemplate = 
dyn_cast(pRecordDecl);
 if (pTemplate) {
 auto const dc = loplugin::DeclCheck(pTemplate);
diff --git a/sc/source/filter/excel/excdoc.cxx 
b/sc/source/filter/excel/excdoc.cxx
index e21164f43632..7dec24838460 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -111,7 +111,7 @@ ExcTable::ExcTable( const XclExpRoot& rRoot ) :
 XclExpRoot( rRoot ),
 mnScTab( SCTAB_GLOBAL ),
 nExcTab( EXC_NOTAB ),
-mxNoteList( std::make_shared() )
+mxNoteList( new XclExpNoteList )
 {
 }
 
@@ -119,7 +119,7 @@ ExcTable::ExcTable( const XclExpRoot& rRoot, SCTAB nScTab ) 
:
 XclExpRoot( rRoot ),
 mnScTab( nScTab ),
 nExcTab( rRoot.GetTabInfo().GetXclTab( nScTab ) ),
-mxNoteList( std::make_shared() )
+mxNoteList( new XclExpNoteList )
 {
 }
 
@@ -258,7 +258,7 @@ void ExcTable::FillAsHeaderBinary( ExcBoundsheetList& 
rBoundsheetList )
 for( nC = 0 ; nC < nScTabCount ; nC++ )
 if( rTabInfo.IsExportTab( nC ) )
 {
-ExcBoundsheetList::RecordRefType xBoundsheet = 
std::make_shared( rR, nC );
+ExcBoundsheetList::RecordRefType xBoundsheet = new 
ExcBundlesheet( rR, nC );
 aRecList.AppendRecord( xBoundsheet );
 rBoundsheetList.AppendRecord( xBoundsheet );
 }
@@ -283,7 +283,7 @@ void ExcTable::FillAsHeaderBinary( ExcBoundsheetList& 
rBoundsheetList )
 for( nC = 0 ; nC < nScTabCount ; nC++ )
 if( rTabInfo.IsExportTab( nC ) )
 {
-ExcBoundsheetList::RecordRefType xBoundsheet = 
std::make_shared( rR, nC );
+ExcBoundsheetList::RecordRefType xBoundsheet = new 
ExcBundlesheet8( rR, nC );
 aRecList.AppendRecord( xBoundsheet );
 

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

2019-07-22 Thread Noel Grandin (via logerrit)
 compilerplugins/clang/unusedfields.only-used-in-constructor.results |   76 ++--
 compilerplugins/clang/unusedfields.readonly.results |  104 
--
 compilerplugins/clang/unusedfields.untouched.results|  118 
---
 compilerplugins/clang/unusedfields.writeonly.results|  158 
+-
 sc/source/filter/xml/xmlexprt.cxx   |1 
 sc/source/filter/xml/xmlexprt.hxx   |1 
 sc/source/filter/xml/xmlsubti.cxx   |2 
 sc/source/filter/xml/xmlsubti.hxx   |1 
 sw/source/filter/inc/fltshell.hxx   |   10 
 9 files changed, 272 insertions(+), 199 deletions(-)

New commits:
commit ac933bb93a7afa8af10382cf2d47e64b31fe2567
Author: Noel Grandin 
AuthorDate: Mon Jul 22 13:35:21 2019 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 23 07:49:07 2019 +0200

loplugin:unusedfields

Change-Id: If1e0b32f2cce7678f454009c0180d7612b4fb7c6
Reviewed-on: https://gerrit.libreoffice.org/76119
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 ca08d4cca7a5..8d2d4d9bb5d5 100644
--- a/compilerplugins/clang/unusedfields.only-used-in-constructor.results
+++ b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
@@ -9,13 +9,11 @@ avmedia/source/vlc/wrapper/Types.hxx:44
 avmedia/source/vlc/wrapper/Types.hxx:45
 libvlc_event_t::(anonymous union)::(anonymous) dummy2 const char *
 avmedia/source/vlc/wrapper/Types.hxx:46
-libvlc_event_t::(anonymous) padding struct (anonymous struct at 
/media/noel/disk2/libo5/avmedia/source/vlc/wrapper/Types.hxx:43:7)
+libvlc_event_t::(anonymous) padding struct (anonymous struct at 
/media/noel/disk3/libo6/avmedia/source/vlc/wrapper/Types.hxx:43:7)
 avmedia/source/vlc/wrapper/Types.hxx:47
-libvlc_event_t u union (anonymous union at 
/media/noel/disk2/libo5/avmedia/source/vlc/wrapper/Types.hxx:41:5)
+libvlc_event_t u union (anonymous union at 
/media/noel/disk3/libo6/avmedia/source/vlc/wrapper/Types.hxx:41:5)
 avmedia/source/vlc/wrapper/Types.hxx:53
 libvlc_track_description_t psz_name char *
-basctl/source/basicide/moduldlg.hxx:204
-basctl::OrganizeDialog m_aCurEntry class basctl::EntryDescriptor
 basegfx/source/polygon/b2dtrapezoid.cxx:202
 basegfx::trapezoidhelper::PointBlockAllocator maFirstStackBlock class 
basegfx::B2DPoint [32]
 basic/qa/cppunit/basictest.hxx:27
@@ -26,7 +24,7 @@ binaryurp/source/writer.hxx:148
 binaryurp::Writer state_ struct binaryurp::WriterState
 canvas/source/vcl/impltools.hxx:117
 vclcanvas::tools::LocalGuard aSolarGuard class SolarMutexGuard
-canvas/workben/canvasdemo.cxx:82
+canvas/workben/canvasdemo.cxx:83
 DemoRenderer maColorWhite uno::Sequence
 chart2/source/controller/accessibility/AccessibleChartShape.hxx:79
 chart::AccessibleChartShape m_aShapeTreeInfo 
::accessibility::AccessibleShapeTreeInfo
@@ -132,15 +130,15 @@ cppu/source/uno/check.cxx:138
 (anonymous namespace)::Char4 chars struct (anonymous namespace)::Char3
 cui/source/dialogs/colorpicker.cxx:719
 cui::ColorPickerDialog m_aColorPrevious class cui::ColorPreviewControl
-cui/source/factory/dlgfact.cxx:1349
+cui/source/factory/dlgfact.cxx:1372
 SvxMacroAssignDialog m_aItems class SfxItemSet
 cui/source/inc/about.hxx:39
 AboutDialog m_pCloseButton weld::Button *
 cui/source/inc/cfgutil.hxx:238
 SvxScriptSelectorDialog m_aStylesInfo struct SfxStylesInfo_Impl
-cui/source/inc/cuitabarea.hxx:228
+cui/source/inc/cuitabarea.hxx:229
 SvxAreaTabPage maFixed_ChangeType enum ChangeType
-cui/source/inc/cuitabarea.hxx:236
+cui/source/inc/cuitabarea.hxx:237
 SvxAreaTabPage m_aXFillAttr class XFillAttrSetItem
 cui/source/inc/tabstpge.hxx:88
 SvxTabulatorTabPage m_aLeftWin class TabWin_Impl
@@ -174,7 +172,7 @@ drawinglayer/source/tools/emfphelperdata.hxx:153
 emfplushelper::EmfPlusHelperData mnFrameRight sal_Int32
 drawinglayer/source/tools/emfphelperdata.hxx:154
 emfplushelper::EmfPlusHelperData mnFrameBottom sal_Int32
-editeng/source/editeng/impedit.hxx:462
+editeng/source/editeng/impedit.hxx:465
 ImpEditEngine aSelFuncSet class EditSelFunctionSet
 filter/source/flash/swfwriter.hxx:391
 swf::Writer maMovieTempFile utl::TempFile
@@ -198,11 +196,11 @@ include/drawinglayer/texture/texture3d.hxx:62
 drawinglayer::texture::GeoTexSvxBitmapEx maBitmap class Bitmap
 include/drawinglayer/texture/texture3d.hxx:64
 drawinglayer::texture::GeoTexSvxBitmapEx maTransparence class Bitmap
-include/filter/msfilter/svdfppt.hxx:881
+include/filter/msfilter/svdfppt.hxx:880
 ImplPPTParaPropSet nDontKnow1 sal_uInt32
-include/filter/msfilter/svdfppt.hxx:882
+include/filter/msfilter/svdfppt.hxx:881
 ImplPPTParaPropSet nDontKnow2 

[Libreoffice-commits] core.git: compilerplugins/clang sc/source solenv/CompilerTest_compilerplugins_clang.mk vcl/unx

2018-12-02 Thread Libreoffice Gerrit user
 compilerplugins/clang/intvsfloat.cxx |6 +--
 compilerplugins/clang/test/intvsfloat.cxx|   43 +++
 sc/source/ui/app/inputwin.cxx|2 -
 solenv/CompilerTest_compilerplugins_clang.mk |1 
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx|2 -
 5 files changed, 24 insertions(+), 30 deletions(-)

New commits:
commit 93e0622d0097c90effc8bec5f31cf0c12a20d88b
Author: Noel Grandin 
AuthorDate: Fri Nov 30 13:25:01 2018 +0200
Commit: Noel Grandin 
CommitDate: Sun Dec 2 11:46:39 2018 +0100

loplugin:intvsfloat get this working reliably

Change-Id: Ifdf1a152f6bc2e2f6edae97a5191120f630f7e49
Reviewed-on: https://gerrit.libreoffice.org/64374
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/store/intvsfloat.cxx 
b/compilerplugins/clang/intvsfloat.cxx
similarity index 96%
rename from compilerplugins/clang/store/intvsfloat.cxx
rename to compilerplugins/clang/intvsfloat.cxx
index 3189d982d9c0..e9ee3fa9b306 100644
--- a/compilerplugins/clang/store/intvsfloat.cxx
+++ b/compilerplugins/clang/intvsfloat.cxx
@@ -16,9 +16,7 @@
 
 TODO multiplying/otherop on a combination of a float and int, and then 
truncating to int. like this:
 float getRotation() {}
-int moRotation;
-moRotation = -F_PI180 * 90 * getRotation();
-
+int moRotation = -F_PI180 * 90 * getRotation();
 */
 namespace
 {
@@ -90,6 +88,8 @@ llvm::Optional IntVsFloat::getExprValue(Expr const* 
expr)
 // Of the available clang Evaluate* APIs, this is the __only__ one that 
produces useful output
 // (as of 17 Aug 2018 checkout of clang, ie. towards clang 7)
 
+if (expr->isValueDependent())
+return llvm::Optional();
 Expr::EvalResult evalResult;
 if (!expr->EvaluateAsRValue(evalResult, compiler.getASTContext()))
 return llvm::Optional();
diff --git a/compilerplugins/clang/test/intvsfloat.cxx 
b/compilerplugins/clang/test/intvsfloat.cxx
index 7c753c3667ab..4746873e7bba 100644
--- a/compilerplugins/clang/test/intvsfloat.cxx
+++ b/compilerplugins/clang/test/intvsfloat.cxx
@@ -18,26 +18,22 @@ struct Class1
 
 void func1(Class1 const& class1)
 {
-if (1
-== PI) // expected-error {{comparing integer to float constant, can 
never be true [loplugin:intvsfloat]}}
+// expected-error@+1 {{comparing integer to float constant, can never be 
true [loplugin:intvsfloat]}}
+if (1 == PI)
 return;
-if (1
-== class1
-   .PI) // expected-error {{comparing integer to float constant, 
can never be true [loplugin:intvsfloat]}}
+// expected-error@+1 {{comparing integer to float constant, can never be 
true [loplugin:intvsfloat]}}
+if (1 == class1.PI)
 return;
-if (true
-== class1
-   .PI) // expected-error {{comparing integer to float constant, 
can never be true [loplugin:intvsfloat]}}
+// expected-error@+1 {{comparing integer to float constant, can never be 
true [loplugin:intvsfloat]}}
+if (true == class1.PI)
 return;
 if (1 == class1.getInt()) // no warning expected
 return;
-if (1
-== class1
-   .E()) // expected-error {{comparing integer to float constant, 
can never be true [loplugin:intvsfloat]}}
+// expected-error@+1 {{comparing integer to float constant, can never be 
true [loplugin:intvsfloat]}}
+if (1 == class1.E())
 return;
-if (true
-== class1
-   .E()) // expected-error {{comparing integer to float constant, 
can never be true [loplugin:intvsfloat]}}
+// expected-error@+1 {{comparing integer to float constant, can never be 
true [loplugin:intvsfloat]}}
+if (true == class1.E())
 return;
 if (1 == class1.getFloat()) // no warning expected
 return;
@@ -45,24 +41,21 @@ void func1(Class1 const& class1)
 
 void func2(Class1 const& class1)
 {
-int i0
-= PI; // expected-error {{assigning constant float value to int 
truncates data [loplugin:intvsfloat]}}
+// expected-error@+1 {{assigning constant float value to int truncates 
data [loplugin:intvsfloat]}}
+int i0 = PI;
 (void)i0;
-int i1
-= class1
-  .PI; // expected-error {{assigning constant float value to int 
truncates data [loplugin:intvsfloat]}}
+// expected-error@+1 {{assigning constant float value to int truncates 
data [loplugin:intvsfloat]}}
+int i1 = class1.PI;
 (void)i1;
-int i2
-= class1
-  .E(); // expected-error {{assigning constant float value to int 
truncates data [loplugin:intvsfloat]}}
+// expected-error@+1 {{assigning constant float value to int truncates 
data [loplugin:intvsfloat]}}
+int i2 = class1.E();
 (void)i2;
 int i3 = class1.getFloat(); // no warning expected
 (void)i3;
 int i4 = class1.getInt(); // no warning expected
 (void)i4;
-bool b1
-= class1
-  .E(); // 

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

2018-11-24 Thread Libreoffice Gerrit user
 compilerplugins/clang/unusedenumconstants.readonly.results |4 -
 sc/source/filter/inc/unitconverter.hxx |   26 -
 sc/source/filter/oox/drawingbase.cxx   |4 -
 sc/source/filter/oox/drawingfragment.cxx   |2 
 sc/source/filter/oox/pagesettings.cxx  |   12 ++--
 sc/source/filter/oox/stylesbuffer.cxx  |2 
 sc/source/filter/oox/unitconverter.cxx |   35 -
 sc/source/filter/oox/worksheethelper.cxx   |6 +-
 8 files changed, 38 insertions(+), 53 deletions(-)

New commits:
commit 61d21e79e681753599b395f224ed48172e808bc4
Author: Noel Grandin 
AuthorDate: Thu Nov 22 15:47:57 2018 +0200
Commit: Noel Grandin 
CommitDate: Sat Nov 24 21:23:54 2018 +0100

convert Unit to scoped enum

and drop unused UNIT_REFDEVX,UNIT_REFDEVY values

Change-Id: I4e516f2c51672f6541f3cf7c03a87aebc4a1f1f6
Reviewed-on: https://gerrit.libreoffice.org/63944
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/unusedenumconstants.readonly.results 
b/compilerplugins/clang/unusedenumconstants.readonly.results
index 88093da091b3..139c7cc8932d 100644
--- a/compilerplugins/clang/unusedenumconstants.readonly.results
+++ b/compilerplugins/clang/unusedenumconstants.readonly.results
@@ -1172,10 +1172,6 @@ sc/inc/types.hxx:56
 enum ScFormulaVectorState FormulaVectorDisabledNotInSoftwareSubset
 sc/inc/types.hxx:123
 enum sc::ListenerGroupType Single
-sc/source/filter/inc/unitconverter.hxx:43
-enum oox::xls::Unit UNIT_REFDEVX
-sc/source/filter/inc/unitconverter.hxx:44
-enum oox::xls::Unit UNIT_REFDEVY
 sc/source/filter/lotus/lotread.cxx:41
 enum STATE S_WK1
 sc/source/ui/inc/viewdata.hxx:43
diff --git a/sc/source/filter/inc/unitconverter.hxx 
b/sc/source/filter/inc/unitconverter.hxx
index 87d19577bec8..ec22a34a19de 100644
--- a/sc/source/filter/inc/unitconverter.hxx
+++ b/sc/source/filter/inc/unitconverter.hxx
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include "workbookhelper.hxx"
 
 namespace com { namespace sun { namespace star {
@@ -32,20 +33,17 @@ namespace oox {
 namespace xls {
 
 /** Units supported by the UnitConverter class. */
-enum Unit
+enum class Unit
 {
-UNIT_INCH,  /// Inches.
-UNIT_POINT, /// Points.
-UNIT_TWIP,  /// Twips (1/20 point).
-UNIT_EMU,   /// English Metric Unit (1/360,000 cm).
-UNIT_SCREENX,   /// Horizontal screen pixels.
-UNIT_SCREENY,   /// Vertical screen pixels.
-UNIT_REFDEVX,   /// Horizontal pixels in Calc reference device.
-UNIT_REFDEVY,   /// Vertical pixels in Calc reference device.
-UNIT_DIGIT, /// Digit width of document default font.
-UNIT_SPACE, /// Space character width of document default font.
-
-UNIT_ENUM_SIZE
+Inch,  /// Inches.
+Point, /// Points.
+Twip,  /// Twips (1/20 point).
+Emu,   /// English Metric Unit (1/360,000 cm).
+ScreenX,   /// Horizontal screen pixels.
+ScreenY,   /// Vertical screen pixels.
+Digit, /// Digit width of document default font.
+Space, /// Space character width of document default font.
+LAST
 };
 
 /** Helper class that provides functions to convert values from and to
@@ -97,7 +95,7 @@ private:
 voidaddErrorCode( sal_uInt8 nErrorCode, const OUString& 
rErrorCode );
 
 private:
-std::vector maCoeffs;   /// Coefficients for unit 
conversion.
+o3tl::enumarray maCoeffs;   /// Coefficients for 
unit conversion.
 std::map maOoxErrCodes;  /// Maps error code 
strings to BIFF error constants.
 sal_Int32   mnNullDate; /// Nulldate of this workbook 
(number of days since -01-01).
 };
diff --git a/sc/source/filter/oox/drawingbase.cxx 
b/sc/source/filter/oox/drawingbase.cxx
index 92723180ffd7..9b6e0aba70b1 100644
--- a/sc/source/filter/oox/drawingbase.cxx
+++ b/sc/source/filter/oox/drawingbase.cxx
@@ -278,8 +278,8 @@ EmuPoint ShapeAnchor::calcCellAnchorEmu( const 
CellAnchorModel& rModel ) const
 case CellAnchorType::Pixel:
 {
 const UnitConverter& rUnitConv = getUnitConverter();
-aEmuPoint.X += static_cast< sal_Int64 >( rUnitConv.scaleValue( 
static_cast< double >( rModel.mnColOffset ), UNIT_SCREENX, UNIT_EMU ) );
-aEmuPoint.Y += static_cast< sal_Int64 >( rUnitConv.scaleValue( 
static_cast< double >( rModel.mnRowOffset ), UNIT_SCREENY, UNIT_EMU ) );
+aEmuPoint.X += static_cast< sal_Int64 >( rUnitConv.scaleValue( 
static_cast< double >( rModel.mnColOffset ), Unit::ScreenX, Unit::Emu ) );
+aEmuPoint.Y += static_cast< sal_Int64 >( rUnitConv.scaleValue( 
static_cast< double >( rModel.mnRowOffset ), Unit::ScreenY, Unit::Emu ) );
 }
 break;
 }
diff --git 

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

2018-07-17 Thread Libreoffice Gerrit user
 compilerplugins/clang/useuniqueptr.cxx |3 +++
 sc/source/ui/inc/tabview.hxx   |   12 ++--
 sc/source/ui/view/tabview.cxx  |4 ++--
 sc/source/ui/view/tabview5.cxx |   24 
 4 files changed, 23 insertions(+), 20 deletions(-)

New commits:
commit 4c2d0b0d85eabc5228b3777d3519482c52a0f96b
Author: Noel Grandin 
AuthorDate: Mon Jul 16 16:41:48 2018 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 17 14:03:19 2018 +0200

loplugin:useuniqueptr in ScTabView

Change-Id: Ic506f5d350ab5912e3ebf753e02821c76841
Reviewed-on: https://gerrit.libreoffice.org/57523
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/useuniqueptr.cxx 
b/compilerplugins/clang/useuniqueptr.cxx
index a9f60c47039f..df087bfeec11 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -82,6 +82,9 @@ public:
 // ODatabaseExport::m_aDestColumns
 if (fn == SRCDIR "/dbaccess/source/ui/misc/DExport.cxx")
 return;
+// ScTabView::pDrawActual and pDrawOld
+if (fn == SRCDIR "/sc/source/ui/view/tabview5.cxx")
+return;
 
 TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
 }
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 4c321ec1653f..7dfcaea6de79 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -137,13 +137,13 @@ private:
 VclPtr pFrameWin;  // First !!!
 ScViewData  aViewData;  // must be at the front !
 
-ScViewSelectionEngine*  pSelEngine;
+std::unique_ptr pSelEngine;
 ScViewFunctionSet   aFunctionSet;
 
-ScHeaderSelectionEngine* pHdrSelEng;
+std::unique_ptr pHdrSelEng;
 ScHeaderFunctionSet  aHdrFunc;
 
-ScDrawView* pDrawView;
+std::unique_ptr pDrawView;
 
 SizeaFrameSize; // passed on as for DoResize
 Point   aBorderPos;
@@ -346,13 +346,13 @@ public:
 const ScViewData&   GetViewData() const { return aViewData; }
 
 ScViewFunctionSet&  GetFunctionSet(){ return aFunctionSet; }
-ScViewSelectionEngine*  GetSelEngine()  { return pSelEngine; }
+ScViewSelectionEngine*  GetSelEngine()  { return pSelEngine.get(); }
 
 boolSelMouseButtonDown( const MouseEvent& rMEvt );
 
-ScDrawView* GetScDrawView() { return pDrawView; }
+ScDrawView* GetScDrawView() { return pDrawView.get(); }
 // against CLOKs
-SdrView*GetSdrView(){ return pDrawView; }
+SdrView*GetSdrView(){ return pDrawView.get(); }
 
 boolIsMinimized() const { return bMinimized; }
 
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 5e53f937e102..d6a21853e616 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1484,10 +1484,10 @@ void ScTabView::UpdateShow()
 
 if (bShowH && bHeader && !pColBar[SC_SPLIT_RIGHT])
 pColBar[SC_SPLIT_RIGHT] = VclPtr::Create( pFrameWin, 
SC_SPLIT_RIGHT,
-, 
pHdrSelEng, this );
+, 
pHdrSelEng.get(), this );
 if (bShowV && bHeader && !pRowBar[SC_SPLIT_TOP])
 pRowBar[SC_SPLIT_TOP] = VclPtr::Create( pFrameWin, 
SC_SPLIT_TOP,
-  , 
pHdrSelEng, this );
+  , 
pHdrSelEng.get(), this );
 
 // show Windows
 
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 962fc20e5c9f..c4e7768da626 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -79,17 +79,17 @@ void ScTabView::Init()
 pGridWin[i] = nullptr;
 pGridWin[SC_SPLIT_BOTTOMLEFT] = VclPtr::Create( pFrameWin, 
, SC_SPLIT_BOTTOMLEFT );
 
-pSelEngine = new ScViewSelectionEngine( pGridWin[SC_SPLIT_BOTTOMLEFT], 
this,
-SC_SPLIT_BOTTOMLEFT );
-aFunctionSet.SetSelectionEngine( pSelEngine );
+pSelEngine.reset( new ScViewSelectionEngine( 
pGridWin[SC_SPLIT_BOTTOMLEFT], this,
+SC_SPLIT_BOTTOMLEFT ) );
+aFunctionSet.SetSelectionEngine( pSelEngine.get() );
 
-pHdrSelEng = new ScHeaderSelectionEngine( pFrameWin,  );
+pHdrSelEng.reset( new ScHeaderSelectionEngine( pFrameWin,  ) );
 
 pColBar[SC_SPLIT_LEFT] = VclPtr::Create( pFrameWin, 
SC_SPLIT_LEFT,
-   , pHdrSelEng, 
this );
+   , 
pHdrSelEng.get(), this );
 pColBar[SC_SPLIT_RIGHT] = nullptr;
 pRowBar[SC_SPLIT_BOTTOM] = VclPtr::Create( pFrameWin, 
SC_SPLIT_BOTTOM,
-   

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

2018-05-11 Thread Noel Grandin
 compilerplugins/clang/datamembershadow.cxx |2 --
 sc/source/ui/vba/vbastyles.cxx |8 +++-
 sc/source/ui/vba/vbastyles.hxx |3 ---
 3 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 3ef9353041a5d132c4797578fec05fd73812e10a
Author: Noel Grandin 
Date:   Thu May 10 13:43:32 2018 +0200

loplugin:datamembershadow in ScVbaStyles

member already present in superclass InheritedHelperInterfaceImpl

Change-Id: I52a8178f95ad65dc0780ba0f82d6322cea039ba4
Reviewed-on: https://gerrit.libreoffice.org/54109
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/datamembershadow.cxx 
b/compilerplugins/clang/datamembershadow.cxx
index 5784b2c6c8b6..6e71ce57a4e7 100644
--- a/compilerplugins/clang/datamembershadow.cxx
+++ b/compilerplugins/clang/datamembershadow.cxx
@@ -55,8 +55,6 @@ bool DataMemberShadow::VisitFieldDecl(FieldDecl const * 
fieldDecl)
 return true;
 if (loplugin::isSamePathname(aFileName, SRCDIR 
"/include/sfx2/templatelocalview.hxx"))
 return true;
-if (loplugin::isSamePathname(aFileName, SRCDIR 
"/sc/source/ui/vba/vbastyles.hxx"))
-return true;
 if (loplugin::isSamePathname(aFileName, SRCDIR 
"/store/source/stortree.hxx")
 || loplugin::isSamePathname(aFileName, SRCDIR 
"/store/source/stordata.hxx"))
 return true;
diff --git a/sc/source/ui/vba/vbastyles.cxx b/sc/source/ui/vba/vbastyles.cxx
index 2b8da076c2ba..a4bb3452f884 100644
--- a/sc/source/ui/vba/vbastyles.cxx
+++ b/sc/source/ui/vba/vbastyles.cxx
@@ -33,7 +33,13 @@ lcl_createAPIStyleToVBAObject( const css::uno::Any& aObject, 
const uno::Referenc
 return uno::makeAny( xStyle );
 }
 
-ScVbaStyles::ScVbaStyles( const uno::Reference< XHelperInterface >& xParent, 
const uno::Reference< css::uno::XComponentContext > & xContext, const 
uno::Reference< frame::XModel >& xModel ) : ScVbaStyles_BASE( xParent, 
xContext, uno::Reference< container::XIndexAccess >( 
ScVbaStyle::getStylesNameContainer( xModel ), uno::UNO_QUERY_THROW ) ), 
mxModel( xModel ), mxParent( xParent )
+ScVbaStyles::ScVbaStyles( const uno::Reference< XHelperInterface >& xParent,
+  const uno::Reference< css::uno::XComponentContext > 
& xContext,
+  const uno::Reference< frame::XModel >& xModel )
+: ScVbaStyles_BASE( xParent,
+xContext,
+uno::Reference< container::XIndexAccess >( 
ScVbaStyle::getStylesNameContainer( xModel ), uno::UNO_QUERY_THROW ) ),
+  mxModel( xModel )
 {
 try
 {
diff --git a/sc/source/ui/vba/vbastyles.hxx b/sc/source/ui/vba/vbastyles.hxx
index 82f60d3a8cda..39ac51ea3de9 100644
--- a/sc/source/ui/vba/vbastyles.hxx
+++ b/sc/source/ui/vba/vbastyles.hxx
@@ -27,9 +27,6 @@ typedef CollTestImplHelper< ov::excel::XStyles > 
ScVbaStyles_BASE;
 class ScVbaStyles: public ScVbaStyles_BASE
 {
 css::uno::Reference< css::frame::XModel > mxModel;
-// hard ref to parent ( perhaps we should try this in the
-// XHelperInterface itself
-css::uno::Reference< ov::XHelperInterface > mxParent;
 css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
 css::uno::Reference< css::container::XNameContainer > 
mxNameContainerCellStyles;
 public:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-06 Thread Noel Grandin
 compilerplugins/clang/useuniqueptr.cxx |   11 +++
 sc/source/filter/xml/xmlcelli.cxx  |   12 
 sc/source/filter/xml/xmlcelli.hxx  |4 ++--
 3 files changed, 17 insertions(+), 10 deletions(-)

New commits:
commit c91956452b5930e46d953668dff51d39746f8cf2
Author: Noel Grandin 
Date:   Fri Apr 6 13:20:46 2018 +0200

loplugin:useuniqueptr in ScXMLTableRowCellContext

Change-Id: Ie2c50b08eed674c129f0f66eae502c61e565a7f8
Reviewed-on: https://gerrit.libreoffice.org/52495
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/useuniqueptr.cxx 
b/compilerplugins/clang/useuniqueptr.cxx
index 3b3e9ff49e81..5d00c1a637e8 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -32,6 +32,17 @@ public:
 
 virtual void run() override
 {
+std::string fn(compiler.getSourceManager()
+   
.getFileEntryForID(compiler.getSourceManager().getMainFileID())
+   ->getName());
+loplugin::normalizeDotDotInFilePath(fn);
+// can't change these because we pass them down to the SfxItemPool 
stuff
+if (fn == SRCDIR "/sc/source/core/data/docpool.cxx")
+return;
+// this just too clever for me
+if (fn == SRCDIR "/sc/source/core/tool/chgtrack.cxx")
+return;
+
 TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
 }
 
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index b1c4f4cf0e3c..cc9ba05135c0 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -124,8 +124,6 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( 
ScXMLImport& rImport,
 ScXMLImportContext( rImport ),
 mpEditEngine(GetScImport().GetEditEngine()),
 mnCurParagraph(0),
-pDetectiveObjVec(nullptr),
-pCellRangeSource(nullptr),
 fValue(0.0),
 nMergedRows(1),
 nMatrixRows(0),
@@ -298,8 +296,6 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( 
ScXMLImport& rImport,
 
 ScXMLTableRowCellContext::~ScXMLTableRowCellContext()
 {
-delete pDetectiveObjVec;
-delete pCellRangeSource;
 }
 
 void ScXMLTableRowCellContext::LockSolarMutex()
@@ -724,18 +720,18 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL 
ScXMLTableRowCellContex
 {
 bIsEmpty = false;
 if (!pDetectiveObjVec)
-pDetectiveObjVec = new ScMyImpDetectiveObjVec;
+pDetectiveObjVec.reset( new ScMyImpDetectiveObjVec );
 pContext = new ScXMLDetectiveContext(
-rXMLImport, pDetectiveObjVec );
+rXMLImport, pDetectiveObjVec.get() );
 }
 break;
 case XML_ELEMENT( TABLE, XML_CELL_RANGE_SOURCE ):
 {
 bIsEmpty = false;
 if (!pCellRangeSource)
-pCellRangeSource = new ScMyImpCellRangeSource();
+pCellRangeSource.reset(new ScMyImpCellRangeSource());
 pContext = new ScXMLCellRangeSourceContext(
-rXMLImport, pAttribList, pCellRangeSource );
+rXMLImport, pAttribList, pCellRangeSource.get() );
 }
 break;
 }
diff --git a/sc/source/filter/xml/xmlcelli.hxx 
b/sc/source/filter/xml/xmlcelli.hxx
index d816dec3ef67..0e567e051910 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -75,8 +75,8 @@ class ScXMLTableRowCellContext : public ScXMLImportContext
 FieldsType maFields;
 
 std::unique_ptr< ScXMLAnnotationData > mxAnnotationData;
-ScMyImpDetectiveObjVec* pDetectiveObjVec;
-ScMyImpCellRangeSource* pCellRangeSource;
+std::unique_ptr< ScMyImpDetectiveObjVec > pDetectiveObjVec;
+std::unique_ptr< ScMyImpCellRangeSource > pCellRangeSource;
 double  fValue;
 SCROW   nMergedRows, nMatrixRows, nRepeatedRows;
 SCCOL   nMergedCols, nMatrixCols, nColsRepeated;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-02-23 Thread Noel Grandin
 compilerplugins/clang/doubleconvert.cxx  |   84 +++
 compilerplugins/clang/test/doubleconvert.cxx |   22 +++
 sc/source/core/tool/detfunc.cxx  |6 -
 sc/source/ui/dbgui/csvgrid.cxx   |   10 +--
 solenv/CompilerTest_compilerplugins_clang.mk |1 
 5 files changed, 115 insertions(+), 8 deletions(-)

New commits:
commit 64ada386b9e67b2cb5823a333ec2b289781459ba
Author: Noel Grandin 
Date:   Thu Feb 22 15:39:56 2018 +0200

new loplugin:doubleconvert to with ColorData work

Change-Id: Ib8f2ef485f548645c4b0e7cf080b72b28c4e278d
Reviewed-on: https://gerrit.libreoffice.org/50226
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/compilerplugins/clang/doubleconvert.cxx 
b/compilerplugins/clang/doubleconvert.cxx
new file mode 100644
index ..a0478e9e5f1f
--- /dev/null
+++ b/compilerplugins/clang/doubleconvert.cxx
@@ -0,0 +1,84 @@
+/* -*- 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 "check.hxx"
+#include "compat.hxx"
+#include "plugin.hxx"
+
+/**
+ * Look for places where we are converting from type A through a conversion 
operator and back to type A,
+ * which is redundant. At the moment only look for Color, to aid my 
ColorData->Color conversion
+ */
+namespace
+{
+class DoubleConvert final : public RecursiveASTVisitor, public 
loplugin::Plugin
+{
+public:
+explicit DoubleConvert(loplugin::InstantiationData const& data)
+: Plugin(data)
+{
+}
+void run() override { 
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
+
+bool VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr const*);
+};
+
+/**
+ The AST looks like:
+
+ CXXOperatorCallExpr 0x8e5b840 'class Color' lvalue
+|-ImplicitCastExpr 0x8e5b828 'class Color &(*)(class Color &&) noexcept' 

+| `-DeclRefExpr 0x8e5b800 'class Color &(class Color &&) noexcept' lvalue 
CXXMethod 0x8e59a08 'operator=' 'class Color &(class Color &&) noexcept'
+|-DeclRefExpr 0x8e5b678 'class Color' lvalue Var 0x8e5b5d0 'col2' 'class Color'
+`-MaterializeTemporaryExpr 0x8e5b7e8 'class Color' xvalue
+  `-CXXConstructExpr 0x8e5b7b0 'class Color' 'void (ColorData)'
+`-ImplicitCastExpr 0x8e5b798 'ColorData':'unsigned int' 
+  `-CXXFunctionalCastExpr 0x8e5b770 'sal_Int32':'int' functional cast to 
sal_Int32 
+`-ImplicitCastExpr 0x8e5b758 'sal_Int32':'int' 
+  `-CXXMemberCallExpr 0x8e5b730 'sal_Int32':'int'
+`-MemberExpr 0x8e5b6f8 '' .operator 
int 0x8e51048
+  `-ImplicitCastExpr 0x8e5b6e0 'const class Color' lvalue 
+`-DeclRefExpr 0x8e5b6b0 'class Color' lvalue Var 0x8e5b518 
'col1' 'class Color'
+*/
+bool DoubleConvert::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr 
const* materializetemp)
+{
+if (ignoreLocation(materializetemp))
+return true;
+auto cxxConstruct
+= 
dyn_cast(materializetemp->GetTemporaryExpr()->IgnoreParenCasts());
+if (!cxxConstruct)
+return true;
+if (cxxConstruct->getNumArgs() == 0)
+return true;
+auto cxxMemberCallExpr
+= 
dyn_cast(cxxConstruct->getArg(0)->IgnoreParenCasts());
+if (!cxxMemberCallExpr)
+return true;
+if (!isa(cxxMemberCallExpr->getMethodDecl()))
+return true;
+if (materializetemp->getType().getCanonicalType().getTypePtr()
+!= cxxMemberCallExpr->getImplicitObjectArgument()
+   ->getType()
+   .getCanonicalType()
+   .getTypePtr())
+return true;
+if (!loplugin::TypeCheck(materializetemp->getType().getCanonicalType())
+ .Class("Color")
+ .GlobalNamespace())
+return true;
+
+report(DiagnosticsEngine::Warning, "redundant double conversion", 
materializetemp->getExprLoc())
+<< materializetemp->getSourceRange();
+return true;
+}
+
+static loplugin::Plugin::Registration reg("doubleconvert");
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/doubleconvert.cxx 
b/compilerplugins/clang/test/doubleconvert.cxx
new file mode 100644
index ..d0fd8b787bdb
--- /dev/null
+++ b/compilerplugins/clang/test/doubleconvert.cxx
@@ -0,0 +1,22 @@
+/* -*- 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 

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

2018-02-01 Thread Noel Grandin
 compilerplugins/clang/singlevalfields.cxx |8 -
 compilerplugins/clang/singlevalfields.results |   82 ++
 sc/source/filter/excel/xechart.cxx|5 
 sc/source/filter/inc/xcl97rec.hxx |2 
 sc/source/filter/inc/xechart.hxx  |1 
 sc/source/filter/xcl97/xcl97rec.cxx   |4 
 sw/source/core/inc/UndoNumbering.hxx  |1 
 sw/source/core/undo/unnum.cxx |   13 --
 sw/source/filter/html/svxcss1.cxx |  143 +++---
 sw/source/filter/html/svxcss1.hxx |5 
 10 files changed, 110 insertions(+), 154 deletions(-)

New commits:
commit 98864543c099027cc3dbedc0389ed46cefe4713e
Author: Noel Grandin 
Date:   Thu Feb 1 12:45:48 2018 +0200

loplugin:singlevalfields

Change-Id: I346f236e28cb0bd064a7d757b187e5e64544700f
Reviewed-on: https://gerrit.libreoffice.org/49086
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/compilerplugins/clang/singlevalfields.cxx 
b/compilerplugins/clang/singlevalfields.cxx
index 83733b7a0041..edf35e5f3cb2 100644
--- a/compilerplugins/clang/singlevalfields.cxx
+++ b/compilerplugins/clang/singlevalfields.cxx
@@ -31,7 +31,7 @@ Note that the actual process may involve a fair amount of 
undoing, hand editing,
 to get it to work :-)
 
 @TODO we don't spot fields that have been zero-initialised via calloc or 
rtl_allocateZeroMemory or memset
-@TODO calls to lambdas (see FIXME near CXXOperatorCallExpr)
+@TODO calls to lambdas where a reference to the field is taken
 
 */
 
@@ -310,12 +310,6 @@ bool SingleValFields::VisitMemberExpr( const MemberExpr* 
memberExpr )
 child = parent;
 parent = getParentStmt(parent);
 }
-else if (isa(parent))
-{
-// FIXME need to handle this properly
-bPotentiallyAssignedTo = true;
-break;
-}
 else if (isa(parent))
 {
 checkCallExpr(child, dyn_cast(parent), assignValue, 
bPotentiallyAssignedTo);
diff --git a/compilerplugins/clang/singlevalfields.results 
b/compilerplugins/clang/singlevalfields.results
index d54fac80e7c9..03a32af65333 100644
--- a/compilerplugins/clang/singlevalfields.results
+++ b/compilerplugins/clang/singlevalfields.results
@@ -4,7 +4,7 @@ chart2/source/model/main/DataPoint.hxx:107
 chart2/source/view/inc/GL3DRenderer.hxx:161
 chart::opengl3D::TextInfoBatch batchNum
 512
-include/basic/sbxvar.hxx:67
+include/basic/sbxvar.hxx:70
 SbxValues::(anonymous) pData
 0
 include/editeng/charsetcoloritem.hxx:35
@@ -25,18 +25,6 @@ include/svtools/svparser.hxx:74
 include/svtools/svparser.hxx:75
 SvParser::TokenStackType bTokenHasValue
 0
-include/tools/multisel.hxx:41
-MultiSelection bInverseCur
-0
-include/unotools/textsearch.hxx:104
-utl::SearchParam m_bWordOnly
-0
-include/unotools/textsearch.hxx:105
-utl::SearchParam m_bSrchInSel
-0
-include/unotools/textsearch.hxx:110
-utl::SearchParam nTransliterationFlags
-0
 include/vcl/filter/pdfdocument.hxx:173
 vcl::filter::PDFNameElement m_nLength
 0
@@ -61,10 +49,10 @@ include/vcl/pdfwriter.hxx:559
 libreofficekit/source/gtk/lokdocview.cxx:84
 LOKDocViewPrivateImpl m_bIsLoading
 0
-opencl/source/opencl_device.cxx:53
+opencl/source/opencl_device.cxx:54
 (anonymous namespace)::LibreOfficeDeviceEvaluationIO inputSize
 15360
-opencl/source/opencl_device.cxx:54
+opencl/source/opencl_device.cxx:55
 (anonymous namespace)::LibreOfficeDeviceEvaluationIO outputSize
 15360
 pyuno/source/module/pyuno_impl.hxx:312
@@ -79,6 +67,12 @@ sc/inc/compiler.hxx:108
 sc/qa/unit/ucalc.hxx:41
 Test::RangeNameDef mnIndex
 1
+sc/source/filter/inc/xcl97rec.hxx:272
+ExcBof8_Base nLowestBiffVer
+6
+sc/source/filter/inc/xechart.hxx:859
+XclExpChDropBar mnBarDist
+100
 sd/inc/sdpptwrp.hxx:42
 SdPPTFilter pBas
 0
@@ -106,10 +100,10 @@ soltools/mkdepend/def.h:130
 soltools/mkdepend/def.h:132
 inclist i_searched
 1
-stoc/source/inspect/introspection.cxx:1533
+stoc/source/inspect/introspection.cxx:1530
 (anonymous namespace)::Cache::Data hits
 1
-sw/inc/hints.hxx:195
+sw/inc/hints.hxx:189
 SwAttrSetChg m_bDelSet
 0
 sw/inc/pagepreviewlayout.hxx:49
@@ -118,9 +112,9 @@ sw/inc/pagepreviewlayout.hxx:49
 sw/source/core/inc/frmtool.hxx:260
 SwBorderAttrs m_bBorderDist
 1
-sw/source/core/inc/swfont.hxx:170
-SwFont m_bURL
-0
+sw/source/core/inc/UndoNumbering.hxx:33
+SwUndoInsNum nSttSet
+18446744073709551615
 sw/source/core/inc/UndoSort.hxx:38
 SwSortUndoElement::(anonymous union)::(anonymous) nKenn
 4294967295
@@ -133,9 +127,12 @@ sw/source/filter/html/htmlcss1.cxx:78
 sw/source/filter/html/htmlcss1.cxx:79
 SwCSS1ItemIds nFormatKeep
 109
-sw/source/filter/html/svxcss1.hxx:199

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

2017-12-18 Thread Noel Grandin
 compilerplugins/clang/singlevalfields.results |   76 ++
 sc/source/ui/inc/undodat.hxx  |2 
 sc/source/ui/undo/undodat.cxx |   11 ---
 3 files changed, 21 insertions(+), 68 deletions(-)

New commits:
commit 150af593ce1dee2a04dd56d9de67b3e0c4581811
Author: Noel Grandin 
Date:   Mon Dec 18 09:13:25 2017 +0200

loplugin:singevalfields

Change-Id: I28c9e436b9d434ce59394ee195ea39815ae49028
Reviewed-on: https://gerrit.libreoffice.org/46685
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/singlevalfields.results 
b/compilerplugins/clang/singlevalfields.results
index b99868b50374..823de7ba50d7 100644
--- a/compilerplugins/clang/singlevalfields.results
+++ b/compilerplugins/clang/singlevalfields.results
@@ -1,21 +1,21 @@
-avmedia/source/viewer/mediawindow_impl.hxx:150
-avmedia::priv::MediaWindowImpl mbEventTransparent
-1
 chart2/source/model/main/DataPoint.hxx:107
 chart::DataPoint m_bNoParentPropAllowed
 0
 chart2/source/view/inc/GL3DRenderer.hxx:161
 chart::opengl3D::TextInfoBatch batchNum
 512
-connectivity/source/inc/odbc/OBoundParam.hxx:113
-connectivity::odbc::OBoundParam paramLength
-0
-cui/source/inc/cfgutil.hxx:132
-SfxConfigGroupListBox m_pImageProvider
-0
 include/basic/sbxvar.hxx:67
 SbxValues::(anonymous) pData
 0
+include/editeng/charsetcoloritem.hxx:35
+SvxCharSetColorItem eFrom
+0
+include/filter/msfilter/dffpropset.hxx:33
+DffPropFlags bSet
+0
+include/filter/msfilter/dffpropset.hxx:35
+DffPropFlags bBlip
+1
 include/o3tl/vector_pool.hxx:93
 o3tl::detail::struct_from_value::type nextFree
 -1
@@ -25,9 +25,6 @@ include/svtools/svparser.hxx:74
 include/svtools/svparser.hxx:75
 SvParser::TokenStackType bTokenHasValue
 0
-include/vcl/field.hxx:99
-PatternFormatter mbInPattKeyInput
-0
 include/vcl/filter/pdfdocument.hxx:173
 vcl::filter::PDFNameElement m_nLength
 0
@@ -67,14 +64,11 @@ sax/source/tools/fastserializer.hxx:231
 sc/inc/compiler.hxx:108
 ScRawToken::(anonymous union)::(anonymous) eInForceArray
 0
-sc/inc/recursionhelper.hxx:56
-ScRecursionHelper bConverging
-0
 sc/qa/unit/ucalc.hxx:41
 Test::RangeNameDef mnIndex
 1
-sc/source/ui/inc/undodat.hxx:448
-ScUndoDataForm nEndChangeAction
+sc/source/ui/inc/undodat.hxx:447
+ScUndoDataForm nStartChangeAction
 0
 sd/inc/sdpptwrp.hxx:42
 SdPPTFilter pBas
@@ -82,9 +76,6 @@ sd/inc/sdpptwrp.hxx:42
 sd/source/filter/html/htmlex.hxx:114
 HtmlExport mbAutoSlide
 1
-sd/source/ui/remotecontrol/DiscoveryService.hxx:43
-sd::DiscoveryService zService
-0
 sfx2/source/appl/lnkbase2.cxx:76
 sfx2::ImplBaseLinkData::tDDEType pItem
 0
@@ -97,9 +88,6 @@ sfx2/source/doc/doctemplates.cxx:136
 sfx2/source/view/ipclient.cxx:78
 SfxBooleanFlagGuard m_bLifeValue
 1
-shell/source/sessioninstall/SyncDbusSessionHelper.cxx:26
-(anonymous namespace)::GErrorWrapper m_pError
-0
 soltools/cpp/cpp.h:120
 includelist deleted
 1
@@ -109,9 +97,6 @@ soltools/mkdepend/def.h:130
 soltools/mkdepend/def.h:132
 inclist i_searched
 1
-starmath/inc/node.hxx:104
-SmNode mnFlags
-0
 stoc/source/inspect/introspection.cxx:1533
 (anonymous namespace)::Cache::Data hits
 1
@@ -124,24 +109,9 @@ sw/inc/pagepreviewlayout.hxx:49
 sw/source/core/inc/frmtool.hxx:260
 SwBorderAttrs m_bBorderDist
 1
-sw/source/core/inc/swfont.hxx:158
-SwFont m_nToxCount
-0
-sw/source/core/inc/swfont.hxx:159
-SwFont m_nRefCount
-0
-sw/source/core/inc/swfont.hxx:160
-SwFont m_nMetaCount
-0
-sw/source/core/inc/swfont.hxx:161
-SwFont m_nInputFieldCount
-0
 sw/source/core/inc/UndoSort.hxx:38
 SwSortUndoElement::(anonymous union)::(anonymous) nKenn
 4294967295
-sw/source/core/text/porlay.hxx:239
-SwParaPortion m_nDelta
-0
 sw/source/filter/html/htmlcss1.cxx:77
 SwCSS1ItemIds nFormatBreak
 93
@@ -157,15 +127,15 @@ sw/source/filter/html/svxcss1.hxx:199
 sw/source/filter/inc/rtf.hxx:30
 RTFSurround::(anonymous union)::(anonymous) nJunk
 0
-sw/source/filter/ww8/ww8par2.hxx:58
-WW8SwFlyPara eAnchor
-0
-sw/source/filter/ww8/ww8par.hxx:650
+sw/source/filter/ww8/ww8par.hxx:651
 WW8FormulaControl mfUnknown
 0
-sw/source/filter/ww8/ww8par.hxx:659
+sw/source/filter/ww8/ww8par.hxx:660
 WW8FormulaControl mhpsCheckBox
 20
+sw/source/uibase/lingu/sdrhhcwrap.hxx:33
+SdrHHCWrapper pTextObj
+0
 vcl/inc/salprn.hxx:41
 SalPrinterQueueInfo mnStatus
 0
@@ -175,24 +145,18 @@ vcl/inc/salprn.hxx:42
 vcl/inc/salprn.hxx:43
 SalPrinterQueueInfo mpSysData
 0
-vcl/inc/svdata.hxx:267
+vcl/inc/svdata.hxx:268
 ImplSVNWFData mnStatusBarLowerRightOffset
 0
-vcl/inc/svdata.hxx:283
+vcl/inc/svdata.hxx:284
 ImplSVNWFData 

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

2017-11-22 Thread Stephan Bergmann
 compilerplugins/clang/unnecessaryparen.cxx |   33 +
 sc/source/ui/view/gridwin.cxx  |2 -
 2 files changed, 12 insertions(+), 23 deletions(-)

New commits:
commit 5640ef110094f33cf678f4e3ef4f3fd4334a00c8
Author: Stephan Bergmann 
Date:   Wed Nov 22 09:54:10 2017 +0100

There appears to be no reason to ignore macros in these parts of...

...loplugin:unnecessaryparen

Change-Id: I473a1e16cf9f485a61af5477aca22798996253a3

diff --git a/compilerplugins/clang/unnecessaryparen.cxx 
b/compilerplugins/clang/unnecessaryparen.cxx
index 57c9cd9c65b4..fe3b0dd4b028 100644
--- a/compilerplugins/clang/unnecessaryparen.cxx
+++ b/compilerplugins/clang/unnecessaryparen.cxx
@@ -146,15 +146,16 @@ bool UnnecessaryParen::VisitParenExpr(const ParenExpr* 
parenExpr)
 }
 
 if (auto declRefExpr = dyn_cast(subExpr)) {
-if (declRefExpr->getLocStart().isMacroID())
-return true;
-
-// hack for BAD_CAST macro
-SourceManager& SM = compiler.getSourceManager();
-const char *p1 = SM.getCharacterData( 
declRefExpr->getLocStart().getLocWithOffset(-10) );
-const char *p2 = SM.getCharacterData( declRefExpr->getLocStart() );
-if ( std::string(p1, p2 - p1).find("BAD_CAST") != std::string::npos )
-return true;
+// hack for libxml2's BAD_CAST object-like macro (expanding to 
"(xmlChar *)"), which is
+// typically used as if it were a function-like macro, e.g., as 
"BAD_CAST(pName)" in
+// SwNode::dumpAsXml (sw/source/core/docnode/node.cxx)
+if (!declRefExpr->getLocStart().isMacroID()) {
+SourceManager& SM = compiler.getSourceManager();
+const char *p1 = SM.getCharacterData( 
declRefExpr->getLocStart().getLocWithOffset(-10) );
+const char *p2 = SM.getCharacterData( declRefExpr->getLocStart() );
+if ( std::string(p1, p2 - p1).find("BAD_CAST") != 
std::string::npos )
+return true;
+}
 
 report(
 DiagnosticsEngine::Warning, "unnecessary parentheses around 
identifier",
@@ -163,9 +164,7 @@ bool UnnecessaryParen::VisitParenExpr(const ParenExpr* 
parenExpr)
 }
 
 
-if (auto cxxNamedCastExpr = dyn_cast(subExpr)) {
-if (cxxNamedCastExpr->getLocStart().isMacroID())
-return true;
+if (isa(subExpr)) {
 report(
 DiagnosticsEngine::Warning, "unnecessary parentheses around cast",
 parenExpr->getLocStart())
@@ -209,8 +208,6 @@ bool UnnecessaryParen::VisitReturnStmt(const ReturnStmt* 
returnStmt)
 {
 if (ignoreLocation(returnStmt))
 return true;
-if (returnStmt->getLocStart().isMacroID())
-return true;
 
 if (!returnStmt->getRetValue())
 return true;
@@ -240,8 +237,6 @@ void UnnecessaryParen::VisitSomeStmt(const Stmt * stmt, 
const Expr* cond, String
 {
 if (ignoreLocation(stmt))
 return;
-if (stmt->getLocStart().isMacroID())
-return;
 
 auto parenExpr = dyn_cast(ignoreAllImplicit(cond));
 if (parenExpr) {
@@ -269,8 +264,6 @@ bool UnnecessaryParen::VisitCallExpr(const CallExpr* 
callExpr)
 {
 if (ignoreLocation(callExpr))
 return true;
-if (callExpr->getLocStart().isMacroID())
-return true;
 if (callExpr->getNumArgs() != 1 || isa(callExpr))
 return true;
 
@@ -294,8 +287,6 @@ bool UnnecessaryParen::VisitCXXOperatorCallExpr(const 
CXXOperatorCallExpr* callE
 {
 if (ignoreLocation(callExpr))
 return true;
-if (callExpr->getLocStart().isMacroID())
-return true;
 if (callExpr->getNumArgs() != 2)
 return true;
 
@@ -334,8 +325,6 @@ bool UnnecessaryParen::VisitVarDecl(const VarDecl* varDecl)
 {
 if (ignoreLocation(varDecl))
 return true;
-if (varDecl->getLocStart().isMacroID())
-return true;
 if (!varDecl->getInit())
 return true;
 
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 7dd772d5b2a1..3bc7ccbb9685 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -3599,7 +3599,7 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& 
rEvt )
 
 // clear DND_ACTION_LINK when other actions are set. The usage 
below cannot handle
 // multiple set values
-if((nMyAction & DND_ACTION_LINK) && (nMyAction & 
(DND_ACTION_COPYMOVE)))
+if((nMyAction & DND_ACTION_LINK) && (nMyAction & 
DND_ACTION_COPYMOVE))
 {
 nMyAction &= ~DND_ACTION_LINK;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-08 Thread Stephan Bergmann
 compilerplugins/clang/unnecessaryoverride.cxx |3 ---
 sc/source/ui/vba/vbaformatcondition.cxx   |6 --
 sc/source/ui/vba/vbaformatcondition.hxx   |1 -
 3 files changed, 10 deletions(-)

New commits:
commit 9fbe22e1d9b30c5c0087e84809c80b936c5c142f
Author: Stephan Bergmann 
Date:   Thu Nov 9 07:52:32 2017 +0100

No need to blacklist this loplugin:unnecessaryoverride

This now hides one of the ScVbaFormatCondition_BASE::Operator overloads, but
that doesn't get called directly at ScVbaFormatCondition anyway.  (And if it
were, we could add an appropriate using declaration to 
ScVbaFormatCondition.)

Change-Id: I8440b76a5745c6874f7a3bfcbb4bc4ce5618a4c4

diff --git a/compilerplugins/clang/unnecessaryoverride.cxx 
b/compilerplugins/clang/unnecessaryoverride.cxx
index b71cf2003f3e..eb3dabb26f60 100644
--- a/compilerplugins/clang/unnecessaryoverride.cxx
+++ b/compilerplugins/clang/unnecessaryoverride.cxx
@@ -267,9 +267,6 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const 
CXXMethodDecl* methodDecl)
 // some very creative method hiding going on here
 if (loplugin::isSamePathname(aFileName, SRCDIR 
"/svx/source/dialog/checklbx.cxx"))
 return true;
-// entertaining template magic
-if (loplugin::isSamePathname(aFileName, SRCDIR 
"/sc/source/ui/vba/vbaformatcondition.cxx"))
-return true;
 
 const CXXMethodDecl* overriddenMethodDecl = 
findOverriddenOrSimilarMethodInSuperclasses(methodDecl);
 if (!overriddenMethodDecl) {
diff --git a/sc/source/ui/vba/vbaformatcondition.cxx 
b/sc/source/ui/vba/vbaformatcondition.cxx
index f5f3aff26e7a..55d81e888030 100644
--- a/sc/source/ui/vba/vbaformatcondition.cxx
+++ b/sc/source/ui/vba/vbaformatcondition.cxx
@@ -128,12 +128,6 @@ ScVbaFormatCondition::Type(  )
 return nReturnType;
 }
 
-::sal_Int32
-ScVbaFormatCondition::Operator( bool bVal )
-{
-return ScVbaFormatCondition_BASE::Operator( bVal );
-}
-
 ::sal_Int32 SAL_CALL
 ScVbaFormatCondition::Operator(  )
 {
diff --git a/sc/source/ui/vba/vbaformatcondition.hxx 
b/sc/source/ui/vba/vbaformatcondition.hxx
index 8ffb1f700b96..85b102310762 100644
--- a/sc/source/ui/vba/vbaformatcondition.hxx
+++ b/sc/source/ui/vba/vbaformatcondition.hxx
@@ -56,7 +56,6 @@ public:
 virtual void SAL_CALL Delete(  ) override;
 virtual void SAL_CALL Modify( ::sal_Int32 Type, const css::uno::Any& 
Operator, const css::uno::Any& Formula1, const css::uno::Any& Formula2 ) 
override;
 virtual ::sal_Int32 SAL_CALL Type(  ) override;
-virtual ::sal_Int32 Operator( bool  ) override;
 virtual ::sal_Int32 SAL_CALL Operator(  ) override;
 virtual void setFormula1( const css::uno::Any& _aFormula1) override;
 virtual css::uno::Reference< ::ooo::vba::excel::XInterior > SAL_CALL 
Interior(  ) override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-15 Thread Stephan Bergmann
 compilerplugins/clang/redundantcast.cxx   |   10 +++---
 compilerplugins/clang/test/redundantcast.cxx  |   17 +
 compilerplugins/clang/test/redundantcast.hxx  |2 ++
 sc/source/ui/unoobj/PivotTableDataProvider.cxx|4 ++--
 sd/source/ui/unoidl/unopage.cxx   |2 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +-
 6 files changed, 26 insertions(+), 11 deletions(-)

New commits:
commit 7282b25f226bf73ed88dbd3d0a6f265f1626d190
Author: Stephan Bergmann 
Date:   Fri Sep 15 18:45:17 2017 +0200

Fix loplugin:redundantcast's VisitCXXFunctionalCastExpr

...when t1 is ElaboratedType sugar (which isn't only used when the type is
written with an elaborated type keyword, but also when it is written with a
qualified name).

(I originally wrote testArithmeticTypedefs to track down a different issue,
which turned out to be a non-issue, with this fix as fall-out.  So that test
doesn't quite match the theme of this commit, but is a worthwhile addition
nonetheless.)

Change-Id: Ic447da4399853d7d045e3e2e7ade8ddf52d89749

diff --git a/compilerplugins/clang/redundantcast.cxx 
b/compilerplugins/clang/redundantcast.cxx
index 32f7e8bd7fd9..dba573387743 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -650,19 +650,15 @@ bool 
RedundantCast::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr const * exp
 }
 
 auto const t1 = expr->getTypeAsWritten();
-auto const t2 = sub->getType().getDesugaredType(compiler.getASTContext()); 
// look through templated wrapped types
-if (t1 != t2)
-return true;
-// if we are casting from/to a typedef, ignore it, even if the underlying 
types are the same
-if ((loplugin::TypeCheck(t1).Typedef() || 
loplugin::TypeCheck(sub->getType()).Typedef())
-&& t1 != sub->getType())
+auto const t2 = sub->getType();
+if (t1.getCanonicalType() != t2.getCanonicalType())
 return true;
 if (!isOkToRemoveArithmeticCast(t1, t2, expr->getSubExpr()))
 return true;
 report(
 DiagnosticsEngine::Warning,
 "redundant functional cast from %0 to %1", expr->getExprLoc())
-<< sub->getType() << t1 << expr->getSourceRange();
+<< t2 << t1 << expr->getSourceRange();
 return true;
 }
 
diff --git a/compilerplugins/clang/test/redundantcast.cxx 
b/compilerplugins/clang/test/redundantcast.cxx
index db1268b8b87b..5a56ec42e32e 100644
--- a/compilerplugins/clang/test/redundantcast.cxx
+++ b/compilerplugins/clang/test/redundantcast.cxx
@@ -300,6 +300,23 @@ bool testCStyleCastOfTemplateMethodResult(Enum1Item* item) 
{
 return (Enum1)item->GetValue() == Enum1::X; // expected-error {{redundant 
cstyle cast from 'Enum1' to 'Enum1' [loplugin:redundantcast]}}
 }
 
+using T1 = int;
+T1 nt1r() { return 0; }
+void testArithmeticTypedefs() {
+(void) static_cast(nir());
+(void) T1(nir());
+(void) (T1) nir();
+(void) static_cast(nt1r());
+(void) int(nt1r());
+(void) (int) nt1r();
+using T2 = T1;
+(void) static_cast(nt1r());
+(void) T2(nt1r());
+(void) (T2) nt1r();
+(void) static_cast(nt1r()); // expected-error {{redundant}}
+(void) T1(nt1r()); // expected-error {{redundant}}
+(void) (T1) nt1r(); // expected-error {{redundant}}
+}
 
 int main() {
 testConstCast();
diff --git a/compilerplugins/clang/test/redundantcast.hxx 
b/compilerplugins/clang/test/redundantcast.hxx
index e87da7a55fe4..014aecea4dc3 100644
--- a/compilerplugins/clang/test/redundantcast.hxx
+++ b/compilerplugins/clang/test/redundantcast.hxx
@@ -30,6 +30,8 @@ S const && csx();
 S nsr();
 S const csr();
 
+void testArithmeticTypedefs();
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx 
b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
index 7d5a3bfa90c7..581e5a9c9b25 100644
--- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx
+++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
@@ -358,9 +358,9 @@ void PivotTableDataProvider::collectPivotTableData()
 if (!xDimProp.is() || !xDimSupp.is())
 continue;
 
-sheet::DataPilotFieldOrientation eDimOrient = 
sheet::DataPilotFieldOrientation(
+sheet::DataPilotFieldOrientation eDimOrient =
 ScUnoHelpFunctions::GetEnumProperty(xDimProp, 
SC_UNO_DP_ORIENTATION,
-
sheet::DataPilotFieldOrientation_HIDDEN));
+
sheet::DataPilotFieldOrientation_HIDDEN);
 
 if (eDimOrient == sheet::DataPilotFieldOrientation_HIDDEN)
 continue;
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 5976b90b56fa..84f7a8399f36 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -1046,7 

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

2017-08-29 Thread Noel Grandin
 compilerplugins/clang/constparams.cxx|2 ++
 sc/source/core/opencl/formulagroupcl.cxx |6 +++---
 sc/source/core/opencl/opbase.cxx |4 ++--
 sc/source/core/opencl/opbase.hxx |4 ++--
 sc/source/filter/dif/difimp.cxx  |2 +-
 sc/source/filter/excel/excdoc.cxx|6 +++---
 sc/source/filter/excel/excrecds.cxx  |   12 ++--
 sc/source/filter/excel/xeescher.cxx  |2 +-
 sc/source/filter/excel/xeformula.cxx |4 ++--
 sc/source/filter/excel/xestream.cxx  |2 +-
 sc/source/filter/excel/xestyle.cxx   |2 +-
 sc/source/filter/excel/xetable.cxx   |4 ++--
 sc/source/filter/excel/xicontent.cxx |2 +-
 sc/source/filter/excel/xilink.cxx|2 +-
 sc/source/filter/excel/xipivot.cxx   |4 ++--
 sc/source/filter/excel/xistream.cxx  |2 +-
 sc/source/filter/excel/xiview.cxx|2 +-
 sc/source/filter/excel/xlescher.cxx  |8 
 sc/source/filter/ftools/fapihelper.cxx   |4 ++--
 sc/source/filter/html/htmlimp.cxx|2 +-
 sc/source/filter/html/htmlpars.cxx   |   16 
 sc/source/filter/inc/XclExpChangeTrack.hxx   |6 +++---
 sc/source/filter/inc/condformatbuffer.hxx|2 +-
 sc/source/filter/inc/dif.hxx |2 +-
 sc/source/filter/inc/drawingfragment.hxx |2 +-
 sc/source/filter/inc/eeparser.hxx|4 ++--
 sc/source/filter/inc/excrecds.hxx|   20 ++--
 sc/source/filter/inc/fapihelper.hxx  |4 ++--
 sc/source/filter/inc/htmlimp.hxx |2 +-
 sc/source/filter/inc/htmlpars.hxx|   16 
 sc/source/filter/inc/pivotcachebuffer.hxx|   12 ++--
 sc/source/filter/inc/qprostyle.hxx   |2 +-
 sc/source/filter/inc/tool.h  |2 +-
 sc/source/filter/inc/xcl97esc.hxx|2 +-
 sc/source/filter/inc/xcl97rec.hxx|4 ++--
 sc/source/filter/inc/xeescher.hxx|2 +-
 sc/source/filter/inc/xilink.hxx  |2 +-
 sc/source/filter/inc/xipivot.hxx |4 ++--
 sc/source/filter/inc/xistream.hxx|2 +-
 sc/source/filter/inc/xiview.hxx  |2 +-
 sc/source/filter/lotus/tool.cxx  |2 +-
 sc/source/filter/oox/condformatbuffer.cxx|8 
 sc/source/filter/oox/drawingfragment.cxx |2 +-
 sc/source/filter/oox/excelvbaproject.cxx |2 +-
 sc/source/filter/oox/pivotcachebuffer.cxx|   12 ++--
 sc/source/filter/oox/sheetdatabuffer.cxx |2 +-
 sc/source/filter/rtf/eeimpars.cxx|2 +-
 sc/source/filter/xcl97/XclExpChangeTrack.cxx |6 +++---
 sc/source/filter/xcl97/xcl97esc.cxx  |2 +-
 sc/source/filter/xcl97/xcl97rec.cxx  |   16 
 sc/source/ui/inc/cliputil.hxx|2 +-
 sc/source/ui/inc/viewfunc.hxx|6 +++---
 sc/source/ui/inc/viewutil.hxx|   10 +-
 sc/source/ui/inc/xmlsourcedlg.hxx|2 +-
 sc/source/ui/view/cliputil.cxx   |2 +-
 sc/source/ui/view/gridwin_dbgutil.cxx|2 +-
 sc/source/ui/view/viewfun5.cxx   |2 +-
 sc/source/ui/view/viewfun6.cxx   |2 +-
 sc/source/ui/view/viewfunc.cxx   |   10 +-
 sc/source/ui/view/viewutil.cxx   |   10 +-
 sc/source/ui/xmlsource/xmlsourcedlg.cxx  |6 +++---
 61 files changed, 147 insertions(+), 145 deletions(-)

New commits:
commit bcc372d15e731ab9ff660072a6dc860708e61a93
Author: Noel Grandin 
Date:   Tue Aug 29 11:00:31 2017 +0200

loplugin:constparam in sc part8

Change-Id: I6cf9c5e662b20de9c9698a8c1fab56a09950c522
Reviewed-on: https://gerrit.libreoffice.org/41683
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/constparams.cxx 
b/compilerplugins/clang/constparams.cxx
index a294e45d58c4..a281d8635900 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -420,6 +420,8 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const 
ParmVarDecl* parmVar
 return true;
 } else if (isa(parent)) {
 return true;
+} else if (isa(parent)) {
+return true;
 } else if (isa(parent)) {
 return false;
 } else if (isa(parent)) {
diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 9d5165bee14e..c423d794d53f 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -3633,7 +3633,7 @@ public:
 DynamicKernel( const ScCalcConfig& config, const FormulaTreeNodeRef& r, 
int nResultSize );
 virtual ~DynamicKernel() override;
 
-

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

2017-08-15 Thread Noel Grandin
 compilerplugins/clang/redundantcast.cxx   |5 ++---
 sc/source/ui/pagedlg/tptable.cxx  |2 +-
 sc/source/ui/view/formatsh.cxx|8 
 sc/source/ui/view/printfun.cxx|2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx |6 +++---
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx |4 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx |   10 +-
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx |   10 +-
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   10 +-
 sw/qa/extras/rtfexport/rtfexport.cxx  |2 +-
 sw/qa/extras/rtfexport/rtfexport2.cxx |4 ++--
 sw/qa/extras/rtfimport/rtfimport.cxx  |4 ++--
 sw/qa/extras/ww8export/ww8export.cxx  |2 +-
 sw/source/core/layout/atrfrm.cxx  |2 +-
 vcl/source/window/printdlg.cxx|8 
 15 files changed, 39 insertions(+), 40 deletions(-)

New commits:
commit 718cdd43c25783d9cd402e381123efe3981cc514
Author: Noel Grandin 
Date:   Tue Aug 15 09:44:18 2017 +0200

loplugin:redundantcast, find more functional casts

In the enum types that caused the problem look like this when I dump
then:

EnumType 0xdb45770 'enum SvxFrameDirection'
`-Enum 0xdb456d8 'SvxFrameDirection'

SubstTemplateTypeParmType 0xdb61200 'enum SvxFrameDirection' sugar
|-TemplateTypeParmType 0xd7518f0 'EnumT' dependent depth 0 index 0
| `-TemplateTypeParm 0xd7518a8 'EnumT'
`-EnumType 0xdb45770 'enum SvxFrameDirection'
  `-Enum 0xdb456d8 'SvxFrameDirection'

Change-Id: Id8fedabe43b7a27df61a2320a9acbf54d2dc7882
Reviewed-on: https://gerrit.libreoffice.org/41169
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/redundantcast.cxx 
b/compilerplugins/clang/redundantcast.cxx
index 2a66f8ff0704..56afdf13f090 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -580,7 +580,6 @@ bool 
RedundantCast::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr const * exp
 if (ignoreLocation(expr)) {
 return true;
 }
-
 // Restrict this to "real" casts (compared to uses of braced-init-list, 
like
 //
 //   Foo{bar, baz}
@@ -590,7 +589,7 @@ bool 
RedundantCast::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr const * exp
 //   std::initializer_list{bar, baz}
 //
 // ), and only to cases where the sub-expression already is a prvalue of
-// non-class type (and thus the cast is unlikely meant to create a
+// non-class type (and thus the cast is unlikely to be meant to create a
 // temporary):
 auto const sub = compat::getSubExprAsWritten(expr);
 if (sub->getValueKind() != VK_RValue || expr->getType()->isRecordType()
@@ -634,7 +633,7 @@ bool 
RedundantCast::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr const * exp
 }
 
 auto const t1 = expr->getTypeAsWritten();
-auto const t2 = sub->getType();
+auto const t2 = sub->getType().getDesugaredType(compiler.getASTContext());
 if (t1 != t2)
 return true;
 if (!isOkToRemoveArithmeticCast(t1, t2, expr->getSubExpr()))
diff --git a/sc/source/ui/pagedlg/tptable.cxx b/sc/source/ui/pagedlg/tptable.cxx
index 90754c32d1cc..fab08754d31e 100644
--- a/sc/source/ui/pagedlg/tptable.cxx
+++ b/sc/source/ui/pagedlg/tptable.cxx
@@ -77,7 +77,7 @@ bool WAS_DEFAULT(sal_uInt16 w, SfxItemSet const & s)
 
 #define GET_BOOL(sid,set)   static_cast((set).Get(GetWhich((sid.GetValue()
 #define GET_USHORT(sid,set) static_cast((set).Get(GetWhich((sid.GetValue()
-#define GET_SHOW(sid,set)   ( ScVObjMode( static_cast((set).Get(GetWhich((sid.GetValue() ) \
+#define GET_SHOW(sid,set)   ( static_cast((set).Get(GetWhich((sid.GetValue() \
   == VOBJ_MODE_SHOW )
 // List box entries "Scaling mode"
 #define SC_TPTABLE_SCALE_PERCENT0
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 3dc53df16d36..b62ac3b34496 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1557,12 +1557,12 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq )
 if (rAttrSet.GetItemState(ATTR_HOR_JUSTIFY, true, ) == 
SfxItemState::SET)
 {
 pHorJustify = static_cast(pItem);
-eHorJustify = SvxCellHorJustify( pHorJustify->GetValue() );
+eHorJustify = pHorJustify->GetValue();
 }
 if (rAttrSet.GetItemState(ATTR_VER_JUSTIFY, true, ) == 
SfxItemState::SET)
 {
 pVerJustify = static_cast(pItem);
-eVerJustify = SvxCellVerJustify( pVerJustify->GetValue() );
+eVerJustify = pVerJustify->GetValue();
 }
 
 switch ( nSlot )
@@ -2299,7 +2299,7 @@ void ScFormatShell::GetTextAttrState( SfxItemSet& rSet )
 {
 case SfxItemState::SET:
 {
-switch ( SvxCellHorJustify( 

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

2017-07-17 Thread Andrea Gelmini
 compilerplugins/clang/compat.hxx |4 ++--
 sc/source/ui/navipi/navipi.cxx   |2 +-
 sfx2/source/control/request.cxx  |2 +-
 sfx2/source/control/shell.cxx|4 ++--
 sw/inc/dialog.hrc|8 
 sw/inc/fesh.hxx  |2 +-
 sw/source/filter/ww8/ww8atr.cxx  |2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 26b52972a8ab15049e63a2518ff8e10d6288d074
Author: Andrea Gelmini 
Date:   Sat Jul 15 10:19:32 2017 +0200

Fix typos

Change-Id: I9d2c641b485c32ddccf0bfaaed1d0796572d1d33
Reviewed-on: https://gerrit.libreoffice.org/39477
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 060bf4cf2317..990f0ac78c26 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -224,8 +224,8 @@ inline llvm::StringRef getImmediateMacroNameForDiagnostics(
 using namespace clang;
 // Verbatim copy from Clang's lib/Lex/Lexer.cpp:
 
-assert(Loc.isMacroID() && "Only reasonble to call this on macros");
-// Walk past macro argument expanions.
+assert(Loc.isMacroID() && "Only reasonable to call this on macros");
+// Walk past macro argument expansion.
 while (SM.isMacroArgExpansion(Loc))
 Loc = SM.getImmediateExpansionRange(Loc).first;
 
diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index 340674c3d0be..650854ec8c2f 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -703,7 +703,7 @@ void ScNavigatorDlg::SetCurrentCell( SCCOL nColNo, SCROW 
nRowNo )
 bUnmark = !pViewData->GetMarkData().IsCellMarked( nColNo, nRowNo );
 
 SfxStringItem   aPosItem( SID_CURRENTCELL, aAddr );
-SfxBoolItem aUnmarkItem( FN_PARAM_1, bUnmark ); // cancel 
selektion
+SfxBoolItem aUnmarkItem( FN_PARAM_1, bUnmark ); // cancel 
selection
 
 rBindings.GetDispatcher()->ExecuteList(SID_CURRENTCELL,
   SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx
index 8abb7c313eed..e65d1f466752 100644
--- a/sfx2/source/control/request.cxx
+++ b/sfx2/source/control/request.cxx
@@ -447,7 +447,7 @@ void SfxRequest::Done
 
 [Note]
 
-'Done ()' is not called, for example when a dialoge started by the function
+'Done ()' is not called, for example when a dialog started by the function
 was canceled by the user or if the execution could not be performed due to
 a wrong context (without use of separate s). 'Done ()' will be
 launched, when executing the function led to a regular error
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index 5bf5b0c413a6..317fa2ff5834 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -354,7 +354,7 @@ void SfxShell::Activate
 FALSE
 the , on which SfxDispatcher
 the SfxShell instance is located, was
-activated. (for example by a closing dialoge) */
+activated. (for example by a closing dialog) */
 )
 {
 BroadcastContextForActivation(true);
@@ -371,7 +371,7 @@ void SfxShell::Deactivate
 FALSE
 the , on which SfxDispatcher
 the SfxShell instance is located, was
-deactivated. (for example by a dialoge) */
+deactivated. (for example by a dialog) */
 )
 {
 BroadcastContextForActivation(false);
diff --git a/sw/inc/dialog.hrc b/sw/inc/dialog.hrc
index 8304950d3695..8da271a33bc3 100644
--- a/sw/inc/dialog.hrc
+++ b/sw/inc/dialog.hrc
@@ -22,16 +22,16 @@
 
 #include "rcid.hrc"
 
-// Dialoge **
+// Dialogs
 
 #define STR_QUERY_SPELL_CONTINUE (RC_DIALOG_BEGIN + 11)
 #define STR_SPELLING_COMPLETED  (RC_DIALOG_BEGIN + 12)
 
-// Strings **
+// Strings
 
 #define STR_CLOSELINKMSG(RC_DIALOG_BEGIN +  3)
 
-// Bereiche *
+// Bereiche
 
 #define RC_REGIONSW_BEGIN   (RC_DIALOG_BEGIN + 60)
 //  RC_REGIONSW_END (RC_DIALOG_BEGIN + 79)
@@ -42,7 +42,7 @@
 #define RC_DLG_ADDR (RC_DIALOG_BEGIN + 90)
 #define RC_SWDLG_BACKGROUND (RC_DIALOG_BEGIN + 91)
 #define RC_DLG_SWNUMFMTDLG  (RC_DIALOG_BEGIN + 92)
-// Ueberlaufpruefung 
+// Ueberlaufpruefung
 
 #define DIALOG_ACT_END  RC_MACASSGN_END
 
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index cb7d75a1b827..cd4b562bd7da 100644
--- a/sw/inc/fesh.hxx

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

2017-07-13 Thread Noel Grandin
 compilerplugins/clang/test/useuniqueptr.cxx |   24 +-
 compilerplugins/clang/useuniqueptr.cxx  |  106 ++--
 sc/source/filter/excel/tokstack.cxx |   38 +++---
 sc/source/filter/inc/tokstack.hxx   |   11 +-
 sw/inc/bparr.hxx|4 -
 sw/source/core/bastyp/bparr.cxx |   23 ++
 sw/source/core/docnode/nodes.cxx|2 
 7 files changed, 141 insertions(+), 67 deletions(-)

New commits:
commit 51a50cc95a8cb461b7026c1eb8908e17f4055076
Author: Noel Grandin 
Date:   Mon Jun 26 09:48:30 2017 +0200

improve useuniqueptr loplugin to find arrays

Change-Id: I81e9d0cd4f430b11d20037054055683240792240
Reviewed-on: https://gerrit.libreoffice.org/39825
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/test/useuniqueptr.cxx 
b/compilerplugins/clang/test/useuniqueptr.cxx
index 564e93ccbdc0..e834123264e0 100644
--- a/compilerplugins/clang/test/useuniqueptr.cxx
+++ b/compilerplugins/clang/test/useuniqueptr.cxx
@@ -8,13 +8,33 @@
  */
 
 
-class Foo {
+class Foo1 {
 char* m_pbar; // expected-note {{member is here [loplugin:useuniqueptr]}}
-~Foo()
+~Foo1()
 {
 delete m_pbar; // expected-error {{a destructor with only a single 
unconditional call to delete on a member, is a sure sign it should be using 
std::unique_ptr for that field [loplugin:useuniqueptr]}}
 m_pbar = nullptr;
 }
 };
 
+
+class Foo2 {
+char* m_pbar1; // expected-note {{member is here [loplugin:useuniqueptr]}}
+char* m_pbar2; // expected-note {{member is here [loplugin:useuniqueptr]}}
+~Foo2()
+{
+delete[] m_pbar1; // expected-error {{managing array of trival type 
'char' manually, rather use std::vector / std::array / std::unique_ptr 
[loplugin:useuniqueptr]}}
+delete[] m_pbar2; // expected-error {{managing array of trival type 
'char' manually, rather use std::vector / std::array / std::unique_ptr 
[loplugin:useuniqueptr]}}
+}
+};
+
+class Foo3 {
+char* m_pbar;
+bool bMine;
+~Foo3()
+{
+if (bMine)
+delete[] m_pbar;
+}
+};
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/compilerplugins/clang/useuniqueptr.cxx 
b/compilerplugins/clang/useuniqueptr.cxx
index afae4c3c770a..9e0dd33e900b 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -33,8 +33,11 @@ public:
 TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
 }
 
-bool VisitCXXDestructorDecl(const CXXDestructorDecl * );
-bool VisitCompoundStmt(const CompoundStmt * );
+bool VisitCXXDestructorDecl(const CXXDestructorDecl* );
+bool VisitCompoundStmt(const CompoundStmt* );
+private:
+void CheckForSingleUnconditionalDelete(const CXXDestructorDecl*, const 
CompoundStmt* );
+void CheckForDeleteArrayOfPOD(const CompoundStmt* );
 };
 
 bool UseUniquePtr::VisitCXXDestructorDecl(const CXXDestructorDecl* 
destructorDecl)
@@ -48,6 +51,14 @@ bool UseUniquePtr::VisitCXXDestructorDecl(const 
CXXDestructorDecl* destructorDec
 if (!compoundStmt)
 return true;
 
+CheckForSingleUnconditionalDelete(destructorDecl, compoundStmt);
+CheckForDeleteArrayOfPOD(compoundStmt);
+
+return true;
+}
+
+void UseUniquePtr::CheckForSingleUnconditionalDelete(const CXXDestructorDecl* 
destructorDecl, const CompoundStmt* compoundStmt)
+{
 const CXXDeleteExpr* deleteExpr = nullptr;
 if (compoundStmt->size() == 1) {
 deleteExpr = dyn_cast(compoundStmt->body_front());
@@ -66,60 +77,60 @@ bool UseUniquePtr::VisitCXXDestructorDecl(const 
CXXDestructorDecl* destructorDec
 deleteExpr = 
dyn_cast(compoundStmt->body_front());
 }
 } else {
-return true;
+return;
 }
 if (deleteExpr == nullptr)
-return true;
+return;
 
 const ImplicitCastExpr* pCastExpr = 
dyn_cast(deleteExpr->getArgument());
 if (!pCastExpr)
-return true;
+return;
 const MemberExpr* pMemberExpr = 
dyn_cast(pCastExpr->getSubExpr());
 if (!pMemberExpr)
-return true;
+return;
 
 // ignore union games
 const FieldDecl* pFieldDecl = 
dyn_cast(pMemberExpr->getMemberDecl());
 if (!pFieldDecl)
-return true;
+return;
 TagDecl const * td = dyn_cast(pFieldDecl->getDeclContext());
 if (td->isUnion())
-return true;
+return;
 
 // ignore calling delete on someone else's field
 if (pFieldDecl->getParent() != destructorDecl->getParent() )
-return true;
+return;
 
 if (ignoreLocation(pFieldDecl))
-return true;
+return;
 // to ignore things like the CPPUNIT macros
 StringRef aFileName = 

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

2017-04-07 Thread Andrea Gelmini
 compilerplugins/clang/constantparam.py |2 +-
 sc/source/filter/inc/xlstring.hxx  |4 ++--
 sc/source/ui/optdlg/opredlin.cxx   |2 +-
 sc/source/ui/view/gridwin2.cxx |2 +-
 sc/source/ui/view/tabvwsh5.cxx |2 +-
 sot/source/sdstor/stg.cxx  |2 +-
 sw/source/uibase/app/docsh.cxx |2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit caf388959576da4f480b8c97443cb052f6201a33
Author: Andrea Gelmini 
Date:   Thu Apr 6 22:32:05 2017 +0200

Fix typos

Change-Id: Ibad3f8e9f55af5e652b6be198bebace2b1bfb35b
Reviewed-on: https://gerrit.libreoffice.org/36235
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/compilerplugins/clang/constantparam.py 
b/compilerplugins/clang/constantparam.py
index 5550c51c34f3..2dede4f1ad8d 100755
--- a/compilerplugins/clang/constantparam.py
+++ b/compilerplugins/clang/constantparam.py
@@ -72,7 +72,7 @@ with open("loplugin.constantparam.report", "wt") as f:
 # take bitmask parameters where one or more of the bits in the
 # bitmask is always one or always zero
 
-# integer to hext str
+# integer to hex str
 def hex(i):
 return "0x%x" % i
 # I can't use python's ~ operator, because that produces negative numbers
diff --git a/sc/source/filter/inc/xlstring.hxx 
b/sc/source/filter/inc/xlstring.hxx
index 6f45c5bdbfc0..e7e68a611812 100644
--- a/sc/source/filter/inc/xlstring.hxx
+++ b/sc/source/filter/inc/xlstring.hxx
@@ -45,8 +45,8 @@ const sal_uInt8 EXC_STRF_UNKNOWN= 0xF2;
 // Fixed-size characters
 const sal_uInt8 EXC_LF_C= '\x0A';   /// LF character 
(used for line break).
 const sal_uInt16 EXC_LF = EXC_LF_C; /// LF character 
(unicode).
-const sal_uInt8 EXC_NUL_C   = '\x00';   /// NUL chararcter.
-const sal_uInt16 EXC_NUL= EXC_NUL_C;/// NUL chararcter 
(unicode).
+const sal_uInt8 EXC_NUL_C   = '\x00';   /// NUL character.
+const sal_uInt16 EXC_NUL= EXC_NUL_C;/// NUL character 
(unicode).
 
 // Rich-string formatting runs 
 
diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx
index baece1764e20..9c0aafd62aad 100644
--- a/sc/source/ui/optdlg/opredlin.cxx
+++ b/sc/source/ui/optdlg/opredlin.cxx
@@ -90,7 +90,7 @@ bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet* /* 
rSet */ )
 
 SC_MOD()->SetAppOptions(aAppOptions);
 
-//  repaint (if everything would be done by Items (how it sould be),
+//  repaint (if everything would be done by Items (how it should be),
 //  this wouldn't be neccessary)
 ScDocShell* pDocSh = dynamic_cast( SfxObjectShell::Current() 
);
 if (pDocSh)
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index cc8e6d89d7b8..c55ce677e730 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -903,7 +903,7 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, 
bool bUp )
 else
 {
 if ( nPosY > aPagebreakSource.aStart.Row() &&
- nPosY <= aPagebreakSource.aEnd.Row() + 1 ) //  to the end 
is also allowe
+ nPosY <= aPagebreakSource.aEnd.Row() + 1 ) //  to the end 
is also allowed
 {
 bToEnd = ( nPosY == aPagebreakSource.aEnd.Row() + 1 );
 aDrawRange.aStart.SetRow( nPosY );
diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx
index 4ff85c818642..478a49b01bae 100644
--- a/sc/source/ui/view/tabvwsh5.cxx
+++ b/sc/source/ui/view/tabvwsh5.cxx
@@ -264,7 +264,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
 {
 //  "Save as" can make a write-protected document writable,
 //  therefore the Layer-Locks anew (#39884#)
-//  (Invalidate etc. is happing already from Sfx)
+//  (Invalidate etc. is happening already from Sfx)
 //  by SID_EDITDOC no SfxHintId::TitleChanged will occur, 
that
 //  is why the own hint from DoSaveCompleted
 //! what is with SfxHintId::SAVECOMPLETED ?
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 0ce16d4900e5..eb87ed99f1e3 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -90,7 +90,7 @@ OLEStorageBase::~OLEStorageBase()
 {
 if( pEntry )
 {
-DBG_ASSERT( pEntry->m_nRefCnt, "RefCount unter 0" );
+DBG_ASSERT( pEntry->m_nRefCnt, "RefCount under 0" );
 if( !--pEntry->m_nRefCnt )
 {
 if( pEntry->m_bZombie )
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 2ae8a2992b2e..6e45da59dc54 100644
--- 

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

2017-01-24 Thread Stephan Bergmann
 compilerplugins/clang/stringconstant.cxx  |  366 --
 compilerplugins/clang/test/stringconstant.cxx |   52 +++
 sc/source/core/tool/interpr2.cxx  |4 
 solenv/CompilerTest_compilerplugins_clang.mk  |1 
 4 files changed, 288 insertions(+), 135 deletions(-)

New commits:
commit 236f69e710b1ce00a68d25c26da82724c658b0d4
Author: Stephan Bergmann 
Date:   Wed Jan 25 07:58:10 2017 +0100

Minor loplugin:stringconstant improvements

Change-Id: I0b39526c0f0854ddbb29e77ece303cf2bdd842c4

diff --git a/compilerplugins/clang/stringconstant.cxx 
b/compilerplugins/clang/stringconstant.cxx
index 34a5421..464fe06 100644
--- a/compilerplugins/clang/stringconstant.cxx
+++ b/compilerplugins/clang/stringconstant.cxx
@@ -75,6 +75,24 @@ bool hasOverloads(FunctionDecl const * decl, unsigned 
arguments) {
 return false;
 }
 
+CXXConstructExpr const * lookForCXXConstructExpr(Expr const * expr) {
+if (auto e = dyn_cast(expr)) {
+expr = e->GetTemporaryExpr();
+}
+if (auto e = dyn_cast(expr)) {
+expr = e->getSubExpr();
+}
+if (auto e = dyn_cast(expr)) {
+expr = e->getSubExpr();
+}
+return dyn_cast(expr);
+}
+
+char const * adviseNonArray(bool nonArray) {
+return nonArray
+? ", and turn the non-array string constant into an array" : "";
+}
+
 class StringConstant:
 public RecursiveASTVisitor, public loplugin::RewritePlugin
 {
@@ -113,7 +131,7 @@ private:
 
 void reportChange(
 Expr const * expr, ChangeKind kind, std::string const & original,
-std::string const & replacement, PassThrough pass,
+std::string const & replacement, PassThrough pass, bool nonArray,
 char const * rewriteFrom, char const * rewriteTo);
 
 void checkEmpty(
@@ -134,6 +152,9 @@ private:
 CallExpr const * expr, unsigned arg, FunctionDecl const * callee,
 bool explicitFunctionalCastNotation);
 
+void handleFunArgOstring(
+CallExpr const * expr, unsigned arg, FunctionDecl const * callee);
+
 std::stack calls_;
 };
 
@@ -490,7 +511,7 @@ bool StringConstant::VisitCallExpr(CallExpr const * expr) {
 if (non) {
 report(
 DiagnosticsEngine::Warning,
-("call of %0 with string constant argument containging"
+("call of '%0' with string constant argument containging"
  " non-ASCII characters"),
 expr->getExprLoc())
 << fdecl->getQualifiedNameAsString() << expr->getSourceRange();
@@ -498,16 +519,16 @@ bool StringConstant::VisitCallExpr(CallExpr const * expr) 
{
 if (emb) {
 report(
 DiagnosticsEngine::Warning,
-("call of %0 with string constant argument containging 
embedded"
- " NULs"),
+("call of '%0' with string constant argument containging"
+ " embedded NULs"),
 expr->getExprLoc())
 << fdecl->getQualifiedNameAsString() << expr->getSourceRange();
 }
 if (n == 0) {
 report(
 DiagnosticsEngine::Warning,
-("rewrite call of %0  with empty string constant argument as"
- " call of rtl::OUString::isEmpty"),
+("rewrite call of '%0' with empty string constant argument as"
+ " call of 'rtl::OUString::isEmpty'"),
 expr->getExprLoc())
 << fdecl->getQualifiedNameAsString() << expr->getSourceRange();
 return true;
@@ -531,7 +552,7 @@ bool StringConstant::VisitCallExpr(CallExpr const * expr) {
 if (non) {
 report(
 DiagnosticsEngine::Warning,
-("call of %0 with string constant argument containging"
+("call of '%0' with string constant argument containging"
  " non-ASCII characters"),
 expr->getExprLoc())
 << fdecl->getQualifiedNameAsString()
@@ -540,7 +561,7 @@ bool StringConstant::VisitCallExpr(CallExpr const * expr) {
 if (emb) {
 report(
 DiagnosticsEngine::Warning,
-("call of %0 with string constant argument containging"
+("call of '%0' with string constant argument containging"
  " embedded NULs"),
 expr->getExprLoc())
 << fdecl->getQualifiedNameAsString()
@@ -549,8 +570,8 @@ bool StringConstant::VisitCallExpr(CallExpr const * expr) {
 if (n == 0) {
 report(
 DiagnosticsEngine::Warning,
-("rewrite call of %0 with empty string constant argument 
as"
- " call of rtl::OUString::isEmpty"),
+("rewrite call of '%0' with empty string constant argument"
+ " as call 

[Libreoffice-commits] core.git: compilerplugins/clang sc/source sd/inc sd/source solenv/CompilerTest_compilerplugins_clang.mk

2016-11-20 Thread Noel Grandin
 compilerplugins/clang/datamembershadow.cxx  |  157 
 compilerplugins/clang/test/datamembershadow.cxx |   19 ++
 sc/source/ui/vba/vbanames.cxx   |3 
 sc/source/ui/vba/vbatextboxshape.cxx|1 
 sc/source/ui/vba/vbatextboxshape.hxx|1 
 sd/inc/sdundo.hxx   |3 
 sd/source/core/annotations/Annotation.cxx   |1 
 sd/source/ui/inc/unmodpg.hxx|4 
 sd/source/ui/view/unmodpg.cxx   |7 -
 solenv/CompilerTest_compilerplugins_clang.mk|1 
 10 files changed, 181 insertions(+), 16 deletions(-)

New commits:
commit 04f262ace019dc87bb52f32c42107a8f2b348d89
Author: Noel Grandin 
Date:   Thu Nov 17 10:59:34 2016 +0200

new loplugin datamembershadow

Change-Id: Ib14319848bafd1fe7e0e663c434bbdeef5e98ecf
Reviewed-on: https://gerrit.libreoffice.org/30963
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/compilerplugins/clang/datamembershadow.cxx 
b/compilerplugins/clang/datamembershadow.cxx
new file mode 100644
index 000..a1d4528
--- /dev/null
+++ b/compilerplugins/clang/datamembershadow.cxx
@@ -0,0 +1,157 @@
+/* -*- 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 
+#include 
+
+#include "plugin.hxx"
+#include "clang/AST/CXXInheritance.h"
+
+/**
+ * Check for data member being shadowed.
+ *
+ * @TODO check for any members in superclass hierarchy with duplicate names,
+ *   more specific names will make the code easier to read
+ */
+namespace
+{
+
+class DataMemberShadow:
+public RecursiveASTVisitor, public loplugin::Plugin
+{
+public:
+explicit DataMemberShadow(InstantiationData const & data): Plugin(data) {}
+
+virtual void run() override {
+TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+}
+
+bool VisitFieldDecl(FieldDecl const *);
+};
+
+bool DataMemberShadow::VisitFieldDecl(FieldDecl const * fieldDecl)
+{
+if (ignoreLocation(fieldDecl)) {
+return true;
+}
+StringRef aFileName = compiler.getSourceManager().getFilename(
+
compiler.getSourceManager().getSpellingLoc(fieldDecl->getLocStart()));
+
+// FIXME complex stuff to fix later
+
+if (aFileName == SRCDIR "/connectivity/source/inc/calc/CTable.hxx")
+return true;
+if (aFileName.startswith(SRCDIR "/chart2/source/"))
+return true;
+if (aFileName == SRCDIR "/cppcanvas/source/mtfrenderer/emfplus.cxx")
+return true;
+if (aFileName == SRCDIR "/cui/source/customize/eventdlg.hxx")
+return true;
+if (aFileName == SRCDIR "/include/sfx2/recentdocsview.hxx")
+return true;
+if (aFileName == SRCDIR "/include/sfx2/templatelocalview.hxx")
+return true;
+if (aFileName == SRCDIR "/filter/source/graphicfilter/idxf/dxfentrd.hxx")
+return true;
+if (aFileName == SRCDIR 
"/framework/source/uielement/popuptoolbarcontroller.cxx")
+return true;
+if (aFileName == SRCDIR 
"/lotuswordpro/source/filter/xfilter/xfcellstyle.hxx")
+return true;
+if (aFileName == SRCDIR 
"/lotuswordpro/source/filter/xfilter/xfdrawobj.hxx")
+return true;
+if (aFileName == SRCDIR "/sc/source/ui/vba/vbastyles.hxx")
+return true;
+if (aFileName == SRCDIR "/sd/inc/Outliner.hxx")
+return true;
+if (aFileName == SRCDIR "/sd/source/ui/annotations/annotationtag.cxx")
+return true;
+if (aFileName == SRCDIR "/sd/source/ui/inc/FrameView.hxx"
+|| aFileName == SRCDIR 
"/sd/source/filter/ppt/../../ui/inc/FrameView.hxx")
+return true;
+if (aFileName == SRCDIR "/sd/source/ui/inc/unopage.hxx")
+return true;
+if (aFileName == SRCDIR "/sd/source/ui/view/viewoverlaymanager.cxx")
+return true;
+if (aFileName == SRCDIR "/sdext/source/presenter/PresenterSpritePane.hxx")
+return true;
+if (aFileName == SRCDIR "/store/source/stortree.hxx"
+|| aFileName == SRCDIR "/store/source/stordata.hxx")
+return true;
+if (aFileName == SRCDIR "/svx/source/table/cell.hxx"
+|| aFileName == SRCDIR "/svx/source/unodraw/../table/cell.hxx"
+|| aFileName == SRCDIR "/svx/source/accessibility/../table/cell.hxx")
+return true;
+if (aFileName == SRCDIR "/sw/source/uibase/inc/dbtree.hxx")
+return true;
+if (aFileName == SRCDIR "/vcl/unx/generic/print/genpspgraphics.cxx")
+return true;
+if (aFileName == SRCDIR "/xmloff/source/draw/ximplink.hxx")
+return true;
+
+const CXXRecordDecl* 

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

2015-11-13 Thread Michael Stahl
 compilerplugins/clang/vclwidgets.cxx  |4 ++-
 sc/source/ui/inc/scuitphfedit.hxx |4 ++-
 sc/source/ui/inc/tphfedit.hxx |4 +++
 sc/source/ui/pagedlg/scuitphfedit.cxx |   36 ++
 sc/source/ui/pagedlg/tphfedit.cxx |   11 ++
 5 files changed, 33 insertions(+), 26 deletions(-)

New commits:
commit 5fe66069010e9afc3a16d238592c3b672850514c
Author: Michael Stahl 
Date:   Thu Nov 12 23:37:12 2015 +0100

sc: loplugin:badstatics: remove pActiveEdWnd global variable

Just use a Link, or rather std::function to set a member in the tab
page.  Unfortunately loplugin:vclwidgets complains about the new member.

Change-Id: Ie2f9cb73c38292d02057d43b12694c6609fa0db8

diff --git a/compilerplugins/clang/vclwidgets.cxx 
b/compilerplugins/clang/vclwidgets.cxx
index 95dfabe..90beed8 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -299,7 +299,9 @@ bool VCLWidgets::VisitFieldDecl(const FieldDecl * 
fieldDecl) {
 const CXXRecordDecl *pParentRecordDecl = 
isa(fieldDecl->getDeclContext()) ? 
dyn_cast(fieldDecl->getParent()) : nullptr;
 if (containsWindowSubclass(fieldDecl->getType())) {
 // have to ignore this for now, nasty reverse dependency from 
tools->vcl
-if (!(pParentRecordDecl != nullptr && 
pParentRecordDecl->getQualifiedNameAsString() == "ErrorContextImpl")) {
+if (!(pParentRecordDecl != nullptr &&
+(pParentRecordDecl->getQualifiedNameAsString() == 
"ErrorContextImpl" ||
+ pParentRecordDecl->getQualifiedNameAsString() == 
"ScHFEditPage"))) {
 report(
 DiagnosticsEngine::Warning,
 "OutputDevice subclass %0 declared as a pointer member, should 
be wrapped in VclPtr",
diff --git a/sc/source/ui/inc/scuitphfedit.hxx 
b/sc/source/ui/inc/scuitphfedit.hxx
index fbdf7cd..326f6b3 100644
--- a/sc/source/ui/inc/scuitphfedit.hxx
+++ b/sc/source/ui/inc/scuitphfedit.hxx
@@ -82,6 +82,8 @@ private:
 VclPtr   m_pFtCreatedBy;
 VclPtr   m_pFtCustomized;
 
+ScEditWindow * m_pEditFocus; ///one of m_pWndLeft, m_pWndCenter, 
m_pWndRight
+
 sal_uInt16   nWhich;
 OUString aCmdArr[6];
 
@@ -99,7 +101,7 @@ private:
 static bool IsExtFileNameEntry(EditTextObject* pTextObj);
 DECL_LINK_TYPED( ListHdl_Impl, ListBox&, void);
 DECL_LINK_TYPED( ClickHdl, Button*, void );
-DECL_STATIC_LINK_TYPED( ScHFEditPage, MenuHdl, ScExtIButton&, void );
+DECL_LINK_TYPED( MenuHdl, ScExtIButton&, void );
 };
 
 class ScRightHeaderEditPage : public ScHFEditPage
diff --git a/sc/source/ui/inc/tphfedit.hxx b/sc/source/ui/inc/tphfedit.hxx
index b362a02..52024fd 100644
--- a/sc/source/ui/inc/tphfedit.hxx
+++ b/sc/source/ui/inc/tphfedit.hxx
@@ -33,6 +33,8 @@
 #include 
 #include 
 
+#include 
+
 class ScHeaderEditEngine;
 class ScPatternAttr;
 class EditView;
@@ -72,6 +74,7 @@ public:
 
 ScHeaderEditEngine*  GetEditEngine() const { return pEdEngine; }
 void SetObjectSelectHdl( const Link& aLink) { 
aObjectSelectLink = aLink; }
+void SetGetFocusHdl(const std::function& rLink) { 
m_GetFocusLink = rLink; }
 
 void SetLocation(ScEditWindowLocation eLoc) { eLocation = eLoc; }
 protected:
@@ -95,6 +98,7 @@ private:
 ScAccessibleEditObject* pAcc;
 
 Link aObjectSelectLink;
+std::function m_GetFocusLink;
 };
 
 class SC_DLLPUBLIC ScExtIButton : public ImageButton
diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx 
b/sc/source/ui/pagedlg/scuitphfedit.cxx
index 9f6f843..be28c11 100644
--- a/sc/source/ui/pagedlg/scuitphfedit.cxx
+++ b/sc/source/ui/pagedlg/scuitphfedit.cxx
@@ -58,6 +58,7 @@ ScHFEditPage::ScHFEditPage( vcl::Window* pParent,
 sal_uInt16  nWhichId,
 boolbHeader  )
 : SfxTabPage( pParent, "HeaderFooterContent", 
"modules/scalc/ui/headerfootercontent.ui",  )
+, m_pEditFocus(nullptr)
 , nWhich( nWhichId )
 {
 get(m_pWndLeft,"textviewWND_LEFT");
@@ -139,9 +140,14 @@ ScHFEditPage::ScHFEditPage( vcl::Window* 
pParent,
 m_pWndLeft->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
 m_pWndCenter->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) 
);
 m_pWndRight->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
+auto setEditFocus = [this](ScEditWindow & rEdit) { this->m_pEditFocus = 
 };
+m_pWndLeft->SetGetFocusHdl(setEditFocus);
+m_pWndCenter->SetGetFocusHdl(setEditFocus);
+m_pWndRight->SetGetFocusHdl(setEditFocus);
 FillCmdArr();
 
 m_pWndLeft->GrabFocus();
+m_pEditFocus = m_pWndLeft; // there's no event from GrabFocus()
 
 InitPreDefinedList();
 
@@ -791,39 +797,37 @@ IMPL_LINK_TYPED( ScHFEditPage, ListHdl_Impl, ListBox&, 
rList, void )
 
 IMPL_LINK_TYPED( ScHFEditPage, ClickHdl, Button*, pBtn, void 

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

2015-11-13 Thread Noel Grandin
 compilerplugins/clang/ptrvector.cxx |   81 
 sc/source/core/data/conditio.cxx|3 -
 2 files changed, 83 insertions(+), 1 deletion(-)

New commits:
commit f73284fb864699716b3a52faf2ad39bc8e48c3cc
Author: Noel Grandin 
Date:   Thu Nov 12 16:14:04 2015 +0200

new loplugin ptrvector - find bad comparison of container

Change-Id: Idb18ae1ca2f7c644680703dc3b7dd3cd6000e040

diff --git a/compilerplugins/clang/ptrvector.cxx 
b/compilerplugins/clang/ptrvector.cxx
new file mode 100644
index 000..513d350
--- /dev/null
+++ b/compilerplugins/clang/ptrvector.cxx
@@ -0,0 +1,81 @@
+/* -*- 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 
+#include 
+#include 
+#include "plugin.hxx"
+#include "compat.hxx"
+
+/**
+  Check for calls to operator== on a std::container< std::unique_ptr >, which 
is not useful,
+  because std::container will compare the pointers so it is never true
+*/
+
+namespace {
+
+class PtrVector:
+public RecursiveASTVisitor, public loplugin::Plugin
+{
+public:
+explicit PtrVector(InstantiationData const & data): Plugin(data) {}
+
+virtual void run() override
+{
+TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+}
+
+bool shouldVisitTemplateInstantiations () const { return true; }
+
+bool VisitCXXOperatorCallExpr(const CXXOperatorCallExpr* );
+};
+
+bool PtrVector::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr* expr)
+{
+if (ignoreLocation(expr)) {
+return true;
+}
+if (expr->getOperator() != clang::OverloadedOperatorKind::OO_EqualEqual
+&& expr->getOperator() != 
clang::OverloadedOperatorKind::OO_ExclaimEqual)
+{
+return true;
+}
+if (isa(expr->getArg(1))) {
+return true;
+}
+const Expr* argExpr = expr->getArg(0);
+std::string s = 
argExpr->getType().getDesugaredType(compiler.getASTContext()).getAsString();
+if (s.find("iterator") != std::string::npos) {
+return true;
+}
+if (s.find("array") == std::string::npos && s.find("deque") == 
std::string::npos
+&& s.find("list") == std::string::npos && s.find("vector") == 
std::string::npos
+&& s.find("set") == std::string::npos && s.find("map") == 
std::string::npos
+&& s.find("stack") == std::string::npos && s.find("queue") == 
std::string::npos)
+{
+return true;
+}
+if (s.find("unique_ptr") != std::string::npos) {
+ expr->getArg(1)->dump();
+report(
+DiagnosticsEngine::Warning,
+"do not call operator== on a std container containing a unique_ptr 
" + s,
+expr->getExprLoc());
+}
+return true;
+}
+
+
+loplugin::Plugin::Registration< PtrVector > X("ptrvector");
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 61aee69..abcd231 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1831,7 +1832,7 @@ bool ScConditionalFormat::EqualEntries( const 
ScConditionalFormat& r ) const
 
 //TODO: Test for same entries in reverse order?
 for (size_t i=0; i

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

2015-05-11 Thread Noel Grandin
 compilerplugins/clang/rendercontext.cxx|   54 +
 sc/source/ui/view/gridwin4.cxx |2 
 sc/source/ui/view/notemark.cxx |2 
 sc/source/ui/view/output.cxx   |6 +-
 sc/source/ui/view/printfun.cxx |4 -
 sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx |4 -
 starmath/source/dialog.cxx |2 
 starmath/source/rect.cxx   |2 
 sw/inc/viewsh.hxx  |5 +
 sw/source/core/bastyp/swtypes.cxx  |2 
 sw/source/core/doc/notxtfrm.cxx|   10 +--
 sw/source/core/inc/drawfont.hxx|5 +
 sw/source/core/inc/notxtfrm.hxx|3 -
 sw/source/core/layout/paintfrm.cxx |   22 
 sw/source/core/layout/virtoutp.cxx |4 -
 sw/source/core/text/inftxt.hxx |8 +--
 sw/source/core/txtnode/fntcache.cxx|6 +-
 sw/source/core/txtnode/swfont.cxx  |4 -
 sw/source/core/view/viewsh.cxx |2 
 sw/source/core/view/vprint.cxx |2 
 sw/source/ui/chrdlg/drpcps.cxx |2 
 sw/source/ui/misc/outline.cxx  |4 -
 sw/source/uibase/uiview/srcview.cxx|2 
 sw/source/uibase/uiview/viewfunc.hxx   |2 
 sw/source/uibase/uiview/viewport.cxx   |2 
 vcl/source/app/svapp.cxx   |5 +
 26 files changed, 105 insertions(+), 61 deletions(-)

New commits:
commit fc9e78c78864cbfa67ddea646da4aa4677d99b0c
Author: Noel Grandin n...@peralex.com
Date:   Mon May 11 08:37:50 2015 +0200

sw,sc,sd,starmath: convert to vcl::RenderContext

Change-Id: I5d0a3b8ed1c49ba2806e0fa528d908da45afd58c

diff --git a/compilerplugins/clang/rendercontext.cxx 
b/compilerplugins/clang/rendercontext.cxx
index a1e7018..bc34629 100644
--- a/compilerplugins/clang/rendercontext.cxx
+++ b/compilerplugins/clang/rendercontext.cxx
@@ -16,7 +16,8 @@
 
 // Check for calls to OutputDevice methods that are not passing through 
RenderContext
 
-namespace {
+namespace
+{
 
 class RenderContext:
 public RecursiveASTVisitorRenderContext, public loplugin::Plugin
@@ -24,7 +25,9 @@ class RenderContext:
 public:
 explicit RenderContext(InstantiationData const  data): Plugin(data) {}
 
-virtual void run() override { 
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
+virtual void run() override {
+TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+}
 
 bool TraverseFunctionDecl(const FunctionDecl * decl);
 
@@ -34,7 +37,8 @@ private:
 boolmbChecking = false;
 };
 
-bool RenderContext::TraverseFunctionDecl(const FunctionDecl * pFunctionDecl) {
+bool RenderContext::TraverseFunctionDecl(const FunctionDecl * pFunctionDecl)
+{
 if (ignoreLocation(pFunctionDecl)) {
 return true;
 }
@@ -67,22 +71,56 @@ bool RenderContext::VisitCXXMemberCallExpr(const 
CXXMemberCallExpr* pCXXMemberCa
 if (pCXXRecordDecl-getQualifiedNameAsString() != OutputDevice) {
 return true;
 }
+// ignore a handful of methods. They will most probably still be present 
in Window for use during processing outside of the Paint()
+// method lifecycle
+const CXXMethodDecl *pCXXMethodDecl = pCXXMemberCallExpr-getMethodDecl();
+if (pCXXMethodDecl-isInstance()) {
+StringRef name = pCXXMethodDecl-getName();
+if (name == LogicToPixel || name == GetMapMode || name == 
GetFontMetric || name == LogicToLogic
+|| name == PixelToLogic || name == SetDigitLanguage)
+{
+return true;
+}
+}
+// for calling through a pointer
 const ImplicitCastExpr *pImplicitCastExpr = 
dyn_castImplicitCastExpr(pCXXMemberCallExpr-getImplicitObjectArgument());
-std::string t2 = 0;
+std::string x = 0; // for debugging
 if (pImplicitCastExpr) {
-t2 = 2;
+x += 1;
 QualType aType = pImplicitCastExpr-getSubExpr()-getType();
 if (aType-isPointerType())
 aType = aType-getPointeeType();
-t2 = aType.getAsString();
-if (t2 == vcl::RenderContext)
+std::string t2 = aType.getAsString();
+if (t2 == vcl::RenderContext || t2 == const vcl::RenderContext)
+return true;
+}
+// for calling through a reference
+const DeclRefExpr *pDeclRefExpr = 
dyn_castDeclRefExpr(pCXXMemberCallExpr-getImplicitObjectArgument());
+if (pDeclRefExpr) {
+x += 2;
+QualType aType = pDeclRefExpr-getType();
+std::string t2 = aType.getAsString();
+if (t2 == vcl::RenderContext || t2 == const vcl::RenderContext)
+return true;
+}
+// for calling through a chain of methods
+const CXXMemberCallExpr *pMemberExpr =