70 Commits

Author SHA1 Message Date
Noel Grandin
87e7b4bf4b loplugin:useuniqueptr more exclusions
Change-Id: I70c6d4af999965497e23ec8180eb08aa6dc648c5
Reviewed-on: https://gerrit.libreoffice.org/62221
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-23 13:18:28 +02:00
Stephan Bergmann
0bf6185516 Fix failure of loplugin:useuniqueptr with older compilers
...where CompilerTest_compilerplugins_clang failed in
compilerplugins/clang/test/useuniqueptr.cxx due to Foo24's

  HTMLAttrs::const_iterator it = m_aSetAttrTab.begin();

and either the old compiler lacked Clang's recent
<https://reviews.llvm.org/D50666> "Fix Stmt::ignoreImplicit" (and the above
initialization expression happens to include a CXXBindTemporaryExpr, at least
with libstdc++), or an even older compiler was used in pre-C++17 mode, so the
above initialization expression happens to include an elidable CXXConstructExpr
copy constructor call.

Change-Id: I757a9ad76829e399b4fe2da1c82863909b8c9657
Reviewed-on: https://gerrit.libreoffice.org/61531
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-10-10 13:46:22 +02:00
Stephan Bergmann
5688cd1d9a Fix loplugin:useuniqueptr for libc++ (macOS)
...after 05a337e297eb0cfe88c99503d760bd9eaf495b7d "loplugin:useuniqueptr look
for deleting in loops with iterators", where it didn't emit the warning for
Foo24 in compilerplugins/clang/test/useuniqueptr.cxx during
CompilerTest_compilerplugins_clang, because in the initialization of

  HTMLAttrs::const_iterator it = m_aSetAttrTab.begin();

the HTMLAttrs::const_iterator CXXConstructExpr happens to have a second,
defaulted argument.

Change-Id: I882a6dfb5cab1b147f790072f2545b13172c0f9a
Reviewed-on: https://gerrit.libreoffice.org/61530
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-10-08 16:58:44 +02:00
Andrea Gelmini
54d82085cc Fix typo
Change-Id: I822fa325d37955583a21e4d7ce2e79a4d5b02fc5
Reviewed-on: https://gerrit.libreoffice.org/61462
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2018-10-06 12:15:01 +02:00
Noel Grandin
05a337e297 loplugin:useuniqueptr look for deleting in loops with iterators
Change-Id: I0e5bf671ee11265c0afa8770430ec9e064e05fe3
Reviewed-on: https://gerrit.libreoffice.org/61402
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-05 16:18:57 +02:00
Noel Grandin
455ac9fb7a loplugin:useuniqueptr check more local variables
Change-Id: I8387731747ee6eb7d74037c0eff7fc9ac0b884c8
Reviewed-on: https://gerrit.libreoffice.org/60619
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-18 09:07:56 +02:00
Noel Grandin
651a2dee1c loplugin:useuniqueptr update exclusions
Change-Id: I9c741dbaba772550b4d68406fff50d8b0ac60874
Reviewed-on: https://gerrit.libreoffice.org/59923
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-03 11:03:30 +02:00
Andrea Gelmini
59a4804ce4 Fix typos
Change-Id: Ia658776bce8744e7b771559ca12b94a20923fc52
Reviewed-on: https://gerrit.libreoffice.org/59782
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43@gmx.de>
2018-08-30 18:36:37 +02:00
Noel Grandin
1fd27a7931 filter out AST in more plugins
I seem to have missed quite a few in

    commit 9f4d23c15115d64febd6bf01f870cc157badd350
    filter out some of the AST in the plugins

This nets me another 14% improvement

Change-Id: I39b980b49ced560f768045dbedd3ddfef29306c1
Reviewed-on: https://gerrit.libreoffice.org/59501
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-23 16:34:48 +02:00
Noel Grandin
86b2f0ad77 improvements to loplugin:useuniqueptr
find more patterns of deleting member data

Change-Id: I8913e364200dad8405bac30dd8cab2a68c8bee8f
Reviewed-on: https://gerrit.libreoffice.org/59233
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-22 08:26:30 +02:00
Noel Grandin
be806964a1 loplugin useuniqueptr improvement
passing owning pointers to constructors

