summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compilerplugins/clang/toolslong.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/compilerplugins/clang/toolslong.cxx b/compilerplugins/clang/toolslong.cxx
index 26105a2697d8..5a3932e90dbd 100644
--- a/compilerplugins/clang/toolslong.cxx
+++ b/compilerplugins/clang/toolslong.cxx
@@ -420,6 +420,12 @@ bool ToolsLong::VisitCStyleCastExpr(CStyleCastExpr* expr)
SourceLocation loc{ compat::getBeginLoc(expr) };
while (compiler.getSourceManager().isMacroArgExpansion(loc))
loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
+ if (compiler.getSourceManager().isMacroBodyExpansion(loc)
+ && compiler.getSourceManager().isInSystemHeader(
+ compiler.getSourceManager().getSpellingLoc(loc)))
+ {
+ return true;
+ }
report(DiagnosticsEngine::Warning, "CStyleCastExpr, suspicious cast from %0 to %1",
compat::getBeginLoc(expr))
<< expr->getSubExpr()->IgnoreParenImpCasts()->getType() << expr->getType()