summaryrefslogtreecommitdiff
path: root/codemaker
AgeCommit message (Collapse)Author
2023-12-04cid#1545597 Using invalid iteratorJulien Nabet
and : cid#1545537 Using invalid iterator cid#1545508 Using invalid iterator cid#1545494 Using invalid iterator cid#1545478 Using invalid iterator cid#1545427 Using invalid iterator cid#1545420 Using invalid iterator cid#1545400 Using invalid iterator cid#1545300 Using invalid iterator cid#1545258 Using invalid iterator cid#1545257 Using invalid iterator cid#1545200 Using invalid iterator cid#1545183 Using invalid iterator Change-Id: Ibf3a41902f34286967195c5c3b22e337a4b06809 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160322 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-11-30Extended loplugin:ostr: codemakerStephan Bergmann
Change-Id: I7addfbde8ee8603eb8ca692debb2ac369347c6c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160127 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-11-20Extended loplugin:ostr: codemakerStephan Bergmann
Change-Id: I7a8eddee0ecf7ab38cc356c157e9832b715da4c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159724 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-13Follow-up on "Make sure __cpp_lib_source_location is consistently defined"Stephan Bergmann
(113e064117b2632974a696b950634229d70c5b96). Mike pointed out that I forgot to fix the generated code and that "https://en.cppreference.com/w/cpp/compiler_support/20 lists <version> as supported since gcc libstdc++ 9, and README.md requires libstdc++ 8.5." Change-Id: Ic7477e39e334735c4a563195fee335a599a0ef79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157933 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-12use std::source_location instead of std::experimental::source_locationNoel Grandin
https://en.cppreference.com/w/cpp/compiler_support says that this is supported in GCC >= 11 CLANG >= 16 Visual Studio >= VS 2019 16.10 And our Visual Studio baseline is now 2019. We still need to make the ifdef conditional check clang, because __has_include will happily return true even if the current clang does not support the necessary builtins. Change-Id: I5f2743e204b8ed22d4651053f3ae579a4a192a45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157515 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-09-26WASM: Embind: get rid of redundant EMSCRIPTEN conditionalSarper Akdemir
As suggested by Stephan Bergmann in https://gerrit.libreoffice.org/c/core/+/156273/comments/4087f8b8_8ab9a1bc It appears whole thing was redundant since the template specialization of emscripten::internal::raw_destructor in codemaker/source/cppumaker/cpputype.cxx:1228. Likely this bit causes memory leaks when the API is used and it is a temporary workaround. Change-Id: Ifb015754f16ddff1065b3285268acf8a339f975b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157234 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir.extern@allotropia.de>
2023-09-24Drop some newly obsolete __clang_major__ version checksStephan Bergmann
...after 6ef2d358ac053ce0f6de9cf0f8f25e8bae66d441 "Adapt Clang and GCC minimum version checks" Change-Id: Ib25fbb76211d1bda1d230de771f207960e645421 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157204 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-09-18JavaScript uno bindings for WASM with Embind - first cutSarper Akdemir
A rough implementation of uno bindings for LOWA using embind. Adds new parameter '-W' to cppumaker to generate _embind.cxx files alongside .hdl & .hpp. For usage examples see static/README.wasm.md Change-Id: Iee5d05e37bfba8e101c08212b15c05f7f2fa6c33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156273 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir.extern@allotropia.de>
2023-09-18Use less zlib external headers dependencyGabor Kelemen
Change-Id: Ibcc7f37e464cde44cfbb6fbd70c3dc66667102bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156553 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com>
2023-03-24loplugin:stringadd in c*Noel Grandin
after my patch to merge the bufferadd loplugin into stringadd Change-Id: I66f4ce2fd87c1e12eefb14406e0e17212f68ceff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149497 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-22Introduce css.reflection.Dump singletonStephan Bergmann
...and revert e1c6f36d8bcc0799281e3a7e244175f682d97cb2 "Add a to_string() function to the code generated for UNO IDL constant groups". (But keep the constants groups the latter had added to cppu/qa/cppumaker/types.idl, and use them in the newly added CppunitTest_stoc_dump, for better or worse.) Change-Id: I56e9eaeb1e45b83a72a25eceef13e719dc6f3a1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149281 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Jenkins
2023-03-17Add a to_string() function to the code generated for UNO IDL constant groupsTor Lillqvist
If the inpt matches one of the constants exactly, the result is the name of that constant. If the input matches some combination of constant values that are single bits, the result is the sequence of the names of those constants joined with plus signs. For instance, if the IDL has: constants Constants { const byte BIT0 = 1; const byte BIT1 = 2; const byte BIT2 = 4; const byte BIT3 = 8; } The result of Constants::to_string(5) is "BIT0+BIT2", and the result of Constants::to_string(17) is "17". I am sure there are corner cases that aren't handled as would be intuitive, especially with types that include unsigned values. Correspondingly, the semantics of the generated to_string() functions is not formally defined. Also add a unit test for the new functionality. Change-Id: I14aa826d0989ac6dfe97dd5c09119b1601c65643 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148995 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2022-12-05Make check for complete type more explicitStephan Bergmann
When 485c9d4f0e59e13e772da8f8a7975f0ddd77c33e "Clarify the use of untools::WeakReference" introduced cppu::detail::isUnoInterfaceType and its use in the requires-clause of unotools::WeakReference::get, its commit message argued that while isUnoInterfaceType only works if the given type is complete, that would already be taken care of via the use of std::is_convertible_v in the implementation of unotools::WeakReference::get. But while std::is_convertible_v nominally requires its argument types to be complete (unless they are void, or arrays of unknown bound), typical implementations like recent libc++ or libstdc++ do not seem to enforce that (and just return false in such a case). So better make isUnoInterfaceType explicitly require that the given type is complete. Which turned up one case where it isn't at the point where unotools::WeakReference<SdrTextObj>::get is called. (And while the resulting call to dynamic_cast<SdrTextObj*>(...) in the implementation of that function would cause an error when SdrTextObj is not complete, compilers happened to instantiate that template specialization only at the end of the TU, by which time SdrTextObj happened to be a complete type in the TUs including that sd/source/ui/inc/futext.hxx. So all happened to work out OK.) Change-Id: I704b8b437fa836e290245d1727e4d356128ef63c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143667 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-03Clarify the use of untools::WeakReferenceStephan Bergmann
...which had been introduced in 78040af9acea0ab681aa54ff23844b647bc9b4f3 "loplugin:refcounting in sc" as a variation on css::uno::WeakReference from include/cppuhelper/weakref.hxx, but without giving much of a rationale. And, at least for --with-latest-c++ builds using a capable C++20 compiler, ensure that the given interface_type is such that the static_cast and dynamic_cast in the implementation of unotools::WeakReference::get are actually sound: If interface_type could be a UNO interface type, that would imply that the xInterface obtained from the underlying WeakReferenceHelper::get() could be a proxy from the C++ UNO bridge, which could (a) be a proxy for only a subtype of interface_type (e.g., just for XInterface), so that the static_cast would be broken, and (b) be a proxy for which the vtable's RTTI slot is not set up (see e.g. the ENABLE_RUNTIME_OPTIMIZATIONS code in bridges::cpp_uno::shared::VtableFactory::initializeBlock in bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx), so that the dynamic_cast could crash. (These issues can even happen when the given interface_type is a C++ implementation class type, but the given object has been bridged over some C++ to C++ UNO ("purpose") bridge, but lets leave it at that...) This required adding some cppu::detail::isUnoInterfaceType predicate to the include files generated by cppumaker, which can be useful in other places too. (For the call to isUnoInterfaceType in the requires-clause of unotools::WeakReference<interface_type>::get to give the correct answer, it is important that interface_type is a complete type---i.e., the corresponding codemaker-generated .hpp having been included if interface_type actually were a UNO include type. But that is already nicely required by the call to std::is_convertible_v in the implementation of that function, anyway.) Change-Id: Ia5efd70085d2d6d45fa0995d00dc8def564bbe5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143601 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-13Drop obsolete preprocessor directives from UNOIDL filesStephan Bergmann
...which were used by ildc, which is gone since a8485d558fab53291e2530fd9a1be581c1628deb "[API CHANGE] Remove deprecated idlc and regmerge from the SDK", and have always been ignored as legacy by its unoidl-write replacement. This change has been carried out (making use of GNU sed extensions) with > for i in $(git ls-files \*.idl); do sed -i -z -E -e 's/\n\n((#[^\n]*\n)+\n)*(#[^\n]*\n)+\n?/\n\n/g' -e 's/\n(#[^\n]*\n)+/\n/g' "$i"; done && git checkout extensions/source/activex/so_activex.idl odk/examples/OLE/activex/so_activex.idl which apparently happened to do the work. (The final two files are not UNOIDL source files.) Change-Id: Ic9369e05d46e8f7e8a304ab01740b171b92335cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135683 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-18clang-tidy modernize-pass-by-value in codemakerNoel Grandin
Change-Id: I2bd9c4c8ced5f0edb9dbf560fe0ed126b9233c26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134519 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-29Revert "use more string_view in codemaker"Noel Grandin
This reverts commit 9463550eabd0455c374c1369bc72388108baccad. Reason for revert: The codemaker::UnoType::decompose was previously mostly returning the same OString it receives, so this change is likely a pessimisation Change-Id: Ie1b41889d0a6af9247b8683075d4edd1163fecc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133492 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-27use more string_view in codemakerNoel Grandin
Change-Id: If311f5600bd61387cc709065978306c21360dea8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133509 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-22address review comments on "use more string in unoidl.."Noel Grandin
on commit 2d9291b9433c9645b0870525211f74bfb1151555 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Thu Apr 21 12:53:15 2022 +0200 use more string_view in unoidl,codemaker Primarily reverting the findEntity call-chain to use OUString instead of std::u16string_view. Change-Id: Ib01b9473c859bba3791563df753823bbf0a87ce0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133302 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-21use more string_view in unoidl,codemakerNoel Grandin
Change-Id: Ibc0624a662c98ef1308a3bb0c7c082935a89a25c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133252 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-17loplugin:stringviewparam convert methods using copy()Noel Grandin
which converts to std::string_view::substr() Change-Id: I3f42213b41a97e77ddcc79d84d512f49d68ca559 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132729 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-10loplugin:stringview check for getToken and trimNoel Grandin
since we now have o3tl versions of those that work on string_view. Also improve those o3tl functions to support both string_view and u16string_view Change-Id: Iacab2996becec62aa78a5597c52d983bb784749a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132755 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-09add a more complete o3tl::getTokenNoel Grandin
so we avoid OUString copying (mostly when doing stuff like parsing numbers of out of strings) Change-Id: I4ef6ac23671c0b40807a22158e655e92dfad4af6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132730 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-02loplugin:stringviewparam convert methods using indexOfNoel Grandin
.. and lastIndexOf, which convert to find and rfind Change-Id: I6c4156cf904774c0d867f85a4c2785dba7593f62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132445 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-04cid#1500511 silence Resource leakCaolán McNamara
Change-Id: I37cdd52d965112598249b929fa49c759a88606c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131002 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-02-08Extend loplugin:stringview to O[U]StringBuffer::toStringStephan Bergmann
Change-Id: I7ad212dfff8b34d05e3b45107a1ef033a4efc454 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129651 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-02-06tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macroVaibhavMalik4187
Change-Id: I4f5258ca5b37e9b1b4237c5d29e4a9e5362fa855 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129116 Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2022-01-23Improve DBG_UNHANDLED_EXCEPTION output a bitStephan Bergmann
For example, in de3898aecb11307789644a1814e9cbb1ee4cc29b "Add missing test dependency" it would have output > warn:svx:680849:680849:svx/source/unodraw/unoshape.cxx:1779: DBG_UNHANDLED_EXCEPTION in setPropertyValues exception: com.sun.star.beans.UnknownPropertyException message: "URL at svx/source/unodraw/unoshape.cxx:1600" rather than > warn:svx:680849:680849:svx/source/unodraw/unoshape.cxx:1779: DBG_UNHANDLED_EXCEPTION in setPropertyValues exception: com.sun.star.beans.UnknownPropertyException message: URL svx/source/unodraw/unoshape.cxx:1600 making it slightly clearer that what follows "URL" is not the value of that URL but rather the source location where the exception was thrown. Change-Id: Ia3abd232fce3d95a8b66ff4ed5bab2fcc248df2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128788 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-12-21loplugin:flatten in canvas..cuiNoel Grandin
Change-Id: I208767eaa60d913fe2882403f1f9351eb08256f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127224 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-29Prepare for removal of non-const operator[] from Sequence in codemakerMike Kaganski
Change-Id: I058cf9ff4f7ce3f49f1dc3abb6b02268d208b225 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124350 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-14Use more appropriate type for OString-length related variableStephan Bergmann
Change-Id: I7a2925116928e16381c95b59a45200fa5f05935e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123575 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-26codemaker : remove useless includesArnaud Versini
Change-Id: Idaac78579d7845a1908bc3c02ff917432ca6a7d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117513 Tested-by: Jenkins Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
2021-05-18Use implicit conversion from OStringBuffer to std::string_viewStephan Bergmann
...instead of going via raw `char const *`. (This changes the code's semantics if buffer can contain embedded NULs, but it is unlikely that the original code using getStr() was even meant to stop comparison at the first embedded NUL.) Change-Id: I00a0a08b3ba8c318e3b898548ef185efa3f93ef2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115713 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-05-14Improve loplugin:stringviewStephan Bergmann
Issue the "instead of O[U]String, pass [u16]string_view" diagnostic also for operator call arguments. (The "rather than copy, pass subView()" diagnostic is already part of handleSubExprThatCouldBeView, so no need to repeat it explicitly for operator call arguments.) (And many call sites don't even require an explicit [u16]string_view, esp. with the recent ad48b2b02f83eed41fb1eb8d16de7e804156fcf1 "Optimized OString operator += overloads". Just some test code in sal/qa/ that explicitly tests the O[U]String functionality had to be excluded.) Change-Id: I8d55ba5a7fa16a563f5ffe43d245125c88c793bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115589 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-05-02throw() -> noexcept, part 2/3: Automatic loplugin:noexcept rewriteStephan Bergmann
Change-Id: I076f16d0536b534abf0ced4d76051eadb4c0e033 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114949 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-04-30throw() -> noexcept, part 1/3: Manual scaffoldingStephan Bergmann
The legacy `throw()` dynamic exception specification is gone for good from C++20 (even if compilers typically still accept it, but e.g. Clang has -Wdeprecated-dynamic-exception-spec to at least warn about it). Introduce SAL_NOEXCEPT for use in URE interface include files. (For both the existing SAL_THROW_EXTERN_C and the new SAL_NOEXCEPT, base usage of `noexept` not on LIBO_INTERNAL_ONLY, but on the actual compiler C++ version, so that e.g. building CppunitTest_cppu_any-external, which uses gb_CppunitTest_set_external_code but not gb_CXX03FLAGS, will not potentially complain about those macros expanding to the legacy `throw()`, like when building with Clang -Wdeprecated-dynamic-exception-spec manually enabled.) Change-Id: I7e5c7f8d5f0fd622cfc9987d656b1f68541375aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114908 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-04-29cid#1473812 Untrusted value as argumentCaolán McNamara
Change-Id: I95877c014d16426622e7114384c8e189c140943c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114836 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-21loplugin:stringadd replace OUStringLiteral temporaries with OUString::ConcatNoel Grandin
Change-Id: I656f06a74d9f0180ae460264563d6a935c7d2c60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114377 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-07Updated README.md files to represent current code / use Markdown formatHossein
Previously, all of the README files have been renamed to README.md and now, the contents of these files were changed to use Markdown format. Other than format inconsistency, some README.md files lacked information about modules, or were out of date. By using LibreOffice / OpenOffice wiki and other documentation websites, these files were updated. Now every README.md file has a title, and some description. The top-level README.md file is changed to add links to the modules. The result of processing the Markdown format README.md files can be seen at: https://docs.libreoffice.org/ Change-Id: Ic3b0c3c064a2498d6a435253b041df010cd7797a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113424 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2021-03-24Using .md extension/Markdown syntax for modules READMEHossein
Renaming all README files for all top level modules to README.md, applying no content change at this stage to be able to track history of the files. These files should be edited to use correct Markdown syntax later. Change-Id: I542fa3f3d32072156f16eaad2211a397cc212665 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112977 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2021-02-12fix fuzzer buildCaolán McNamara
Change-Id: I41df4af812cd225a0bd8e49df9e8b3c322698d28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110825 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-01-29loplugin:stringviewparam extend to new..Noel
O[U]StringBuffer methods Change-Id: I0ffbc33d54ae7c98b5652434f3370ee4f819f6f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110090 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-29loplugin:stringviewparam: operator +Stephan Bergmann
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-11Adapt the remaining OUString functions to std string_viewStephan Bergmann
...for LIBO_INTERNAL_ONLY. These had been missed by 1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take std::u16string_view parameters" because they did not match the multi-overload pattern that was addressed there, but they nevertheless benefit from being changed just as well (witness e.g. the various resulting changes from copy() to subView()). This showed a conversion from OStringChar to std::string_view to be missing (while the corresponding conversion form OUStringChar to std::u16string_view was already present). The improvement to loplugin:stringadd became necessary to fix > [CPT] compilerplugins/clang/test/stringadd.cxx > error: 'error' diagnostics expected but not seen: > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd] > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd] > 2 errors generated. Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-13tdf#123936 Formatting files in module codemaker with clang-formatPhilipp Hofer
Change-Id: Icd006d12942489a10fc2b3b801233c9527284721 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105652 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2020-11-11loplugin:stringviewNoel
Add new methods "subView" to O(U)String to return substring views of the underlying data. Add a clang plugin to warn when replacing existing calls to copy() would be better to use subView(). Change-Id: I03a5732431ce60808946f2ce2c923b22845689ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105420 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-09-04tdf#124176 Use #pragma once in codemakerGeorge Bateman
This commit was carried out by a Python script, source of which is at https://bugs.documentfoundation.org/show_bug.cgi?id=124176#c97. Change-Id: I421f0594d5f4389f7800a5bd0e339edde5627bb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100182 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-09-02Turn OStringLiteral into a consteval'ed, static-refcound rtl_StringStephan Bergmann
...from which an OString can cheaply be instantiated. The one downside is that OStringLiteral now needs to be a template abstracting over the string length. But any uses for which that is a problem (e.g., as the element type of a containers that would no longer be homogeneous, or in the signature of a function that shall not be turned into a template for one reason or another) can be replaced with std::string_view, without loss of efficiency compared to the original OStringLiteral, and without loss of expressivity (esp. with the newly introduced OString(std::string_view) ctor). The new OStringLiteral ctor code would probably not be very efficient if it were ever executed at runtime, but it is intended to be only executed at compile time. Where available, C++20 "consteval" is used to statically ensure that. The intended use of the new OStringLiteral is in all cases where an object that shall itself not be an OString (e.g., because it shall be a global static variable for which the OString ctor/dtor would be detrimental at library load/unload) must be converted to an OString instance in at least one place. Other string literal abstractions could use std::string_view (or just plain char const[N]), but interestingly OStringLiteral might be more efficient than constexpr std::string_view even for such cases, as it should not need any relocations at library load time. For now, no existing uses of OUStringLiteral have been changed to some other abstraction (unless technically necessary as discussed above), and no additional places that would benefit from OUStringLiteral have been changed to use it. sal/qa/rtl/strings/test_ostring_concat.cxx documents some workarounds for GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96878> "Failed class template argument deduction in unevaluated, parenthesized context". Those places, as well as uses of OStringLiteral in incodemaker/source/javamaker/javaoptions.cxx and i18npool/source/breakiterator/breakiterator_unicode.cxx, which have been replaced with OString::Concat (and which is arguably a better choice, anyway), also caused failures with at least Clang 5.0.2 (but would not have caused failures with at least recent Clang 12 trunk, so appear to be bugs in Clang that have meanwhile been fixed). This change also revealed a bug in at least recent Clang 12 trunk CastExpr::getSubExprAsWritten (still to be reported to LLVM), triggered at least in some calls from loplugin code (for which it can be fixed for now in the existing compat::getSubStringAsWritten). A similar commit for OUStringLiteral is planned, too. Change-Id: Ib192f4ed4c44769512a16364cb55c25627bae6f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101814 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-30Goodbye O[U]StringView, welcome O[U]String::ConcatStephan Bergmann
O[U]StringView had an odd mixture of uses. For one, it was used like std::[u16]string_view, for which directly using the latter std types is clearly the better alternative. For another, it was used in concatenation sequences, when neither of the two leading terms were of our rtl string-related types. For that second use case introduce O[U]String::Concat (as std::[u16]string_view can obviously not be used, those not being one of our rtl string-related types). Also, O[U]StringLiteral is occasionally used for this, but the planned changes outlined in the 33ecd0d5c4fff9511a8436513936a3f7044a775a "Change OUStringLiteral from char[] to char16_t[]" commit message will make that no longer work, so O[U]String::Concat will be the preferred solution in such use cases going forward, too. O[U]StringView was also occasionally used to include O[U]StringBuffer values in concatenation sequences, for which a more obvious alternative is to make O[U]StringBuffer participate directly in the ToStringHelper/O[U]StringConcat machinery. Change-Id: I1f0e8d836796c9ae01c45f32c518be5f52976622 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101586 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-19Fix the Clang check for using <experimental/source_location>Stephan Bergmann
(see the <https://gerrit.libreoffice.org/c/core/+/93868/19# message-77dcd3b30c4ae3919354f84b46b27d934164a938> comment to "use std::experimental::source_location in uno::Exception") Change-Id: I5d682dcf97be59f1798c5c08ad13025dfee0dd4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94495 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>