Change-Id: I4e64cabbf449393b77162a845b3138be415e2dc9
Reviewed-on: https://gerrit.libreoffice.org/59346
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-21 09:34:09 +02:00
Stephan Bergmann
3cc5149a84 Avoid -Werror=deprecated-declarations with recent Clang trunk
...which first added alternative names to and then deprecated getLocBegin/End

Change-Id: Iaefb8ce259057abfa6cd20f0b63c0ef2949a96b2
Reviewed-on: https://gerrit.libreoffice.org/58820
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-10 15:14:03 +02:00
Noel Grandin
cfe896e7b8 loplugin:useuniqueptr in SwGrfExtPage
Change-Id: Ic71cf09b6a443f6918b074010fe53ea0843bf246
Reviewed-on: https://gerrit.libreoffice.org/58238
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-30 08:21:01 +02:00
Noel Grandin
8a592a5c6a loplugin:useuniqueptr in rptui::Condition
Change-Id: I1197be1f7ea8b621dedef41fdd0a664cb6d90374
Reviewed-on: https://gerrit.libreoffice.org/57879
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-24 10:48:08 +02:00
Noel Grandin
4089e1d9f6 loplugin:useuniqueptr fix check for DELETEZ inside compound stmt
Change-Id: Id748b8b0c9cfe8c288dfafb5d0c2a83a8de2c91c
Reviewed-on: https://gerrit.libreoffice.org/57871
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-24 08:34:32 +02:00
Noel Grandin
dba5dccfc5 loplugin:useuniqueptr in SwHTMLWriter
Change-Id: I67f3dd615e798f8ac865b57332f6153530d81929
Reviewed-on: https://gerrit.libreoffice.org/57863
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-24 08:32:56 +02:00
Noel Grandin
a98d071d32 loplugin:useuniqueptr in HTMLTable
Change-Id: I46ece073659444e802bf480996a5797c9f1ec9e8
Reviewed-on: https://gerrit.libreoffice.org/57754
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-20 15:24:27 +02:00
Noel Grandin
82a2a8f29e loplugin:useuniqueptr in XclObj
Change-Id: I2995dfe5fb39ae2e7f3c37992cb3e2147381784e
Reviewed-on: https://gerrit.libreoffice.org/57753
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-20 09:00:02 +02:00
Noel Grandin
8a939de0e1 loplugin:useuniqueptr in SwUndoTableMerge
Change-Id: I0c528c2b12d219f37a2c2fdf2211fce3c51ad9e4
Reviewed-on: https://gerrit.libreoffice.org/57688
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-19 08:13:50 +02:00
Noel Grandin
4c2d0b0d85 loplugin:useuniqueptr in ScTabView
Change-Id: Ic506f5d350abbbbb5912e3ebf753e02821c76841
Reviewed-on: https://gerrit.libreoffice.org/57523
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-17 14:03:19 +02:00
Noel Grandin
011c6c719f loplugin:useuniqueptr in SwHTMLWriter
Change-Id: I4802e6502addce96bff4831598e852e4fe673af4
Reviewed-on: https://gerrit.libreoffice.org/57521
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-17 12:19:14 +02:00
Noel Grandin
e7a252166e loplugin:useuniqueptr in UndoTransliterate_Data
Change-Id: I1c6e865a6f59ce7f31c42d28b2b463a577b3cc28
Reviewed-on: https://gerrit.libreoffice.org/57421
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-16 08:38:38 +02:00
Noel Grandin
dbf8ad9bc3 loplugin:useuniqueptr in SbUnoStructRefObject
now that we have upgraded to VS2017, we can use std::unique_ptr in
std::map

Change-Id: Id01af07ccae7447405b8f0bc44b08043f453e54b
Reviewed-on: https://gerrit.libreoffice.org/57384
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-13 11:58:10 +02:00
Noel Grandin
c75f597722 loplugin:useuniqueptr in SwGrammarContact
Change-Id: I1e6a2ca8f00d6130cfa6d2c18139bf61ada10630
Reviewed-on: https://gerrit.libreoffice.org/57363
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-13 08:40:54 +02:00
Michael Stahl
ff002524c1 compilerplugins: try to make these work with icecream
There are some problems here, this should fix one of them: the
getFilename function returns "<stdin>" for spelling locations, because
the input to clang is sort of preprocessed via -frewrite-includes if
icecream is used and the file is built on a remote host (whereas it's
apparently not preprocessed if the file is compiled locally by icecream).

