From 9b51d16771175b1245f755d28877fd61a0b432a1 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 18 May 2017 14:26:47 +0200 Subject: Remove unnecessary restrictions Change-Id: Idc0db273f7ad2d6b11113752ca01a1f2a327e991 --- compilerplugins/clang/comparisonwithconstant.cxx | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/comparisonwithconstant.cxx b/compilerplugins/clang/comparisonwithconstant.cxx index 1c7daf5c3c4f..180e45df3a5c 100644 --- a/compilerplugins/clang/comparisonwithconstant.cxx +++ b/compilerplugins/clang/comparisonwithconstant.cxx @@ -74,11 +74,6 @@ bool ComparisonWithConstant::VisitBinaryOperator(const BinaryOperator* binaryOp) if (!(binaryOp->getOpcode() == BO_EQ || binaryOp->getOpcode() == BO_NE)) { return true; } - // ignore logging macros - if (compiler.getSourceManager().isMacroBodyExpansion(binaryOp->getSourceRange().getBegin()) - || compiler.getSourceManager().isMacroArgExpansion(binaryOp->getSourceRange().getBegin())) { - return true; - } // protect against clang assert if (binaryOp->getLHS()->isValueDependent() || binaryOp->getRHS()->isValueDependent()) { return true; @@ -118,14 +113,6 @@ bool ComparisonWithConstant::rewrite(const BinaryOperator * binaryOp) { const std::string lhsString = getExprAsString(lhsRange); 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 if (!replaceText(lhsRange, rhsString)) { return false; -- cgit