[Lldb-commits] [lldb] f009241 - [lldb] Fix -Wdangling-else warning in CommunicationTest

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 8 22:25:11 PST 2023


Author: Jonas Devlieghere
Date: 2023-03-08T22:21:00-08:00
New Revision: f009241ae595ae6db5a859e498f72fd7e5dc6ce8

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

LOG: [lldb] Fix -Wdangling-else warning in CommunicationTest

Fixed warning: suggest explicit braces to avoid ambiguous ‘else’
[-Wdangling-else]

Added: 
    

Modified: 
    lldb/unittests/Core/CommunicationTest.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Core/CommunicationTest.cpp b/lldb/unittests/Core/CommunicationTest.cpp
index 19ca4cb3d2493..df9ff089a0d73 100644
--- a/lldb/unittests/Core/CommunicationTest.cpp
+++ b/lldb/unittests/Core/CommunicationTest.cpp
@@ -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);


        


More information about the lldb-commits mailing list