[Libreoffice-commits] core.git: 2 commits - compilerplugins/clang external/mdds

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 26 06:14:10 UTC 2019


 compilerplugins/clang/compat.hxx                 |   10 +++++++++-
 compilerplugins/clang/conditionalstring.cxx      |    2 +-
 compilerplugins/clang/doubleconvert.cxx          |    2 +-
 compilerplugins/clang/implicitboolconversion.cxx |    4 ++--
 compilerplugins/clang/plugin.cxx                 |    3 ++-
 compilerplugins/clang/redundantfcast.cxx         |    4 ++--
 compilerplugins/clang/referencecasting.cxx       |    5 +++--
 compilerplugins/clang/simplifybool.cxx           |    3 ++-
 compilerplugins/clang/stringbuffer.cxx           |    3 ++-
 compilerplugins/clang/stringconstant.cxx         |    4 ++--
 compilerplugins/clang/stringstatic.cxx           |    3 ++-
 compilerplugins/clang/unnecessaryparen.cxx       |    2 +-
 compilerplugins/clang/unoany.cxx                 |    5 +++--
 compilerplugins/clang/unoquery.cxx               |    3 ++-
 external/mdds/UnpackedTarball_mdds.mk            |    1 +
 external/mdds/Wdeprecated-copy.patch             |   11 +++++++++++
 16 files changed, 46 insertions(+), 19 deletions(-)

