summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-11-12 12:01:53 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-11-12 14:19:29 +0100
commit3d885f20269dd4b7485fbe09c70014646e799366 (patch)
tree178fc02cf45142a078ca79b1537ccfcabfec3dec /compilerplugins
parentd89b5f3a5440cf890cf6977ef84e3419dd23e668 (diff)
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@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/unnecessaryparen.cxx8
1 files changed, 8 insertions, 0 deletions
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;
}