summaryrefslogtreecommitdiffstats
path: root/compilerplugins/clang/redundantcast.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-14 13:59:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-14 14:43:43 +0200
commit5685ee25aad4a4debb47fb5896082be48f521d17 (patch)
treeba2d8f9341fc1124097e70cae64e1f07cc920712 /compilerplugins/clang/redundantcast.cxx
parentconnect to modified instead of up/down/focus-lost (diff)
downloadcore-5685ee25aad4a4debb47fb5896082be48f521d17.tar.gz
core-5685ee25aad4a4debb47fb5896082be48f521d17.zip
improve redundantcast loplugin
to find c-style casts where the expression is a templated method Change-Id: Ifbd1e2cdc72d906fc95a7ec0f9408c3f6d2a836b Reviewed-on: https://gerrit.libreoffice.org/42275 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/redundantcast.cxx')
-rw-r--r--compilerplugins/clang/redundantcast.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx
index 19393e0c6449..32f7e8bd7fd9 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -294,6 +294,9 @@ bool RedundantCast::VisitCStyleCastExpr(CStyleCastExpr const * expr) {
}
auto t1 = compat::getSubExprAsWritten(expr)->getType();
auto t2 = expr->getTypeAsWritten();
+ if (auto templateType = dyn_cast<SubstTemplateTypeParmType>(t1)) {
+ t1 = templateType->desugar();
+ }
if (t1 != t2) {
return true;
}