diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-12-21 22:00:40 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-12-21 22:00:40 +0100 |
commit | f266c81b2d692068d49e682f50447ef700f10fc6 (patch) | |
tree | e568881522b4f13c09507f6ec5bd16b52a2a76d9 /compilerplugins | |
parent | fb7c18884223f08818b44a9953b55c69a029c71c (diff) |
Don't call isIntegerConstantExpr if isValueDependent
...some paths trough clang::Expr::isIntegerConstantExpr (esp. if
non-CPlusPlus11) assert the assumption that the given expr is not
value-dependent, so it appears to be a prereq
Change-Id: Ibc5fe472ea3f91b31c8cb7f06c4b7c7f4d6831a3
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/literaltoboolconversion.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compilerplugins/clang/literaltoboolconversion.cxx b/compilerplugins/clang/literaltoboolconversion.cxx index b84500a595b3..07a7e5084fa0 100644 --- a/compilerplugins/clang/literaltoboolconversion.cxx +++ b/compilerplugins/clang/literaltoboolconversion.cxx @@ -47,7 +47,8 @@ bool LiteralToBoolConversion::VisitImplicitCastExpr( return true; } APSInt res; - if (sub->isIntegerConstantExpr(res, compiler.getASTContext()) + if (!sub->isValueDependent() + && sub->isIntegerConstantExpr(res, compiler.getASTContext()) && res.getLimitedValue() <= 1) { SourceLocation loc { sub->getLocStart() }; @@ -132,7 +133,9 @@ bool LiteralToBoolConversion::VisitImplicitCastExpr( expr->getLocStart()) << expr->getCastKindName() << expr->getSubExpr()->getType() << expr->getType() << expr->getSourceRange(); - } else if (sub->isIntegerConstantExpr(res, compiler.getASTContext())) { + } else if (!sub->isValueDependent() + && sub->isIntegerConstantExpr(res, compiler.getASTContext())) + { report( DiagnosticsEngine::Warning, ("implicit conversion (%0) of integer constant expression of type" |