summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/stringadd.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-15 20:24:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-16 07:57:45 +0200
commit3ee177a14d8b816ef5b62500aeb54524c289e045 (patch)
tree982b524a298c2b2f959f5c858c81be9b3420566a /compilerplugins/clang/stringadd.cxx
parent820f340f285932bbb8d6739177e9bb81c23c1a5d (diff)
loplugin:stringadd look through a couple more known-good methods
Change-Id: Ifbdb3e41eae665f7dcaf5301aaba2b6e4662cf48 Reviewed-on: https://gerrit.libreoffice.org/80855 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/stringadd.cxx')
-rw-r--r--compilerplugins/clang/stringadd.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/compilerplugins/clang/stringadd.cxx b/compilerplugins/clang/stringadd.cxx
index 7ae30922d5c8..986b2f938c7d 100644
--- a/compilerplugins/clang/stringadd.cxx
+++ b/compilerplugins/clang/stringadd.cxx
@@ -46,10 +46,13 @@ public:
{
std::string fn(handler.getMainFileName());
loplugin::normalizeDotDotInFilePath(fn);
- if (fn == SRCDIR "/sal/qa/rtl/oustring/rtl_OUString2.cxx"
- || fn == SRCDIR "/sal/qa/rtl/strings/test_oustring_concat.cxx"
- || fn == SRCDIR "/sal/qa/rtl/strings/test_ostring_concat.cxx"
- || fn == SRCDIR "/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx")
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/rtl/oustring/"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/rtl/oustringbuffer/"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/rtl/strings/"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/OStringBuffer/"))
return false;
// there is an ifdef here, but my check is not working, not sure why
if (fn == SRCDIR "/pyuno/source/module/pyuno_runtime.cxx")
@@ -183,7 +186,6 @@ bool StringAdd::VisitCXXOperatorCallExpr(CXXOperatorCallExpr const* operatorCall
{
if (ignoreLocation(operatorCall))
return true;
- // TODO PlusEqual seems to generate temporaries, does not do the StringConcat optimisation
if (operatorCall->getOperator() != OO_Plus)
return true;
auto tc = loplugin::TypeCheck(operatorCall->getType()->getUnqualifiedDesugaredType());
@@ -261,7 +263,8 @@ bool StringAdd::isSideEffectFree(Expr const* expr)
if (calleeMethodDecl && calleeMethodDecl->getIdentifier())
{
auto name = calleeMethodDecl->getName();
- if (name == "number" || name == "unacquired")
+ if (callExpr->getNumArgs() > 0
+ && (name == "number" || name == "unacquired" || "boolean"))
{
auto tc = loplugin::TypeCheck(calleeMethodDecl->getParent());
if (tc.Class("OUString") || tc.Class("OString"))