summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-12-23 18:44:47 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-12-23 20:47:47 +0100
commit68a3c364f73ae0537cac6fdd1cf59e23667ed8e6 (patch)
tree45e49ee9a1d893ab08d33d9b9107c72f582f6d66 /compilerplugins
parent473ca9b7530df1e7d24e2fc36b88619b73029ac8 (diff)
Don't call isIntegerConstantExpr on value dependent Expr
...as it causes Clang to fail with > Assertion failed: (!isValueDependent() && "Expression evaluator can't be called on a dependent expression."), function isIntegerConstantExpr, file .../llvm/llvm-project/clang/lib/AST/ExprConstant.cpp, line 15487. Change-Id: I335f7610955c30a5c102bfb3b8aa6441a30dd247 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108241 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/elidestringvar.cxx2
-rw-r--r--compilerplugins/clang/test/elidestringvar.cxx5
2 files changed, 5 insertions, 2 deletions
diff --git a/compilerplugins/clang/elidestringvar.cxx b/compilerplugins/clang/elidestringvar.cxx
index 6fd57c44ff4f..412fa8cb09db 100644
--- a/compilerplugins/clang/elidestringvar.cxx
+++ b/compilerplugins/clang/elidestringvar.cxx
@@ -131,7 +131,7 @@ public:
{
break;
}
- if (e2->isIntegerConstantExpr(compiler.getASTContext()))
+ if (!e2->isValueDependent() && e2->isIntegerConstantExpr(compiler.getASTContext()))
{
break;
}
diff --git a/compilerplugins/clang/test/elidestringvar.cxx b/compilerplugins/clang/test/elidestringvar.cxx
index 3e8e6592bbae..16fa7c570914 100644
--- a/compilerplugins/clang/test/elidestringvar.cxx
+++ b/compilerplugins/clang/test/elidestringvar.cxx
@@ -11,8 +11,9 @@
#include "rtl/ustring.hxx"
-OUString f(sal_Unicode c, int n)
+template <sal_Unicode C> OUString f(sal_Unicode c, int n)
{
+ OUString s0(C);
OUString s1(c);
// expected-note@+1 {{literal 'rtl::OUString' variable defined here [loplugin:elidestringvar]}}
OUString s2('a');
@@ -23,6 +24,8 @@ OUString f(sal_Unicode c, int n)
OUString s4 = s4lit;
switch (n)
{
+ case 0:
+ return s0;
case 1:
return s1;
case 2: