loplugin:constparams in sdext

Change-Id: Ia5d2c00b02bf1758f7502065dd109f0f54fda2d3
Reviewed-on: https://gerrit.libreoffice.org/40124
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2017-07-18 11:08:41 +02:00
parent e56596e009
commit 3964408f7f
14 changed files with 37 additions and 34 deletions

View File

@ -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;
}

View File

@ -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 );

View File

@ -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

View File

@ -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[] = {

View File

@ -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[] = {

View File

@ -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 );
};

View File

@ -107,7 +107,7 @@ PDFEntry::~PDFEntry()
{
}
EmitImplData* PDFEntry::getEmitData( EmitContext& rContext )
EmitImplData* PDFEntry::getEmitData( EmitContext const & rContext )
{
return rContext.m_pImplData.get();
}

View File

@ -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

View File

@ -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

View File

@ -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() )

View File

@ -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;}

View File

@ -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());

View File

@ -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
{

View File

@ -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.