[llvm] r356286 - [ConstantRange] Try to fix compiler warnings; NFC

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 15 11:08:06 PDT 2019


Author: nikic
Date: Fri Mar 15 11:08:06 2019
New Revision: 356286

URL: http://llvm.org/viewvc/llvm-project?rev=356286&view=rev
Log:
[ConstantRange] Try to fix compiler warnings; NFC

Try to fix "ignoring return value" and "default label" errors on
clang-with-thin-lto-ubuntu buildbot.

Modified:
    llvm/trunk/unittests/IR/ConstantRangeTest.cpp

Modified: llvm/trunk/unittests/IR/ConstantRangeTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/ConstantRangeTest.cpp?rev=356286&r1=356285&r2=356286&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/ConstantRangeTest.cpp (original)
+++ llvm/trunk/unittests/IR/ConstantRangeTest.cpp Fri Mar 15 11:08:06 2019
@@ -1318,9 +1318,9 @@ static void TestOverflowExhaustive(Fn1 O
           bool RangeHasOverflow = false;
           bool RangeHasNoOverflow = false;
           APInt N1(Bits, Lo1);
-          for (unsigned I1 = 0; I1 < Size1; I1++, N1++) {
+          for (unsigned I1 = 0; I1 < Size1; ++I1, ++N1) {
             APInt N2(Bits, Lo2);
-            for (unsigned I2 = 0; I2 < Size2; I2++, N2++) {
+            for (unsigned I2 = 0; I2 < Size2; ++I2, ++N2) {
               assert(CR1.contains(N1));
               assert(CR2.contains(N2));
 
@@ -1351,8 +1351,6 @@ static void TestOverflowExhaustive(Fn1 O
               EXPECT_TRUE(RangeHasOverflow);
               EXPECT_TRUE(RangeHasNoOverflow);
               break;
-            default:
-              llvm_unreachable("Invalid enum return value");
           }
         }
       }
@@ -1364,7 +1362,7 @@ TEST_F(ConstantRangeTest, UnsignedAddOve
   TestOverflowExhaustive(
       [](const APInt &N1, const APInt &N2) {
         bool Overflow;
-        N1.uadd_ov(N2, Overflow);
+        (void) N1.uadd_ov(N2, Overflow);
         return Overflow;
       },
       [](const ConstantRange &CR1, const ConstantRange &CR2) {
@@ -1376,7 +1374,7 @@ TEST_F(ConstantRangeTest, UnsignedSubOve
   TestOverflowExhaustive(
       [](const APInt &N1, const APInt &N2) {
         bool Overflow;
-        N1.usub_ov(N2, Overflow);
+        (void) N1.usub_ov(N2, Overflow);
         return Overflow;
       },
       [](const ConstantRange &CR1, const ConstantRange &CR2) {
@@ -1388,7 +1386,7 @@ TEST_F(ConstantRangeTest, SignedAddOverf
   TestOverflowExhaustive(
       [](const APInt &N1, const APInt &N2) {
         bool Overflow;
-        N1.sadd_ov(N2, Overflow);
+        (void) N1.sadd_ov(N2, Overflow);
         return Overflow;
       },
       [](const ConstantRange &CR1, const ConstantRange &CR2) {
@@ -1400,7 +1398,7 @@ TEST_F(ConstantRangeTest, SignedSubOverf
   TestOverflowExhaustive(
       [](const APInt &N1, const APInt &N2) {
         bool Overflow;
-        N1.ssub_ov(N2, Overflow);
+        (void) N1.ssub_ov(N2, Overflow);
         return Overflow;
       },
       [](const ConstantRange &CR1, const ConstantRange &CR2) {




More information about the llvm-commits mailing list