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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 17 18:41:12 UTC 2019


 compilerplugins/clang/dbgunhandledexception.cxx       |    8 +++---
 compilerplugins/clang/indentation.cxx                 |   14 ++++++----
 compilerplugins/clang/literaltoboolconversion.cxx     |    7 +++--
 compilerplugins/clang/passparamsbyref.cxx             |    7 +++--
 compilerplugins/clang/sharedvisitor/generator.cxx     |    4 ++-
 compilerplugins/clang/sharedvisitor/sharedvisitor.cxx |   24 ++++++++++++------
 compilerplugins/clang/unicodetochar.cxx               |   15 ++++++-----
 compilerplugins/clang/unreffun.cxx                    |    5 ++-
 sc/source/ui/Accessibility/AccessibleDocument.cxx     |    1 
 9 files changed, 54 insertions(+), 31 deletions(-)

New commits:
commit aab10bb21f230a0d0d6acf59ccab50dd3c2c3d0a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 17 12:54:05 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 17 20:40:14 2019 +0200

    fix "tdf#119388 calc, slow removing column, improve ScChildrenShapes"
    
    forgot to add the code to actually update the map, which would be bad
    for accessibility
    
    Change-Id: I5d93dd84649ce27a37c9035622f94fff3237b778
    Reviewed-on: https://gerrit.libreoffice.org/75773
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 1e9b8244a96e..856ef70b88c4 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1182,6 +1182,7 @@ void ScChildrenShapes::AddShape(const uno::Reference<drawing::XShape>& xShape, b
         ScAccessibleShapeData* pShape = new ScAccessibleShapeData();
         pShape->xShape = xShape;
         SortedShapes::iterator aNewItr = maZOrderedShapes.insert(aFindItr, pShape);
+        maShapesMap[xShape] = pShape;
         SetAnchor(xShape, pShape);
 
         uno::Reference< beans::XPropertySet > xShapeProp(xShape, uno::UNO_QUERY);
commit 476fb5d26ea766ae1aa3238e2967480857872d29
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 17 15:07:50 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 17 20:40:01 2019 +0200

    Revert "simplify sharedplugin PostTraverse calls"
    
    This reverts commit ff55ad1aceb10b900254c8ad3629775b7789d60a,
    Lubos prefers it the way it was.
    
    Change-Id: I68edc21c438b6aa2fc819245dd9a3d590af3a278
    Reviewed-on: https://gerrit.libreoffice.org/75790
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    Tested-by: Jenkins

diff --git a/compilerplugins/clang/dbgunhandledexception.cxx b/compilerplugins/clang/dbgunhandledexception.cxx
index 0b0cb41edc2e..81d6126fb3af 100644
--- a/compilerplugins/clang/dbgunhandledexception.cxx
+++ b/compilerplugins/clang/dbgunhandledexception.cxx
@@ -34,7 +34,7 @@ public:
     bool VisitCallExpr(CallExpr const* call);
     bool TraverseCXXCatchStmt(CXXCatchStmt*);
     bool PreTraverseCXXCatchStmt(CXXCatchStmt*);
-    void PostTraverseCXXCatchStmt(CXXCatchStmt*);
+    bool PostTraverseCXXCatchStmt(CXXCatchStmt*, bool traverseOk);
 
 private:
     std::stack<CXXCatchStmt const*> currCatchStmt;
@@ -56,10 +56,11 @@ bool DbgUnhandledException::PreTraverseCXXCatchStmt(CXXCatchStmt* catchStmt)
     return true;
 }
 
-void DbgUnhandledException::PostTraverseCXXCatchStmt(CXXCatchStmt* catchStmt)
+bool DbgUnhandledException::PostTraverseCXXCatchStmt(CXXCatchStmt* catchStmt, bool)
 {
     assert(currCatchStmt.top() == catchStmt);
     currCatchStmt.pop();
+    return true;
 }
 
 bool DbgUnhandledException::TraverseCXXCatchStmt(CXXCatchStmt* catchStmt)
@@ -67,7 +68,8 @@ bool DbgUnhandledException::TraverseCXXCatchStmt(CXXCatchStmt* catchStmt)
     if (!PreTraverseCXXCatchStmt(catchStmt))
         return false;
     bool ret = RecursiveASTVisitor::TraverseCXXCatchStmt(catchStmt);
-    PostTraverseCXXCatchStmt(catchStmt);
+    if (!PostTraverseCXXCatchStmt(catchStmt, ret))
+        return false;
     return ret;
 }
 
