]> granicus.if.org Git - clang/commitdiff
Fix a thinko and a typo in the delayed-diagnostic code.
authorDouglas Gregor <dgregor@apple.com>
Mon, 22 Mar 2010 15:47:45 +0000 (15:47 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 22 Mar 2010 15:47:45 +0000 (15:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99178 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Diagnostic.cpp

index 227c175dc0ca1e21a5487455a84c5303850f946e..31d3b34c816aeec97a777126107cf1a23d9e9afb 100644 (file)
@@ -297,8 +297,8 @@ void Diagnostic::SetDelayedDiagnostic(unsigned DiagID, llvm::StringRef Arg1,
     return;
 
   DelayedDiagID = DiagID;
-  DelayedDiagArg1 = Arg1;
-  DelayedDiagArg1 = Arg2;
+  DelayedDiagArg1 = Arg1.str();
+  DelayedDiagArg2 = Arg2.str();
 }
 
 void Diagnostic::ReportDelayed() {
@@ -567,10 +567,11 @@ bool DiagnosticBuilder::Emit() {
   bool Emitted = DiagObj->ProcessDiag();
 
   // Clear out the current diagnostic object.
+  unsigned DiagID = DiagObj->CurDiagID;
   DiagObj->Clear();
 
   // If there was a delayed diagnostic, emit it now.
-  if (DiagObj->DelayedDiagID)
+  if (DiagObj->DelayedDiagID && DiagObj->DelayedDiagID != DiagID)
     DiagObj->ReportDelayed();
 
   // This diagnostic is dead.