[PATCH] D119066: [Support] Fix for two issues with clearing of the internal storage for cl::bits

Riyaz V Puthiyapurayil via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 6 11:56:45 PST 2022


RVP added a comment.

The pre-merge build shows a failure due to some unit tests timing out. I am not able to see any relation. Please let me know otherwise. Thanks.



================
Comment at: llvm/include/llvm/Support/CommandLine.h:1731
 template <class DataType> class bits_storage<DataType, bool> {
-  unsigned Bits; // Where to store the bits...
 
----------------
Previously, uninitialized if cl::bits has non-static lifetime


================
Comment at: llvm/unittests/Support/CommandLineTest.cpp:1954
   EXPECT_TRUE(Option);
+  EXPECT_EQ((1u << ValA) | (1u << ValC), Bits.getBits());
   EXPECT_EQ(1u, Sink.size());
----------------
Without the initialization, this EXPECT will fail.


================
Comment at: llvm/unittests/Support/CommandLineTest.cpp:1963
   EXPECT_FALSE(Option);
+  EXPECT_EQ(0u, Bits.getBits());
   EXPECT_EQ(0u, Sink.size());
----------------
Without the fix in setDefault, this EXPECT will fail.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119066/new/

https://reviews.llvm.org/D119066



More information about the llvm-commits mailing list