diff options
Diffstat (limited to 'include/clang/Basic/PartialDiagnostic.h')
-rw-r--r-- | include/clang/Basic/PartialDiagnostic.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h index 3f4626e..3f68160 100644 --- a/include/clang/Basic/PartialDiagnostic.h +++ b/include/clang/Basic/PartialDiagnostic.h @@ -19,6 +19,7 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/DataTypes.h" #include <cassert> @@ -200,6 +201,14 @@ public: } } +#if LLVM_HAS_RVALUE_REFERENCES + PartialDiagnostic(PartialDiagnostic &&Other) + : DiagID(Other.DiagID), DiagStorage(Other.DiagStorage), + Allocator(Other.Allocator) { + Other.DiagStorage = 0; + } +#endif + PartialDiagnostic(const PartialDiagnostic &Other, Storage *DiagStorage) : DiagID(Other.DiagID), DiagStorage(DiagStorage), Allocator(reinterpret_cast<StorageAllocator *>(~uintptr_t(0))) @@ -242,6 +251,19 @@ public: return *this; } +#if LLVM_HAS_RVALUE_REFERENCES + PartialDiagnostic &operator=(PartialDiagnostic &&Other) { + freeStorage(); + + DiagID = Other.DiagID; + DiagStorage = Other.DiagStorage; + Allocator = Other.Allocator; + + Other.DiagStorage = 0; + return *this; + } +#endif + ~PartialDiagnostic() { freeStorage(); } @@ -299,7 +321,7 @@ public: } void EmitToString(DiagnosticsEngine &Diags, - llvm::SmallVectorImpl<char> &Buf) const { + SmallVectorImpl<char> &Buf) const { // FIXME: It should be possible to render a diagnostic to a string without // messing with the state of the diagnostics engine. DiagnosticBuilder DB(Diags.Report(getDiagID())); |