[Libreoffice-commits] core.git: compilerplugins/clang
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Wed Dec 23 19:48:31 UTC 2020
compilerplugins/clang/elidestringvar.cxx | 2 +-
compilerplugins/clang/test/elidestringvar.cxx | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 68a3c364f73ae0537cac6fdd1cf59e23667ed8e6
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Dec 23 18:44:47 2020 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Dec 23 20:47:47 2020 +0100
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 at redhat.com>
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 at +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:
More information about the Libreoffice-commits
mailing list