summaryrefslogtreecommitdiffstats
path: root/codemaker
Commit message (Collapse)AuthorAgeFilesLines
* loplugin:stringadd improve detectionNoel Grandin2019-10-282-4/+4
| | | | | | | | | | 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>
* size some stringbuffer to prevent re-allocNoel Grandin2019-10-233-16/+66
| | | | | | | Change-Id: I385587a922c555c320a45dcc6d644315b72510e9 Reviewed-on: https://gerrit.libreoffice.org/81278 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* size some stringbuffer to prevent re-allocNoel Grandin2019-10-211-3/+3
| | | | | | | | | | | | found by the simple expidient of putting asserts in the resize routine. Where an explicit const size is used, I started with 32 and kept doubling until that site did not need resizing anymore. Change-Id: I998787edc940d0a3ba23b5ac37131ab9ecd300f4 Reviewed-on: https://gerrit.libreoffice.org/81138 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* loplugin:buffereadd find stuff involving adding *StringBufferNoel Grandin2019-10-171-3/+1
| | | | | | | | | and create conversion methods on *StringBuffer to make this work Change-Id: I3cf5ee3e139826168894b46eff8ee4bcde00cb7e Reviewed-on: https://gerrit.libreoffice.org/80949 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* loplugin:stringadd look for unnecessary temporariesNoel Grandin2019-10-142-17/+17
| | | | | | | | | | | 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>
* loplugin:redundantpointerops simplify *p.get()Noel Grandin2019-10-081-1/+1
| | | | | | | Change-Id: I12517651fb3f777fd08e384992bb3e84b340ad85 Reviewed-on: https://gerrit.libreoffice.org/80382 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* loplugin:stringadd in basctl..cuiNoel Grandin2019-10-012-34/+32
| | | | | | | Change-Id: I2fdeb7eb3ead3512ad6d3fe793305038ab3aa7ae Reviewed-on: https://gerrit.libreoffice.org/79886 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* loplugin:useuniqueptr in ClassFileNoel Grandin2019-09-053-13/+13
| | | | | | | Change-Id: I6ca5ae6f700747e726e531231b3a5cd1586c54d7 Reviewed-on: https://gerrit.libreoffice.org/78652 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* New loplugin:dataStephan Bergmann2019-05-221-1/+1
| | | | | | | | | | ...following up on 1453c2c8f13bac64ecd1981af7cebf1c421808ac "prefer vector::data to &vector[0]" Change-Id: I7c113747d92d144a521d49b89384dd8bf1215c01 Reviewed-on: https://gerrit.libreoffice.org/72765 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* tdf#120703 PVS: Silence V522 warningsMike Kaganski2019-04-141-2/+1
| | | | | | | | | V522 There might be dereferencing of a potential null pointer. Change-Id: Ie4bc74a734a6d5a73838a27e0d80cc8e51595839 Reviewed-on: https://gerrit.libreoffice.org/70730 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
* loplugin:sequentialassign in codemaker..connectivityNoel Grandin2019-04-132-4/+2
| | | | | | | Change-Id: I9776431ebce95a88ae42715aaba2ddc28fb52471 Reviewed-on: https://gerrit.libreoffice.org/70642 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
* Revert "Get rid of b2u/u2b helpers; use OUString's toUtf8/fromUtf8 instead"Mike Kaganski2019-04-059-85/+88
| | | | | | | | | This reverts commit 84662e9030a855c8db7cd40d9ce354b773d78c16. Change-Id: I1cc98d3201390609ae3615baa8e92c926cdcde9a Reviewed-on: https://gerrit.libreoffice.org/70294 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
* tdf#120703: partially revert commit 85456fae54029edd26df2277a9eec5e2fe3d9739Mike Kaganski2019-04-051-2/+1
| | | | | | | | | | | | | ... to take into account possible differences of results of dynamic_cast vs static_cast; the change casts dynamically, as before the commit, and only adds asserts on the result of the cast. Thanks to sberg for pointing my mistake out! Change-Id: Ib77d443e5a858e744f369f58542de603f948fd1c Reviewed-on: https://gerrit.libreoffice.org/70274 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* Get rid of b2u/u2b helpers; use OUString's toUtf8/fromUtf8 insteadMike Kaganski2019-04-049-88/+85
| | | | | | | | | | | | | These helpers are used in code generator code; so any invalid UTF-8 or UTF-16 in the conversion is programmer's error which needs fixing. Thus, the behavior of toUtf8/fromUtf8 which asserts the validity is fine here. Change-Id: I3004e233c9de59f8e348455f1f04d23e8c51ed3d Reviewed-on: https://gerrit.libreoffice.org/70249 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
* tdf#120703 PVS: Silence V522 warningsMike Kaganski2019-04-011-1/+2
| | | | | | | | | V522 There might be dereferencing of a potential null pointer. Change-Id: Ie617b41a8f8d334022cf5313b242a236baedba48 Reviewed-on: https://gerrit.libreoffice.org/70017 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
* Some uses of C++17 class template argument deductionStephan Bergmann2019-02-192-2/+2
| | | | | | | Change-Id: I47c469c0fcdff41d83729be9489c946e81ef3686 Reviewed-on: https://gerrit.libreoffice.org/68020 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* loplugin:indentation in codemaker..comphelperNoel Grandin2019-02-081-4/+3
| | | | | | | Change-Id: I8dee6245cfa1f7998591b31a3752bbbae13f499d Reviewed-on: https://gerrit.libreoffice.org/67527 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* Remove obsolete SAL_FALLTHROUGH completelyStephan Bergmann2018-12-084-4/+4
| | | | | | | | | | ...after 7ffdd830d5fb52f2ca25aa80277d22ea6d89970b "HAVE_CPP_ATTRIBUTE_FALLTHROUGH is always true now" Change-Id: I54e5ff4e036a6bb3e5774d1c0524158aae18e937 Reviewed-on: https://gerrit.libreoffice.org/64800 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* fix signatures of deleted copy/assign operatorsNoel Grandin2018-11-022-6/+6
| | | | | | | Change-Id: Id1a0749b78a7021be3564487fb974d7084705129 Reviewed-on: https://gerrit.libreoffice.org/62718 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* loplugin:useuniqueptr in codemakerNoel Grandin2018-10-313-11/+7
| | | | | | | Change-Id: I1d6ec5a5c06a32242773c857444bb63b7b4207b6 Reviewed-on: https://gerrit.libreoffice.org/62648 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* remove more rtl::OUString and OString prefixesNoel Grandin2018-10-249-24/+20
| | | | | | | | | which seem to have snuck back in since the great rounds of removals. Change-Id: I85f7f5f4801c0b48dae8b50f51f83595b286d6a1 Reviewed-on: https://gerrit.libreoffice.org/62229 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* pvs-studio: The condition 'nIndex != - 1' of loop is always trueCaolán McNamara2018-10-211-1/+1
| | | | | | | | Change-Id: I5b74d8ac2701adbd63816360812687201f645c39 Reviewed-on: https://gerrit.libreoffice.org/62097 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
* clang-tidy readability-simplify-boolean-exprNoel Grandin2018-10-181-8/+2
| | | | | | | Change-Id: I78fa01a6c803dec782488490b730af3a11814d64 Reviewed-on: https://gerrit.libreoffice.org/61902 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* clang-tidy readability-redundant-smartptr-getNoel Grandin2018-10-173-25/+16
| | | | | | | | | redundant get() call on smart pointer Change-Id: Icb5a03bbc15e79a30d3d135a507d22914d15c2bd Reviewed-on: https://gerrit.libreoffice.org/61837 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* New loplugin:externalStephan Bergmann2018-09-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* Revert "clang bugprone-unused-return-value"Noel Grandin2018-09-111-2/+4
| | | | | | | | | | | | | | | | | comment from sberg: aren't these changes broken in general, when the called function may throw an exception before it takes ownership of the passed-in pointer? So revert, except for (a) PlainTextFilterDetect::detect, which was definitely a leak (b) SwCursor::FindAll, where unique_ptr was being unnecessarily used This reverts commit 7764ae70b04058a64a3999529e98d1115ba59d1c. Change-Id: I555e651b44e245b031729013d2ce88d26e8a357e Reviewed-on: https://gerrit.libreoffice.org/60301 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
* Generate UNO exception classes as SAL_WARN_UNUSEDStephan Bergmann2018-09-101-1/+1
| | | | | | | | | | ...to find more places like 09978dd1fc18ce1ae707bc9e4ea1d2745ff07b61 "clang-tidy bugprone-unused-return-value" Change-Id: Ibe8b6790c701dc8270295dd1e2cbc9023b5ce018 Reviewed-on: https://gerrit.libreoffice.org/60234 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* clang bugprone-unused-return-valueNoel Grandin2018-09-081-4/+2
| | | | | | | | | | | most of these changes just make the change of ownership when using std::unique_ptr clearer, but there is one definite leak fix in PlainTextFilterDetect::detect Change-Id: I8282a68007222a4fee84004f394bde0cca8569e9 Reviewed-on: https://gerrit.libreoffice.org/60159 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
* loplugin:unusedfieldsNoel Grandin2018-08-082-8/+1
| | | | | | | Change-Id: I9ae44279f1cce06bd6868005fbb878ba4894aed7 Reviewed-on: https://gerrit.libreoffice.org/58706 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* codemaker: avoid -Werror=deprecated-copy (GCC trunk towards GCC 9)Stephan Bergmann2018-07-271-0/+6
| | | | | | | | | | | | | | ...by explicitly defaulting the copy/move functions (and, where needed in turn, also a default ctor) for classes that have a user-declared dtor that does nothing other than an implicitly-defined one would do, but needs to be user- declared because it is virtual and potentially serves as a key function to emit the vtable, or is non-public, etc. (For LIBO_INTERNAL_ONLY, in cppumaker- genered code.) Change-Id: Ia13d945c10600f5793a3247f85a464170ede483d Reviewed-on: https://gerrit.libreoffice.org/58116 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* Add missing method hasUnsignedLongDependency()Muhammet Kara2018-07-252-1/+4
| | | | | | | | | | | | | m_unsignedLongDependency was already set but never used. Behavior of Includes::Includes ctor is now in consistency with the related switch cases in Includes::add (see: m_includeSalTypesH) Change-Id: I4cca1bab014ac280b73b7532aadfd5ff2b0b9894 Reviewed-on: https://gerrit.libreoffice.org/57792 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
* Add missing sal/log.hxx headersGabor Kelemen2018-07-091-0/+1
| | | | | | | | | | | | | | | | rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directories from a* to configmgr Change-Id: I6ea1a7f992b1f835f5bac7a725e1135abee3f85a Reviewed-on: https://gerrit.libreoffice.org/57170 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
* tdf#96099 Remove trivial std::map typedefs in [cd]*Arkadiy Illarionov2018-06-291-31/+29
| | | | | | | Change-Id: I043d265d3d73a3e16f05d5ca7e29a09341651d82 Reviewed-on: https://gerrit.libreoffice.org/56639 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* tdf#117918 codemaker: avoid including ourselves in .hpp filesMiklos Vajna2018-06-061-1/+4
| | | | | | | | | | It's pointless, include guards will make sure it's a NOP, but it confuses tools like IWYU. Change-Id: Ic1f56ef267954cdf8bf3cb4f4a5e841d5e4bb82a Reviewed-on: https://gerrit.libreoffice.org/55354 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* coverity#1019311 silence Unchecked return valueCaolán McNamara2018-01-261-1/+1
| | | | Change-Id: Ife2bfed0eecff5fe247d0fef6ee7d77626d9f0be
* loplugin:unusedmethods also check for functions returning boolNoel Grandin2018-01-191-4/+4
| | | | | | | | | we were previously excluding them Change-Id: I48a68799b0de60b4995fae541eb363e043d4dd11 Reviewed-on: https://gerrit.libreoffice.org/48167 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* SAL_W32 is just an alias for _WIN32Stephan Bergmann2018-01-192-5/+5
| | | | | | | | | ...so consistently use the latter instead of the former Change-Id: I144d5e7c472632f93b2258461510346bc85892d9 Reviewed-on: https://gerrit.libreoffice.org/48135 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* More loplugin:cstylecast: codemakerStephan Bergmann2018-01-121-1/+1
| | | | | | | | auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: If1c6b7a83f6f64fbcbced4f036c0f859a1408d0c
* Fix typosAndrea Gelmini2017-12-291-1/+1
| | | | | | | Change-Id: I0e56430afa65b6b5826d56212ac501c0244fce9b Reviewed-on: https://gerrit.libreoffice.org/47145 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
* loplugin:unnecessaryparen: Warn about parentheses around literalsStephan Bergmann2017-11-273-18/+18
| | | | | | | | | | | | | | | | | | ...that are not composed of multiple tokens, like ("foo" "bar"). Also don't yet warn about Boolean literals, which are sometimes wrapped in parentheses to silence unreachable-code warnings. To avoid multiple warnings about code like f((0)) switch to generally using a set of ParenExpr to keep track of which occurrences have already been handled. Change-Id: I036a25a92836ec6ab6c56ea848f71bc6d63822bc Reviewed-on: https://gerrit.libreoffice.org/45317 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* Replace most lists by vectors in codemakerJulien Nabet2017-11-263-10/+8
| | | | | | | | Change-Id: Id867b497514d2d795504ae5c9e7d0ad356524ad5 Reviewed-on: https://gerrit.libreoffice.org/45274 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
* loplugin:constantparam in c*Noel Grandin2017-11-011-7/+1
| | | | | | | Change-Id: I10c7b62e6458062324367b94b207f776af79f598 Reviewed-on: https://gerrit.libreoffice.org/44129 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
* loplugin:includeform: codemakerStephan Bergmann2017-10-2326-142/+142
| | | | Change-Id: If0c6726c4e096f50e2e16f2a4f7e5821457ac368
* loplugin:constmethod in codemaker,registry,storeNoel Grandin2017-10-206-23/+23
| | | | | | | Change-Id: Ie75875974f054ff79bd64b1c261e79e2b78eb7fc Reviewed-on: https://gerrit.libreoffice.org/43540 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* add << operator for css::uno::ExceptionNoel Grandin2017-10-041-0/+31
| | | | | | | Change-Id: Ia23dafd07133779144965682df3b7125a3214235 Reviewed-on: https://gerrit.libreoffice.org/43046 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
* clang-tidy modernize-use-emplace in c*Noel Grandin2017-09-113-14/+11
| | | | | | | Change-Id: I419d1f67ba301050d05981db2a3d6178878684a9 Reviewed-on: https://gerrit.libreoffice.org/42110 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* new loplugin:droplongNoel Grandin2017-08-142-2/+2
| | | | | | | | | | | | The types 'long' and 'unsigned long' are different sizes on different platforms, making them wholy unsuitable for portable code. And when I mean different sizes, I mean 64bit Linux and 64bit Windows have different bit sizes. Change-Id: Id4d8cd709bf71a3f85ed6515fae2b0a21ae8c25d Reviewed-on: https://gerrit.libreoffice.org/41130 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* convert std::map::insert to std::map::emplace IINoel Grandin2017-08-115-43/+20
| | | | | | | Change-Id: Ief8bd59c903625ba65b75114b7b52c3b7ecbd331 Reviewed-on: https://gerrit.libreoffice.org/41019 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* loplugin:oncevarNoel Grandin2017-07-311-6/+3
| | | | | | | | | extend oncevar to any POD type Change-Id: Ia98ee0a67f183e40fb0c38477760124b2c411dc0 Reviewed-on: https://gerrit.libreoffice.org/40564 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* loplugin:constparams codemaker,idl,idlcNoel Grandin2017-07-181-2/+2
| | | | | | | Change-Id: Ic72b7525cfbfbd3c5afb12fe9ea814176e6c8c9d Reviewed-on: https://gerrit.libreoffice.org/40126 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>