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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244129 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2015-08-05 21:06:50 +00:00
parent 8cfa23f93a
commit 0caff999ff
2 changed files with 9 additions and 4 deletions

View File

@ -20,7 +20,8 @@
using namespace llvm;
LogBuilder::~LogBuilder() {
consumer.logf(*this);
if (consumer)
consumer->logf(*this);
}
StringRef LogBuilder::getFormat() const { return Format; }

View File

@ -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);