From: Axel Naumann Date: Tue, 23 Sep 2014 12:31:25 +0000 (+0200) Subject: Automatically stream to parent if not skipped. X-Git-Tag: v6-02-00-rc1~28 X-Git-Url: https://root.cern.ch/gitweb?p=root.git;a=commitdiff_plain;h=50bcf0681b9de57dc5ada82386e55657c28afdd7 Automatically stream to parent if not skipped. --- 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) {