[Lldb-commits] [lldb] dddb9d1 - [lldb][test] Fix missing-braces warnings in unit tests

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 21 05:36:14 PST 2023


Author: David Spickett
Date: 2023-12-21T13:36:04Z
New Revision: dddb9d1ee3e283133ce1abb50b7c7a3715317b9d

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

LOG: [lldb][test] Fix missing-braces warnings in unit tests

```
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/unittests/Utility/ChecksumTest.cpp:15:38: warning: suggest braces around initialization of subobject [-Wmissing-braces]
static llvm::MD5::MD5Result hash1 = {0, 1, 2,  3,  4,  5,  6,  7,
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                     {
```
And others.

Added: 
    

Modified: 
    lldb/unittests/Utility/ChecksumTest.cpp
    lldb/unittests/Utility/FileSpecTest.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Utility/ChecksumTest.cpp b/lldb/unittests/Utility/ChecksumTest.cpp
index 7537d30b5ff5b8..a81aba2ee98ca1 100644
--- a/lldb/unittests/Utility/ChecksumTest.cpp
+++ b/lldb/unittests/Utility/ChecksumTest.cpp
@@ -12,14 +12,14 @@
 
 using namespace lldb_private;
 
-static llvm::MD5::MD5Result hash1 = {0, 1, 2,  3,  4,  5,  6,  7,
-                                     8, 9, 10, 11, 12, 13, 14, 15};
+static llvm::MD5::MD5Result hash1 = {
+    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}};
 
-static llvm::MD5::MD5Result hash2 = {0, 1, 2,  3,  4,  5,  6,  7,
-                                     8, 9, 10, 11, 12, 13, 14, 15};
+static llvm::MD5::MD5Result hash2 = {
+    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}};
 
-static llvm::MD5::MD5Result hash3 = {8, 9, 10, 11, 12, 13, 14, 15,
-                                     0, 1, 2,  3,  4,  5,  6,  7};
+static llvm::MD5::MD5Result hash3 = {
+    {8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7}};
 
 TEST(ChecksumTest, TestConstructor) {
   Checksum checksum1;

diff  --git a/lldb/unittests/Utility/FileSpecTest.cpp b/lldb/unittests/Utility/FileSpecTest.cpp
index 565395a495be60..9faad10e47301a 100644
--- a/lldb/unittests/Utility/FileSpecTest.cpp
+++ b/lldb/unittests/Utility/FileSpecTest.cpp
@@ -536,7 +536,8 @@ TEST(FileSpecTest, TestGetComponents) {
 }
 
 TEST(FileSpecTest, TestChecksum) {
-  Checksum checksum({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15});
+  Checksum checksum(llvm::MD5::MD5Result{
+      {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}});
   FileSpec file_spec("/foo/bar", FileSpec::Style::posix, checksum);
   EXPECT_TRUE(static_cast<bool>(file_spec.GetChecksum()));
   EXPECT_EQ(file_spec.GetChecksum(), checksum);


        


More information about the lldb-commits mailing list