From 26e7c6d6abf889a7e5bbc0fa4f73034f9cbd07b9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 6 Apr 2017 13:42:59 +0200 Subject: loplugin:redundantcast check for c-style char casts Change-Id: Id6881262e370fd563ec29db95e4af5cfcb04ea34 Reviewed-on: https://gerrit.libreoffice.org/36247 Tested-by: Jenkins Reviewed-by: Noel Grandin --- compilerplugins/clang/redundantcast.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'compilerplugins') 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 -- cgit