diff --git a/compilerplugins/clang/indentation.cxx b/compilerplugins/clang/indentation.cxx
index b544138f9f5d..eaa795e6765a 100644
--- a/compilerplugins/clang/indentation.cxx
+++ b/compilerplugins/clang/indentation.cxx
@@ -65,7 +65,7 @@ public:
 
     bool VisitCompoundStmt(CompoundStmt const*);
     bool PreTraverseSwitchStmt(SwitchStmt*);
-    void PostTraverseSwitchStmt(SwitchStmt*);
+    bool PostTraverseSwitchStmt(SwitchStmt*, bool);
     bool TraverseSwitchStmt(SwitchStmt*);
     bool VisitSwitchStmt(SwitchStmt const*);
 
@@ -79,14 +79,18 @@ bool Indentation::PreTraverseSwitchStmt(SwitchStmt* switchStmt)
     return true;
 }
 
-void Indentation::PostTraverseSwitchStmt(SwitchStmt*) { switchStmtBodies.pop_back(); }
+bool Indentation::PostTraverseSwitchStmt(SwitchStmt*, bool)
+{
+    switchStmtBodies.pop_back();
+    return true;
+}
 
 bool Indentation::TraverseSwitchStmt(SwitchStmt* switchStmt)
 {
     PreTraverseSwitchStmt(switchStmt);
-    FilteringPlugin::TraverseSwitchStmt(switchStmt);
-    PostTraverseSwitchStmt(switchStmt);
-    return true;
+    auto ret = FilteringPlugin::TraverseSwitchStmt(switchStmt);
+    PostTraverseSwitchStmt(switchStmt, ret);
+    return ret;
 }
 
 bool Indentation::VisitCompoundStmt(CompoundStmt const* compoundStmt)
diff --git a/compilerplugins/clang/literaltoboolconversion.cxx b/compilerplugins/clang/literaltoboolconversion.cxx
index 9e9b0b391523..6bfef41b6cc0 100644
--- a/compilerplugins/clang/literaltoboolconversion.cxx
+++ b/compilerplugins/clang/literaltoboolconversion.cxx
@@ -31,7 +31,7 @@ public:
     bool VisitImplicitCastExpr(ImplicitCastExpr const * expr);
 
     bool PreTraverseLinkageSpecDecl(LinkageSpecDecl * decl);
-    void PostTraverseLinkageSpecDecl(LinkageSpecDecl * decl);
+    bool PostTraverseLinkageSpecDecl(LinkageSpecDecl * decl, bool);
     bool TraverseLinkageSpecDecl(LinkageSpecDecl * decl);
 
 private:
@@ -64,15 +64,16 @@ bool LiteralToBoolConversion::PreTraverseLinkageSpecDecl(LinkageSpecDecl *) {
     return true;
 }
 
-void LiteralToBoolConversion::PostTraverseLinkageSpecDecl(LinkageSpecDecl *) {
+bool LiteralToBoolConversion::PostTraverseLinkageSpecDecl(LinkageSpecDecl *, bool) {
     assert(externCContexts_ != 0);
     --externCContexts_;
+    return true;
 }
 
 bool LiteralToBoolConversion::TraverseLinkageSpecDecl(LinkageSpecDecl * decl) {
     PreTraverseLinkageSpecDecl(decl);
     bool ret = RecursiveASTVisitor::TraverseLinkageSpecDecl(decl);
-    PostTraverseLinkageSpecDecl(decl);
+    PostTraverseLinkageSpecDecl(decl, ret);
     return ret;
 }
 
diff --git a/compilerplugins/clang/passparamsbyref.cxx b/compilerplugins/clang/passparamsbyref.cxx
index af28388c4e79..7de7133f3aed 100644
--- a/compilerplugins/clang/passparamsbyref.cxx
+++ b/compilerplugins/clang/passparamsbyref.cxx
@@ -44,7 +44,7 @@ public:
     // LValueToRValue ImplicitCastExprs when determining whether a param is
     // bound to a reference:
     bool PreTraverseFunctionDecl(FunctionDecl *);
-    void PostTraverseFunctionDecl(FunctionDecl *);
+    bool PostTraverseFunctionDecl(FunctionDecl *, bool);
     bool TraverseFunctionDecl(FunctionDecl *);
     bool PreTraverseImplicitCastExpr(ImplicitCastExpr *);
     bool TraverseImplicitCastExpr(ImplicitCastExpr *);
@@ -83,7 +83,7 @@ bool PassParamsByRef::PreTraverseFunctionDecl(FunctionDecl* functionDecl)
     return true;
 }
 
-void PassParamsByRef::PostTraverseFunctionDecl(FunctionDecl* functionDecl)
+bool PassParamsByRef::PostTraverseFunctionDecl(FunctionDecl* functionDecl, bool)
 {
     mbInsideFunctionDecl = false;
 
@@ -132,6 +132,7 @@ void PassParamsByRef::PostTraverseFunctionDecl(FunctionDecl* functionDecl)
                 << can->getSourceRange();
         }
     }