Using getPresumedLoc() uses the #line directives in the preprocessed
input, which avoids the problem but is more expensive, so try to use it
only when necessary.

The getFileEntry(getMainFileID())->getName() pattern will also result
in "<stdin>", but fortunately icecream passes -main-file-name,
which oddly enough isn't used by the SourceManager's spelling locations,
but is available separately via CodeGenOptions.

This builds everything successfully with clang version 6.0.0:
ICECC_PREFERRED_HOST=myremote make check gb_SUPPRESS_TESTS=t

Change-Id: Ic121511683e5302d7b9d85186c8b9c4a5443fa1b
Reviewed-on: https://gerrit.libreoffice.org/54993
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-07-06 14:12:58 +02:00
Noel Grandin
38733c7daa loplugin:useuniqueptr in ScSimpleEditSourceHelper
Change-Id: Iebe62753d9e6f83f985e4c55fb938d5861613898
Reviewed-on: https://gerrit.libreoffice.org/56903
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-04 08:35:22 +02:00
Noel Grandin
35c165e46a loplugin:useuniqueptr in SwTextAPIObject
Change-Id: Ied235aefe2cc2ce5e88487503c17e1a54d25ac52
Reviewed-on: https://gerrit.libreoffice.org/56624
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-29 08:40:31 +02:00
Noel Grandin
bf82016b20 loplugin:useuniqueptr in SwDoc
Change-Id: Ic895c7b79a25a0766cc6d352c5ed75873004fddb
Reviewed-on: https://gerrit.libreoffice.org/56496
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-27 08:34:48 +02:00
Noel Grandin
200ca38824 teach useuniqueptr loplugin about calling delete on a param
which is often a useful indicator that the callers can be made to use
std::unique_ptr

Change-Id: Idb1745d1f58dbcf389c9f60f1a5728d7d092ade5
Reviewed-on: https://gerrit.libreoffice.org/56238
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-22 20:11:50 +02:00
Noel Grandin
f66510f1da loplugin:useuniqueptr in ODbTypeWizDialog
Change-Id: I4c364ddbad4881cc8a70a1827d7c51e7cc9313f1
Reviewed-on: https://gerrit.libreoffice.org/54850
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-28 13:54:42 +02:00
Noel Grandin
0f30c9a1ef loplugin:useuniqueptr in GridWindow
Change-Id: I9fd6d8ac159994c894739afbb3dccb72576dccfb
Reviewed-on: https://gerrit.libreoffice.org/54844
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-28 08:45:33 +02:00
Andrea Gelmini
2985319ebd Fix typos
Change-Id: Ibe94c7379a9389a0506c33666bf2bfb033f96f08
Reviewed-on: https://gerrit.libreoffice.org/54670
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jens Carl <j.carl43@gmx.de>
2018-05-23 06:52:55 +02:00
Noel Grandin
516d593ce1 loplugin:useuniqueptr in SvxAutoCorrectLanguageLists
Change-Id: Ie433a336f9cd5133aefbe4ef88d214b5f5c63a0a
Reviewed-on: https://gerrit.libreoffice.org/54182
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-18 13:13:41 +02:00
Noel Grandin
19b4520fbf loplugin:useuniqueptr in SvxOutlinerForwarder
Change-Id: Ie861132b43b0a01ee8b4f3bc201bbf12f8af9f36
Reviewed-on: https://gerrit.libreoffice.org/54181
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-16 09:03:47 +02:00
Noel Grandin
5c3816cce5 loplugin:useuniqueptr in SfxTabDialog
Change-Id: I460bf5aac44e6fd08a5bd5ab8af217dedbcc3cf8
Reviewed-on: https://gerrit.libreoffice.org/54174
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-14 11:11:33 +02:00
Noel Grandin
ae680f7c7d make useuniqueptr loplugin check child compound statements
where the child compound statement is unconditional

