[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Thu May 18 12:27:40 UTC 2017


 compilerplugins/clang/comparisonwithconstant.cxx |   13 -------------
 1 file changed, 13 deletions(-)

New commits:
commit 9b51d16771175b1245f755d28877fd61a0b432a1
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu May 18 14:26:47 2017 +0200

    Remove unnecessary restrictions
    
    Change-Id: Idc0db273f7ad2d6b11113752ca01a1f2a327e991

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;


More information about the Libreoffice-commits mailing list