[lldb] Fix -Wdangling-else warning in CommunicationTest
authorJonas Devlieghere <jonas@devlieghere.com>
Thu, 9 Mar 2023 06:21:00 +0000 (22:21 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Thu, 9 Mar 2023 06:21:00 +0000 (22:21 -0800)
Fixed warning: suggest explicit braces to avoid ambiguous ‘else’
[-Wdangling-else]

lldb/unittests/Core/CommunicationTest.cpp

index 19ca4cb..df9ff08 100644 (file)
@@ -86,8 +86,9 @@ static void CommunicationReadTest(bool use_read_thread) {
 
   // Test using Communication that is disconnected.
   ASSERT_EQ(comm.Disconnect(), lldb::eConnectionStatusSuccess);
-  if (use_read_thread)
+  if (use_read_thread) {
     ASSERT_TRUE(comm.StartReadThread());
+  }
   error.Clear();
   EXPECT_EQ(
       comm.Read(buf, sizeof(buf), std::chrono::seconds(5), status, &error), 0U);
@@ -97,8 +98,9 @@ static void CommunicationReadTest(bool use_read_thread) {
 
   // Test using Communication without a connection.
   comm.SetConnection(nullptr);
-  if (use_read_thread)
+  if (use_read_thread) {
     ASSERT_TRUE(comm.StartReadThread());
+  }
   error.Clear();
   EXPECT_EQ(
       comm.Read(buf, sizeof(buf), std::chrono::seconds(5), status, &error), 0U);