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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 12 13:19:51 UTC 2018


 compilerplugins/clang/unnecessaryparen.cxx |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit 3d885f20269dd4b7485fbe09c70014646e799366
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Nov 12 12:01:53 2018 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Nov 12 14:19:29 2018 +0100

    Adapt to new ConstantExpr in Clang trunk towards Clang 8
    
    After <https://reviews.llvm.org/D53921> "Compound literals, enums, et al require
    const expr" (making use of ConstantExpr recently introduced with
    <https://reviews.llvm.org/D53475> "Create ConstantExpr class",
    CompilerTest_compilerplugins_clang started to fail with
    
    > [CPT] compilerplugins/clang/test/unnecessaryparen.cxx
    > error: 'error' diagnostics expected but not seen:
    >   File /data/sbergman/lo-clang2/core/compilerplugins/clang/test/unnecessaryparen.cxx Line 35: parentheses immediately inside case statement [loplugin:unnecessaryparen]
    > error: 'error' diagnostics seen but not expected:
    >   File /data/sbergman/lo-clang2/core/compilerplugins/clang/test/unnecessaryparen.cxx Line 35: unnecessary parentheses around identifier [loplugin:unnecessaryparen]
    > 2 errors generated.
    
    Change-Id: Iebcfcd9af30e26df02819fbffb105599fa6a1701
    Reviewed-on: https://gerrit.libreoffice.org/63285
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/unnecessaryparen.cxx b/compilerplugins/clang/unnecessaryparen.cxx
index 1a26ed21c7fb..b2ad2951ec90 100644
--- a/compilerplugins/clang/unnecessaryparen.cxx
+++ b/compilerplugins/clang/unnecessaryparen.cxx
@@ -15,6 +15,9 @@
 #include <unordered_set>
 
 #include <clang/AST/CXXInheritance.h>
+
+#include "config_clang.h"
+
 #include "compat.hxx"
 #include "plugin.hxx"
 
@@ -52,6 +55,11 @@ Expr const * ignoreAllImplicit(Expr const * expr) {
                 expr = ce->getImplicitObjectArgument();
             }
         }
+#if CLANG_VERSION >= 80000
+        else if (auto const e = dyn_cast<ConstantExpr>(expr)) {
+            expr = e->getSubExpr();
+        }
+#endif
         if (expr == oldExpr)
             return expr;
     }


More information about the Libreoffice-commits mailing list