]> granicus.if.org Git - clang/commitdiff
Simplify PDiag's move assignment overload a bit, the self-move check isn't actually...
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 6 Dec 2012 20:12:03 +0000 (20:12 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 6 Dec 2012 20:12:03 +0000 (20:12 +0000)
This just empties out the diag, which is fine.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169542 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/PartialDiagnostic.h

index 63363a9e93fdbc3a8cfa6141837d69957e061310..0ac42961d32dfbb586ba9141fd6c1d8b204cb34c 100644 (file)
@@ -253,17 +253,13 @@ public:
 
 #if LLVM_HAS_RVALUE_REFERENCES
   PartialDiagnostic &operator=(PartialDiagnostic &&Other) {
-    if (this != &Other) {
-      if (DiagStorage)
-        freeStorage();
-
-      DiagID = Other.DiagID;
-      DiagStorage = Other.DiagStorage;
-      Allocator = Other.Allocator;
+    freeStorage();
 
-      Other.DiagStorage = 0;
-    }
+    DiagID = Other.DiagID;
+    DiagStorage = Other.DiagStorage;
+    Allocator = Other.Allocator;
 
+    Other.DiagStorage = 0;
     return *this;
   }
 #endif