+    return true;
 }
 
 bool PassParamsByRef::TraverseFunctionDecl(FunctionDecl* functionDecl)
@@ -140,7 +141,7 @@ bool PassParamsByRef::TraverseFunctionDecl(FunctionDecl* functionDecl)
     if (PreTraverseFunctionDecl(functionDecl))
     {
         ret = RecursiveASTVisitor::TraverseFunctionDecl(functionDecl);
-        PostTraverseFunctionDecl(functionDecl);
+        PostTraverseFunctionDecl(functionDecl, ret);
     }
     return ret;
 }
diff --git a/compilerplugins/clang/sharedvisitor/generator.cxx b/compilerplugins/clang/sharedvisitor/generator.cxx
index 3eeb74b26c77..b12939516d16 100644
--- a/compilerplugins/clang/sharedvisitor/generator.cxx
+++ b/compilerplugins/clang/sharedvisitor/generator.cxx
@@ -318,7 +318,9 @@ void generateVisitor( PluginType type )
                 output << "        if( " << plugin.variableName << " != nullptr ";
                 output << ")\n";
                 output << "        {\n";
-                output << "            " << plugin.variableName << "->Post" << traverse.name << "( arg );\n";
+                output << "            if( !" << plugin.variableName << "->Post" << traverse.name << "( arg, ret ))\n";
+                // This will disable the plugin for the rest of the run.
+                output << "                save" << plugin.className << " = nullptr;\n";
                 output << "        }\n";
             }
             output << "        " << plugin.variableName << " = save" << plugin.className << ";\n";
diff --git a/compilerplugins/clang/sharedvisitor/sharedvisitor.cxx b/compilerplugins/clang/sharedvisitor/sharedvisitor.cxx
index 33db9d878021..1552f2661f32 100644
--- a/compilerplugins/clang/sharedvisitor/sharedvisitor.cxx
+++ b/compilerplugins/clang/sharedvisitor/sharedvisitor.cxx
@@ -1246,7 +1246,8 @@ public:
         bool ret = RecursiveASTVisitor::TraverseCStyleCastExpr( arg );
         if( unicodeToChar != nullptr )
         {
-            unicodeToChar->PostTraverseCStyleCastExpr( arg );
+            if( !unicodeToChar->PostTraverseCStyleCastExpr( arg, ret ))
+                saveUnicodeToChar = nullptr;
         }
         unicodeToChar = saveUnicodeToChar;
         return ret;
@@ -1274,7 +1275,8 @@ public:
         bool ret = RecursiveASTVisitor::TraverseCXXCatchStmt( arg );
         if( dbgUnhandledException != nullptr )
         {
-            dbgUnhandledException->PostTraverseCXXCatchStmt( arg );
+            if( !dbgUnhandledException->PostTraverseCXXCatchStmt( arg, ret ))
+                saveDbgUnhandledException = nullptr;
         }
         dbgUnhandledException = saveDbgUnhandledException;
         return ret;
@@ -1290,7 +1292,8 @@ public:
         bool ret = RecursiveASTVisitor::TraverseCXXFunctionalCastExpr( arg );
         if( unicodeToChar != nullptr )
         {
-            unicodeToChar->PostTraverseCXXFunctionalCastExpr( arg );
+            if( !unicodeToChar->PostTraverseCXXFunctionalCastExpr( arg, ret ))
+                saveUnicodeToChar = nullptr;
         }
         unicodeToChar = saveUnicodeToChar;
         return ret;
@@ -1306,7 +1309,8 @@ public:
         bool ret = RecursiveASTVisitor::TraverseCXXStaticCastExpr( arg );
         if( unicodeToChar != nullptr )
         {
-            unicodeToChar->PostTraverseCXXStaticCastExpr( arg );
+            if( !unicodeToChar->PostTraverseCXXStaticCastExpr( arg, ret ))
+                saveUnicodeToChar = nullptr;
         }
         unicodeToChar = saveUnicodeToChar;
         return ret;
@@ -1322,7 +1326,8 @@ public:
         bool ret = RecursiveASTVisitor::TraverseFriendDecl( arg );
         if( unrefFun != nullptr )
         {
-            unrefFun->PostTraverseFriendDecl( arg );
+            if( !unrefFun->PostTraverseFriendDecl( arg, ret ))
+                saveUnrefFun = nullptr;
         }
         unrefFun = saveUnrefFun;
         return ret;
