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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 5 12:54:16 UTC 2020


 compilerplugins/clang/plugin.cxx         |    3 ++-
 sc/inc/addincol.hxx                      |    2 +-
 sc/source/core/data/formulacell.cxx      |    2 +-
 sc/source/core/tool/address.cxx          |    2 +-
 sc/source/core/tool/interpr1.cxx         |    4 ++--
 sc/source/core/tool/jumpmatrix.cxx       |    2 +-
 sc/source/filter/excel/xelink.cxx        |   31 ++++++++++++++++---------------
 sc/source/filter/xml/xmlexprt.cxx        |    2 +-
 sc/source/filter/xml/xmlexternaltabi.cxx |    2 +-
 sc/source/ui/docshell/externalrefmgr.cxx |    2 +-
 10 files changed, 27 insertions(+), 25 deletions(-)

New commits:
commit 94a34d6bdb41da2aafc519ffe1447d03ba99b4a6
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jun 5 08:57:32 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jun 5 14:53:33 2020 +0200

    add boost::intrusive_ptr to list of smart points in plugins
    
    and fix some loplugin:simplifypointertobool warnings
    
    Change-Id: I3644c390a3339a4cb8d66d6d034a0f043de9320c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95572
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index c9e0170f2969..dc7c673a31c3 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -856,7 +856,8 @@ bool isSmartPointerType(const Expr* e)
            || tc2.Class("ScopedReadAccess").Namespace("Bitmap").GlobalNamespace()
            || tc2.Class("ScopedVclPtrInstance").GlobalNamespace()
            || tc2.Class("VclPtr").GlobalNamespace()
-           || tc2.Class("ScopedVclPtr").GlobalNamespace())
+           || tc2.Class("ScopedVclPtr").GlobalNamespace()
+           || tc2.Class("intrusive_ptr").Namespace("boost").GlobalNamespace())
     {
         return true;
     }
diff --git a/sc/inc/addincol.hxx b/sc/inc/addincol.hxx
index 8244d0565850..411459981a68 100644
--- a/sc/inc/addincol.hxx
+++ b/sc/inc/addincol.hxx
@@ -218,7 +218,7 @@ public:
 
     FormulaError        GetErrCode() const      { return nErrCode; }
     bool                HasString() const       { return bHasString; }
-    bool                HasMatrix() const       { return xMatrix.get(); }
+    bool                HasMatrix() const       { return bool(xMatrix); }
     bool                HasVarRes() const       { return xVarRes.is(); }
     double              GetValue() const        { return fValue; }
     const OUString&     GetString() const       { return aString; }
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 328b881b516c..448c778c8995 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -5437,7 +5437,7 @@ void ScFormulaCell::EndListeningTo( sc::EndListeningContext& rCxt )
 
 bool ScFormulaCell::IsShared() const
 {
-    return mxGroup.get() != nullptr;
+    return bool(mxGroup);
 }
 
 bool ScFormulaCell::IsSharedTop() const
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 2c7b5b07a398..0d75dfe4a816 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -1397,7 +1397,7 @@ static ScRefFlags lcl_ScAddress_Parse_OOo( const sal_Unicode* p, const ScDocumen
 
                         if (pRefMgr->getSingleRefToken(nFileId, aTab,
                                     ScAddress(nCol, nRow, 0), nullptr,
-                                    &nTab).get())
+                                    &nTab))
                         {
                             rAddr.SetTab( nTab);
                             nRes |= ScRefFlags::TAB_VALID;
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 56309d6878d7..419550d21684 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -176,7 +176,7 @@ void ScInterpreter::ScIfJump()
                     xNew = new ScJumpMatrixToken( pJumpMat );
                     GetTokenMatrixMap().emplace(pCur, xNew);
                 }
-                if (!xNew.get())
+                if (!xNew)
                 {
                     PushIllegalArgument();
                     return;
@@ -481,7 +481,7 @@ void ScInterpreter::ScChooseJump()
                     xNew = new ScJumpMatrixToken( pJumpMat );
                     GetTokenMatrixMap().emplace(pCur, xNew);
                 }
