[llvm] r244129 - -Wdeprecated clean by making LogBuilder move constructible so it can be returned by value (in DifferenceEngine::logf)

David Blaikie dblaikie at gmail.com
Wed Aug 5 14:06:50 PDT 2015


Author: dblaikie
Date: Wed Aug  5 16:06:50 2015
New Revision: 244129

URL: http://llvm.org/viewvc/llvm-project?rev=244129&view=rev
Log:
-Wdeprecated clean by making LogBuilder move constructible so it can be returned by value (in DifferenceEngine::logf)

Modified:
    llvm/trunk/tools/llvm-diff/DiffLog.cpp
    llvm/trunk/tools/llvm-diff/DiffLog.h

Modified: llvm/trunk/tools/llvm-diff/DiffLog.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-diff/DiffLog.cpp?rev=244129&r1=244128&r2=244129&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-diff/DiffLog.cpp (original)
+++ llvm/trunk/tools/llvm-diff/DiffLog.cpp Wed Aug  5 16:06:50 2015
@@ -20,7 +20,8 @@
 using namespace llvm;
 
 LogBuilder::~LogBuilder() {
-  consumer.logf(*this);
+  if (consumer)
+    consumer->logf(*this);
 }
 
 StringRef LogBuilder::getFormat() const { return Format; }

Modified: llvm/trunk/tools/llvm-diff/DiffLog.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-diff/DiffLog.h?rev=244129&r1=244128&r2=244129&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-diff/DiffLog.h (original)
+++ llvm/trunk/tools/llvm-diff/DiffLog.h Wed Aug  5 16:06:50 2015
@@ -27,7 +27,7 @@ namespace llvm {
 
   /// A temporary-object class for building up log messages.
   class LogBuilder {
-    Consumer &consumer;
+    Consumer *consumer;
 
     /// The use of a stored StringRef here is okay because
     /// LogBuilder should be used only as a temporary, and as a
@@ -38,8 +38,12 @@ namespace llvm {
     SmallVector<Value*, 4> Arguments;
 
   public:
-    LogBuilder(Consumer &c, StringRef Format)
-      : consumer(c), Format(Format) {}
+    LogBuilder(Consumer &c, StringRef Format) : consumer(&c), Format(Format) {}
+    LogBuilder(LogBuilder &&L)
+        : consumer(L.consumer), Format(L.Format),
+          Arguments(std::move(L.Arguments)) {
+      L.consumer = nullptr;
+    }
 
     LogBuilder &operator<<(Value *V) {
       Arguments.push_back(V);




More information about the llvm-commits mailing list