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

loplugin:unnecessaryparen improve return check

Change-Id: I8128aa4b5fc60efd1dbf5971cdde11e588f5f64b
Reviewed-on: https://gerrit.libreoffice.org/47167Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 0e5fc156
......@@ -27,21 +27,24 @@ namespace {
// Like clang::Stmt::IgnoreImplicit (lib/AST/Stmt.cpp), but also ignoring CXXConstructExpr and
// looking through implicit UserDefinedConversion's member function call:
Expr const * ignoreAllImplicit(Expr const * expr) {
while (true)
{
auto oldExpr = expr;
if (auto const e = dyn_cast<ExprWithCleanups>(expr)) {
expr = e->getSubExpr();
}
if (auto const e = dyn_cast<CXXConstructExpr>(expr)) {
else if (auto const e = dyn_cast<CXXConstructExpr>(expr)) {
if (e->getNumArgs() == 1) {
expr = e->getArg(0);
}
}
if (auto const e = dyn_cast<MaterializeTemporaryExpr>(expr)) {
else if (auto const e = dyn_cast<MaterializeTemporaryExpr>(expr)) {
expr = e->GetTemporaryExpr();
}
if (auto const e = dyn_cast<CXXBindTemporaryExpr>(expr)) {
else if (auto const e = dyn_cast<CXXBindTemporaryExpr>(expr)) {
expr = e->getSubExpr();
}
while (auto const e = dyn_cast<ImplicitCastExpr>(expr)) {
else if (auto const e = dyn_cast<ImplicitCastExpr>(expr)) {
expr = e->getSubExpr();
if (e->getCastKind() == CK_UserDefinedConversion) {
auto const ce = cast<CXXMemberCallExpr>(expr);
......@@ -49,6 +52,9 @@ Expr const * ignoreAllImplicit(Expr const * expr) {
expr = ce->getImplicitObjectArgument();
}
}
if (expr == oldExpr)
return expr;
}
return expr;
}
......@@ -261,7 +267,7 @@ bool UnnecessaryParen::VisitReturnStmt(const ReturnStmt* returnStmt)
return true;
// only non-operator-calls for now
auto subExpr = parenExpr->getSubExpr();
auto subExpr = ignoreAllImplicit(parenExpr->getSubExpr());
if (isa<CallExpr>(subExpr) && !isa<CXXOperatorCallExpr>(subExpr))
{
report(
......
......@@ -182,7 +182,7 @@ namespace drawinglayer
OUString SAL_CALL XPrimitive2DRenderer::getImplementationName()
{
return(XPrimitive2DRenderer_getImplementationName());
return XPrimitive2DRenderer_getImplementationName();
}
sal_Bool SAL_CALL XPrimitive2DRenderer::supportsService(const OUString& rServiceName)
......
......@@ -77,7 +77,7 @@ namespace accessibility
uno::Reference< XAccessible > SAL_CALL AccessibleSelectionBase::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
{
::osl::MutexGuard aGuard( implGetMutex() );
return( OCommonAccessibleSelection::getSelectedAccessibleChild( nSelectedChildIndex ) );
return OCommonAccessibleSelection::getSelectedAccessibleChild( nSelectedChildIndex );
}
......
......@@ -215,7 +215,7 @@ namespace emfio
OUString SAL_CALL XEmfParser::getImplementationName()
{
return(XEmfParser_getImplementationName());
return XEmfParser_getImplementationName();
}
sal_Bool SAL_CALL XEmfParser::supportsService(const OUString& rServiceName)
......
......@@ -409,7 +409,7 @@ OUString LwpFontNameManager::GetNameByIndex(sal_uInt16 index)
return OUString();
sal_uInt16 nameindex = m_pFontNames[index-1].GetFaceID();
return (m_FontTbl.GetFaceName(nameindex));
return m_FontTbl.GetFaceName(nameindex);
}
void LwpFontAttrManager::Read(LwpObjectStream *pStrm)
......@@ -515,7 +515,7 @@ void LwpFontManager::Override(sal_uInt32 fontID, rtl::Reference<XFFont> const &
OUString LwpFontManager::GetNameByID(sal_uInt32 fontID)
{
return ( m_FNMgr.GetNameByIndex(GetFontNameIndex(fontID)) );//use font id for bullet?
return m_FNMgr.GetNameByIndex(GetFontNameIndex(fontID));//use font id for bullet?
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -5145,7 +5145,7 @@ inline OUString getCurrentPID()
#else
nPID = getpid();
#endif
return (OUString::number(nPID));
return OUString::number(nPID);
}
//~ do some clean up work after all test completed.
......
......@@ -1137,7 +1137,7 @@ void EffectMigration::SetPresentationOrder( SvxShape* pShape, sal_Int32 nNewPos
while( aIter != aEnd )
{
aEffects.push_back( *(*aIter) );
rSequence.erase( (*aIter++) );
rSequence.erase( *aIter++ );
}
if( nNewPos > nCurrentPos )
......
......@@ -165,7 +165,7 @@ namespace svgio
OUString SAL_CALL XSvgParser::getImplementationName()
{
return(XSvgParser_getImplementationName());
return XSvgParser_getImplementationName();
}
sal_Bool SAL_CALL XSvgParser::supportsService(const OUString& rServiceName)
......
......@@ -1986,7 +1986,7 @@ class DemoPopup : public FloatingWindow
aSize.Width() -= 2;
aSize.Height() -= 2;
Color aColor( GetLineColor() );
SetLineColor( ( COL_GRAY ) );
SetLineColor( COL_GRAY );
DrawRect( tools::Rectangle( Point( 1, 1 ), aSize ) );
SetLineColor( aColor );
}
......
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