summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/flatten.cxx
AgeCommit message (Collapse)Author
2020-07-30loplugin:flatten in sw/uibase/utl..sw/uibase/wrtshNoel Grandin
Change-Id: I9010524952ce3b99a62e53dbf715a72c86a89b01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99766 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-20compilerplugins: fix building against baseline clang (5.0.2)Miklos Vajna
Where the Optional ctor is explicit. Change-Id: I577661c022f25502260977a6ef6744e4e178acc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92519 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2020-04-17improve failure mode in flatten lopluginNoel Grandin
rather than asserting, write out a warning so that section of code can be handled manually Change-Id: I1356012f4e480cff9508dad6c2d70cbbba1a5dc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92424 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-08loplugin:flatten in i18npoolNoel Grandin
and workaround a clang crash Change-Id: Ida94c8abb4b2e997d38a7f430e59f73aadf8fcc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91844 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-23Fix typosAndrea Gelmini
Change-Id: Iba46fbe8559211403118a23cd198a2217b333a81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90900 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2019-10-06replace throw with abortLuboš Luňák
There is nothing catching the exception anyway, and this fails to compile if compiling the plugin with Clang's CXXFLAGS (which include -fno-exceptions). Change-Id: Iad9316ad9613e4fd66d0e5a16fd71bbb8066cc2b Reviewed-on: https://gerrit.libreoffice.org/80299 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2018-08-23filter out AST in more pluginsNoel Grandin
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-10Avoid -Werror=deprecated-declarations with recent Clang trunkStephan Bergmann
...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-02-10improve loplugin rewriter double source modification detectionNoel Grandin
because my new rewriter easily generates overlapping rewriting. Move the code from flatten and salcall up into the pluginhandler, and drop the simpler detection logic. Change-Id: I3da51ac510954a5d4276cee0924cc5dc1fc9a734 Reviewed-on: https://gerrit.libreoffice.org/49493 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-22loplugin:flatten look for large if statement at end of functionNoel Grandin
the rewriter is capable of flattening the function by returning early, and inverting simple conditions. More complex conditions are just wrapped in "!(x)" Change-Id: I028fd7b018dc7347c1b323b2a73ab99c18508faa Reviewed-on: https://gerrit.libreoffice.org/45071 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-14loplugin:flatten loosen conditionNoel Grandin
the description in the comment was right, but the code was not Change-Id: I7c038e7453f4387d33ec6423c0c55446d6d0df47 Reviewed-on: https://gerrit.libreoffice.org/44680 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-08Fix loplugin:flatten's skipping of if/then/else/if chainsStephan Bergmann
(but which finds no new hits) Change-Id: I5d5f351402797b662a08ec8dca301bd174e22a50 Reviewed-on: https://gerrit.libreoffice.org/44433 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-07Remove obsolete commentStephan Bergmann
...that should have been removed in 2446d2b2fb8b091eaae015fd5bb26bd8e0f596f7 "Avoid expensive calls to containsPreprocessingConditionalInclusion" Change-Id: I2ffe0ec7b6f1ec0b418979f2864bd5de79ab2c9a
2017-11-07Avoid expensive calls to containsPreprocessingConditionalInclusionStephan Bergmann
Change-Id: I42981a23f75298591b2c3b073aea66426220f3e2
2017-11-07Clean away temporarily added using declarationsStephan Bergmann
Change-Id: I26734c13515394162d88351a1cbe2b20abdac865
2017-10-06Improve performance of loplugin:flattenNoel Grandin
...by avoiding calls to parentStmt. Change-Id: I4f3d66a0529e9c3abf5c963bcf70db7a2afa1bf9
2017-10-05Also suppress loplugin:flatten in C++ class member functions...Stephan Bergmann
...invovling preprocessing conditionals, to actually make the unhelpful warning on Windows about OleEmbeddedObject::changeState go away. And while at it, make the check for preprocessing conditionals more targeted (similar to 1084e8be44661aaeacb8801707701013eb3fcdbc "More targeted check for preprocessing conditionals in loplugin:blockblock"). Change-Id: I0300e0a547e969520a90cd126ea8f788cc17560f Reviewed-on: https://gerrit.libreoffice.org/42975 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-09-30Suppress loplugin:flatten in functions involving preprocessing conditionalsStephan Bergmann
...as needed by clang-cl on Windows to avoid unhelpful warnings about OleEmbeddedObject::changeState (embeddedobj/source/msole/oleembed.cxx) containging an "if" in an "#ifdef _WIN32" block followed by "else throw". Change-Id: I95bed29b9003db08499156ae7f885aeeea5a0158 Reviewed-on: https://gerrit.libreoffice.org/42963 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-09-29loplugin:flatten check for throw in then clauseNoel Grandin
also make the plugin ignore the case where we have var decl's in the clause we want to flatten, which could lead to problematic extension of variable lifetime Change-Id: I3061f7104e8c6a460bf74f5eac325a516ec50c59 Reviewed-on: https://gerrit.libreoffice.org/42889 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-27disable flatten lopluginNoel Grandin
<noelgrandin> sberg, new plugin flatten just went active <sberg> noelgrandin, with a measure to avoid extending lifetime of (problematic) local vars? <noelgrandin> sberg, no <sberg> noelgrandin, how can you make it active then? <noelgrandin> sberg, ok, will disable Change-Id: I595d1a50ff34417faf73b777714f9dc92e2a43d2
2017-09-27loplugin:flatten in variousNoel Grandin
Change-Id: I42dca691ffadbddad38a7e8f978b1da9d5d9a7b0 Reviewed-on: https://gerrit.libreoffice.org/42842 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-23loplugin:flatten in svl..svxNoel Grandin
and implement a check in the plugin to prevent us modifying the same patch of source code twice. This logic should probably be moved into plugin.cxx at some point. Change-Id: I7ebff6424cc8733bb2c8f7dba75eaaec68649290 Reviewed-on: https://gerrit.libreoffice.org/42660 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-22loplugin:flatten in pyuno..scNoel Grandin
Change-Id: I7ddc0b76532d26910f78642200750459508c2861 Reviewed-on: https://gerrit.libreoffice.org/42617 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-22loplugin:flatten in scaddins..sdNoel Grandin
Change-Id: I190323ce910224f883c4370b2c752644a5a35edd Reviewed-on: https://gerrit.libreoffice.org/42626 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-22loplugin:flatten in framework..packageNoel Grandin
Change-Id: Ide8a97eae6e2fdc7d2dcccba1480ac55a9b555bc Reviewed-on: https://gerrit.libreoffice.org/42593 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-21-Werror=unused-but-set-variableStephan Bergmann
Change-Id: I8bdf8a4c04256ad665960dd6f0d71d032156a34b
2017-09-21loplugin:flatten in editeng..extensionsNoel Grandin
Change-Id: I2b68f5640471ea827c09af1b5a319fb526a53b4b Reviewed-on: https://gerrit.libreoffice.org/42579 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-21loplugin:flatten in basctl..configmgrNoel Grandin
Change-Id: I674cad57ce30a885e126d3bcc921f8fcb53dc36d Reviewed-on: https://gerrit.libreoffice.org/42577 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-20new loplugin flattenNoel Grandin
look for places where we can flatten the control flow in a method by exiting early with a throw, ie. instead of if (cond) stuff(); else throw ex; we change it to: if (!cond) throw ex; stuff(); Change-Id: I8b6bdf883b325807c7e3a3ef698e4f4606e7d38b