summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/constantparam.cxx
AgeCommit message (Collapse)AuthorFilesLines
2024-04-22loplugin:constantparam filter out workdir/ stuff earlierNoel Grandin1-3/+6
Change-Id: I5b90bd855a74b03d534ce64689361b7417293a6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166422 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-14better solution for ignoreLocation for tree-wide pluginsNoel Grandin1-0/+2
Change-Id: I7336003e038781d4ef50380fa49f66b5ff19379f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135589 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-24loplugin:constantparam improvementsNoel Grandin1-8/+5
(1) sanitize call value output, make downstream processing easier (2) remove bad ignoreLocation() call, which was eliminating a lot of valueable data and thus generating false positives Change-Id: I39230c260c5cf717559300913fbc68bc3485b957 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131986 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-02-17Bump compiler plugins Clang baseline to 12.0.1Stephan Bergmann1-10/+2
...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>
2021-11-11Drop ScGlobal::GetEmptyOUString() and EMPTY_OUSTRINGMike Kaganski1-6/+0
OUString default ctor already uses a static instance (through rtl_uString_new), no need to have another module-specific static. Commit d8037ae18a297229d1b79f8f76331abfd548350d had removed its sw counterpart some time ago. Change-Id: I140fe13bc1f6b0cbe188e83e602fdebe995e467a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125061 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-18make FORCE_COMPILE_ALL more flexible than all or nothingLuboš Luňák1-1/+1
Rename it to FORCE_COMPILE and it takes the --enable-symbols specification of what to include, for example FORCE_COMPILE="all -sw/ -Library_sc". Change-Id: I92afd8e0abc75d3566285c197d6640c26c03db36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122248 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-06-14Adapt compilerplugins to LLVM 13 APSInt::toString changeStephan Bergmann1-1/+1
<https://github.com/llvm/llvm-project/commit/61cdaf66fe22be2b5942ddee4f46a998b4f3ee29> "[ADT] Remove APInt/APSInt toString() std::string variants". TODO: While most uses of compat::toString should be harmless performance-wise, as they are either in error reporting code or in plugins that are not run by default, some calls like the one in compilerplugins/clang/staticconstfield.cxx might benefit from moving them away from using std::string. Change-Id: Icfac7d6d4a0a4a4edeb5c8bdcdbc13b73e20a5e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117152 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-02-13Get rid of some unnecessary llvm::StringRef -> std::string conversionsStephan Bergmann1-2/+2
(as discussed in the commit message of ce1d8e20a708ed031f2336770a41fbe501fe8225 "Adapt to '[ADT] Make StringRef's std::string conversion operator explicit'"; there are more of those that cannot easily be dropped, though). Change-Id: Ib2e223f7de96ad8859eab165daa759b480326c7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88582 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-29Adapt to "[ADT] Make StringRef's std::string conversion operator explicit"Stephan Bergmann1-5/+5
...<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-11-11Make base of loplugin::FunctionAddress more flexibleStephan Bergmann1-2/+2
(I'm planning to use it for a FilteringRewritePlugin.) And while at it, base its current uses on FilteringPlugin. Change-Id: I0acdcc6cb0b3a434b425405c8c438dbf65e4d3cb Reviewed-on: https://gerrit.libreoffice.org/82451 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-08better name for a function in compilerpluginsLuboš Luňák1-1/+1
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-07do not use compiler.getSourceManager().getFilename()Luboš Luňák1-1/+1
This is a continuation of ff002524c12471668e63837a804b6006f9136a34. When compiling with icecream, its -frewrite-includes merges all #include's into one .cxx file and marks them with with line markers. But SourceManager::getFilename() doesn't take those into account and so it reports all of those as <stdin>. So use getFileNameOfSpellingLoc(), which explicitly handles this case. And we should probably never ever use SourceManager::getFilename(). Change-Id: Ia194c2e041578e1e199aee2df2f885922ef7e31a Reviewed-on: https://gerrit.libreoffice.org/80326 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-07-19loplugin:constantparamNoel Grandin1-2/+3
and tweak the plugin to handle a crash seen with clang-9 Change-Id: Ie1ccf80c16a20dbca58e5bd081af13f75cf5ac8f Reviewed-on: https://gerrit.libreoffice.org/75850 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-05-03Fix building compilerplugins with Clang trunk towards Clang 9Stephan Bergmann1-0/+4
...after <https://github.com/llvm/llvm-project/commit/ f19a8b05171a67a290e7d3bd6eba0c95c7b3259c> "Replace ad-hoc tracking of pattern for an instantiated class-scope" removed ASTContext::getClassScopeSpecializationPattern. None of the affected plugins are enabled by default (nor checked by solenv/CompilerTest_compilerplugins_clang.mk), so just make sure they still compile, leaving any potentially necessary adaptions to another commit. Change-Id: I7102851409e78eff284b50337f7ad0f721e1e548 Reviewed-on: https://gerrit.libreoffice.org/71702 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-11-27add EvaluateAsInt compat function for latest clangNoel Grandin1-1/+1
the old EvaluateAsInt method has been dropped as from current clang Change-Id: Ie30d1547ad8de777badff4b380d2fc9fb261e8fe Reviewed-on: https://gerrit.libreoffice.org/64107 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-23Bump compiler plugins Clang baseline to 5.0.2Stephan Bergmann1-1/+1
...as discussed at <https://lists.freedesktop.org/archives/libreoffice/2018-November/081435.html> "minutes of ESC call ..." Change-Id: Ia053da171d59747984546f38e19da808825b4f79 Reviewed-on: https://gerrit.libreoffice.org/63832 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-10Avoid -Werror=deprecated-declarations with recent Clang trunkStephan Bergmann1-2/+2
...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-07-06compilerplugins: try to make these work with icecreamMichael Stahl1-2/+1
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-04-10put the loplugin output files in the workdirNoel Grandin1-1/+1
so that the next time I accidentally leave one turned on, and commit it, the buildbots will clean up naturally the next time they run 'make clean' Change-Id: Ia09dea9c272c322c7e2773c5458cb54aceb50dd1
2018-03-27Let prefix arguments to hasPathnamePrefix end in slashStephan Bergmann1-1/+1
...for better precision Change-Id: I5f273b7c66ba931647805c415622b5ac767ff987
2017-12-19Bump --enable-compiler-plugins to Clang 3.8.0Stephan Bergmann1-8/+1
<https://lists.freedesktop.org/archives/libreoffice/2017-December/079107.html> "Clang baseline bump" Change-Id: I18fca8794ea34118fc6308458064d0c28cf5caf7 Reviewed-on: https://gerrit.libreoffice.org/46557 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-07Clean away temporarily added using declarationsStephan Bergmann1-3/+3
Change-Id: I26734c13515394162d88351a1cbe2b20abdac865
2017-10-27extract some common code for checking if a functions address was takenNoel Grandin1-18/+10
Change-Id: I292b4e9bf17c83f83ff43ac4c5870d33092d0c71
2017-10-27loplugin:constantparam was not always using canonical location for functionNoel Grandin1-5/+4
Change-Id: I8a15da534ba2cf9968cba0ee1f1bb74d7e3a0d54
2017-06-20reformat some loplugin codeNoel Grandin1-2/+2
to match our more normal conventions. Also drop the 'using std' and some other cruft Change-Id: I02ef81c5427188bc03a20b157a57a900a9d7bf0d
2017-05-18Adapt pathname checks to mixed usage of \ and / on WindowsStephan Bergmann1-3/+3
Change-Id: I91bc89a9076c6642e06b238f65f2d31a1d20c6b5
2017-05-10add some some empty string names to constantparam lopluginNoel Grandin1-1/+5
Change-Id: I8f67212271a798d544b7aad46f08890122cd5e18
2017-05-09make loplugin constantparam smarter about string paramsNoel Grandin1-3/+29
Change-Id: Id3df69b38fd35f46735246a6d307a89aa10d4294 Reviewed-on: https://gerrit.libreoffice.org/37426 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-08teach loplugin:constantparam about simple constructor callsNoel Grandin1-1/+21
Change-Id: I7d2a28ab5951fbdb5a427c84e9ac4c1e32ecf9f9 Reviewed-on: https://gerrit.libreoffice.org/37280 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-11loplugin constantparam, ignore variadic methodsNoel Grandin1-0/+2
Change-Id: Ieabb020406d5a381dd9cbace3b1e4cc434857d54
2016-10-18loplugins: extract some common functionalityNoel Grandin1-1/+1
Change-Id: If470e1d9b481c9eda0829aa985152baf8fb46d7a
2016-10-01Fix typosAndrea Gelmini1-1/+1
Change-Id: I6aeda978911b25caa45d4e459e581fc743e93d2c Reviewed-on: https://gerrit.libreoffice.org/29442 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-27clang plugins: do "dotdot" normalisationNoel Grandin1-0/+1
which fixes some false positives Change-Id: I555349180b5ca819f29695789f1545ba2177bd09 Reviewed-on: https://gerrit.libreoffice.org/29320 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-14loplugin:constantparamNoel Grandin1-52/+35
clean up the plugin a little, and try to catch params which are default constructed, which doesn't seem to be working yet Change-Id: Ife45f18502a45cd26306424b7432c55fcbb0fd12 Reviewed-on: https://gerrit.libreoffice.org/28861 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-10loplugin:constantparam in sdNoel Grandin1-0/+2
Change-Id: I2bc989802c12b379a1ba4202f54ecfef1f339c8c Reviewed-on: https://gerrit.libreoffice.org/28774 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-09-06teach loplugin constantparam about default param valuesNoel Grandin1-25/+47
Change-Id: I334622bd34d8349f5b3988122d282b1062b225bb
2016-07-25loplugins: more consistent naming of output filesNoel Grandin1-2/+2
Change-Id: Ia26f697cb16078f235c94e4cff449a60c1bbd74e
2016-06-24Adpat to <https://llvm.org/svn/llvm-project/cfe/trunk@273647>Stephan Bergmann1-1/+1
"Use more ArrayRefs" Change-Id: Ied0ab11dd9366b3f499100b2627f4919cca52c9c
2016-06-23new loplugin: singlevalfieldsNoel Grandin1-2/+1
look for fields that only have a single constant value assigned to them Change-Id: Iafcd37fdb8a8119bbc00f92981a1a01badf9c5a2
2016-05-18update unusedmethods plugin to deal with constructorsNoel Grandin1-9/+2
and fix the operator< implementations in some of the other plugins too. Change-Id: Ie5631e0cdc8d2a994ad2af2533cdb558a6cfc035 Reviewed-on: https://gerrit.libreoffice.org/25057 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-03-16loplugin:constantparams in vcl/Noel Grandin1-32/+83
also some improvements to the plugin Change-Id: I0e3a519d70756e577fcb1bd47dd66864b5b4c871 Reviewed-on: https://gerrit.libreoffice.org/23289 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-03-15loplugin:constantparamNoel Grandin1-2/+9
Change-Id: I270e068b3c83e966e741b0a072fecce9d92d53f5
2016-03-08new loplugin:constantparamNoel Grandin1-0/+215
finds parameters that are only ever being called with a single value Change-Id: Ibd0c9b6e6dbc1d1b5d5a005eaa19959560a6e50f