Kaydet (Commit) 17ee20b1 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:passstuffbyref improved return in emfio,writerfilter

Change-Id: I237936d62d0f1b17574dd88b5c9de932dc03238e
Reviewed-on: https://gerrit.libreoffice.org/47214Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst d4d0b1a2
...@@ -250,7 +250,8 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C ...@@ -250,7 +250,8 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
|| (dc.MemberFunction().Class("Submission").Namespace("xforms") || (dc.MemberFunction().Class("Submission").Namespace("xforms")
.GlobalNamespace()) .GlobalNamespace())
|| (dc.Function("TopLeft").Class("SwRect").GlobalNamespace()) || (dc.Function("TopLeft").Class("SwRect").GlobalNamespace())
|| (dc.Function("ConvDicList_CreateInstance").GlobalNamespace())) || (dc.Function("ConvDicList_CreateInstance").GlobalNamespace())
|| (dc.Function("Create").Class("OUnoAutoPilot").Namespace("dbp").GlobalNamespace()))
{ {
return; return;
} }
...@@ -349,6 +350,9 @@ bool PassStuffByRef::isReturnExprDisqualified(const Expr* expr) ...@@ -349,6 +350,9 @@ bool PassStuffByRef::isReturnExprDisqualified(const Expr* expr)
if (isa<CXXBindTemporaryExpr>(expr)) { if (isa<CXXBindTemporaryExpr>(expr)) {
return true; return true;
} }
if (isa<InitListExpr>(expr)) {
return true;
}
expr = expr->IgnoreParenCasts(); expr = expr->IgnoreParenCasts();
if (auto childExpr = dyn_cast<ArraySubscriptExpr>(expr)) { if (auto childExpr = dyn_cast<ArraySubscriptExpr>(expr)) {
expr = childExpr->getLHS(); expr = childExpr->getLHS();
......
...@@ -115,7 +115,7 @@ class CommandLineArgs ...@@ -115,7 +115,7 @@ class CommandLineArgs
std::vector< OUString > GetConversionList() const; std::vector< OUString > GetConversionList() const;
const OUString& GetConversionParams() const { return m_conversionparams;} const OUString& GetConversionParams() const { return m_conversionparams;}
OUString GetConversionOut() const; OUString GetConversionOut() const;
OUString GetImageConversionType() const { return m_convertimages; } OUString const & GetImageConversionType() const { return m_convertimages; }
const OUString& GetPidfileName() const { return m_pidfile;} const OUString& GetPidfileName() const { return m_pidfile;}
// Special analyzed states (does not match directly to a command line parameter!) // Special analyzed states (does not match directly to a command line parameter!)
......
...@@ -280,7 +280,7 @@ namespace emfio ...@@ -280,7 +280,7 @@ namespace emfio
bool isEmpty() const { return maClip.isCleared(); } bool isEmpty() const { return maClip.isCleared(); }
basegfx::B2DPolyPolygon getClipPath() const; basegfx::B2DPolyPolygon const & getClipPath() const;
bool operator==(const WinMtfClipPath& rPath) const bool operator==(const WinMtfClipPath& rPath) const
{ {
......
...@@ -115,7 +115,7 @@ namespace emfio ...@@ -115,7 +115,7 @@ namespace emfio
maClip = basegfx::utils::B2DClipState(); maClip = basegfx::utils::B2DClipState();
} }
basegfx::B2DPolyPolygon WinMtfClipPath::getClipPath() const basegfx::B2DPolyPolygon const & WinMtfClipPath::getClipPath() const
{ {
return maClip.getClipPoly(); return maClip.getClipPoly();
} }
......
...@@ -337,7 +337,7 @@ namespace pcr ...@@ -337,7 +337,7 @@ namespace pcr
virtual ~EventHolder( ) override; virtual ~EventHolder( ) override;
private: private:
ScriptEventDescriptor impl_getDescriptor_throw( const OUString& _rEventName ) const; ScriptEventDescriptor const & impl_getDescriptor_throw( const OUString& _rEventName ) const;
}; };
...@@ -364,7 +364,7 @@ namespace pcr ...@@ -364,7 +364,7 @@ namespace pcr
return impl_getDescriptor_throw( _rEventName ); return impl_getDescriptor_throw( _rEventName );
} }
ScriptEventDescriptor EventHolder::impl_getDescriptor_throw( const OUString& _rEventName ) const ScriptEventDescriptor const & EventHolder::impl_getDescriptor_throw( const OUString& _rEventName ) const
{ {
EventMap::const_iterator pos = m_aEventNameAccess.find( _rEventName ); EventMap::const_iterator pos = m_aEventNameAccess.find( _rEventName );
if ( pos == m_aEventNameAccess.end() ) if ( pos == m_aEventNameAccess.end() )
......
...@@ -923,7 +923,7 @@ namespace pcr ...@@ -923,7 +923,7 @@ namespace pcr
} }
OPropertyBrowserController::PropertyHandlerRef OPropertyBrowserController::impl_getHandlerForProperty_throw( const OUString& _rPropertyName ) const OPropertyBrowserController::PropertyHandlerRef const & OPropertyBrowserController::impl_getHandlerForProperty_throw( const OUString& _rPropertyName ) const
{ {
PropertyHandlerRepository::const_iterator handlerPos = m_aPropertyHandlers.find( _rPropertyName ); PropertyHandlerRepository::const_iterator handlerPos = m_aPropertyHandlers.find( _rPropertyName );
if ( handlerPos == m_aPropertyHandlers.end() ) if ( handlerPos == m_aPropertyHandlers.end() )
......
...@@ -318,7 +318,7 @@ namespace pcr ...@@ -318,7 +318,7 @@ namespace pcr
@return @return
the handler which is responsible for the given property the handler which is responsible for the given property
*/ */
PropertyHandlerRef PropertyHandlerRef const &
impl_getHandlerForProperty_throw( const OUString& _rPropertyName ) const; impl_getHandlerForProperty_throw( const OUString& _rPropertyName ) const;
/** determines whether we have a handler for the given property /** determines whether we have a handler for the given property
......
...@@ -3764,7 +3764,7 @@ bool DomainMapper::IsRTFImport() const ...@@ -3764,7 +3764,7 @@ bool DomainMapper::IsRTFImport() const
return m_pImpl->IsRTFImport(); return m_pImpl->IsRTFImport();
} }
uno::Reference < lang::XMultiServiceFactory > DomainMapper::GetTextFactory() const uno::Reference < lang::XMultiServiceFactory > const & DomainMapper::GetTextFactory() const
{ {
return m_pImpl->GetTextFactory(); return m_pImpl->GetTextFactory();
} }
...@@ -3780,7 +3780,7 @@ OUString DomainMapper::getOrCreateCharStyle( PropertyValueVector_t& rCharPropert ...@@ -3780,7 +3780,7 @@ OUString DomainMapper::getOrCreateCharStyle( PropertyValueVector_t& rCharPropert
return pStyleSheets->getOrCreateCharStyle( rCharProperties, bAlwaysCreate ); return pStyleSheets->getOrCreateCharStyle( rCharProperties, bAlwaysCreate );
} }
StyleSheetTablePtr DomainMapper::GetStyleSheetTable( ) StyleSheetTablePtr const & DomainMapper::GetStyleSheetTable( )
{ {
return m_pImpl->GetStyleSheetTable( ); return m_pImpl->GetStyleSheetTable( );
} }
......
...@@ -96,11 +96,11 @@ public: ...@@ -96,11 +96,11 @@ public:
bool IsOOXMLImport() const; bool IsOOXMLImport() const;
bool IsRTFImport() const; bool IsRTFImport() const;
css::uno::Reference<css::lang::XMultiServiceFactory> GetTextFactory() const; css::uno::Reference<css::lang::XMultiServiceFactory> const & GetTextFactory() const;
css::uno::Reference<css::text::XTextRange> GetCurrentTextRange(); css::uno::Reference<css::text::XTextRange> GetCurrentTextRange();
OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate ); OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate );
std::shared_ptr< StyleSheetTable > GetStyleSheetTable( ); std::shared_ptr< StyleSheetTable > const & GetStyleSheetTable( );
GraphicZOrderHelper* graphicZOrderHelper(); GraphicZOrderHelper* graphicZOrderHelper();
GraphicNamingHelper& GetGraphicNamingHelper(); GraphicNamingHelper& GetGraphicNamingHelper();
......
...@@ -381,17 +381,17 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) ...@@ -381,17 +381,17 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
return bRet; return bRet;
} }
std::shared_ptr< vector<sal_Int32> > DomainMapperTableManager::getCurrentGrid( ) std::shared_ptr< vector<sal_Int32> > const & DomainMapperTableManager::getCurrentGrid( )
{ {
return m_aTableGrid.back( ); return m_aTableGrid.back( );
} }
std::shared_ptr< vector< sal_Int32 > > DomainMapperTableManager::getCurrentSpans( ) std::shared_ptr< vector< sal_Int32 > > const & DomainMapperTableManager::getCurrentSpans( )
{ {
return m_aGridSpans.back( ); return m_aGridSpans.back( );
} }
std::shared_ptr< vector< sal_Int32 > > DomainMapperTableManager::getCurrentCellWidths( ) std::shared_ptr< vector< sal_Int32 > > const & DomainMapperTableManager::getCurrentCellWidths( )
{ {
return m_aCellWidths.back( ); return m_aCellWidths.back( );
} }
......
...@@ -94,9 +94,9 @@ public: ...@@ -94,9 +94,9 @@ public:
virtual void endOfCellAction() override; virtual void endOfCellAction() override;
virtual void endOfRowAction() override; virtual void endOfRowAction() override;
IntVectorPtr getCurrentGrid( ); IntVectorPtr const & getCurrentGrid( );
IntVectorPtr getCurrentSpans( ); IntVectorPtr const & getCurrentSpans( );
IntVectorPtr getCurrentCellWidths( ); IntVectorPtr const & getCurrentCellWidths( );
/// Turn the attributes collected so far in m_aTableLook into a property and clear the container. /// Turn the attributes collected so far in m_aTableLook into a property and clear the container.
void finishTableLook(); void finishTableLook();
......
...@@ -581,13 +581,13 @@ PropertyMapPtr DomainMapper_Impl::GetTopContextOfType(ContextType eId) ...@@ -581,13 +581,13 @@ PropertyMapPtr DomainMapper_Impl::GetTopContextOfType(ContextType eId)
} }
uno::Reference< text::XTextAppend > DomainMapper_Impl::GetTopTextAppend() uno::Reference< text::XTextAppend > const & DomainMapper_Impl::GetTopTextAppend()
{ {
OSL_ENSURE(!m_aTextAppendStack.empty(), "text append stack is empty" ); OSL_ENSURE(!m_aTextAppendStack.empty(), "text append stack is empty" );
return m_aTextAppendStack.top().xTextAppend; return m_aTextAppendStack.top().xTextAppend;
} }
FieldContextPtr DomainMapper_Impl::GetTopFieldContext() FieldContextPtr const & DomainMapper_Impl::GetTopFieldContext()
{ {
SAL_WARN_IF(m_aFieldStack.empty(), "writerfilter.dmapper", "Field stack is empty"); SAL_WARN_IF(m_aFieldStack.empty(), "writerfilter.dmapper", "Field stack is empty");
return m_aFieldStack.top(); return m_aFieldStack.top();
......
...@@ -167,7 +167,7 @@ public: ...@@ -167,7 +167,7 @@ public:
const OUString& GetCommand() const {return m_sCommand; } const OUString& GetCommand() const {return m_sCommand; }
void SetFieldId(FieldId eFieldId ) { m_eFieldId = eFieldId; } void SetFieldId(FieldId eFieldId ) { m_eFieldId = eFieldId; }
boost::optional<FieldId> GetFieldId() const { return m_eFieldId; } boost::optional<FieldId> const & GetFieldId() const { return m_eFieldId; }
void AppendResult(OUString const& rResult) { m_sResult += rResult; } void AppendResult(OUString const& rResult) { m_sResult += rResult; }
const OUString& GetResult() const { return m_sResult; } const OUString& GetResult() const { return m_sResult; }
...@@ -635,8 +635,8 @@ public: ...@@ -635,8 +635,8 @@ public:
} }
PropertyMapPtr GetTopContextOfType(ContextType eId); PropertyMapPtr GetTopContextOfType(ContextType eId);
css::uno::Reference<css::text::XTextAppend> GetTopTextAppend(); css::uno::Reference<css::text::XTextAppend> const & GetTopTextAppend();
FieldContextPtr GetTopFieldContext(); FieldContextPtr const & GetTopFieldContext();
FontTablePtr const & GetFontTable() FontTablePtr const & GetFontTable()
{ {
......
...@@ -253,7 +253,7 @@ OUString OLEHandler::getCLSID(const uno::Reference<uno::XComponentContext>& xCom ...@@ -253,7 +253,7 @@ OUString OLEHandler::getCLSID(const uno::Reference<uno::XComponentContext>& xCom
return aRet; return aRet;
} }
OUString OLEHandler::GetDrawAspect() const OUString const & OLEHandler::GetDrawAspect() const
{ {
return m_sDrawAspect; return m_sDrawAspect;
} }
......
...@@ -90,7 +90,7 @@ public: ...@@ -90,7 +90,7 @@ public:
/// Get the CLSID of the OLE object, in case we can find one based on m_sProgId. /// Get the CLSID of the OLE object, in case we can find one based on m_sProgId.
OUString getCLSID(const css::uno::Reference<css::uno::XComponentContext>& xComponentContext) const; OUString getCLSID(const css::uno::Reference<css::uno::XComponentContext>& xComponentContext) const;
OUString GetDrawAspect() const; OUString const & GetDrawAspect() const;
OUString copyOLEOStream(css::uno::Reference<css::text::XTextDocument> const& xTextDocument); OUString copyOLEOStream(css::uno::Reference<css::text::XTextDocument> const& xTextDocument);
......
...@@ -562,7 +562,7 @@ bool SettingsTable::GetProtectForm() const ...@@ -562,7 +562,7 @@ bool SettingsTable::GetProtectForm() const
{ {
return m_pImpl->m_bProtectForm; return m_pImpl->m_bProtectForm;
} }
uno::Sequence<beans::PropertyValue> SettingsTable::GetThemeFontLangProperties() const uno::Sequence<beans::PropertyValue> const & SettingsTable::GetThemeFontLangProperties() const
{ {
return m_pImpl->m_pThemeFontLangProps; return m_pImpl->m_pThemeFontLangProps;
} }
......
...@@ -75,7 +75,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable ...@@ -75,7 +75,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable
bool GetNoColumnBalance() const; bool GetNoColumnBalance() const;
bool GetProtectForm() const; bool GetProtectForm() const;
css::uno::Sequence<css::beans::PropertyValue> GetThemeFontLangProperties() const; css::uno::Sequence<css::beans::PropertyValue> const & GetThemeFontLangProperties() const;
css::uno::Sequence<css::beans::PropertyValue> GetCompatSettings() const; css::uno::Sequence<css::beans::PropertyValue> GetCompatSettings() const;
......
...@@ -395,7 +395,7 @@ StyleSheetTable::~StyleSheetTable() ...@@ -395,7 +395,7 @@ StyleSheetTable::~StyleSheetTable()
{ {
} }
PropertyMapPtr StyleSheetTable::GetDefaultCharProps() PropertyMapPtr const & StyleSheetTable::GetDefaultCharProps()
{ {
return m_pImpl->m_pDefaultCharProps; return m_pImpl->m_pDefaultCharProps;
} }
......
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate ); OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate );
/// Returns the default character properties. /// Returns the default character properties.
PropertyMapPtr GetDefaultCharProps(); PropertyMapPtr const & GetDefaultCharProps();
private: private:
// Properties // Properties
......
...@@ -218,7 +218,7 @@ public: ...@@ -218,7 +218,7 @@ public:
@param i index of the cell @param i index of the cell
*/ */
TablePropertyMapPtr getCellProperties(unsigned int i) const TablePropertyMapPtr const & getCellProperties(unsigned int i) const
{ {
return mCells[i]->getProperties(); return mCells[i]->getProperties();
} }
......
...@@ -196,13 +196,13 @@ class TableManager ...@@ -196,13 +196,13 @@ class TableManager
TableManagerState mState; TableManagerState mState;
protected: protected:
TablePropertyMapPtr getCellProps() TablePropertyMapPtr const & getCellProps()
{ {
return mState.getCellProps(); return mState.getCellProps();
} }
public: public:
TablePropertyMapPtr getRowProps() TablePropertyMapPtr const & getRowProps()
{ {
return mState.getRowProps(); return mState.getRowProps();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment