]> granicus.if.org Git - clang/commitdiff
Give DiagnosticInfo a real copy constructor, even though it
authorChris Lattner <sabre@nondot.org>
Tue, 18 Nov 2008 07:46:42 +0000 (07:46 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 18 Nov 2008 07:46:42 +0000 (07:46 +0000)
is destructive.

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

include/clang/Basic/Diagnostic.h

index 566b5e3d480e4059b7532504c8c10c98f4a0d5d1..fb1d7a629e2ab57cfce8ba5613972626866975e7 100644 (file)
@@ -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]) &&