summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-11 16:01:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-11 16:10:01 +0200
commitb533b2748e0f0ce4d5263f5f5720280c51803e25 (patch)
treef60e2280a9cddfc946e1debcd5a1bef4aedef913 /compilerplugins
parent673347af7d37f6789855c17732c9980d91ec6240 (diff)
unusedfields plugin needs to ignore fields that have reinterpret_cast on them
Change-Id: Ie8570de6a4eafc95352899fbfd1447d7c3a84e1a
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/unusedfields.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx
index 3de31c3c8ae6..72354f757d90 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -305,7 +305,13 @@ void UnusedFields::checkWriteOnly(const FieldDecl* fieldDecl, const Expr* member
return;
break;
}
- if (isa<CastExpr>(parent) || isa<MemberExpr>(parent) || isa<ParenExpr>(parent) || isa<ParenListExpr>(parent)
+ if (isa<CXXReinterpretCastExpr>(parent))
+ {
+ // once we see one of these, there is not much useful we can know
+ bPotentiallyReadFrom = true;
+ break;
+ }
+ else if (isa<CastExpr>(parent) || isa<MemberExpr>(parent) || isa<ParenExpr>(parent) || isa<ParenListExpr>(parent)
#if CLANG_VERSION >= 40000
|| isa<ArrayInitLoopExpr>(parent)
#endif