diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-06 13:42:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-07 07:07:40 +0000 |
commit | 26e7c6d6abf889a7e5bbc0fa4f73034f9cbd07b9 (patch) | |
tree | 2a47812e7598234339f34671369ecf07db65ed8b /compilerplugins | |
parent | 8e9b4227b739d735a4c232a5f0e7df47a4e94be9 (diff) |
loplugin:redundantcast check for c-style char casts
Change-Id: Id6881262e370fd563ec29db95e4af5cfcb04ea34
Reviewed-on: https://gerrit.libreoffice.org/36247
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/redundantcast.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx index 20a04b2176c7..72391256b285 100644 --- a/compilerplugins/clang/redundantcast.cxx +++ b/compilerplugins/clang/redundantcast.cxx @@ -330,9 +330,18 @@ bool RedundantCast::VisitCStyleCastExpr(CStyleCastExpr const * expr) { << t1 << t2 << expr->getSourceRange(); return true; } - bool bBuiltinType = t1->isSpecificBuiltinType(BuiltinType::Bool) || t1->isSpecificBuiltinType(BuiltinType::Double) + bool bBuiltinType = t1->isSpecificBuiltinType(BuiltinType::Bool) + || t1->isSpecificBuiltinType(BuiltinType::Void) || t1->isSpecificBuiltinType(BuiltinType::Float) - || t1->isSpecificBuiltinType(BuiltinType::Void); + || t1->isSpecificBuiltinType(BuiltinType::Double) + || t1->isSpecificBuiltinType(BuiltinType::UChar) + || t1->isSpecificBuiltinType(BuiltinType::Char_U) + || t1->isSpecificBuiltinType(BuiltinType::SChar) + || t1->isSpecificBuiltinType(BuiltinType::Char_S) + || t1->isSpecificBuiltinType(BuiltinType::Char16) + || t1->isSpecificBuiltinType(BuiltinType::Char32) + || t1->isSpecificBuiltinType(BuiltinType::WChar_U) + || t1->isSpecificBuiltinType(BuiltinType::WChar_S); if ((bBuiltinType || loplugin::TypeCheck(t1).Typedef()) && t1 == t2) { // Ignore FD_ISSET expanding to "...(SOCKET)(fd)..." in some Microsoft |