Remove unnecessary restrictions
Change-Id: Idc0db273f7ad2d6b11113752ca01a1f2a327e991
This commit is contained in:
@@ -74,11 +74,6 @@ bool ComparisonWithConstant::VisitBinaryOperator(const BinaryOperator* binaryOp)
|
|||||||
if (!(binaryOp->getOpcode() == BO_EQ || binaryOp->getOpcode() == BO_NE)) {
|
if (!(binaryOp->getOpcode() == BO_EQ || binaryOp->getOpcode() == BO_NE)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// ignore logging macros
|
|
||||||
if (compiler.getSourceManager().isMacroBodyExpansion(binaryOp->getSourceRange().getBegin())
|
|
||||||
|| compiler.getSourceManager().isMacroArgExpansion(binaryOp->getSourceRange().getBegin())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// protect against clang assert
|
// protect against clang assert
|
||||||
if (binaryOp->getLHS()->isValueDependent() || binaryOp->getRHS()->isValueDependent()) {
|
if (binaryOp->getLHS()->isValueDependent() || binaryOp->getRHS()->isValueDependent()) {
|
||||||
return true;
|
return true;
|
||||||
@@ -118,14 +113,6 @@ bool ComparisonWithConstant::rewrite(const BinaryOperator * binaryOp) {
|
|||||||
const std::string lhsString = getExprAsString(lhsRange);
|
const std::string lhsString = getExprAsString(lhsRange);
|
||||||
const std::string rhsString = getExprAsString(rhsRange);
|
const std::string rhsString = getExprAsString(rhsRange);
|
||||||
|
|
||||||
/* we can't safely move around stuff containing comments, we mess up the resulting code */
|
|
||||||
if ( lhsString.find("/*") != std::string::npos || lhsString.find("//") != std::string::npos ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ( rhsString.find("/*") != std::string::npos || rhsString.find("//") != std::string::npos ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// switch LHS and RHS
|
// switch LHS and RHS
|
||||||
if (!replaceText(lhsRange, rhsString)) {
|
if (!replaceText(lhsRange, rhsString)) {
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user