New commits:
commit 48d0d5482dd4fc496e039986a71bb785f4880cb7
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Nov 25 17:01:03 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Nov 26 07:13:00 2019 +0100

    external/mdds: -Werror,-Wdeprecated-copy
    
    > In file included from sc/source/core/data/cellvalues.cxx:12:
    > In file included from sc/inc/column.hxx:28:
    > In file included from sc/inc/mtvelements.hxx:30:
    > In file included from workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector.hpp:33:
    > workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector_itr.hpp:74:9: error: definition of implicit copy assignment operator for 'private_data' is deprecated because it has a user-declared copy constructor [-Werror,-Wdeprecated-copy]
    >         private_data(const private_data& other) :
    >         ^
    > workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector_itr.hpp:44:8: note: in implicit copy assignment operator for 'mdds::detail::mtv::iterator_value_node<unsigned long, mdds::mtv::base_element_block>::private_data' first required here
    > struct iterator_value_node
    >        ^
    > workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector_itr.hpp:219:20: note: in implicit copy assignment operator for 'mdds::detail::mtv::iterator_value_node<unsigned long, mdds::mtv::base_element_block>' first required here
    >         m_cur_node = other.m_cur_node;
    >                    ^
    > workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector_itr.hpp:238:7: note: in instantiation of member function 'mdds::detail::mtv::iterator_common_base<mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>::iterator_trait>::operator=' requested here
    > class iterator_base : public iterator_common_base<_Trait>
    >       ^
    
    with recent Clang 10 trunk, similar to
    <https://gerrit.libreoffice.org/#/c/83698/> "Remove some redundantly
    user-declared copy ctors and assignment ops"
    
    Change-Id: I156674bad367ca68404c3c75d61ec72b401c6305
    Reviewed-on: https://gerrit.libreoffice.org/83700
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/external/mdds/UnpackedTarball_mdds.mk b/external/mdds/UnpackedTarball_mdds.mk
index c015f4c13f5a..c5ca78bd368c 100644
--- a/external/mdds/UnpackedTarball_mdds.mk
+++ b/external/mdds/UnpackedTarball_mdds.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,mdds,$(MDDS_TARBALL)))
 $(eval $(call gb_UnpackedTarball_set_patchlevel,mdds,0))
 
 $(eval $(call gb_UnpackedTarball_add_patches,mdds,\
+    external/mdds/Wdeprecated-copy.patch \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/mdds/Wdeprecated-copy.patch b/external/mdds/Wdeprecated-copy.patch
new file mode 100644
index 000000000000..edcb2ddaa9ec
--- /dev/null
+++ b/external/mdds/Wdeprecated-copy.patch
@@ -0,0 +1,11 @@
+--- include/mdds/multi_type_vector_itr.hpp
++++ include/mdds/multi_type_vector_itr.hpp
+@@ -71,8 +71,6 @@
+         private_data() : block_index(0) {}
+         private_data(size_type _block_index) :
+             block_index(_block_index) {}
+-        private_data(const private_data& other) :
+-            block_index(other.block_index) {}
+ 
+         void swap(private_data& other)
+         {
commit 95d8b368d11eeccc276c0c6ac225144566a1206d
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Nov 25 13:04:02 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Nov 26 07:12:38 2019 +0100

    Adapt to clang::MaterializeTemporaryExpr::GetTemparyExpr rename
    
    ...in <https://github.com/llvm/llvm-project/commit/
    b0561b3346e7bf0ae974995ca95b917eebde18e1> "[NFC] Refactor representation of
    materialized temporaries"
    
    Change-Id: I02fbf6765f9713e4d457f07521129cc9d8db5751
    Reviewed-on: https://gerrit.libreoffice.org/83669
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index c091c51601f7..ca752552f677 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -168,6 +168,14 @@ inline bool EvaluateAsInt(clang::Expr const * expr, llvm::APSInt& intRes, const
 #endif
 }
 
+inline clang::Expr * getSubExpr(clang::MaterializeTemporaryExpr const * expr) {
+#if CLANG_VERSION >= 100000
+    return expr->getSubExpr();
+#else
+    return expr->GetTemporaryExpr();
+#endif
+}
+
 // Work around <http://reviews.llvm.org/D22128>:
 //
 // SfxErrorHandler::GetClassString (svtools/source/misc/ehdl.cxx):
@@ -202,7 +210,7 @@ namespace detail {
     // Skip through reference binding to temporary.
     if (clang::MaterializeTemporaryExpr *Materialize
                                   = clang::dyn_cast<clang::MaterializeTemporaryExpr>(expr))
-      expr = Materialize->GetTemporaryExpr();
+      expr = compat::getSubExpr(Materialize);
 
     // Skip any temporary bindings; they're implicit.
     if (clang::CXXBindTemporaryExpr *Binder = clang::dyn_cast<clang::CXXBindTemporaryExpr>(expr))
diff --git a/compilerplugins/clang/conditionalstring.cxx b/compilerplugins/clang/conditionalstring.cxx
index d09472c25446..2d40c1b3aebf 100644
--- a/compilerplugins/clang/conditionalstring.cxx
+++ b/compilerplugins/clang/conditionalstring.cxx
@@ -40,7 +40,7 @@ Expr const* ignoreImplicit(Expr const* expr)
 #endif
         else if (auto const e3 = dyn_cast<MaterializeTemporaryExpr>(e))
         {
-            e = e3->GetTemporaryExpr();
+            e = compat::getSubExpr(e3);
         }
         else if (auto const e4 = dyn_cast<CXXBindTemporaryExpr>(e))
         {
diff --git a/compilerplugins/clang/doubleconvert.cxx b/compilerplugins/clang/doubleconvert.cxx
index 95565301b751..2dbff56ca30b 100644
--- a/compilerplugins/clang/doubleconvert.cxx
+++ b/compilerplugins/clang/doubleconvert.cxx
@@ -53,7 +53,7 @@ bool DoubleConvert::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr const
     if (ignoreLocation(materializetemp))
         return true;
     auto cxxConstruct
-        = dyn_cast<CXXConstructExpr>(materializetemp->GetTemporaryExpr()->IgnoreParenCasts());
+        = dyn_cast<CXXConstructExpr>(compat::getSubExpr(materializetemp)->IgnoreParenCasts());
     if (!cxxConstruct)
         return true;
     if (cxxConstruct->getNumArgs() == 0)
diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx
index 3adbf7197f47..5b713ce77ecb 100644
--- a/compilerplugins/clang/implicitboolconversion.cxx
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -30,7 +30,7 @@ Expr const * ignoreParenAndTemporaryMaterialization(Expr const * expr) {
         if (e == nullptr) {
             return expr;
         }
-        expr = e->GetTemporaryExpr();
+        expr = compat::getSubExpr(e);
     }
 }
 
@@ -908,7 +908,7 @@ bool ImplicitBoolConversion::VisitMaterializeTemporaryExpr(
     if (ignoreLocation(expr)) {
         return true;
     }
-    if (auto const sub = dyn_cast<ExplicitCastExpr>(expr->GetTemporaryExpr())) {
+    if (auto const sub = dyn_cast<ExplicitCastExpr>(compat::getSubExpr(expr))) {
         auto const subsub = compat::getSubExprAsWritten(sub);
         if (subsub->getType().IgnoreParens() == expr->getType().IgnoreParens()
             && isBool(subsub))
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index 01484bddc432..eb4ac24c9743 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -18,6 +18,7 @@
 #include <clang/Basic/FileManager.h>
 #include <clang/Lex/Lexer.h>
 
+#include "compat.hxx"
 #include "pluginhandler.hxx"
 
 /*
@@ -30,7 +31,7 @@ namespace {
 
 Expr const * skipImplicit(Expr const * expr) {
     if (auto const e = dyn_cast<MaterializeTemporaryExpr>(expr)) {
-        expr = e->GetTemporaryExpr()->IgnoreImpCasts();
+        expr = compat::getSubExpr(e)->IgnoreImpCasts();
     }
     if (auto const e = dyn_cast<CXXBindTemporaryExpr>(expr)) {
         expr = e->getSubExpr();
diff --git a/compilerplugins/clang/redundantfcast.cxx b/compilerplugins/clang/redundantfcast.cxx
index 5084d5a29ab3..0dca2a1c60cb 100644
--- a/compilerplugins/clang/redundantfcast.cxx
+++ b/compilerplugins/clang/redundantfcast.cxx
@@ -42,7 +42,7 @@ public:
             expr = cxxConstructExpr->getArg(0);
         }
         if (auto materializeTemporaryExpr = dyn_cast<MaterializeTemporaryExpr>(expr))
-            expr = materializeTemporaryExpr->GetTemporaryExpr();
+            expr = compat::getSubExpr(materializeTemporaryExpr);
         auto cxxFunctionalCastExpr = dyn_cast<CXXFunctionalCastExpr>(expr);
         if (!cxxFunctionalCastExpr)
             return true;
@@ -94,7 +94,7 @@ public:
             if (!materializeTemporaryExpr)
                 continue;
             auto functionalCast = dyn_cast<CXXFunctionalCastExpr>(
-                materializeTemporaryExpr->GetTemporaryExpr()->IgnoreImpCasts());
+                compat::getSubExpr(materializeTemporaryExpr)->IgnoreImpCasts());
             if (!functionalCast)
                 continue;
             auto const t1 = functionalCast->getTypeAsWritten();
diff --git a/compilerplugins/clang/referencecasting.cxx b/compilerplugins/clang/referencecasting.cxx
index 45b65d3e7f26..1f8e13173811 100644
--- a/compilerplugins/clang/referencecasting.cxx
+++ b/compilerplugins/clang/referencecasting.cxx
@@ -10,6 +10,7 @@
  */
 #ifndef LO_CLANG_SHARED_PLUGINS
 
+#include "compat.hxx"
 #include "plugin.hxx"
 #include "check.hxx"
 #include <iostream>
@@ -111,7 +112,7 @@ bool ReferenceCasting::VisitCXXConstructExpr(const CXXConstructExpr* cce)
         }
         if (auto matTempExpr = dyn_cast<MaterializeTemporaryExpr>(constructorArg0))
         {
-            constructorArg0 = matTempExpr->GetTemporaryExpr();
+            constructorArg0 = compat::getSubExpr(matTempExpr);
             continue;
         }
         if (auto bindTempExpr = dyn_cast<CXXBindTemporaryExpr>(constructorArg0))
@@ -223,7 +224,7 @@ bool ReferenceCasting::VisitCXXMemberCallExpr(const CXXMemberCallExpr* mce)
         }
         if (auto matTempExpr = dyn_cast<MaterializeTemporaryExpr>(arg0))
         {
-            arg0 = matTempExpr->GetTemporaryExpr();
+            arg0 = compat::getSubExpr(matTempExpr);
             continue;
         }
         if (auto bindTempExpr = dyn_cast<CXXBindTemporaryExpr>(arg0))
diff --git a/compilerplugins/clang/simplifybool.cxx b/compilerplugins/clang/simplifybool.cxx
index 83cbf2dc56f6..b1cd6b8c2abd 100644
--- a/compilerplugins/clang/simplifybool.cxx
+++ b/compilerplugins/clang/simplifybool.cxx
@@ -9,6 +9,7 @@
 
 #include <cassert>
 
+#include "compat.hxx"
 #include "plugin.hxx"
 #include "clang/AST/CXXInheritance.h"
 
@@ -21,7 +22,7 @@ Expr const * ignoreAllImplicit(Expr const * expr) {
         expr = e->getSubExpr();
     }
     if (auto const e = dyn_cast<MaterializeTemporaryExpr>(expr)) {
-        expr = e->GetTemporaryExpr();
+        expr = compat::getSubExpr(e);
     }
     if (auto const e = dyn_cast<CXXBindTemporaryExpr>(expr)) {
         expr = e->getSubExpr();
diff --git a/compilerplugins/clang/stringbuffer.cxx b/compilerplugins/clang/stringbuffer.cxx
index b68a8ba32700..61df3069a51c 100644
--- a/compilerplugins/clang/stringbuffer.cxx
+++ b/compilerplugins/clang/stringbuffer.cxx
@@ -9,6 +9,7 @@
 #ifndef LO_CLANG_SHARED_PLUGINS
 
 #include "check.hxx"
+#include "compat.hxx"
 #include "plugin.hxx"
 #include <vector>
 
@@ -57,7 +58,7 @@ bool StringBuffer::VisitCXXMemberCallExpr(CXXMemberCallExpr const* memberCallExp
     auto matTemp = dyn_cast<MaterializeTemporaryExpr>(memberCallExpr->getArg(0));
     if (!matTemp)
         return true;
-    if (!isa<CXXOperatorCallExpr>(matTemp->GetTemporaryExpr()))
+    if (!isa<CXXOperatorCallExpr>(compat::getSubExpr(matTemp)))
         return true;
     report(DiagnosticsEngine::Warning,
            "appending added result of OUString to OUStringBuffer, rather do .append(x).append(y)",
diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx
index 2360ef2e3620..389691796dd7 100644
--- a/compilerplugins/clang/stringconstant.cxx
+++ b/compilerplugins/clang/stringconstant.cxx
@@ -86,7 +86,7 @@ bool hasOverloads(FunctionDecl const * decl, unsigned arguments) {
 
 CXXConstructExpr const * lookForCXXConstructExpr(Expr const * expr) {
     if (auto e = dyn_cast<MaterializeTemporaryExpr>(expr)) {
-        expr = e->GetTemporaryExpr();
+        expr = compat::getSubExpr(e);
     }
     if (auto e = dyn_cast<CXXFunctionalCastExpr>(expr)) {
         expr = e->getSubExpr();
@@ -1072,7 +1072,7 @@ bool StringConstant::VisitCXXConstructExpr(CXXConstructExpr const * expr) {
             for (auto i(argsBeg); i != argsEnd; ++i) {
                 Expr const * e = (*i)->IgnoreParenImpCasts();
                 if (isa<MaterializeTemporaryExpr>(e)) {
-                    e = cast<MaterializeTemporaryExpr>(e)->GetTemporaryExpr()
+                    e = compat::getSubExpr(cast<MaterializeTemporaryExpr>(e))
                         ->IgnoreParenImpCasts();
                 }
                 if (isa<CXXFunctionalCastExpr>(e)) {
diff --git a/compilerplugins/clang/stringstatic.cxx b/compilerplugins/clang/stringstatic.cxx
index a923da405f25..69e6c427f90e 100644
--- a/compilerplugins/clang/stringstatic.cxx
+++ b/compilerplugins/clang/stringstatic.cxx
@@ -12,6 +12,7 @@
 #include <set>
 
 #include "check.hxx"
+#include "compat.hxx"
 #include "plugin.hxx"
 
 /** Look for static OUString and OUString[], they can be more efficiently declared as:
@@ -100,7 +101,7 @@ bool StringStatic::VisitVarDecl(VarDecl const* varDecl)
                 expr = castExpr->getSubExpr();
             }
             else if (MaterializeTemporaryExpr const * materializeExpr = dyn_cast<MaterializeTemporaryExpr>(expr)) {
-                expr = materializeExpr->GetTemporaryExpr();
+                expr = compat::getSubExpr(materializeExpr);
             }
             else if (CXXBindTemporaryExpr const * bindExpr = dyn_cast<CXXBindTemporaryExpr>(expr)) {
                 expr = bindExpr->getSubExpr();
diff --git a/compilerplugins/clang/unnecessaryparen.cxx b/compilerplugins/clang/unnecessaryparen.cxx
index 9fb8fb85aa82..f1c17c830207 100644
--- a/compilerplugins/clang/unnecessaryparen.cxx
+++ b/compilerplugins/clang/unnecessaryparen.cxx
@@ -44,7 +44,7 @@ Expr const * ignoreAllImplicit(Expr const * expr) {
             }
         }
         else if (auto const e = dyn_cast<MaterializeTemporaryExpr>(expr)) {
-            expr = e->GetTemporaryExpr();
+            expr = compat::getSubExpr(e);
         }
         else if (auto const e = dyn_cast<CXXBindTemporaryExpr>(expr)) {
             expr = e->getSubExpr();
diff --git a/compilerplugins/clang/unoany.cxx b/compilerplugins/clang/unoany.cxx
index e0360c6cd2de..d44fce1d434c 100644
--- a/compilerplugins/clang/unoany.cxx
+++ b/compilerplugins/clang/unoany.cxx
@@ -10,6 +10,7 @@
 #ifndef LO_CLANG_SHARED_PLUGINS
 
 #include "check.hxx"
+#include "compat.hxx"
 #include "plugin.hxx"
 
 namespace {
@@ -52,7 +53,7 @@ bool UnoAny::VisitCXXOperatorCallExpr(CXXOperatorCallExpr const * expr)
         return true;
     }
     if (auto expr2 = dyn_cast<MaterializeTemporaryExpr>(expr->getArg(1))) {
-        if (auto expr3 = dyn_cast<CXXBindTemporaryExpr>(expr2->GetTemporaryExpr())) {
+        if (auto expr3 = dyn_cast<CXXBindTemporaryExpr>(compat::getSubExpr(expr2))) {
             if (auto expr4 = dyn_cast<CallExpr>(expr3->getSubExpr())) {
                 if (loplugin::DeclCheck(expr4->getDirectCallee()).Function("makeAny").
                     Namespace("uno").Namespace("star").Namespace("sun").Namespace("com").GlobalNamespace()) {
@@ -66,7 +67,7 @@ bool UnoAny::VisitCXXOperatorCallExpr(CXXOperatorCallExpr const * expr)
                 }
             }
         }
-        if (isa<CXXFunctionalCastExpr>(expr2->GetTemporaryExpr())) {
+        if (isa<CXXFunctionalCastExpr>(compat::getSubExpr(expr2))) {
             //expr->getArg(1)->dump();
             report(
                     DiagnosticsEngine::Warning,
diff --git a/compilerplugins/clang/unoquery.cxx b/compilerplugins/clang/unoquery.cxx
index 82427555fef9..fd7715fe1df3 100644
--- a/compilerplugins/clang/unoquery.cxx
+++ b/compilerplugins/clang/unoquery.cxx
@@ -10,6 +10,7 @@
 #ifndef LO_CLANG_SHARED_PLUGINS
 
 #include "check.hxx"
+#include "compat.hxx"
 #include "plugin.hxx"
 
 // TODO it would be better if we were running some kind of nullability analysis here, where we marked
@@ -63,7 +64,7 @@ bool UnoQuery::VisitCXXMemberCallExpr(CXXMemberCallExpr const* memberCallExpr)
     Expr const* expr = operatorCallExpr->getArg(0)->IgnoreImplicit();
     // depending on the version of clang, the IgnoreImplicit may or may not look through these nodes
     if (auto matTemp = dyn_cast<MaterializeTemporaryExpr>(expr))
-        expr = matTemp->GetTemporaryExpr();
+        expr = compat::getSubExpr(matTemp);
     if (auto bindTemp = dyn_cast<CXXBindTemporaryExpr>(expr))
         expr = bindTemp->getSubExpr();
 


More information about the Libreoffice-commits mailing list