@@ -1338,7 +1343,8 @@ public:
         bool ret = RecursiveASTVisitor::TraverseFunctionDecl( arg );
         if( passParamsByRef != nullptr )
         {
-            passParamsByRef->PostTraverseFunctionDecl( arg );
+            if( !passParamsByRef->PostTraverseFunctionDecl( arg, ret ))
+                savePassParamsByRef = nullptr;
         }
         passParamsByRef = savePassParamsByRef;
         return ret;
@@ -1378,7 +1384,8 @@ public:
         bool ret = RecursiveASTVisitor::TraverseLinkageSpecDecl( arg );
         if( literalToBoolConversion != nullptr )
         {
-            literalToBoolConversion->PostTraverseLinkageSpecDecl( arg );
+            if( !literalToBoolConversion->PostTraverseLinkageSpecDecl( arg, ret ))
+                saveLiteralToBoolConversion = nullptr;
         }
         literalToBoolConversion = saveLiteralToBoolConversion;
         return ret;
@@ -1406,7 +1413,8 @@ public:
         bool ret = RecursiveASTVisitor::TraverseSwitchStmt( arg );
         if( indentation != nullptr )
         {
-            indentation->PostTraverseSwitchStmt( arg );
+            if( !indentation->PostTraverseSwitchStmt( arg, ret ))
+                saveIndentation = nullptr;
         }
         indentation = saveIndentation;
         return ret;
diff --git a/compilerplugins/clang/unicodetochar.cxx b/compilerplugins/clang/unicodetochar.cxx
index 17f4795495ad..3599d3081a9f 100644
--- a/compilerplugins/clang/unicodetochar.cxx
+++ b/compilerplugins/clang/unicodetochar.cxx
@@ -30,13 +30,14 @@ public:
         subExprs_.push(expr->getSubExpr());
         return true;
     }
-    void PostTraverseCStyleCastExpr(CStyleCastExpr *) {
+    bool PostTraverseCStyleCastExpr(CStyleCastExpr *, bool ) {
         subExprs_.pop();
+        return true;
     }
     bool TraverseCStyleCastExpr(CStyleCastExpr * expr) {
         PreTraverseCStyleCastExpr(expr);
         bool ret = RecursiveASTVisitor::TraverseCStyleCastExpr(expr);
-        PostTraverseCStyleCastExpr(expr);
+        PostTraverseCStyleCastExpr(expr, ret);
         return ret;
     }
 
@@ -44,13 +45,14 @@ public:
         subExprs_.push(expr->getSubExpr());
         return true;
     }
-    void PostTraverseCXXStaticCastExpr(CXXStaticCastExpr *) {
+    bool PostTraverseCXXStaticCastExpr(CXXStaticCastExpr *, bool) {
         subExprs_.pop();
+        return true;
     }
     bool TraverseCXXStaticCastExpr(CXXStaticCastExpr * expr) {
         PreTraverseCXXStaticCastExpr(expr);
         bool ret = RecursiveASTVisitor::TraverseCXXStaticCastExpr(expr);
-        PostTraverseCXXStaticCastExpr(expr);
+        PostTraverseCXXStaticCastExpr(expr, ret);
         return ret;
     }
 
@@ -58,13 +60,14 @@ public:
         subExprs_.push(expr->getSubExpr());
         return true;
     }
-    void PostTraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr *) {
+    bool PostTraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr *, bool) {
         subExprs_.pop();
+        return true;
     }
     bool TraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr * expr) {
         PreTraverseCXXFunctionalCastExpr(expr);
         bool ret = RecursiveASTVisitor::TraverseCXXFunctionalCastExpr(expr);
-        PostTraverseCXXFunctionalCastExpr(expr);
+        PostTraverseCXXFunctionalCastExpr(expr, ret);
         return ret;
     }
 
diff --git a/compilerplugins/clang/unreffun.cxx b/compilerplugins/clang/unreffun.cxx
index ab0e01b70ecb..353eee5f0b31 100644
--- a/compilerplugins/clang/unreffun.cxx
+++ b/compilerplugins/clang/unreffun.cxx
@@ -57,13 +57,14 @@ public:
         friendFunction.push( dyn_cast_or_null<FunctionDecl>(decl->getFriendDecl()));
         return true;
     }
-    void PostTraverseFriendDecl(FriendDecl *) {
+    bool PostTraverseFriendDecl(FriendDecl *, bool ) {
         friendFunction.pop();
+        return true;
     }
     bool TraverseFriendDecl(FriendDecl * decl) {
         PreTraverseFriendDecl(decl);
         auto const ret = RecursiveASTVisitor::TraverseFriendDecl(decl);
-        PostTraverseFriendDecl(decl);
+        PostTraverseFriendDecl(decl, ret);
         return ret;
     }
 


More information about the Libreoffice-commits mailing list