summaryrefslogtreecommitdiff
path: root/compilerplugins/clang
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-09-19 15:52:05 +0200
committerNoel Grandin <noel@peralex.com>2014-09-29 12:50:35 +0200
commit07ca074e425ea381b9de1e7298be11678d3f6b38 (patch)
treee81f6b285fb16788fcbb4184c5f84c294bfa40d9 /compilerplugins/clang
parent6129aea3a5bad629a108363f3a7fbf135e796092 (diff)
cstylecast plugin: ignore templates, improve message
Change-Id: I8347010d5607dc2cbb113b33f1cb2cc78ec106d2
Diffstat (limited to 'compilerplugins/clang')
-rw-r--r--compilerplugins/clang/store/cstylecast.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/compilerplugins/clang/store/cstylecast.cxx b/compilerplugins/clang/store/cstylecast.cxx
index 5183e26ff27e..c34a6bd7a95c 100644
--- a/compilerplugins/clang/store/cstylecast.cxx
+++ b/compilerplugins/clang/store/cstylecast.cxx
@@ -58,6 +58,10 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
if( expr->getCastKind() == CK_BitCast ) {
return true;
}
+ // ignore stuff from inside templates for now
+ if( expr->getCastKind() == CK_Dependent ) {
+ return true;
+ }
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
expr->getLocStart());
StringRef filename = compiler.getSourceManager().getFilename(spellingLocation);
@@ -66,16 +70,18 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
return true;
}
if ( compat::isInMainFile(compiler.getSourceManager(), spellingLocation)
- ? (filename.startswith(SRCDIR "/sal")) // sal has tons of weird stuff going on that I don't understand enough to fix
+ ? (filename.startswith(SRCDIR "/sal") // sal has tons of weird stuff going on that I don't understand enough to fix
+ || filename.startswith(SRCDIR "/bridges")) // I'm not messing with this code - far too dangerous
: (filename.startswith(SRCDIR "/include/tools/solar.h")) ) {
return true;
}
report(
DiagnosticsEngine::Warning,
- "c-style cast, type=%0, from=%1, recommendedFix=%2",
+ "c-style cast, type=%0, from=%1, to=%2, recommendedFix=%3",
expr->getSourceRange().getBegin())
<< expr->getCastKind()
<< expr->getSubExprAsWritten()->getType()
+ << expr->getType()
<< recommendedFix(expr->getCastKind())
<< expr->getSourceRange();
return true;