diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-21 15:45:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-22 07:44:16 +0100 |
commit | 640e03da110d76b2c7d5ed5b8b8ba3b4367865ba (patch) | |
tree | 79856af3daab1e809c388ac27aa2f3284842235c /compilerplugins | |
parent | a0ebba3d8855fee0bcec04a10137ae3a4f9f0e77 (diff) |
loplugin:simplifybool re-activate the !! warning
Change-Id: Iac7d82a1c228734177be536e9a6c41803c03637b
Reviewed-on: https://gerrit.libreoffice.org/45035
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/simplifybool.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compilerplugins/clang/simplifybool.cxx b/compilerplugins/clang/simplifybool.cxx index faf0849b3f40..cf5570b60008 100644 --- a/compilerplugins/clang/simplifybool.cxx +++ b/compilerplugins/clang/simplifybool.cxx @@ -90,7 +90,14 @@ bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) { if (e == nullptr) { return true; } -/* hits for OSL_ENSURE(!b, ...); + // Ignore macros, otherwise + // OSL_ENSURE(!b, ...); + // triggers. + if (e->getLocStart().isMacroID()) + return true; + // double logical not of an int is an idiom to convert to bool + if (!e->IgnoreImpCasts()->getType()->isBooleanType()) + return true; report( DiagnosticsEngine::Warning, ("double logical negation expression of the form '!!A' (with A of type" @@ -99,7 +106,6 @@ bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) { << e->IgnoreImpCasts()->getType() << e->IgnoreImpCasts()->getType()->isBooleanType() << expr->getSourceRange(); -*/ return true; } |