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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 12 10:18:12 UTC 2021


 sc/source/filter/inc/formulabuffer.hxx  |    2 +-
 sc/source/filter/inc/orcusinterface.hxx |   11 ++++++-----
 sc/source/filter/inc/tokstack.hxx       |    4 ++--
 sc/source/filter/oox/formulabuffer.cxx  |    2 +-
 sc/source/filter/orcus/interface.cxx    |   22 +++++++++++-----------
 sc/source/ui/view/prevloc.cxx           |    8 ++++----
 6 files changed, 25 insertions(+), 24 deletions(-)

New commits:
commit 20f064c1d4d2788edbd4ed7303cf1fcc4f817be4
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sun Sep 12 10:53:22 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Sep 12 12:17:38 2021 +0200

    clang:optin.performance.Padding in sc
    
    Excessive padding in 'struct ScPreviewLocationEntry' (10 padding bytes,
    where 2 is optimal).
    Excessive padding in 'struct oox::xls::FormulaBuffer::SharedFormulaDesc'
    (8 padding bytes, where 0 is optimal).
    Excessive padding in 'struct ScOrcusStyles::font' (11 padding bytes,
    where 3 is optimal).
    Excessive padding in 'struct ScOrcusFactory::CellStoreToken' (8 padding
    bytes, where 0 is optimal).
    Excessive padding in 'struct TokenPool::ExtCellRef' (10 padding bytes,
    where 2 is optimal).
    Excessive padding in 'struct TokenPool::ExtAreaRef' (10 padding bytes,
    where 2 is optimal).
    
    Change-Id: Ifce31c799b0f64d3c6971279345391bb74f210c0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121994
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/inc/formulabuffer.hxx b/sc/source/filter/inc/formulabuffer.hxx
index 052741bfcf34..36e41c7baa38 100644
--- a/sc/source/filter/inc/formulabuffer.hxx
+++ b/sc/source/filter/inc/formulabuffer.hxx
@@ -38,8 +38,8 @@ public:
     struct SharedFormulaDesc
     {
         ScAddress maAddress;
-        sal_Int32 mnSharedId;
         OUString maCellValue;
+        sal_Int32 mnSharedId;
         sal_Int32 mnValueType;
 
         SharedFormulaDesc(
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index f92125d207ce..060456733fbc 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -355,11 +355,11 @@ private:
 
     struct font
     {
-        bool mbBold;
-        bool mbItalic;
         OUString maName;
         double mnSize;
         Color maColor;
+        bool mbBold;
+        bool mbItalic;
 
         bool mbHasFontAttr;
         bool mbHasUnderlineAttr;
@@ -585,7 +585,7 @@ class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
 {
     struct CellStoreToken
     {
-        enum class Type
+        enum class Type : sal_uInt8
         {
             Auto,
             Numeric,
@@ -598,13 +598,14 @@ class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
             FillDownCells
         };
 
-        ScAddress maPos;
-        Type meType;
 
         OUString maStr1;
         OUString maStr2;
         double mfValue;
 
+        ScAddress maPos;
+        Type meType;
+
         uint32_t mnIndex1;
         uint32_t mnIndex2;
         formula::FormulaGrammar::Grammar meGrammar;
diff --git a/sc/source/filter/inc/tokstack.hxx b/sc/source/filter/inc/tokstack.hxx
index 2689a1ab89e9..03301d510e2f 100644
--- a/sc/source/filter/inc/tokstack.hxx
+++ b/sc/source/filter/inc/tokstack.hxx
@@ -183,18 +183,18 @@ private:
         /** for storage of external cell references */
         struct ExtCellRef
         {
-            sal_uInt16      mnFileId;
             OUString        maTabName;
             ScSingleRefData   maRef;
+            sal_uInt16      mnFileId;
         };
         ::std::vector<ExtCellRef>   maExtCellRefs;
 
         /** for storage of external area references */
         struct ExtAreaRef
         {
-            sal_uInt16      mnFileId;
             OUString        maTabName;
             ScComplexRefData    maRef;
+            sal_uInt16      mnFileId;
         };
         ::std::vector<ExtAreaRef>   maExtAreaRefs;
 
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index a93043830892..2aeccb1b37b7 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -345,7 +345,7 @@ FormulaBuffer::SharedFormulaEntry::SharedFormulaEntry(
 FormulaBuffer::SharedFormulaDesc::SharedFormulaDesc(
     const ScAddress& rAddr, sal_Int32 nSharedId,
     const OUString& rCellValue, sal_Int32 nValueType ) :
-    maAddress(rAddr), mnSharedId(nSharedId), maCellValue(rCellValue), mnValueType(nValueType) {}
+    maAddress(rAddr), maCellValue(rCellValue), mnSharedId(nSharedId), mnValueType(nValueType) {}
 
 FormulaBuffer::SheetItem::SheetItem() :
     mpCellFormulas(nullptr),
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 4212182d6c6a..f809edb816cd 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -259,9 +259,9 @@ void ScOrcusNamedExpression::commit()
 }
 
 ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, Type eType)
-    : maPos(rPos)
+    : mfValue(std::numeric_limits<double>::quiet_NaN())
+    , maPos(rPos)
     , meType(eType)
-    , mfValue(std::numeric_limits<double>::quiet_NaN())
     , mnIndex1(0)
     , mnIndex2(0)
     , meGrammar(formula::FormulaGrammar::GRAM_UNSPECIFIED)
@@ -269,9 +269,9 @@ ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, Type eType
 }
 
 ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, double fValue)
-    : maPos(rPos)
+    : mfValue(fValue)
+    , maPos(rPos)
     , meType(Type::Numeric)
-    , mfValue(fValue)
     , mnIndex1(0)
     , mnIndex2(0)
     , meGrammar(formula::FormulaGrammar::GRAM_UNSPECIFIED)
@@ -279,9 +279,9 @@ ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, double fVa
 }
 
 ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, uint32_t nIndex)
