[PATCH] D86053: [APInt] Allow self-assignment with libstdc++

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 03:02:03 PDT 2020


vitalybuka created this revision.
Herald added subscribers: llvm-commits, dexonsmith.
Herald added a project: LLVM.
vitalybuka requested review of this revision.

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-ubuntu/builds/8256/steps/test-check-all/logs/FAIL%3A%20LLVM%3A%3Athinlto-function-summary-paramaccess.ll


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86053

Files:
  llvm/include/llvm/ADT/APInt.h
  llvm/unittests/ADT/APIntTest.cpp


Index: llvm/unittests/ADT/APIntTest.cpp
===================================================================
--- llvm/unittests/ADT/APIntTest.cpp
+++ llvm/unittests/ADT/APIntTest.cpp
@@ -1784,7 +1784,7 @@
 }
 
 // Test that self-move works, but only when we're using MSVC.
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__GLIBCXX__)
 #if defined(__clang__)
 // Disable the pragma warning from versions of Clang without -Wself-move
 #pragma clang diagnostic push
@@ -1813,7 +1813,7 @@
 #pragma clang diagnostic pop
 #pragma clang diagnostic pop
 #endif
-#endif // _MSC_VER
+#endif // _MSC_VER || __GLIBCXX__
 
 TEST(APIntTest, byteSwap) {
   EXPECT_EQ(0x00000000, APInt(16, 0x0000).byteSwap());
Index: llvm/include/llvm/ADT/APInt.h
===================================================================
--- llvm/include/llvm/ADT/APInt.h
+++ llvm/include/llvm/ADT/APInt.h
@@ -765,8 +765,8 @@
 
   /// Move assignment operator.
   APInt &operator=(APInt &&that) {
-#ifdef _MSC_VER
-    // The MSVC std::shuffle implementation still does self-assignment.
+#if defined(_MSC_VER) || defined(__GLIBCXX__)
+    // Some std::shuffle implementations still do self-assignment.
     if (this == &that)
       return *this;
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86053.285949.patch
Type: text/x-patch
Size: 1225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200817/0299d16a/attachment.bin>


More information about the llvm-commits mailing list