From 50bcf0681b9de57dc5ada82386e55657c28afdd7 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Tue, 23 Sep 2014 14:31:25 +0200 Subject: [PATCH] Automatically stream to parent if not skipped. --- interpreter/cling/lib/Interpreter/ForwardDeclPrinter.cpp | 14 ++++++-------- interpreter/cling/lib/Interpreter/ForwardDeclPrinter.h | 7 ++++++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/interpreter/cling/lib/Interpreter/ForwardDeclPrinter.cpp b/interpreter/cling/lib/Interpreter/ForwardDeclPrinter.cpp index 55f14d7..22aab63 100644 --- a/interpreter/cling/lib/Interpreter/ForwardDeclPrinter.cpp +++ b/interpreter/cling/lib/Interpreter/ForwardDeclPrinter.cpp @@ -510,16 +510,18 @@ namespace cling { Out() << ";\n"; } m_Indentation -= m_Policy.Indentation; - std::string output = subStream.take(true); - Out() << output; + if (m_SkipFlag) { + return; + } } else Out() << ' '; // D->getBody()->printPretty(Out, 0, SubPolicy, Indentation); } - std::string output = stream.take(true); - Out() << output << ";\n"; + if (m_SkipFlag) { + return; + } } void ForwardDeclPrinter::VisitFriendDecl(FriendDecl *D) { @@ -892,10 +894,6 @@ namespace cling { else { Visit(D->getTemplatedDecl()); } - if (!m_SkipFlag) { - std::string output = Stream.take(true); - Out() << output; - } } void ForwardDeclPrinter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) { diff --git a/interpreter/cling/lib/Interpreter/ForwardDeclPrinter.h b/interpreter/cling/lib/Interpreter/ForwardDeclPrinter.h index 18ef30c..9194664 100644 --- a/interpreter/cling/lib/Interpreter/ForwardDeclPrinter.h +++ b/interpreter/cling/lib/Interpreter/ForwardDeclPrinter.h @@ -259,8 +259,13 @@ namespace cling { m_pr.m_Policy = *pol; } ~StreamRAII() { - if (!m_HavePopped) + if (!m_HavePopped) { m_pr.m_StreamStack.pop(); + m_Stream.flush(); + if (!m_pr.m_SkipFlag) { + m_pr.Log() << m_Output; + } + } m_pr.m_Policy = m_oldPol; } std::string take(bool pop = false) { -- 1.8.2