summaryrefslogtreecommitdiff
path: root/compilerplugins/clang
AgeCommit message (Collapse)Author
2016-12-18loplugin:fpcomparison: Whitelist some Windows-only functionsStephan Bergmann
Change-Id: I94f35696ba358a049ee65764d17c62df7889aec7
2016-12-18loplugin:commaoperator: Ignore occurrence in FD_SET expansion on WindowsStephan Bergmann
Change-Id: I66974c273918d6d887364e7d552e3caf63e16343
2016-12-18Chose better diagnostic locationStephan Bergmann
Change-Id: I502da4b93905e64ca5506f24dc1f6bf2bf990dc2
2016-12-18Generalize typedef-to-void* check in loplugin:redundantcastStephan Bergmann
...to also cover cases like conversion betwen LPVOID and HANDLE in Windows-only code Change-Id: I934fe89372ee7a12462e7ad4284b9ea2cc73ce5a
2016-12-18Rename cdecl -> classdecl (MSVC treats the former like a keyword)Stephan Bergmann
Change-Id: I1859a92c996b907b8d511cddba25c00c9a52f398
2016-12-17Adapt to no-longer explicit OUStringLiteral ctorStephan Bergmann
...from previous commit Change-Id: I062b7cd212c17e7eb5274476e6859228d0477c7f Reviewed-on: https://gerrit.libreoffice.org/32098 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-12-16Make move detection in loplugin::passstuffbyref work for parenthesized casesStephan Bergmann
Change-Id: I56754a718af9433c0fa654ccb8eb34da00e75420
2016-12-16Make move detection in loplugin:passstuffbyref work with MSVCRTStephan Bergmann
...where an ImplicitCastExpr happens to appear between CXXConstructExpr and CallExpr Change-Id: I62226cc89d87bd3d9c03743b650f10c32c18f9be
2016-12-15disable the 'two different log areas in the same file' loplugin checkNoel Grandin
too many false+ to leave it alive by default Change-Id: I6d8f92b630c351c1ac788fad79f8d7c435ba4963
2016-12-15teach sallogareas plugin to catch inconsistenciesNoel Grandin
Change-Id: I8bcea5ffc74d48148bea78da8c17744e288c069a Reviewed-on: https://gerrit.libreoffice.org/32004 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-14Merge shell into TaskManager base classStephan Bergmann
(arbitrarily decided to keep the latter, being the less odd class name) Change-Id: I5c061a0f12b8f3095e283b4896f7c910948ac50f
2016-12-14Disambiguate clang::StringLiteralStephan Bergmann
...vs. recently introduced llvm::StringLiteral (llvm/ADT/StringRef.h) Change-Id: I4d74546b0d1401a74b0c15368bbc93794ecd0b1d
2016-12-14Check that VclPtr is only instantiated with appropriate typesStephan Bergmann
...deriving from VclReferenceBase. Complicated by the fact that the argument type may be incomplete at the time of template instantiation. So this approach may be less precise than the change to loplugin:vclwidgets from cbf5b21f2a65bbb342295200f6ad93a00f90733e "Catch some misuses of VclPtr construction" when the argument type becomes complete later in the comilation unit. However, this approach would also catch the two misuses in UnoControls found by cbf5b21f2a65bbb342295200f6ad93a00f90733e, so go with this approach for now and revert the change to loplugin:vclwdigets. Change-Id: I7888f23d2b9e2db81ae2ce4bf4c8277912317685 Reviewed-on: https://gerrit.libreoffice.org/31966 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-12-12Prevent use of ORowSetValue with sal_Bool as TINYINTStephan Bergmann
sal_Bool and sal_uInt8 are typedefs for the same underlying type, so any use of ORowSetValue with sal_Bool instead of bool, apparently intending to treat the value as a boolean, actually treated it as a TINYINT. (See e.g. recent 7b0c57b2faec875c790051d233d1e9abaed2a3bc "some compilers don't like implicit bool-to-ORowSetValue conversion".) Now that there's no way to create a sal_uInt8 ORowSetValue, getUInt8 and the m_uInt8 union member can probably go away, too. Change-Id: Ia27554f76e7e9edce6410284b578064573e54fd3 Reviewed-on: https://gerrit.libreoffice.org/31909 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-12-12Whitelist aLogger, in FormulaLogger& FormulaLogger::get()Tor Lillqvist
To avoid this: sc/source/core/tool/formulalogger.cxx:55:26: error: bad static variable causes crash on shutdown [loplugin:badstatics] static FormulaLogger aLogger; ~~~~~~~~~~~~~~~~~~~~~^~~~~~~ sc/inc/formulalogger.hxx:42:31: note: ... due to this member of 'FormulaLogger' [loplugin:badstatics] const ScFormulaCellGroup* mpLastGroup = nullptr; ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ sc/inc/formulacell.hxx:66:20: note: ... due to this member of 'ScFormulaCellGroup' [loplugin:badstatics] ScFormulaCell *mpTopCell; ~~~~~~~~~~~~~~~^~~~~~~~~ sc/inc/formulacell.hxx:114:21: note: ... due to this member of 'ScFormulaCell' [loplugin:badstatics] ScDocument* pDocument; ~~~~~~~~~~~~~~~~^~~~~~~~~ sc/inc/document.hxx:312:27: note: ... due to this member of 'ScDocument' [loplugin:badstatics] VclPtr<SfxPrinter> pPrinter; ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ Change-Id: I533e45f655ca928a801188aa48ee818d89a962ac
2016-12-09No need for rtl::Reference friend, no need for #include vclptr.hxxStephan Bergmann
Change-Id: I7bdd15a93e728ef7e98a53001c6eb6b56f761a6d
2016-12-09Catch some misuses of VclPtr constructionStephan Bergmann
...that go unnoticed due to the non-explicit VclPtr::oeprator reference_type * Change-Id: Ia63edf8425d3ecb7c7f98eb56a710ac0cceccb67
2016-12-08sw: remove some inline version control in uibaseMiklos Vajna
Change-Id: I7125b6f8593cac2c33916341f5649f57044ad045 Reviewed-on: https://gerrit.libreoffice.org/31761 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-12-07Replace calls to get(Qualified)NameAsString with stuff from check.hxxStephan Bergmann
Change-Id: I14e48ea5c59bdd12ad6484222b3e8733664e78c4 Reviewed-on: https://gerrit.libreoffice.org/31712 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-12-06new loplugin/rewriter comparisonwithconstantNoel Grandin
As per sberg' suggestion Limit it to == and !=, because some people like the flow of inequalities like: "0 < a && a < 42" The changes to sal/ were made using the rewriter. The rewriter still has one bug, in pipe.cxx, it managed to pick up some random piece of macro. No idea why. Change-Id: I01305f9c5396a4b6c7421d6e92f1b4b529388e82 Reviewed-on: https://gerrit.libreoffice.org/30962 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-05loplugin:unnecessaryoverride (dtors)Stephan Bergmann
Change-Id: Ia38672028668959bf3d5541fe4ddb9fb72848617
2016-12-05make passstuffbyref plugin ignore std::move'd paramsNoel Grandin
request from vmiklos Change-Id: If263beb0623d725e406003bb1660df10fe4b4e35 Reviewed-on: https://gerrit.libreoffice.org/31555 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-01Missing includeStephan Bergmann
Change-Id: I6af48e37b1b796a1680447ff972de8b5f5623d26
2016-11-29loplugin:vclwidgets check for assigning from VclPt<T> to T*Noel Grandin
Inspired by a recent bug report where we were assigning the result of VclPtr<T>::Create to a raw pointer. As a consequence, we also need to change various methods that were returning newly created Window subclasses via raw pointer, to instead return those via VclPtr Change-Id: I8118e0195a5b2b4780e646cfb0e151692e54ae2b Reviewed-on: https://gerrit.libreoffice.org/31318 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-25loplugin:stringconstant: look into 'char const * const var = "..."'Stephan Bergmann
Change-Id: I52a97b8ec273509131c2200e47527221cb62d7ee
2016-11-25Clean up CLANG_VERSION checkStephan Bergmann
Change-Id: Idfdffd73e9029216775d2a6ad46293ee1a4f1308
2016-11-25Clean up PPCallbacks compatiblity fixStephan Bergmann
Change-Id: I91f1db18b7876c4ecc30f7f97283e0ef0369eba5
2016-11-24Blind fix for Clang 3.6Stephan Bergmann
Change-Id: I56dc86df0d355cfa8af38661892ea2bb580c394b
2016-11-24CompilerTest_compilerplugins_clang: fix this to work with clang-3.7Miklos Vajna
Change-Id: I653b9c3aba53da421592b230bee3a9b69d3cb2d7
2016-11-23loplugin field-can-be-private in include/vcl..xmlscriptNoel Grandin
Change-Id: Ia03f7cccb256d825daa4dc6f4c0598448e46e6cf Reviewed-on: https://gerrit.libreoffice.org/31069 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-22New loplugin:oslendianStephan Bergmann
...to catch new places where defined'ness of OSL_BIG/LITENDIAN would be checked without osl/endian.h being included; cf. e2f08f9def0869460ad38a1c2adb450778290f6e "connectivity, sc: add missing #include <osl/endian.h>" and 2b14fb3a4f92b928f0a5fc536c6a5f4a6e51a9b8 "cppcanvas, oox: add missing #include <osl/endian.h>". Change-Id: I167c8916a01391b7dacad7325153ccf35d3ba9dc
2016-11-22can-be-private analysis needs to ignore virtual methodsNoel Grandin
Change-Id: I1e2f28ed550ff9751912f70e3eec511ddc5b75cf
2016-11-21FieldDecl::getParent fires assert for Objective C @interface membersStephan Bergmann
(like in vcl/inc/osx/a11ywrapper.h's AquaA11yWrapper), at least on recent Clang trunk, from within the call to cast() in cast<RecordDecl>(getDeclContext()) as the decl context apparently is something other than a RecordDecl. Change-Id: I238bae44d6db0f04bf8f90b0032489e3b4822eee
2016-11-21new loplugin datamembershadowNoel Grandin
Change-Id: Ib14319848bafd1fe7e0e663c434bbdeef5e98ecf Reviewed-on: https://gerrit.libreoffice.org/30963 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-17extend unusedfields loplugin to find fields that can be privateNoel Grandin
and apply the results in xmlscript Change-Id: Ib126f6e1576639abfd171e99d9561be9715ece2f
2016-11-16update couple of loplugins for move constructorsNoel Grandin
Change-Id: I82140569a3e09225065d721e4aeac5c5fe93bc45
2016-11-16Reduce noise for irrelevant warnings somewhatStephan Bergmann
...other options to avoid such irrelevant warnings can be to move code to an include file and/or to define a dummy main() accessing otherwise unreferenced entities. Change-Id: Ifd44e376b35ef68496f3aba6a3c046d684824000
2016-11-16new loplugin finalprotectedNoel Grandin
look for final classes, and make sure they don't have protected members Change-Id: I1fa810659bba02b61a5160dbfd8e24185ec9abf4 Reviewed-on: https://gerrit.libreoffice.org/30895 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-15New compilerplugins/clang unit testsStephan Bergmann
...to check that loplugin produces warnings/errors as expected: * Clang has a -verify switch that makes it easy to write test input .cxx files that list in comments all the warnings/errors that are expected, and let Clang check those expectations instead of generating object code. See include/clang/Frontend/VerifyDiagnosticConsumer.h in the Clang source tree for documentation. * Introduce a CompilerTest gbuild class that uses the existing LinkTarget class as much as possible. Checking the input files is implicitly phony, as the compilation step doesn't generate any object files, and the link step does nothing because there is no gb_LinkTarget_set_targettype for CompilerTest. The setup at least works for Clang on Linux (will need adaptions for Clang on Windows; compilers other than Clang are not relevant for now given this is used to check compilerplugins). * Definition of gb_CFLAGS_WERROR in solenv/gbuild/platform/com_GCC_defs.mk needs to be lazy ('=' vs. ':=') so that CompilerTest can override it: The Clang -verify mode wants the input files to specify whether the loplugin diagnostics are warnings or errros, so they consistently need to be errors independent of --enable-werror configuration. * A first (example) test is in compilerplugins/clang/test/salbool.cxx. The corresponding gbuild CompilerTest instance is in solenv/CompilerTest_compilerplugins_clang.mk for now. The reason for that odd split across compilerplugins/ and solenv/ is that there is no compilerplugins/Modules_compilerplugins.mk file, so this setup is the easiest hack for now (to be cleaned up). (Another area that could be improved is that all test files need to be listed explicitly in the CompilerTest_*.mk file, instead of, say, using all .c/.cxx/.m/.mm files in a specified directory.) * The test is run somewhat late during a top-level 'make', after loplugin has already been used in compilation. But it can be run manually (e.g., 'make solenv') when making changes to loplugin during development. Change-Id: I01e12fb84887d264ac03ef2484807458c2075af4
2016-11-14CXXDestructorDecl is already handledStephan Bergmann
...a few lines up, together with CXXConstructorDecl Change-Id: Id9afd4d3936b2efb92de3c6ab950da78d876a5a8
2016-11-14ignore constructors for method-can-be-private analysisNoel Grandin
doesn't work right now Change-Id: I43693104f4af204a6bd0c22b0f7ef53c1a14bb6e
2016-11-14tdf#68118: Pass current document frame to SvxScriptSelectorDialogMike Kaganski
... through MacroChooser Without this, current document's macros library is unavailable in "Assign" dialog Change-Id: I83baa3b98858260eab61e8f4fefde3f9979c6d83 Reviewed-on: https://gerrit.libreoffice.org/30600 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2016-11-11update vclwidget loplugin to find ref-dropping assigmentNoel Grandin
Look for places where we are accidentally assigning a returned-by-value VclPtr<T> to a T*, which generally ends up in a use-after-free. Change-Id: I4f361eaca88820cdb7aa3b8340212db61580fdd9 Reviewed-on: https://gerrit.libreoffice.org/30749 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-08loplugin:oncevarNoel Grandin
Change-Id: I44fb6858eeff14fcbd9fdfbbb0aabd1433b6a27d Reviewed-on: https://gerrit.libreoffice.org/30668 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-04move loplugin:defaultparams to store/Eike Rathke
As per IRC 2016-11-04 12:21 Change-Id: Ic4cc7f67fb31be80a966c652cb30bb859f874a8b
2016-11-04-Werror=unused-functionStephan Bergmann
Change-Id: I33790862cfe40693921d07182ccf4645c3ef28a3
2016-11-04update loplugin:unnnecessaryvirtual to handler destructorsNoel Grandin
and update modules writerfilter..xmloff with the resulting changes Change-Id: I54d19c22ddb0ff579b32e4934d266c925b19305c Reviewed-on: https://gerrit.libreoffice.org/30530 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-02loplugin:unusedfieldsNoel Grandin
Change-Id: I96634c18ba6600f8f7d5d04a162dcd7e1e312923 Reviewed-on: https://gerrit.libreoffice.org/30474 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-01disable this chunk of loplugin code on clang < 3.8Noel Grandin
not worth the spaghetti of making it work across version Change-Id: I0de923b16fb6d58cbad55adc9878ab39bc0c86ae
2016-10-31loplugin:vclwidgets: Adapt iterator hack to libc++Stephan Bergmann
Change-Id: I1e4fbb06578b2b1d6de4b57507693b014d36cd3a