summaryrefslogtreecommitdiffstats
path: root/compilerplugins
Commit message (Collapse)AuthorAgeFilesLines
* DiagnosticsEngine::getCustomDiagID isn't const, so don't pass in const engine.Andrzej Hunt2014-01-311-1/+1
| | | | | Change-Id: I7e4494b7f1cb62ab27851e34ab4dc6be8e04e1fa Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
* sbergman's typoJesús Corrius2014-01-311-1/+1
| | | | Change-Id: I36dc29659d0d6965c28e5fe0bb03759476de4781
* clang::DiagnosticsEnginge::getCustomDiagID now needs a literal FormatStringStephan Bergmann2014-01-312-2/+18
| | | | | | ...at least in trunk 200400 towards Clang 3.5. Change-Id: Ibe956a7f28c16510506bd354582b3fe5a72582e5
* Clang API function terminology got changedStephan Bergmann2014-01-312-6/+58
| | | | | | ...at least in trunk 200400 towards Clang 3.5. Change-Id: I6e295e3a4cf721fbda9df8e7c5bed3993ee78216
* literaltobool conversion plugin, reduce spurious warnings with clang 3.3Noel Grandin2014-01-301-1/+1
| | | | | | | It appears that clang 3.3 also generates spurious warnings, so adjust the ifdef Change-Id: Idb57f7eafd55effd4c7c8b1f96c03c2ea6ddaba3
* implicitboolconversion: also warn about redundant explicit castsStephan Bergmann2014-01-291-0/+16
| | | | Change-Id: Ib89b4c12d2cdca873a9fe9a509d7a123977652a7
* Further fix for old Clang versionsStephan Bergmann2014-01-291-0/+9
| | | | | | | ...maybe this needs adaption for 3.3 or 3.4 too, known to work with trunk towards 3.5. Change-Id: I9f05ae44e4a49ae51df69d5a3c1df5eb371a1c87
* Fix for old Clang versionsStephan Bergmann2014-01-291-5/+35
| | | | Change-Id: Ib902535c03a9f1b93a2c4ff3dd61d29e316bfd49
* Clang plugin to warn about implicit conversion of literals to boolStephan Bergmann2014-01-281-0/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | ...which warns about apparent errors like n == KIND_FOO || KIND_BAR that should have read n == KIND_FOO || n == KIND_BAR It also warns about trivial (mis-)uses of 0/1 and sal_False/True like while (1) { ... } instead of while (true) { ... } which it can automatically rewrite. It does not warn if the relevant code is inside a macro in a .h (i.e., C) include file, nor when a string literal is used in the assert macro like assert(!"this cannot happen"); Change-Id: If8c305a25e5da15e78f6139b5b0c0e868f06d4f3
* Prepare dual-mode compiler plugin featureStephan Bergmann2014-01-2719-94/+140
| | | | | | | | | ...which can act as either a rewriter or a non-rewriter that emits warnings. Also added COMPILER_PLUGIN_WARNINGS_ONLY=X to demote warnings from plugin X from errors to warnings, even under --enable-werror. Change-Id: I05361936240a890515c6bba2459565417c1746b7
* implicitboolconversion: warn about mixing bool with integerStephan Bergmann2014-01-261-0/+30
| | | | | | ...in &=, |=, ^=, as does MSVC, too. Change-Id: I57ecc9d784dd483e04ae561c62595b1d0380517f
* implicitboolconversion: also warn about mixing bool/sal_Bool in &=, |=, ^=Stephan Bergmann2014-01-221-3/+3
| | | | | | ...as MSVC would warn about those anyway. Change-Id: If22dfd35bc01aff1a1bef68702c616e711db42fb
* implicitboolconversion: also warn about mixing bool/sal_Bool in == etc.Stephan Bergmann2014-01-221-13/+16
| | | | | | | | | | | | | | | | ...as MSVC would warn about those anyway (at least about cases that do not compare against literal sal_True/sal_False, but warning even about those helped clean up lots of redundant if (foo == true) instead of just if (foo) etc. across the code base). Change-Id: Iad4b335c35c5411070f04f87f974db7942c288d4
* Improve Clang 3.2 hasCLanguageLinkageType workaroundStephan Bergmann2014-01-221-1/+1
| | | | Change-Id: If5c104adc05aa362d15cedf6f8953bda478897bc
* Make implicitboolconversion.cxx compile with Clang 3.2Stephan Bergmann2014-01-201-3/+30
| | | | Change-Id: I011e74fd044d0b76cccc60adea362805917c584a
* Clang plugin that flags implicit conversions from boolStephan Bergmann2014-01-171-0/+480
| | | | | | | | | | | | | ...as they are often enough errors, like a typo in brace placement in if (foo == (FOO || bar == BAR) && baz) or a literal true passed as an argument to a function that rather expects an integer bit mask, etc. The plugin is smart enough to detect interaction with logically boolean return/parameter types of C functions that use [unsigned] int instead, and knows the relevant boolean typedefs (sal_Bool, gboolean, etc.). Change-Id: I5f0e4344fe86589bec35a71018c7effdedf85e3e
* compilerplugins: ignore WORKDIR codeStephan Bergmann2014-01-101-3/+3
| | | | | | | ...which is typically external or generated code and causes warnings that we cannot easily fix. Change-Id: If86ecd96c069ec23c6b3d7f5c32bf962397393e5
* Clang plugin to re-write SvStream operator<< to non-overloaded methodsNoel Grandin2014-01-101-0/+181
| | | | | | | | | | | | Use a clang rewriter to rewrite SvStream::operator<< to methods like WriteUInt32. Note that the rewriter is not perfect, and hand-tweaking the output is necessary. Change-Id: I0291c8192ca74d6334ed3cf8cb713212b2f0c67d Reviewed-on: https://gerrit.libreoffice.org/7307 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
* compilerplugins: strip out -m32/-m64 from CXXMichael Stahl2014-01-101-2/+3
| | | | | | | These are not part of LO and need to be built with native bitness of the compiler. Change-Id: I41fdec130a63e0c0d07f1df228031014cd2351c2
* typo fixesAndras Timar2013-12-201-1/+1
| | | | Change-Id: Ia5f104bfd707bcf4e159c78ca2764c861fb0b6d9
* remove SOLARENV variableMichael Stahl2013-11-021-1/+1
| | | | | | | | It is constant and can just be replaced by $(SRCDIR)/solenv. Use BUILD_TYPE where it was used to check if config_*.mk is sourced. Change-Id: Ib9d480c57194b6340093aa47776f8768df69b7d1
* solver doesn't solve anything...Michael Stahl2013-10-312-24/+4
| | | | | | | | | | | | | | ... it is an abbreviation of "Solar Version". Since nobody can remember that: remove OUTDIR OUTDIR_FOR_BUILD SOLARVER SOLARVERSION solarpath and any mention thereof. Change-Id: Idb3031c4f25a76ac05b22ec67e3ca3e1e8e512ad Reviewed-on: https://gerrit.libreoffice.org/6515 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
* add mode lines to new files (and idls) since last runCaolán McNamara2013-09-2232-0/+90
| | | | Change-Id: Id1e74f18c90e69d1a781c8f02e30dc3c005ed4fd
* move valueof compiler pluginLuboš Luňák2013-08-271-0/+0
| | | | | | | The mass-conversion has been already done, so it's most probably not needed anymore. Change-Id: I3f161b8ea122e4dd185746ea29509b0d7768d6c7
* finish deprecation of O(U)String::valueOf()Luboš Luňák2013-08-211-0/+148
| | | | | | | Compiler plugin to replace with matching number(), boolean() or OUString ctor, ran it, few manual tweaks, mark as really deprecated. Change-Id: I4a79bdbcf4c460d21e73b635d2bd3725c22876b2
* warn when rewriter should modify something involving a macroLuboš Luňák2013-08-211-0/+6
| | | | | | | Apparently Clang rewriter API doesn't properly bail out if the range given is not inside one file, so check explicitly. Change-Id: I27be6d396a131d385231e9c0dfa8c84d9fa15ccc
* prevent crash when rewriting sourceLuboš Luňák2013-08-211-0/+2
| | | | Change-Id: I97519c2fb08efa2c694c9fb91a4cc402a6347c2c
* helper for getting location after current tokenLuboš Luňák2013-08-213-2/+9
| | | | | | | Given that locations often point to a (start of) token, even if it's e.g. getLocEnd(), this should be very useful. Change-Id: I266e4c0a234262e99158c8f495b631f54f8a5608
* update/rework the Rewriter wrapper functionsLuboš Luňák2013-08-212-51/+76
| | | | | | | Some improvements, like making it simple to actually remove a statement or a token including its associated whitespace. Change-Id: I02a5bd919f1fadae1dcd45a76f9d25df353ac518
* error: cannot use dynamic_cast with -fno-rttiStephan Bergmann2013-08-066-7/+12
| | | | | | ...with recent Clang trunk towards 3.4 Change-Id: Ie0991c7bd560c30551aeaada426382a889b46391
* clang binary is in clang build directory, not with its sourcesLuboš Luňák2013-08-051-1/+1
| | | | Change-Id: If037eac010d3cb72ca185382232c211758d009e6
* note about getDirectCallee() vs getCallee()Luboš Luňák2013-08-051-0/+5
| | | | Change-Id: I0a4cfd0ddb0c03b0db95d003004195df29a3f6df
* 'generic' compiler plugin to modify calls to a specific functionLuboš Luňák2013-08-051-0/+84
| | | | Change-Id: I60756d9054dfa5c55aeae8ddc904ddf6d67d2088
* Adapt to PPCallbacks.h changes on Clang trunk towards 3.4Stephan Bergmann2013-07-241-1/+7
| | | | Change-Id: I5611ffd36f9c6d1560a6ada6118a1efaeb6dc522
* adjust for upstreaming of warn_unused attributeLuboš Luňák2013-07-231-0/+9
| | | | | | | The warn_unused attribute has been upstream to GCC and Clang, so use it if present. Still warn about STL types if those do not use it yet (which is the status as of now). Change-Id: I3c003e44c08d1d141e23bba38cf92e663a5ac353
* mention the explicit bool conversion from C++11 for pointer-to-bool checkLuboš Luňák2013-07-161-3/+4
| | | | Change-Id: I050019b30d2ec96bbd25916624f8cb88d72110e4
* compiler plugin warning about unwanted silent pointer-to-bool conversionsLuboš Luňák2013-07-151-0/+163
| | | | | | | | | | | | | | | | | C/C++ silently converts pointers to booleans, which is presumably seen as a good idea by lazy people, but it can occassionally silently break code in strange ways, most notably by selecting a bool overload when no matching overload for the pointer exists (OUStringBuffer::append() can break like that, e.g. in ba37e4062f538db7e51d6a64ba544eeddbc567cf, other cases are 8e3bf1598fa95ac8d099e45ae4252e7654a6f590 or 28e4c0250e67a344b4d6088bdca2e680a4bffad0). So far the plugin checks only conversions in function call arguments, there's disabled code that could check more places, but I'm not aware so far of any place where anything actually broke because of that, and it'd require fixups to be explicit in some places (e.g. 'bool b = returns_pointer();' would require '!= NULL' added), so for it'll be only the simple various and it can be made more strict if wanted. Change-Id: I6a5d207daf925e6c2d1bf684060536795ecfcc35
* fix finding all parents for AST nodesLuboš Luňák2013-07-151-5/+17
| | | | | | | Ctor bodies can also have code inside of member variables initialization, which is not considered to be inside function body. Change-Id: Id68960093a51396b9486f1364b1a361526c3431d
* simplify bodynotinblock plugin using parentStmt()Luboš Luňák2013-06-202-47/+43
| | | | Change-Id: Ia2fe10af2ca555c7b88348e7ed571f1176586580
* simplify postfixincrementfix plugin using parentStmt()Luboš Luňák2013-06-202-67/+27
| | | | Change-Id: I93fa422afe7f3e1e10576dd64af9d57b2302f44e
* make it easy to get a parent of an AST nodeLuboš Luňák2013-06-202-0/+74
| | | | | | | | Clang API doesn't provide this, but it's occasionally needed, and so far the way has been inspecting the highest possible node in AST and walking down and remembering, which is complicated, error-prone and annoying. Change-Id: Id5b72cb5ebfc069e90efe6d673c0ef18ebcdab61
* work around the C++11 __float128 problem with libstdc++ headers and clangLuboš Luňák2013-06-131-1/+1
| | | | Change-Id: Ia1b443d22b3b7f6f93f1ad8c5fa760b0f1da3b83
* Ignore warnings in Clang headersStephan Bergmann2013-06-051-1/+1
| | | | | | (as occur at least in trunk Clang builds) Change-Id: I7e74200ae1042133fa04477e39e46fd2f01cc1b0
* Adapt UPDATE_FILES=<module> to headers being moved to include/Stephan Bergmann2013-06-051-1/+12
| | | | Change-Id: I6af5236358a51a51514d646c809147db56b2464b
* fix plugin build with clang < 3.3Luboš Luňák2013-06-021-6/+6
| | | | Change-Id: If2eb7595ca7d25f6d491e332bb3060061d3b42a7
* make compiler plugin warnings follow WaELuboš Luňák2013-05-311-2/+0
| | | | Change-Id: I72f1a11ce86d66e773e66116c725310df77fce39
* obey --enable-werror when building clang pluginLuboš Luňák2013-05-311-1/+5
| | | | Change-Id: I8ca9b09a6ffd4b2f00740563fa9682fdabb26b3d
* reoder stuff in makefileLuboš Luňák2013-05-311-2/+2
| | | | | | At the top should be stuff to set manually if needed. Change-Id: I516ac6df8102f00f6fc34c4c87d040688fcc2e99
* update for PPCallbacks API changes in Clang3.3Luboš Luňák2013-05-312-2/+43
| | | | Change-Id: I8493afa8e2264a42fba090c9c72f36f36cb2d165
* mark all virtuals in the clang plugin as overrideLuboš Luňák2013-05-3115-21/+21
| | | | | | In order to help catch Clang API changes. Change-Id: I5738f5dff405f7a2dd377c983fb32c1c7a2ff921