summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-01-29 11:15:32 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-01-29 11:15:44 +0100
commitc03a2a0b1b78428d9c44519c5e2bf3c1dde78425 (patch)
treeb4b5b1292e680090de350eb89b88c8fa20dd86c4 /compilerplugins
parent9038a3ef7c10aff868636715924cb9f97d648d80 (diff)
Further fix for old Clang versions
...maybe this needs adaption for 3.3 or 3.4 too, known to work with trunk towards 3.5. Change-Id: I9f05ae44e4a49ae51df69d5a3c1df5eb371a1c87
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/literaltoboolconversion.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/compilerplugins/clang/literaltoboolconversion.cxx b/compilerplugins/clang/literaltoboolconversion.cxx
index 1ede8b52c12b..5c61647ce09b 100644
--- a/compilerplugins/clang/literaltoboolconversion.cxx
+++ b/compilerplugins/clang/literaltoboolconversion.cxx
@@ -114,6 +114,14 @@ bool LiteralToBoolConversion::VisitImplicitCastExpr(
<< expr->getCastKindName() << expr->getSubExpr()->getType()
<< expr->getType() << expr->getSourceRange();
}
+// At least Clang 3.2 would erroneously warn about Cache::add
+// (binaryurp/source/cache.hxx:53)
+//
+// if( !size_) {
+//
+// as "implicit conversion (IntegralToBoolean) of null pointer constant of type
+// 'std::size_t' (aka 'unsigned long') to 'bool'":
+#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3
} else if (sub->isNullPointerConstant(
compiler.getASTContext(), Expr::NPC_ValueDependentIsNull)
!= Expr::NPCK_NotNull)
@@ -125,6 +133,7 @@ bool LiteralToBoolConversion::VisitImplicitCastExpr(
expr->getLocStart())
<< expr->getCastKindName() << expr->getSubExpr()->getType()
<< expr->getType() << expr->getSourceRange();
+#endif
} else if (sub->isIntegerConstantExpr(compiler.getASTContext())) {
report(
DiagnosticsEngine::Warning,