diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-28 18:56:43 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-28 19:09:17 +0100 |
commit | 13e45d6fdec650e37ca8c6f41aaea24c6fa2c349 (patch) | |
tree | f78ab7fa03a5b3dce30746ed1c473733b8c88340 /compilerplugins | |
parent | test for tdf#90001 (diff) | |
download | core-13e45d6fdec650e37ca8c6f41aaea24c6fa2c349.tar.gz core-13e45d6fdec650e37ca8c6f41aaea24c6fa2c349.zip |
loplugin:redundantcast: Don't warn about certain casts in macros
...that might depend on macro arguments and not really be redundant
Change-Id: If19de3835a4972add58965ea7c0936fad7ef6957
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/redundantcast.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx index 1f580e588293..22e2ddf0094a 100644 --- a/compilerplugins/clang/redundantcast.cxx +++ b/compilerplugins/clang/redundantcast.cxx @@ -25,6 +25,7 @@ #include "clang/Sema/Sema.h" +#include "compat.hxx" #include "plugin.hxx" namespace { @@ -143,7 +144,9 @@ if(!cc->getSubExpr()->getType()->isPointerType()){ } else if (isa<CXXStaticCastExpr>(e) && isVoidPointer( dyn_cast<CXXStaticCastExpr>(e)->getSubExpr() - ->IgnoreParenImpCasts()->getType())) + ->IgnoreParenImpCasts()->getType()) + && !compat::isMacroBodyExpansion( + compiler, e->getLocStart())) { report( DiagnosticsEngine::Warning, |