-                if (xNew.get())
+                if (xNew)
                 {
                     PushTokenRef( xNew);
                     // set endpoint of path for main code line
diff --git a/sc/source/core/tool/jumpmatrix.cxx b/sc/source/core/tool/jumpmatrix.cxx
index 38fd4ab82d41..f66a82abeba7 100644
--- a/sc/source/core/tool/jumpmatrix.cxx
+++ b/sc/source/core/tool/jumpmatrix.cxx
@@ -165,7 +165,7 @@ void ScJumpMatrix::SetNewResMat(SCSIZE nNewCols, SCSIZE nNewRows)
 bool ScJumpMatrix::HasResultMatrix() const
 {
     // We now always have a matrix but caller logic may still want to check it.
-    return pMat.get() != nullptr;
+    return bool(pMat);
 }
 
 ScRefList& ScJumpMatrix::GetRefList()
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index d283d7d099c3..519ceec9a8ff 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -1374,21 +1374,22 @@ bool XclExpXct::BuildCrnList( XclExpCrnList& rCrnRecs )
                 sal_uInt32 nScNumFmt = 0;
                 ScExternalRefCache::TokenRef xToken = mxCacheTable->getCell( nScCol, nScRow, &nScNumFmt );
                 using namespace ::formula;
-                if( xToken.get() ) switch( xToken->GetType() )
-                {
-                    case svDouble:
-                        bValid = (rFormatter.GetType( nScNumFmt ) == SvNumFormatType::LOGICAL) ?
-                            rCrnRecs.InsertValue( nScCol, nScRow, Any( xToken->GetDouble() != 0 ) ) :
-                            rCrnRecs.InsertValue( nScCol, nScRow, Any( xToken->GetDouble() ) );
-                    break;
-                    case svString:
-                        // do not save empty strings (empty cells) to cache
-                        if( !xToken->GetString().isEmpty() )
-                            bValid = rCrnRecs.InsertValue( nScCol, nScRow, Any( xToken->GetString().getString() ) );
-                    break;
-                    default:
-                    break;
-                }
+                if( xToken )
+                    switch( xToken->GetType() )
+                    {
+                        case svDouble:
+                            bValid = (rFormatter.GetType( nScNumFmt ) == SvNumFormatType::LOGICAL) ?
+                                rCrnRecs.InsertValue( nScCol, nScRow, Any( xToken->GetDouble() != 0 ) ) :
+                                rCrnRecs.InsertValue( nScCol, nScRow, Any( xToken->GetDouble() ) );
+                        break;
+                        case svString:
+                            // do not save empty strings (empty cells) to cache
+                            if( !xToken->GetString().isEmpty() )
+                                bValid = rCrnRecs.InsertValue( nScCol, nScRow, Any( xToken->GetString().getString() ) );
+                        break;
+                        default:
+                        break;
+                    }
             }
         }
     }
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index a338a2d861c5..5321f342c332 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -4927,7 +4927,7 @@ void ScXMLExport::WriteExternalRefCaches()
                     sal_uInt32 nNumFmt = 0;
                     ScExternalRefCache::TokenRef pToken = pTable->getCell(nCol, nRow, &nNumFmt);
                     OUString aStrVal;
-                    if (pToken.get())
+                    if (pToken)
                     {
                         sal_Int32 nIndex = GetNumberFormatStyleIndex(nNumFmt);
                         if (nIndex >= 0)
diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx b/sc/source/filter/xml/xmlexternaltabi.cxx
index 79249b78ad66..8185cf6f5821 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -210,7 +210,7 @@ void SAL_CALL ScXMLExternalRefRowContext::endFastElement( sal_Int32 /* nElement
             ScExternalRefCache::TokenRef pToken = pTab->getCell(
                 static_cast<SCCOL>(j), static_cast<SCROW>(mrExternalRefInfo.mnRow));
 
-            if (pToken.get())
+            if (pToken)
             {
                 pTab->setCell(static_cast<SCCOL>(j),
                               static_cast<SCROW>(mrExternalRefInfo.mnRow+i), pToken);
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 9b90a5cbea36..9ba5e0b5e0cf 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2224,7 +2224,7 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefTokenFromSrcDoc(
     ScRefCellValue aCell(*pSrcDoc, rPos);
     ScExternalRefCache::TokenRef pToken(convertToToken(mpDoc, pSrcDoc, aCell));
 
-    if (!pToken.get())
+    if (!pToken)
     {
         // Generate an error for unresolvable cells.
         pToken.reset( new FormulaErrorToken( FormulaError::NoValue));


More information about the Libreoffice-commits mailing list