[llvm] 7ec2444 - unittest: Work around build failure on MSVC builders

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 20 12:38:47 PDT 2020


Author: Vedant Kumar
Date: 2020-03-20T12:38:00-07:00
New Revision: 7ec24448801c30bb0b2127f2c7b7ac10c1a009fc

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

LOG: unittest: Work around build failure on MSVC builders

MSVC insists on using the deleted move constructor instead of the copy
constructor:

http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/41203

C:\ps4-buildslave2\lld-x86_64-win7\llvm-project\llvm\unittests\ADT\CoalescingBitVectorTest.cpp(193):
error C2280: 'llvm::CoalescingBitVector<unsigned
int,16>::CoalescingBitVector(llvm::CoalescingBitVector<unsigned int,16>
&&)': attempting to reference a deleted function

Added: 
    

Modified: 
    llvm/unittests/ADT/CoalescingBitVectorTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/ADT/CoalescingBitVectorTest.cpp b/llvm/unittests/ADT/CoalescingBitVectorTest.cpp
index 06ac5df721be..4f87bf415beb 100644
--- a/llvm/unittests/ADT/CoalescingBitVectorTest.cpp
+++ b/llvm/unittests/ADT/CoalescingBitVectorTest.cpp
@@ -183,14 +183,12 @@ TEST(CoalescingBitVectorTest, Comparison) {
 
 // A simple implementation of set union, used to double-check the human
 // "expected" answer.
-UBitVec simpleUnion(UBitVec::Allocator &Alloc, const UBitVec &LHS,
+void simpleUnion(UBitVec &Union, const UBitVec &LHS,
                     const UBitVec &RHS) {
-  UBitVec Union(Alloc);
   for (unsigned Bit : LHS)
     Union.test_and_set(Bit);
   for (unsigned Bit : RHS)
     Union.test_and_set(Bit);
-  return Union;
 }
 
 TEST(CoalescingBitVectorTest, Union) {
@@ -204,7 +202,8 @@ TEST(CoalescingBitVectorTest, Union) {
     BV1.set(LHS);
     UBitVec BV2(Alloc);
     BV2.set(RHS);
-    const UBitVec &DoubleCheckedExpected = simpleUnion(Alloc, BV1, BV2);
+    UBitVec DoubleCheckedExpected(Alloc);
+    simpleUnion(DoubleCheckedExpected, BV1, BV2);
     ASSERT_TRUE(elementsMatch(DoubleCheckedExpected, Expected));
     BV1 |= BV2;
     ASSERT_TRUE(elementsMatch(BV1, Expected));
@@ -277,13 +276,11 @@ TEST(CoalescingBitVectorTest, Union) {
 
 // A simple implementation of set intersection, used to double-check the
 // human "expected" answer.
-UBitVec simpleIntersection(UBitVec::Allocator &Alloc, const UBitVec &LHS,
-                           const UBitVec &RHS) {
-  UBitVec Intersection(Alloc);
+void simpleIntersection(UBitVec &Intersection, const UBitVec &LHS,
+                        const UBitVec &RHS) {
   for (unsigned Bit : LHS)
     if (RHS.test(Bit))
       Intersection.set(Bit);
-  return Intersection;
 }
 
 TEST(CoalescingBitVectorTest, Intersection) {
@@ -297,7 +294,8 @@ TEST(CoalescingBitVectorTest, Intersection) {
     BV1.set(LHS);
     UBitVec BV2(Alloc);
     BV2.set(RHS);
-    const UBitVec &DoubleCheckedExpected = simpleIntersection(Alloc, BV1, BV2);
+    UBitVec DoubleCheckedExpected(Alloc);
+    simpleIntersection(DoubleCheckedExpected, BV1, BV2);
     ASSERT_TRUE(elementsMatch(DoubleCheckedExpected, Expected));
     BV1 &= BV2;
     ASSERT_TRUE(elementsMatch(BV1, Expected));
@@ -356,14 +354,11 @@ TEST(CoalescingBitVectorTest, Intersection) {
 
 // A simple implementation of set intersection-with-complement, used to
 // double-check the human "expected" answer.
-UBitVec simpleIntersectionWithComplement(UBitVec::Allocator &Alloc,
-                                         const UBitVec &LHS,
-                                         const UBitVec &RHS) {
-  UBitVec Intersection(Alloc);
+void simpleIntersectionWithComplement(UBitVec &Intersection, const UBitVec &LHS,
+                                      const UBitVec &RHS) {
   for (unsigned Bit : LHS)
     if (!RHS.test(Bit))
       Intersection.set(Bit);
-  return Intersection;
 }
 
 TEST(CoalescingBitVectorTest, IntersectWithComplement) {
@@ -378,8 +373,8 @@ TEST(CoalescingBitVectorTest, IntersectWithComplement) {
         BV1.set(LHS);
         UBitVec BV2(Alloc);
         BV2.set(RHS);
-        const UBitVec &DoubleCheckedExpected =
-            simpleIntersectionWithComplement(Alloc, BV1, BV2);
+        UBitVec DoubleCheckedExpected(Alloc);
+        simpleIntersectionWithComplement(DoubleCheckedExpected, BV1, BV2);
         ASSERT_TRUE(elementsMatch(DoubleCheckedExpected, Expected));
         BV1.intersectWithComplement(BV2);
         ASSERT_TRUE(elementsMatch(BV1, Expected));


        


More information about the llvm-commits mailing list