[cfe-commits] r152640 - /cfe/trunk/include/clang/Basic/Diagnostic.h

Daniel Dunbar daniel at zuster.org
Tue Mar 13 11:30:38 PDT 2012


Author: ddunbar
Date: Tue Mar 13 13:30:38 2012
New Revision: 152640

URL: http://llvm.org/viewvc/llvm-project?rev=152640&view=rev
Log:
[Basic] Fix ~Diagnostic() to not call Emit() when there is no diag obj (most
commonly when the diag has been copied).
 - This eliminates a completely spurious call to Emit() which was in
   Sema::Diag(). Sob.

Modified:
    cfe/trunk/include/clang/Basic/Diagnostic.h

Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=152640&r1=152639&r2=152640&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Tue Mar 13 13:30:38 2012
@@ -797,7 +797,10 @@
 
   /// Destructor - The dtor emits the diagnostic if it hasn't already
   /// been emitted.
-  ~DiagnosticBuilder() { Emit(); }
+  ~DiagnosticBuilder() {
+    if (DiagObj)
+      Emit();
+  }
 
   /// isActive - Determine whether this diagnostic is still active.
   bool isActive() const { return DiagObj != 0; }





More information about the cfe-commits mailing list