From: Chris Lattner Date: Tue, 18 Nov 2008 07:46:42 +0000 (+0000) Subject: Give DiagnosticInfo a real copy constructor, even though it X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=520987fc4e5e60c80bcce613b0f8813ffb2fdca0;p=clang Give DiagnosticInfo a real copy constructor, even though it is destructive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59507 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 566b5e3d48..fb1d7a629e 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -207,7 +207,7 @@ private: /// this reason, we stick state in the Diagnostic class, see the comment there /// for more info. class DiagnosticInfo { - Diagnostic *DiagObj; + mutable Diagnostic *DiagObj; FullSourceLoc Loc; unsigned DiagID; void operator=(const DiagnosticInfo&); // DO NOT IMPLEMENT @@ -221,7 +221,7 @@ public: /// Copy constructor. When copied, this "takes" the diagnostic info from the /// input and neuters it. - DiagnosticInfo(DiagnosticInfo &D) { + DiagnosticInfo(const DiagnosticInfo &D) { DiagObj = D.DiagObj; Loc = D.Loc; DiagID = D.DiagID; @@ -262,7 +262,7 @@ public: assert(Idx < DiagObj->NumDiagRanges && "Invalid diagnostic range index!"); return *DiagObj->DiagRanges[Idx]; } - + DiagnosticInfo &operator<<(const std::string &S) { assert((unsigned)DiagObj->NumDiagArgs < sizeof(DiagObj->DiagArguments)/sizeof(DiagObj->DiagArguments[0]) &&