new loplugin: pointerbool

look for possibly bogus implicit conversions to bool when passing
(normally pointer) args to bool params.

this plugin comes in the wake of a couple of bugs caused by refactoring,
where some of the call sites were not currently updated.

Of the changes, the following are real bugs:

desktop/../dp_persmap.cxx

StartInputFieldDlg
    in sw/../fldmgr.cxx
which occurred as a result of
    commit 39d719a80d
    Date:   Tue May 3 11:39:37 2016 +0200
    tdf#99529 sw: don't pop up input field dialog before inserting field

CSerializationURLEncoded::encode_and_append in
    forms/../serialization_urlencoded.cxx

XclExpCFImpl::XclExpCFImpl
    in sc/../xecontent.cxx
I have no idea how to properly fix this, just made a guess.

SwDocTest::test64kPageDescs
    in sw/qa/core/uwriter.cxx
which looks like a simple copy/paste error.

Change-Id: I795ebd5ef485a1d36863dc27fe13832989f5a441
Reviewed-on: https://gerrit.libreoffice.org/48291
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2018-01-21 13:07:10 +02:00
parent ea20bc176c
commit 91b4e45316
29 changed files with 203 additions and 35 deletions

View File

@@ -138,6 +138,15 @@ TypeCheck TypeCheck::NotSubstTemplateTypeParmType() const {
? *this : TypeCheck();
}
TypeCheck TypeCheck::SubstTemplateTypeParmType() const {
if (!type_.isNull()) {
if (auto const t = type_->getAs<clang::SubstTemplateTypeParmType>()) {
return TypeCheck(t->desugar());
}
}
return TypeCheck();
}
ContextCheck DeclCheck::Operator(clang::OverloadedOperatorKind op) const {
assert(op != clang::OO_None);
auto f = llvm::dyn_cast_or_null<clang::FunctionDecl>(decl_);