From b283da20cb2ad5e386ae04e004fbe80576f508fb Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 6 Dec 2012 20:12:03 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169542 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/PartialDiagnostic.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h index 63363a9e93..0ac42961d3 100644 --- a/include/clang/Basic/PartialDiagnostic.h +++ b/include/clang/Basic/PartialDiagnostic.h @@ -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 -- 2.40.0