]> granicus.if.org Git - clang/commitdiff
[Basic] Fix ~Diagnostic() to not call Emit() when there is no diag obj (most
authorDaniel Dunbar <daniel@zuster.org>
Tue, 13 Mar 2012 18:30:38 +0000 (18:30 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 13 Mar 2012 18:30:38 +0000 (18:30 +0000)
commonly when the diag has been copied).
 - This eliminates a completely spurious call to Emit() which was in
   Sema::Diag(). Sob.

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

include/clang/Basic/Diagnostic.h

index 85d405062c8b77e03f26288e5b19ed7fda038dcb..9d3e02b65755e37fa2d43c2b8190e8f825feb9fe 100644 (file)
@@ -797,7 +797,10 @@ public:
 
   /// 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; }