[llvm] 2249ece - [IR][ShuffleVector] Fix Wdangling-else warning in InstructionsTest

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 6 14:07:27 PDT 2021


Author: Luke Benes
Date: 2021-11-07T00:07:01+03:00
New Revision: 2249ecee8d9a6237f51485bd39f01ba031575987

URL: https://github.com/llvm/llvm-project/commit/2249ecee8d9a6237f51485bd39f01ba031575987
DIFF: https://github.com/llvm/llvm-project/commit/2249ecee8d9a6237f51485bd39f01ba031575987.diff

LOG: [IR][ShuffleVector] Fix Wdangling-else warning in InstructionsTest

Fix a dangling else that gcc-11 warned about. The EXPECT_EQ macro
expands to an if-else, so the whole construction contains a hidden
dangling else.

Differential Revision: https://reviews.llvm.org/D113346

Added: 
    

Modified: 
    llvm/unittests/IR/InstructionsTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/IR/InstructionsTest.cpp b/llvm/unittests/IR/InstructionsTest.cpp
index a4a96714e82d..5b977ef65b89 100644
--- a/llvm/unittests/IR/InstructionsTest.cpp
+++ b/llvm/unittests/IR/InstructionsTest.cpp
@@ -1204,8 +1204,9 @@ TEST(InstructionsTest, ShuffleMaskIsReplicationMask_Exhaustive_Correctness) {
         int Elt = std::get<0>(I);
         int ActualElt = std::get<0>(I);
 
-        if (Elt != -1)
+        if (Elt != -1) {
           EXPECT_EQ(Elt, ActualElt);
+        }
       }
 
       return /*Abort=*/false;


        


More information about the llvm-commits mailing list