summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/stringconcatauto.cxx
AgeCommit message (Collapse)Author
2022-11-05loplugin:stringconcatauto: There's no dangling-ref issue with O[U]StringNumberStephan Bergmann
...so it's unclear why 2f5f45921b05904a4be1ff633be09c62cb44ff08 "support O(U)String::number() for fast string concatenation" added that here. On the contrary, variables of type OStringNumber can be useful replacements for calls to std::sprintf (which started to emit deprecation warnings with macOS 13 SDK now), so this is in preparation for follow-up commits that will replace many uses of that across the code base with various alternatives. Change-Id: I6f8508d49dc84773c50f4c33dba38fe08c4c8969 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142318 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-14Fix loplugin:stringconcatautoStephan Bergmann
...after af2879e434fa0dc6b2a626617ed865e4f66eb5ad "Deduplicate stringconcat more" changed the *StringNumberBase::toAsciiUperCase return typr from O[U]StringNumber to the underlying StringNumberBase. (And where that commit had added some odd check for a non-existing "StringNumber" type to compilerplugins/clang/stringconcatauto.cxx, presumably in error.) Change-Id: I622e6ae30fcec8f081c978eaf67ffb716a10ee4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141363 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-13Deduplicate stringconcat moreMike Kaganski
In the process, drop ToStringHelper::allowO(U)StringConcat, because we can deduce this information from ToStringHelper's addData itself. To do that, addData was converted to ToStringHelper::operator(), which allows to use std::is_invocable_v on the helper class. Change-Id: Ic77878ca0ff65ada8c0a942191bc11de15b9ad2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141254 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-02-17Bump compiler plugins Clang baseline to 12.0.1Stephan Bergmann
...as discussed in the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2020-November/086234.html> "Bump --enable-compiler-plugins Clang baseline?" (and now picked up again at <https://lists.freedesktop.org/archives/libreoffice/2022-February/088459.html> "Re: Bump --enable-compiler-plugins Clang baseline?"), and clean up compilerplugins/clang/ accordingly Change-Id: I5e81c6fdcc363aeefd6227606225b526fdf7ac16 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129989 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-29Adapt to "[ADT] Make StringRef's std::string conversion operator explicit"Stephan Bergmann
...<https://github.com/llvm/llvm-project/commit/ 777180a32b61070a10dd330b4f038bf24e916af1>. This is just a quick fix to get copmilerplugins buiding again with latest LLVM/Clang trunk. Ideally, we should get rid of as many of those (potentially expensive) conversions from llvm::StringRef to std::string as possible. Change-Id: I18e185e0022a06fd8e3b983a3c4f80e1f3b96746 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87682 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-08better name for a function in compilerpluginsLuboš Luňák
The function is not just about a spelling location. Change-Id: I96e9e9ef7e27a9763397b4b86473c1c30d0e3eeb Reviewed-on: https://gerrit.libreoffice.org/80381 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-10-01Remove spurious #include <unistd.h>Stephan Bergmann
(which appears to be unused and caused compilation failure on Windows) Change-Id: Ice6882d98da3bac1f53e869b73ab179df93280fa Reviewed-on: https://gerrit.libreoffice.org/79925 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-01Use loplugin::isSamePathname (as needed on Windows)Stephan Bergmann
Change-Id: I8a1df1c64a93dc3e4a6fb00afd11aaf8521ecea4 Reviewed-on: https://gerrit.libreoffice.org/79926 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-24support O(U)String::number() for fast string concatenationLuboš Luňák
When I did the fast string concatenation, I didn't add any support for number(), which simply returned a O(U)String, and so it did the extra allocation/deallocation, although that could be avoided. In order to support this, number() now returns a special temporary return type, similarly to O(U)StringConcat, which allows delaying the concatenation the same way. Also similarly, the change of the return type in some cases requires explicit cast to the actual string type. Usage of OString::getStr() is so extensive in the codebase that I actually added it to the helper class, after that it's only relatively few cases. Change-Id: Iba6e158010e1e458089698c426803052b6f46031 Reviewed-on: https://gerrit.libreoffice.org/78873 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-09-24compiler check for rtl::OUStringConcat instancesLuboš Luňák
Something like auto str = "string" + OUString::number( 10 ); will not be OUString but actually rtl::OUStringConcat (which gets implicitly converted to OUString, but not with auto). Since those refer to temporaries from the expression, they should not outlive the expression. Change-Id: Ib4cde4b38befb3d49927d0cf01c52ebb2d36df89 Reviewed-on: https://gerrit.libreoffice.org/78830 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>