[cfe-commits] r169542 - /cfe/trunk/include/clang/Basic/PartialDiagnostic.h

Benjamin Kramer benny.kra at googlemail.com
Thu Dec 6 12:12:03 PST 2012


Author: d0k
Date: Thu Dec  6 14:12:03 2012
New Revision: 169542

URL: http://llvm.org/viewvc/llvm-project?rev=169542&view=rev
Log:
Simplify PDiag's move assignment overload a bit, the self-move check isn't actually necessary.

This just empties out the diag, which is fine.

Modified:
    cfe/trunk/include/clang/Basic/PartialDiagnostic.h

Modified: cfe/trunk/include/clang/Basic/PartialDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/PartialDiagnostic.h?rev=169542&r1=169541&r2=169542&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/PartialDiagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/PartialDiagnostic.h Thu Dec  6 14:12:03 2012
@@ -253,17 +253,13 @@
 
 #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





More information about the cfe-commits mailing list