Krishna-13-cyber updated this revision to Diff 507113.
Krishna-13-cyber added a comment.

I have updated the patch without removing the whole of the previous block.I 
have added a condition to find the case where we don't need a diagnostic 
message to be printed or warned.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146376/new/

https://reviews.llvm.org/D146376

Files:
  clang/lib/Sema/SemaDeclCXX.cpp


Index: clang/lib/Sema/SemaDeclCXX.cpp
===================================================================
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -16723,7 +16723,7 @@
     if ((isa<CXXBoolLiteralExpr>(LHS) && RHS->getType()->isBooleanType()) ||
         (isa<CXXBoolLiteralExpr>(RHS) && LHS->getType()->isBooleanType()))
       return;
-
+      
     // Don't print obvious expressions.
     if (!UsefulToPrintExpr(LHS) && !UsefulToPrintExpr(RHS))
       return;
@@ -16744,9 +16744,16 @@
           DiagSide[I].Result.Val, Side->getType(), DiagSide[I].ValueString);
     }
     if (DiagSide[0].Print && DiagSide[1].Print) {
+      if (DiagSide[0].ValueString == SmallString<12>("false") && 
DiagSide[1].ValueString == SmallString<12>("false"))
+      {
+        return;
+      }
+      else
+      {
       Diag(Op->getExprLoc(), diag::note_expr_evaluates_to)
           << DiagSide[0].ValueString << Op->getOpcodeStr()
           << DiagSide[1].ValueString << Op->getSourceRange();
+      }
     }
   }
 }


Index: clang/lib/Sema/SemaDeclCXX.cpp
===================================================================
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -16723,7 +16723,7 @@
     if ((isa<CXXBoolLiteralExpr>(LHS) && RHS->getType()->isBooleanType()) ||
         (isa<CXXBoolLiteralExpr>(RHS) && LHS->getType()->isBooleanType()))
       return;
-
+      
     // Don't print obvious expressions.
     if (!UsefulToPrintExpr(LHS) && !UsefulToPrintExpr(RHS))
       return;
@@ -16744,9 +16744,16 @@
           DiagSide[I].Result.Val, Side->getType(), DiagSide[I].ValueString);
     }
     if (DiagSide[0].Print && DiagSide[1].Print) {
+      if (DiagSide[0].ValueString == SmallString<12>("false") && DiagSide[1].ValueString == SmallString<12>("false"))
+      {
+        return;
+      }
+      else
+      {
       Diag(Op->getExprLoc(), diag::note_expr_evaluates_to)
           << DiagSide[0].ValueString << Op->getOpcodeStr()
           << DiagSide[1].ValueString << Op->getSourceRange();
+      }
     }
   }
 }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to