summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/stringadd.cxx
AgeCommit message (Collapse)Author
2019-10-31Fix StringAdd::isCompileTimeConstantStephan Bergmann
...to find StringLiteral on the RHS of +=. Which revealed that the VisitCompoundStmt/checkForCompoundAssign logic needed to be fixed, too, so that s += side_effect(); s += "literal"; s += side_effect(); only gets combined to s += side_effect() + "literal"; s += side_effect(); and not all the way to s += side_effect() + "literal" + side_effect(); Change-Id: I432e3458b933a7d0ad6141c747b675cc8b0f0ba4 Reviewed-on: https://gerrit.libreoffice.org/81804 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-28Completely remove lambda capture that is unusedStephan Bergmann
...since 6d6fad522a2cd6a2959ea774969a86288f5a3cb7 "Introduce OStringChar" (and had needlessly been kept alive with ce3badb157c58941608f878a7de98c7739e30aec "compilerplugins: fix -Werror,-Wunused-lambda-capture") Change-Id: Ie34ef1197f97ecab5b8f30741f1e2c4b3a9db594 Reviewed-on: https://gerrit.libreoffice.org/81591 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-28loplugin:stringadd improve detectionNoel Grandin
if one side of the expression is a compile-time-constant, we don't need to worry about side-effects on the other side Change-Id: Iee71ea51b327ef244bf39f128f921ac325d74e2b Reviewed-on: https://gerrit.libreoffice.org/81589 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-25compilerplugins: fix -Werror,-Wunused-lambda-captureMiklos Vajna
Change-Id: I2a1374a1e79401c2107d003102ab797fac9a3d66
2019-10-24Introduce OStringCharStephan Bergmann
...similar to OUStringChar, to be used in string concatenation expressions. And enable the corresponding loplugin:stringadd check, and fix its findings. Change-Id: I35ebb2253ba82bda6c98ae6ebd2ad4f27cf9abf9 Reviewed-on: https://gerrit.libreoffice.org/81456 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-23Don't use broken StringAdd::getSourceAsStringStephan Bergmann
it caused clang-cl to crash when processing desktop/source/app/opencl.cxx Change-Id: I0a39697e75242cd00f12b60477d51a1e5bf96a4f Reviewed-on: https://gerrit.libreoffice.org/81409 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-17loplugin:stringadd fix conditionNoel Grandin
Change-Id: I7752c281b1b6dd0d26bd7d6c4a6896c663f4cbc3 Reviewed-on: https://gerrit.libreoffice.org/80921 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-16loplugin:stringadd look through a couple more known-good methodsNoel Grandin
Change-Id: Ifbdb3e41eae665f7dcaf5301aaba2b6e4662cf48 Reviewed-on: https://gerrit.libreoffice.org/80855 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-15Improve loplugin:stringadd diagnosticsStephan Bergmann
Change-Id: I8b87c4e56f10417acd538b765b3f8e4cc6e12fb9 Reviewed-on: https://gerrit.libreoffice.org/80844 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-15Improve loplugin:stringaddStephan Bergmann
...after 9b5dad13b56bdde7c40970351af3da3a2c3c9350 "loplugin:stringadd look for unnecessary temporaries". There was no reason to check for implicit MaterializeTemporaryExpr instead of explicitly written CXXFunctionalCastExpr, and checking for the latter makes it easier to report the casted-from type, which gives useful information how to change code that exhibits the warning. See the comments at <https://gerrit.libreoffice.org/#/c/80724/> "loplugin:stringadd look for unnecessary temporaries" for details. (And while at it, remove some commented-out debug code that is probably no longer relevant now.) Change-Id: I7d4cab85432885d617dd7114c75163c1eb376fc2 Reviewed-on: https://gerrit.libreoffice.org/80823 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-14Comment out a lambda capture that isn't used, to avoid compiler warningTor Lillqvist
(The use of it is also commented out.) Change-Id: Ie015a8cbd0f7a982721a389487c2134a1aba8ed1
2019-10-14loplugin:stringadd look for unnecessary temporariesNoel Grandin
which defeat the *StringConcat optimisation. Also make StringConcat conversions treat a nullptr as an empty string, to match the O*String(char*) constructors. Change-Id: If45f5b4b6a535c97bfeeacd9ec472a7603a52e5b Reviewed-on: https://gerrit.libreoffice.org/80724 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-02new loplugin:stringaddNoel Grandin
look for places where we can replace sequential additions to OUString/OString with one concatentation (i.e. +) expression, which is more efficient Change-Id: I64d91328bf64828d8328b1cad9e90953c0a75663 Reviewed-on: https://gerrit.libreoffice.org/79406 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>