-    : maPos(rPos)
+    : mfValue(std::numeric_limits<double>::quiet_NaN())
+    , maPos(rPos)
     , meType(Type::String)
-    , mfValue(std::numeric_limits<double>::quiet_NaN())
     , mnIndex1(nIndex)
     , mnIndex2(0)
     , meGrammar(formula::FormulaGrammar::GRAM_UNSPECIFIED)
@@ -290,10 +290,10 @@ ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, uint32_t n
 
 ScOrcusFactory::CellStoreToken::CellStoreToken(const ScAddress& rPos, const OUString& rFormula,
         formula::FormulaGrammar::Grammar eGrammar)
-    : maPos(rPos)
-    , meType(Type::Formula)
-    , maStr1(rFormula)
+    : maStr1(rFormula)
     , mfValue(std::numeric_limits<double>::quiet_NaN())
+    , maPos(rPos)
+    , meType(Type::Formula)
     , mnIndex1(0)
     , mnIndex2(0)
     , meGrammar(eGrammar)
@@ -1317,10 +1317,10 @@ ScOrcusStyles::ScOrcusStyles( ScOrcusFactory& rFactory, bool bSkipDefaultStyles
 }
 
 ScOrcusStyles::font::font():
-    mbBold(false),
-    mbItalic(false),
     mnSize(10),
     maColor(COL_BLACK),
+    mbBold(false),
+    mbItalic(false),
     mbHasFontAttr(false),
     mbHasUnderlineAttr(false),
     mbHasStrikeout(false),
diff --git a/sc/source/ui/view/prevloc.cxx b/sc/source/ui/view/prevloc.cxx
index 9060893cad9a..e7922b252510 100644
--- a/sc/source/ui/view/prevloc.cxx
+++ b/sc/source/ui/view/prevloc.cxx
@@ -26,7 +26,7 @@
 
 namespace {
 
-enum ScPreviewLocationType
+enum ScPreviewLocationType : sal_uInt8
 {
     SC_PLOC_CELLRANGE,
     SC_PLOC_COLHEADER,
@@ -43,17 +43,17 @@ enum ScPreviewLocationType
 
 struct ScPreviewLocationEntry
 {
-    ScPreviewLocationType   eType;
-    tools::Rectangle               aPixelRect;
+    tools::Rectangle         aPixelRect;
     ScRange                 aCellRange;
+    ScPreviewLocationType   eType;
     bool                    bRepeatCol;
     bool                    bRepeatRow;
 
     ScPreviewLocationEntry( ScPreviewLocationType eNewType, const tools::Rectangle& rPixel, const ScRange& rRange,
                             bool bRepCol, bool bRepRow ) :
-        eType( eNewType ),
         aPixelRect( rPixel ),
         aCellRange( rRange ),
+        eType( eNewType ),
         bRepeatCol( bRepCol ),
         bRepeatRow( bRepRow )
     {


More information about the Libreoffice-commits mailing list