Give DiagnosticInfo a real copy constructor, even though it

is destructive.

llvm-svn: 59507
This commit is contained in:
Chris Lattner 2008-11-18 07:46:42 +00:00
parent ab73bb1494
commit 5d4562ca20
1 changed files with 3 additions and 3 deletions

View File

@ -207,7 +207,7 @@ private:
/// this reason, we stick state in the Diagnostic class, see the comment there /// this reason, we stick state in the Diagnostic class, see the comment there
/// for more info. /// for more info.
class DiagnosticInfo { class DiagnosticInfo {
Diagnostic *DiagObj; mutable Diagnostic *DiagObj;
FullSourceLoc Loc; FullSourceLoc Loc;
unsigned DiagID; unsigned DiagID;
void operator=(const DiagnosticInfo&); // DO NOT IMPLEMENT void operator=(const DiagnosticInfo&); // DO NOT IMPLEMENT
@ -221,7 +221,7 @@ public:
/// Copy constructor. When copied, this "takes" the diagnostic info from the /// Copy constructor. When copied, this "takes" the diagnostic info from the
/// input and neuters it. /// input and neuters it.
DiagnosticInfo(DiagnosticInfo &D) { DiagnosticInfo(const DiagnosticInfo &D) {
DiagObj = D.DiagObj; DiagObj = D.DiagObj;
Loc = D.Loc; Loc = D.Loc;
DiagID = D.DiagID; DiagID = D.DiagID;
@ -262,7 +262,7 @@ public:
assert(Idx < DiagObj->NumDiagRanges && "Invalid diagnostic range index!"); assert(Idx < DiagObj->NumDiagRanges && "Invalid diagnostic range index!");
return *DiagObj->DiagRanges[Idx]; return *DiagObj->DiagRanges[Idx];
} }
DiagnosticInfo &operator<<(const std::string &S) { DiagnosticInfo &operator<<(const std::string &S) {
assert((unsigned)DiagObj->NumDiagArgs < assert((unsigned)DiagObj->NumDiagArgs <
sizeof(DiagObj->DiagArguments)/sizeof(DiagObj->DiagArguments[0]) && sizeof(DiagObj->DiagArguments)/sizeof(DiagObj->DiagArguments[0]) &&