summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/constparams.cxx
AgeCommit message (Collapse)Author
2018-05-04Adapt to Clang trunk SourceManager::getImmediateExpansionRange changesStephan Bergmann
...of <http://llvm.org/viewvc/llvm-project?view=revision&revision=331155> "PR37189 Fix incorrect end source location and spelling for a split '>>' token", changing (among others) the return type of getImmediateExpansionRange from a std::pair of token locations to CharSourceRange (which will typically also represent token locations, but might also represent char locations). For now, map the return value of getImmediateExpansionRange back to a std::pair (as expected by our compilerplugins code in its current form), and mark the char location case with a TODO (which will need to be addressed if any of our plugins starts to produce wrong results due to not handling that char location case). In the long run, we should instead adapt our code to use the new return type of getImmediateExpansionRange directly. Change-Id: Idc2f5dc43830af4798b55bf605976c4ab146c522 Reviewed-on: https://gerrit.libreoffice.org/53817 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-24loplugin:constparamsNoel Grandin
Change-Id: I7c695073d9a9d3b7a641d6eb9fe01a47d8c3a504 Reviewed-on: https://gerrit.libreoffice.org/48392 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-07loplugin:constparams in sdNoel Grandin
Change-Id: Id4b68ca0509111396ed354f4cda43d663083cad0 Reviewed-on: https://gerrit.libreoffice.org/44388 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-07Clean away temporarily added using declarationsStephan Bergmann
Change-Id: I26734c13515394162d88351a1cbe2b20abdac865
2017-11-02improve constparam lopluginNoel Grandin
lots of little fixes to make the logic less pessimistic Change-Id: If368822984250b11b98c56f5890177a1402e8660 Reviewed-on: https://gerrit.libreoffice.org/44168 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-27extract some common code for checking if a functions address was takenNoel Grandin
Change-Id: I292b4e9bf17c83f83ff43ac4c5870d33092d0c71
2017-10-27rename loplugin::Plugin::parentStmtNoel Grandin
to getParentStmt and rename parentFunctionDecl to getParentFunctionDecl, so I don't keep using accidentally naming my variables the same as the functions. Change-Id: I66f9452458c8b439e5132191ac5219fb6d420708
2017-10-18rename some fieldsNoel Grandin
in preparation for const-method detection Change-Id: Iecf7102892d664ded799615ce1a848a538dcfcef
2017-10-06disable constparams lopluginNoel Grandin
increases compile time too much, I will run this by hand periodically Change-Id: I118567ef294847ff609d4de771d998ce3b57161b
2017-09-30loplugin:constparams: Ignore functions whose address is takenStephan Bergmann
(unless as the callee of a function call). In response to <https://gerrit.libreoffice.org/#/c/42912/> "DO NOT MERGE - error in clang static plugin". Many of the whitelisted functions can now be taken off the list. Change-Id: I04c2ee445e7973a288f42fd663d8b2d78cd3c5aa Reviewed-on: https://gerrit.libreoffice.org/42958 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-09-30Access to ProcessEventsToSignal's bSignal is racyStephan Bergmann
...so spell out its single use, locking the appropriate mutex around the access Change-Id: I8e8f47de1979f5a80cf1ad65e5ec24d25145c463 Reviewed-on: https://gerrit.libreoffice.org/42908 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-08-31Revert loplugin:constparam behavior when param is subject of castStephan Bergmann
...cf. 72cfd4d024aa9deb68010824a804f252e37b8388 "loplugin:constparams: Also handle ObjCObjectPointerType" Change-Id: Ieec294d721002cac0c37bf2590a9ce20b3e123e3
2017-08-31Adapt lopluign:constparams to variadic CXXOperatorCallExprStephan Bergmann
Change-Id: I21c7a0fb447b5ba0a7aa0ddc690b969b156a91f3
2017-08-31Restrict loplugin:constparams cast-to-void checkStephan Bergmann
Change-Id: I3c4d4f99b423f46136a79f3b06c5f0e1492872f1
2017-08-31loplugin:constparams: Also handle ObjCObjectPointerTypeStephan Bergmann
...in 0660a30d54eb6762302cf1afd43de01e137f6393 "Avoid loplugin:constparam when param is subject of cast to non-const pointer" But turns out this whole avoidance is ill-advised and should eventually be reverted: Aug 31 09:09:26 <sberg> noelgrandin, the way you originally handled CastExpr in constparam's checkIfCanBeConst, your intent was if there's code like static_cast<T*>(p) and param p is found it can be made const, one would also need to change that cast to static_cast<T const *>(p) when fixing the loplugin warning, right? Aug 31 09:09:43 <noelgrandin> sberg, correct Aug 31 09:10:10 <sberg> noelgrandin, I messed the up with 0660a30d54eb6762302cf1afd43de01e137f6393 Aug 31 09:10:12 <IZBot> core - Avoid loplugin:constparam when param is subject of cast to non-const pointer - http://cgit.freedesktop.org/libreoffice/core/commit/?id=0660a30d54eb6762302cf1afd43de01e137f6393 Aug 31 09:10:24 <noelgrandin> sberg, I probably should have had a test for that Aug 31 09:10:41 <noelgrandin> tests are better at expressing intent Aug 31 09:10:56 <sberg> I ran across it in a function that needed to have the param non-const for API reasons (callback fn), and it looked like the "obvious" fix there, not needing to add the fn to the blacklist Aug 31 09:11:26 <sberg> I'll eventually get that fixed again (but want to first get the Mac and Windows builds to succeed) Aug 31 09:11:44 <noelgrandin> fair enough Change-Id: Idef0cfc417ec0597a26a29c8720e3e4051a68e00
2017-08-31...in which Johnny returns from the fair for realStephan Bergmann
and finds loplugin:constparams adapted to ObjCIvarRefExpr also Change-Id: Ib803cd80b01ad7a0fa07bddb77a873bb323a50c0
2017-08-30Avoid loplugin:constparam when param is marked as unusedStephan Bergmann
...as in entry_group_callback (sd/source/ui/remotecontrol/AvahiNetworkService.cxx), AVAHI_GCC_UNUSED void *userdata Change-Id: I494067878181c51b77d581a21ab1c9ef81e482e5
2017-08-30Avoid loplugin:constparam when param is cast to voidStephan Bergmann
...which typically indicates that the param just has to be of the given type for some reason Change-Id: Ide30f514c5a849ae897c31c1744ece9df712a9fc
2017-08-30Avoid loplugin:constparam when param is subject of cast to non-const pointerStephan Bergmann
...as in WriteCallback (desktop/source/minidump/minidump.cxx), where void *ptr is use in static_cast<char *>(ptr) Change-Id: I0bd44329029cd793390d0744de3c839612e0b494
2017-08-30Adapt loplugin:constparam to jurt/source/pipe/staticsalhack.cxxStephan Bergmann
Change-Id: I0193ce3be582cb0a06cca17257b1e6587c5b3752
2017-08-30...in which Johnny returns from the fairStephan Bergmann
and finds loplugin:constparams adapted to ObjCMessageExpr Change-Id: I6e1ddd0fb1a8a61d5a78c156bccfc29f7233909e
2017-08-30loplugin:constparam in variousNoel Grandin
Change-Id: I6821a3946f2e8fabf26558a84370c16ac8827fed Reviewed-on: https://gerrit.libreoffice.org/41721 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-29loplugin:constparam in sc part8Noel Grandin
Change-Id: I6cf9c5e662b20de9c9698a8c1fab56a09950c522 Reviewed-on: https://gerrit.libreoffice.org/41683 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-07loplugin:constparams in sw part10Noel Grandin
Change-Id: I7d708c3e6157d0b8690b433d3363d2c0745b2410 Reviewed-on: https://gerrit.libreoffice.org/40832 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-07-Werror=unused-functionStephan Bergmann
Change-Id: Ia98b64a5500b99c5a6f20c723d96d9c4686f3271
2017-08-07loplugin:constparams in sw part9Noel Grandin
Change-Id: I2edba9cde5a5efd06815a55632703b706ca523c7 Reviewed-on: https://gerrit.libreoffice.org/40830 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-04loplugin:constparams in sw part3Noel Grandin
Change-Id: I05ad3204af4e6ec3c832b185a1b35fdb75a229b2 Reviewed-on: https://gerrit.libreoffice.org/40760 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-03loplugin:constparams in sw part2Noel Grandin
Change-Id: I51ae0e8caaf46f141d3d15ace47612df1e476de7 Reviewed-on: https://gerrit.libreoffice.org/40735 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-03loplugin:constparams in sw part1Noel Grandin
Change-Id: Id8d8afe268a82585ec2d3699411073dfb905d6ba Reviewed-on: https://gerrit.libreoffice.org/40734 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-03loplugin:constparams in sdNoel Grandin
Change-Id: I833c6da99d5ccb8f6a8b5c905bee73b75fde0a89 Reviewed-on: https://gerrit.libreoffice.org/40700 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-31loplugin:constparams in basctlNoel Grandin
Change-Id: If6c2b980a2916c4ee8ac108fbb84b006a35f49c5 Reviewed-on: https://gerrit.libreoffice.org/40570 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-28loplugin:constparams handle constructorsNoel Grandin
had to change the structure of the plugin considerably, was too messy to structure it to do the calculations on a per-function basis Change-Id: I4edee7735f726101105c607368124a08dba21086 Reviewed-on: https://gerrit.libreoffice.org/40516 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-27loplugin:constparams in chart2Noel Grandin
Change-Id: Ic325b79f04e04aa19e08a60db30b982d90f04c80 Reviewed-on: https://gerrit.libreoffice.org/40480 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-27loplugin:constparams in svxNoel Grandin
and fix a bug in the plugin itself when calling operator's like the one on std::function<> Change-Id: I1617607107eeff06785c1841f69e13ad2926218e Reviewed-on: https://gerrit.libreoffice.org/40446 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-21loplugin:constparams in soltools and variousNoel Grandin
Change-Id: I5e8e4a9a31aa7c3ff54cc7ce137d08770ea297e1 Reviewed-on: https://gerrit.libreoffice.org/40279 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-20loplugin:constparams in basicNoel Grandin
Change-Id: Idf55f63f2d56be4997a8cdc6afc5690eacac9a60 Reviewed-on: https://gerrit.libreoffice.org/40214 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-19loplugin:constparams in connectivityNoel Grandin
Change-Id: I9b81c6227fb3c89a832640058a11444f72019694 Reviewed-on: https://gerrit.libreoffice.org/40155 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-19loplugin:constparams in desktopNoel Grandin
Change-Id: Idba3acbd1e6ad5e1ce1cae9f80f764906ab8b143 Reviewed-on: https://gerrit.libreoffice.org/40157 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-18loplugin:constparams in sdextNoel Grandin
Change-Id: Ia5d2c00b02bf1758f7502065dd109f0f54fda2d3 Reviewed-on: https://gerrit.libreoffice.org/40124 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-18loplugin:constparams in toolkit,ucb,xmlhelpNoel Grandin
Change-Id: I2287bf468aae5008e25aa8b1bc0b63cff7bb1bf1 Reviewed-on: https://gerrit.libreoffice.org/40117 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-18loplugin:constparams in vclNoel Grandin
Change-Id: I36afe2107e07ffb9b73c0b76be600e3e999a0fd4 Reviewed-on: https://gerrit.libreoffice.org/40116 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-15improve unusedfields lopluginNoel Grandin
to ignore assignments when doing writeonly analysis Change-Id: I9eb6f2594003a610582dbc20acb7ccf14ef72c6c
2017-05-18Adapt pathname checks to mixed usage of \ and / on WindowsStephan Bergmann
Change-Id: I91bc89a9076c6642e06b238f65f2d31a1d20c6b5
2016-10-18loplugins: extract some common functionalityNoel Grandin
Change-Id: If470e1d9b481c9eda0829aa985152baf8fb46d7a
2016-07-12new plugin constparamsNoel Grandin
very basic detection of pointer and reference params that can be const. Off by default until the relevant changes have landed. Change-Id: I88bba4e67307e3fb0e11dad252ec59c913828763