[Libreoffice-commits] core.git: 2 commits - compilerplugins/clang svl/source

Noel Grandin noel at peralex.com
Tue Jul 12 09:33:46 UTC 2016


 compilerplugins/clang/fragiledestructor.cxx |   15 +++++++--------
 svl/source/numbers/zformat.cxx              |   11 +++++++++++
 2 files changed, 18 insertions(+), 8 deletions(-)

New commits:
commit e12fbdd64b83f988191b8d085c99467fd8a52555
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Jul 12 11:31:25 2016 +0200

    only traverse the dtor's statements once
    
    rather than twice, once implicitly from TraverseCXXDestructorDecl and
    explicitly from VisitCXXDestructorDecl
    
    Change-Id: I62a794faa530f2b54b82c86de0629afa28f30091
    Reviewed-on: https://gerrit.libreoffice.org/27139
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/compilerplugins/clang/fragiledestructor.cxx b/compilerplugins/clang/fragiledestructor.cxx
index ebce1d6..d4b7e61 100644
--- a/compilerplugins/clang/fragiledestructor.cxx
+++ b/compilerplugins/clang/fragiledestructor.cxx
@@ -29,7 +29,7 @@ public:
 
     virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
 
-    bool VisitCXXDestructorDecl(const CXXDestructorDecl *);
+    bool TraverseCXXDestructorDecl(CXXDestructorDecl *);
 
     bool VisitCXXMemberCallExpr(const CXXMemberCallExpr *);
 
@@ -37,13 +37,13 @@ private:
     bool mbChecking = false;
 };
 
-bool FragileDestructor::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorDecl)
+bool FragileDestructor::TraverseCXXDestructorDecl(CXXDestructorDecl* pCXXDestructorDecl)
 {
     if (ignoreLocation(pCXXDestructorDecl)) {
-        return true;
+        return RecursiveASTVisitor::TraverseCXXDestructorDecl(pCXXDestructorDecl);
     }
     if (!pCXXDestructorDecl->isThisDeclarationADefinition()) {
-        return true;
+        return RecursiveASTVisitor::TraverseCXXDestructorDecl(pCXXDestructorDecl);
     }
     // ignore this for now, too tricky for me to work out
     StringRef aFileName = compiler.getSourceManager().getFilename(
@@ -55,12 +55,11 @@ bool FragileDestructor::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDest
         // dont know how to detect this in clang - it is making an explicit call to it's own method, so presumably OK
         || aFileName == SRCDIR "/basic/source/sbx/sbxvalue.cxx"
        )
-        return true;
+        return RecursiveASTVisitor::TraverseCXXDestructorDecl(pCXXDestructorDecl);
     mbChecking = true;
-    Stmt * pStmt = pCXXDestructorDecl->getBody();
-    TraverseStmt(pStmt);
+    bool ret = RecursiveASTVisitor::TraverseCXXDestructorDecl(pCXXDestructorDecl);
     mbChecking = false;
-    return true;
+    return ret;
 }
 
 bool FragileDestructor::VisitCXXMemberCallExpr(const CXXMemberCallExpr* callExpr)
commit 0727e6e79994b66836841978a554b7f6855449dc
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date:   Mon Jul 11 09:20:21 2016 +0200

    tdf#100842 Do not insert things in the middle of the number
    
    With fraction number format, if number is longer than number of digits in format
    jump to the beginning of number before inserting extras:
    strings, blank, star filling
    Do not do this for exponent of scientific format as it may contain
    unwanted 0 at beginning.
    
    Change-Id: Ide99f5cba198f76541f0e4e17b29469a99b57b9f
    Reviewed-on: https://gerrit.libreoffice.org/27097
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index aea14d0..1350525 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -4144,6 +4144,7 @@ bool SvNumberformat::ImpNumberFill( OUStringBuffer& sBuff, // number string
     const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
     // no normal thousands separators if number divided by thousands
     bool bDoThousands = (rInfo.nThousand == 0);
+    bool bFoundNumber = false;
     short nType;
 
     k = sBuff.getLength(); // behind last digit
@@ -4155,12 +4156,18 @@ bool SvNumberformat::ImpNumberFill( OUStringBuffer& sBuff, // number string
         case NF_SYMBOLTYPE_STAR:
             if( bStarFlag )
             {
+                if ( bFoundNumber && eSymbolType != NF_SYMBOLTYPE_EXP )
+                    k = 0; // tdf#100842 jump to beginning of number before inserting something else
                 bRes = lcl_insertStarFillChar( sBuff, k, rInfo.sStrArray[j]);
             }
             break;
         case NF_SYMBOLTYPE_BLANK:
             if (rInfo.sStrArray[j].getLength() >= 2)
+            {
+                if ( bFoundNumber && eSymbolType != NF_SYMBOLTYPE_EXP )
+                    k = 0; // tdf#100842 jump to beginning of number before inserting something else
                 k = InsertBlanks(sBuff, k, rInfo.sStrArray[j][1] );
+            }
             break;
         case NF_SYMBOLTYPE_THSEP:
             // Same as in ImpNumberFillWithThousands() above, do not insert
@@ -4181,6 +4188,7 @@ bool SvNumberformat::ImpNumberFill( OUStringBuffer& sBuff, // number string
             break;
         case NF_SYMBOLTYPE_DIGIT:
         {
+            bFoundNumber = true;
             const OUString& rStr = rInfo.sStrArray[j];
             const sal_Unicode* p1 = rStr.getStr();
             const sal_Unicode* p = p1 + rStr.getLength();
@@ -4211,6 +4219,7 @@ bool SvNumberformat::ImpNumberFill( OUStringBuffer& sBuff, // number string
         case NF_KEY_GENERAL: // Standard in the String
         {
             OUStringBuffer sNum;
+            bFoundNumber = true;
             ImpGetOutputStandard(rNumber, sNum);
             sNum.stripStart('-');
             sBuff.insert(k, sNum.makeStringAndClear());
@@ -4220,6 +4229,8 @@ bool SvNumberformat::ImpNumberFill( OUStringBuffer& sBuff, // number string
             break;
 
         default:
+            if ( bFoundNumber && eSymbolType != NF_SYMBOLTYPE_EXP )
+                k = 0; // tdf#100842 jump to beginning of number before inserting something else
             sBuff.insert(k, rInfo.sStrArray[j]);
             break;
         } // of switch


More information about the Libreoffice-commits mailing list