summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/salunicodeliteral.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-06-02 09:38:15 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-06-02 09:38:15 +0200
commitbeae2dd6c88d341f8c7de567c3da9fcc1ff423ab (patch)
treebdba428d2195d423c3a8cf9c6d07e00bcbd280ae /compilerplugins/clang/salunicodeliteral.cxx
parent6a62339a6cc236cc39b827658099c3883fcffaa2 (diff)
Improved loplugin:redundantcast static_cast handling
Change-Id: I74e4ebda40f95661c5ae344132fcabbbf08ab0a4
Diffstat (limited to 'compilerplugins/clang/salunicodeliteral.cxx')
-rw-r--r--compilerplugins/clang/salunicodeliteral.cxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/compilerplugins/clang/salunicodeliteral.cxx b/compilerplugins/clang/salunicodeliteral.cxx
index 6b03156b55e7..410a1aba45c9 100644
--- a/compilerplugins/clang/salunicodeliteral.cxx
+++ b/compilerplugins/clang/salunicodeliteral.cxx
@@ -52,13 +52,23 @@ private:
void check(ExplicitCastExpr const * expr) {
if (ignoreLocation(expr)
- || isInUnoIncludeFile(expr->getExprLoc())
+ || isInUnoIncludeFile(expr->getExprLoc()))
//TODO: '#ifdef LIBO_INTERNAL_ONLY' within UNO include files
- || !(loplugin::TypeCheck(expr->getTypeAsWritten())
- .Typedef("sal_Unicode").GlobalNamespace()))
{
return;
}
+ for (auto t = expr->getTypeAsWritten();;) {
+ auto const tt = t->getAs<TypedefType>();
+ if (tt == nullptr) {
+ return;
+ }
+ if (loplugin::TypeCheck(t).Typedef("sal_Unicode")
+ .GlobalNamespace())
+ {
+ break;
+ }
+ t = tt->desugar();
+ }
auto const e1 = expr->getSubExprAsWritten();
auto const loc = e1->getLocStart();
if (loc.isMacroID()