Change-Id: I755e7ee9134bde81811a694d42a996d3eaae3fc2
Reviewed-on: https://gerrit.libreoffice.org/53763
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-03 08:25:43 +02:00
Noel Grandin
a369e6bbd5 loplugin:useuniqueptr look for DELETEZ expressions
can't believe I've been missing these

Change-Id: If39827e1583cbcedfd5061a5059d6df53be0f9c8
Reviewed-on: https://gerrit.libreoffice.org/53598
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-29 17:03:18 +02:00
Noel Grandin
7e937a1384 loplugin:useuniqueptr in Inflater,Deflater
Change-Id: I55833664a6e76d781908b8f1f721dd9a4946e35f
Reviewed-on: https://gerrit.libreoffice.org/53224
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-23 08:14:07 +02:00
Noel Grandin
d911b3d37d loplugin:useuniqueptr in OStorePageBIOS
update the plugin to check all methods for deleting fields.

Also remove the dead checks for new failing here, can never have worked,
because it is not calling the std::nothrow variant.

Change-Id: I139410e42f83ae2db0cd38ceee81c8b4c310268c
Reviewed-on: https://gerrit.libreoffice.org/52881
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-16 08:21:36 +02:00
Noel Grandin
c91956452b loplugin:useuniqueptr in ScXMLTableRowCellContext
Change-Id: Ie2c50b08eed674c129f0f66eae502c61e565a7f8
Reviewed-on: https://gerrit.libreoffice.org/52495
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-06 15:13:20 +02:00
Stephan Bergmann
449d416335 Let prefix arguments to hasPathnamePrefix end in slash
...for better precision

Change-Id: I5f273b7c66ba931647805c415622b5ac767ff987
2018-03-27 08:20:47 +02:00
Stephan Bergmann
cbd1f3695f Use isSamePathname instead of hasPathnamePrefix, where appropriate
Change-Id: I75f32fc66877c0fb1e71be3b5e8b6d6c1b9c4d36
2018-03-27 08:20:47 +02:00
Noel Grandin
987cd20a33 loplugin:useuniqueptr in ImpEditEngine
Change-Id: I5afc846c803f5191bb5e04590923059e88434b76
Reviewed-on: https://gerrit.libreoffice.org/49176
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-05 07:52:50 +01:00
Noel Grandin
23e9b12944 loplugin:useuniqueptr in i18npool
Change-Id: Iff39b9298bfad474c5c011b6355b8ebf5be06318
Reviewed-on: https://gerrit.libreoffice.org/49091
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-02 11:12:15 +01:00
Noel Grandin
1d98683296 teach useuniqueptr loplugin about while loops
and reduce code duplication

Change-Id: I292d7515b15fce4cf1714c3b11b947493706bc3c
Reviewed-on: https://gerrit.libreoffice.org/49090
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-02 07:38:57 +01:00
Noel Grandin
084571ee6c loplugin:useuniqueptr in ModelData_Impl
Change-Id: I66866ed1698fafe59ba31f99df09fb792da410e3
Reviewed-on: https://gerrit.libreoffice.org/48702
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-29 07:17:24 +01:00
Noel Grandin
a9286f445d loplugin:useuniqueptr in PPDParser
Change-Id: Iafd63c276d430ea2a08286921f593bc56587e71c
2018-01-17 10:16:35 +02:00
Noel Grandin
2e97530102 loplugin:useuniqueptr expand search for ranged-loop-delete
Change-Id: I78955f4db9b4da2858dfb25e69a5502eb0280418
2018-01-17 10:16:35 +02:00
Noel Grandin
397d5cbc3c loplugin:useuniqueptr in Cursor
Change-Id: I5de300709409311b7a1d451ee1d314596cf2e879
Reviewed-on: https://gerrit.libreoffice.org/47836
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-15 07:28:35 +01:00
Noel Grandin
22bba5f377 teach useuniqueptr loplugin about "if(field != null) delete field"
Change-Id: I938deef90c8d6ceb0e72ab3f6ee2cbddc6f72b8d
Reviewed-on: https://gerrit.libreoffice.org/47730
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-12 07:02:29 +01:00