[Libreoffice-commits] core.git: compilerplugins/clang sdext/source
Noel Grandin
noel.grandin at collabora.co.uk
Tue Jul 18 13:00:23 UTC 2017
compilerplugins/clang/constparams.cxx | 13 +++++++++----
sdext/source/minimizer/graphiccollector.cxx | 2 +-
sdext/source/minimizer/impoptimizer.cxx | 2 +-
sdext/source/minimizer/informationdialog.cxx | 2 +-
sdext/source/minimizer/optimizerdialogcontrols.cxx | 2 +-
sdext/source/pdfimport/inc/pdfparse.hxx | 2 +-
sdext/source/pdfimport/pdfparse/pdfentries.cxx | 2 +-
sdext/source/pdfimport/tree/genericelements.cxx | 8 ++++----
sdext/source/pdfimport/tree/genericelements.hxx | 8 ++++----
sdext/source/presenter/PresenterController.cxx | 4 ++--
sdext/source/presenter/PresenterController.hxx | 4 ++--
sdext/source/presenter/PresenterTheme.cxx | 10 ++++------
sdext/source/presenter/PresenterToolBar.cxx | 10 +++++-----
sdext/source/presenter/PresenterToolBar.hxx | 2 +-
14 files changed, 37 insertions(+), 34 deletions(-)
New commits:
commit 3964408f7f6acbfe613c6173f44c810fdacdc63d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Jul 18 11:08:41 2017 +0200
loplugin:constparams in sdext
Change-Id: Ia5d2c00b02bf1758f7502065dd109f0f54fda2d3
Reviewed-on: https://gerrit.libreoffice.org/40124
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index 9fbea42bdd44..3fc5928c9589 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -360,13 +360,14 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
} else if (isa<UnaryExprOrTypeTraitExpr>(parent)) {
return false; // ???
} else if (isa<CXXNewExpr>(parent)) {
- return true; // because the ParamVarDecl must be a parameter to the expression, probably an array count
+ return true; // because the ParamVarDecl must be a parameter to the expression, probably an array length
} else if (auto lambdaExpr = dyn_cast<LambdaExpr>(parent)) {
for (auto it = lambdaExpr->capture_begin(); it != lambdaExpr->capture_end(); ++it)
{
- if (it->getCapturedVar() == parmVarDecl)
+ if (it->capturesVariable() && it->getCapturedVar() == parmVarDecl)
return it->getCaptureKind() != LCK_ByRef;
}
+ /* sigh. just running this message will cause clang to crash (in sdext)
report(
DiagnosticsEngine::Warning,
"cannot handle this lambda",
@@ -374,14 +375,18 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
<< parent->getSourceRange();
parent->dump();
parmVarDecl->dump();
+ */
+ return false;
+ } else if (isa<CXXTypeidExpr>(parent)) {
+ return true;
} else {
+ parent->dump();
+ parmVarDecl->dump();
report(
DiagnosticsEngine::Warning,
"oh dear, what can the matter be?",
parent->getLocStart())
<< parent->getSourceRange();
- parent->dump();
- parmVarDecl->dump();
}
return true;
}
diff --git a/sdext/source/minimizer/graphiccollector.cxx b/sdext/source/minimizer/graphiccollector.cxx
index 6890498fcdf9..d37945eeb542 100644
--- a/sdext/source/minimizer/graphiccollector.cxx
+++ b/sdext/source/minimizer/graphiccollector.cxx
@@ -87,7 +87,7 @@ void ImpAddEntity( std::vector< GraphicCollector::GraphicEntity >& rGraphicEntit
}
}
-void ImpAddGraphicEntity( const Reference< XComponentContext >& rxMSF, Reference< XShape >& rxShape, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
+void ImpAddGraphicEntity( const Reference< XComponentContext >& rxMSF, Reference< XShape > const & rxShape, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
{
Reference< XGraphic > xGraphic;
Reference< XPropertySet > xShapePropertySet( rxShape, UNO_QUERY_THROW );
diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx
index c90e3c2469fb..9a444ba87d4c 100644
--- a/sdext/source/minimizer/impoptimizer.cxx
+++ b/sdext/source/minimizer/impoptimizer.cxx
@@ -206,7 +206,7 @@ void ImpConvertOLE( const Reference< XModel >& rxModel, sal_Int32 nOLEOptimizati
}
}
-void ImpCompressGraphic( Reference< XGraphicProvider >& rxGraphicProvider, const Reference< XGraphic >& rxGraphic, Reference< XOutputStream >& rxOutputStream,
+void ImpCompressGraphic( Reference< XGraphicProvider > const & rxGraphicProvider, const Reference< XGraphic >& rxGraphic, Reference< XOutputStream > const & rxOutputStream,
const OUString& rDestMimeType, const awt::Size& rLogicalSize, sal_Int32 nJPEGQuality, sal_Int32 nImageResolution, bool bRemoveCropping, const text::GraphicCrop& rGraphicCropLogic )
{
try
diff --git a/sdext/source/minimizer/informationdialog.cxx b/sdext/source/minimizer/informationdialog.cxx
index 2cbce59a353b..470512571c75 100644
--- a/sdext/source/minimizer/informationdialog.cxx
+++ b/sdext/source/minimizer/informationdialog.cxx
@@ -152,7 +152,7 @@ OUString InsertCheckBox( InformationDialog& rInformationDialog, const OUString&
return rControlName;
}
-OUString InsertButton( InformationDialog& rInformationDialog, const OUString& rControlName, Reference< XActionListener >& xActionListener,
+OUString InsertButton( InformationDialog& rInformationDialog, const OUString& rControlName, Reference< XActionListener > const & xActionListener,
sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nTabIndex, PPPOptimizerTokenEnum nResID )
{
OUString pNames[] = {
diff --git a/sdext/source/minimizer/optimizerdialogcontrols.cxx b/sdext/source/minimizer/optimizerdialogcontrols.cxx
index d0821cba0c9a..9c942d832b16 100644
--- a/sdext/source/minimizer/optimizerdialogcontrols.cxx
+++ b/sdext/source/minimizer/optimizerdialogcontrols.cxx
@@ -85,7 +85,7 @@ OUString InsertSeparator( OptimizerDialog& rOptimizerDialog, const OUString& rCo
}
-OUString InsertButton( OptimizerDialog& rOptimizerDialog, const OUString& rControlName, Reference< XActionListener >& xActionListener,
+OUString InsertButton( OptimizerDialog& rOptimizerDialog, const OUString& rControlName, Reference< XActionListener > const & xActionListener,
sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nTabIndex, bool bEnabled, PPPOptimizerTokenEnum nResID, css::awt::PushButtonType nPushButtonType )
{
OUString pNames[] = {
diff --git a/sdext/source/pdfimport/inc/pdfparse.hxx b/sdext/source/pdfimport/inc/pdfparse.hxx
index 4620cb6a624f..5e4bd837eb51 100644
--- a/sdext/source/pdfimport/inc/pdfparse.hxx
+++ b/sdext/source/pdfimport/inc/pdfparse.hxx
@@ -63,7 +63,7 @@ struct PDFEntry
virtual PDFEntry* clone() const = 0;
protected:
- static EmitImplData* getEmitData( EmitContext& rContext );
+ static EmitImplData* getEmitData( EmitContext const & rContext );
static void setEmitData( EmitContext& rContext, EmitImplData* pNewEmitData );
};
diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index 4a90b784fde9..34d23a5a1310 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -107,7 +107,7 @@ PDFEntry::~PDFEntry()
{
}
-EmitImplData* PDFEntry::getEmitData( EmitContext& rContext )
+EmitImplData* PDFEntry::getEmitData( EmitContext const & rContext )
{
return rContext.m_pImplData.get();
}
diff --git a/sdext/source/pdfimport/tree/genericelements.cxx b/sdext/source/pdfimport/tree/genericelements.cxx
index 1ffc3c1b8e35..cd704ad19adf 100644
--- a/sdext/source/pdfimport/tree/genericelements.cxx
+++ b/sdext/source/pdfimport/tree/genericelements.cxx
@@ -48,7 +48,7 @@ void Element::applyToChildren( ElementTreeVisitor& rVisitor )
(*it)->visitedBy( rVisitor, it );
}
-void Element::setParent( std::list<Element*>::iterator& el, Element* pNewParent )
+void Element::setParent( std::list<Element*>::iterator const & el, Element* pNewParent )
{
if( pNewParent )
{
@@ -191,7 +191,7 @@ void ParagraphElement::visitedBy( ElementTreeVisitor& r
rVisitor.visit(*this,rParentIt);
}
-bool ParagraphElement::isSingleLined( PDFIProcessor& rProc ) const
+bool ParagraphElement::isSingleLined( PDFIProcessor const & rProc ) const
{
std::list< Element* >::const_iterator it = Children.begin();
TextElement* pText = nullptr, *pLastText = nullptr;
@@ -366,12 +366,12 @@ void PageElement::resolveHyperlinks()
}
}
-void PageElement::resolveFontStyles( PDFIProcessor& rProc )
+void PageElement::resolveFontStyles( PDFIProcessor const & rProc )
{
resolveUnderlines(rProc);
}
-void PageElement::resolveUnderlines( PDFIProcessor& rProc )
+void PageElement::resolveUnderlines( PDFIProcessor const & rProc )
{
// FIXME: currently the algorithm used is quadratic
// this could be solved by some sorting beforehand
diff --git a/sdext/source/pdfimport/tree/genericelements.hxx b/sdext/source/pdfimport/tree/genericelements.hxx
index 63fa7845cf5e..3d2703768ae1 100644
--- a/sdext/source/pdfimport/tree/genericelements.hxx
+++ b/sdext/source/pdfimport/tree/genericelements.hxx
@@ -100,7 +100,7 @@ namespace pdfi
/** el must be a valid dereferenceable iterator of el->Parent->Children
pNewParent must not be NULL
*/
- static void setParent( std::list<Element*>::iterator& el, Element* pNewParent );
+ static void setParent( std::list<Element*>::iterator const & el, Element* pNewParent );
double x, y, w, h;
sal_Int32 StyleId;
@@ -193,7 +193,7 @@ namespace pdfi
virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* >::const_iterator& rParentIt ) override;
// returns true only if only a single line is contained
- bool isSingleLined( PDFIProcessor& rProc ) const;
+ bool isSingleLined( PDFIProcessor const & rProc ) const;
// returns the highest line height of the contained textelements
// line height is font height if the text element is itself multilined
double getLineHeight( PDFIProcessor& rProc ) const;
@@ -257,8 +257,8 @@ namespace pdfi
static void updateParagraphGeometry( Element* pEle );
void resolveHyperlinks();
- void resolveFontStyles( PDFIProcessor& rProc );
- void resolveUnderlines( PDFIProcessor& rProc );
+ void resolveFontStyles( PDFIProcessor const & rProc );
+ void resolveUnderlines( PDFIProcessor const & rProc );
sal_Int32 PageNumber;
ListElement Hyperlinks; // contains not yet realized links on this page
diff --git a/sdext/source/presenter/PresenterController.cxx b/sdext/source/presenter/PresenterController.cxx
index 26bd1d5f4208..a7771ea220ac 100644
--- a/sdext/source/presenter/PresenterController.cxx
+++ b/sdext/source/presenter/PresenterController.cxx
@@ -575,7 +575,7 @@ const Reference<drawing::XDrawPage>& PresenterController::GetCurrentSlide() cons
return mxCurrentSlide;
}
-bool PresenterController::HasTransition (Reference<drawing::XDrawPage>& rxPage)
+bool PresenterController::HasTransition (Reference<drawing::XDrawPage> const & rxPage)
{
bool bTransition = false;
sal_uInt16 aTransitionType = 0;
@@ -597,7 +597,7 @@ bool PresenterController::HasTransition (Reference<drawing::XDrawPage>& rxPage)
return bTransition;
}
-bool PresenterController::HasCustomAnimation (Reference<drawing::XDrawPage>& rxPage)
+bool PresenterController::HasCustomAnimation (Reference<drawing::XDrawPage> const & rxPage)
{
bool bCustomAnimation = false;
if( rxPage.is() )
diff --git a/sdext/source/presenter/PresenterController.hxx b/sdext/source/presenter/PresenterController.hxx
index 51d12a0a094b..a561e738061b 100644
--- a/sdext/source/presenter/PresenterController.hxx
+++ b/sdext/source/presenter/PresenterController.hxx
@@ -122,8 +122,8 @@ public:
const css::uno::Reference<css::drawing::framework::XConfigurationController>&
GetConfigurationController() const;
const css::uno::Reference<css::drawing::XDrawPage>& GetCurrentSlide() const;
- static bool HasTransition (css::uno::Reference<css::drawing::XDrawPage>& rxPage);
- static bool HasCustomAnimation (css::uno::Reference<css::drawing::XDrawPage>& rxPage);
+ static bool HasTransition (css::uno::Reference<css::drawing::XDrawPage> const & rxPage);
+ static bool HasCustomAnimation (css::uno::Reference<css::drawing::XDrawPage> const & rxPage);
void SetAccessibilityActiveState (const bool bIsActive);
bool IsAccessibilityActive() const { return mbIsAccessibilityActive;}
diff --git a/sdext/source/presenter/PresenterTheme.cxx b/sdext/source/presenter/PresenterTheme.cxx
index 9fdd24a0bb18..7dbd8e9e38a0 100644
--- a/sdext/source/presenter/PresenterTheme.cxx
+++ b/sdext/source/presenter/PresenterTheme.cxx
@@ -154,7 +154,7 @@ public:
private:
void ProcessPaneStyle (
- ReadContext& rReadContext,
+ ReadContext const & rReadContext,
const ::std::vector<css::uno::Any>& rValues);
};
@@ -191,7 +191,7 @@ public:
private:
void ProcessViewStyle(
- ReadContext& rReadContext,
+ ReadContext const & rReadContext,
const Reference<beans::XPropertySet>& rxProperties);
};
@@ -847,7 +847,7 @@ void PaneStyleContainer::Read (
}
void PaneStyleContainer::ProcessPaneStyle(
- ReadContext& rReadContext,
+ ReadContext const & rReadContext,
const ::std::vector<Any>& rValues)
{
if (rValues.size() != 6)
@@ -953,8 +953,6 @@ void ViewStyleContainer::Read (
ReadContext& rReadContext,
const Reference<container::XHierarchicalNameAccess>& rxThemeRoot)
{
- (void)rReadContext;
-
Reference<container::XNameAccess> xViewStyleList (
PresenterConfigurationAccess::GetConfigurationNode(
rxThemeRoot,
@@ -972,7 +970,7 @@ void ViewStyleContainer::Read (
}
void ViewStyleContainer::ProcessViewStyle(
- ReadContext& rReadContext,
+ ReadContext const & rReadContext,
const Reference<beans::XPropertySet>& rxProperties)
{
std::shared_ptr<ViewStyle> pStyle (new ViewStyle());
diff --git a/sdext/source/presenter/PresenterToolBar.cxx b/sdext/source/presenter/PresenterToolBar.cxx
index 871c0c36e17e..e01fdf096887 100644
--- a/sdext/source/presenter/PresenterToolBar.cxx
+++ b/sdext/source/presenter/PresenterToolBar.cxx
@@ -101,8 +101,8 @@ namespace {
void ReadElementMode (
const Reference<beans::XPropertySet>& rxProperties,
const OUString& rsModeName,
- std::shared_ptr<ElementMode>& rpDefaultMode,
- ::sdext::presenter::PresenterToolBar::Context& rContext);
+ std::shared_ptr<ElementMode> const & rpDefaultMode,
+ ::sdext::presenter::PresenterToolBar::Context const & rContext);
};
typedef std::shared_ptr<ElementMode> SharedElementMode;
@@ -629,7 +629,7 @@ void PresenterToolBar::CreateControls (
void PresenterToolBar::ProcessEntry (
const Reference<beans::XPropertySet>& rxProperties,
- Context& rContext)
+ Context const & rContext)
{
if ( ! rxProperties.is())
return;
@@ -1361,8 +1361,8 @@ ElementMode::ElementMode()
void ElementMode::ReadElementMode (
const Reference<beans::XPropertySet>& rxElementProperties,
const OUString& rsModeName,
- std::shared_ptr<ElementMode>& rpDefaultMode,
- ::sdext::presenter::PresenterToolBar::Context& rContext)
+ std::shared_ptr<ElementMode> const & rpDefaultMode,
+ ::sdext::presenter::PresenterToolBar::Context const & rContext)
{
try
{
diff --git a/sdext/source/presenter/PresenterToolBar.hxx b/sdext/source/presenter/PresenterToolBar.hxx
index 05eabc3816fa..bf6dcd519053 100644
--- a/sdext/source/presenter/PresenterToolBar.hxx
+++ b/sdext/source/presenter/PresenterToolBar.hxx
@@ -190,7 +190,7 @@ private:
void ProcessEntry (
const css::uno::Reference<css::beans::XPropertySet>& rProperties,
- Context& rContext);
+ Context const & rContext);
/** @throws css::lang::DisposedException when the object has already been
disposed.
More information about the Libreoffice-commits
mailing list