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
This commit is contained in:
@@ -47,7 +47,8 @@ bool LiteralToBoolConversion::VisitImplicitCastExpr(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
APSInt res;
|
APSInt res;
|
||||||
if (sub->isIntegerConstantExpr(res, compiler.getASTContext())
|
if (!sub->isValueDependent()
|
||||||
|
&& sub->isIntegerConstantExpr(res, compiler.getASTContext())
|
||||||
&& res.getLimitedValue() <= 1)
|
&& res.getLimitedValue() <= 1)
|
||||||
{
|
{
|
||||||
SourceLocation loc { sub->getLocStart() };
|
SourceLocation loc { sub->getLocStart() };
|
||||||
@@ -132,7 +133,9 @@ bool LiteralToBoolConversion::VisitImplicitCastExpr(
|
|||||||
expr->getLocStart())
|
expr->getLocStart())
|
||||||
<< expr->getCastKindName() << expr->getSubExpr()->getType()
|
<< expr->getCastKindName() << expr->getSubExpr()->getType()
|
||||||
<< expr->getType() << expr->getSourceRange();
|
<< expr->getType() << expr->getSourceRange();
|
||||||
} else if (sub->isIntegerConstantExpr(res, compiler.getASTContext())) {
|
} else if (!sub->isValueDependent()
|
||||||
|
&& sub->isIntegerConstantExpr(res, compiler.getASTContext()))
|
||||||
|
{
|
||||||
report(
|
report(
|
||||||
DiagnosticsEngine::Warning,
|
DiagnosticsEngine::Warning,
|
||||||
("implicit conversion (%0) of integer constant expression of type"
|
("implicit conversion (%0) of integer constant expression of type"
|
||||||
|
Reference in New Issue
Block a user