Fix savannah #99234.

The issue we experienced is that we couldn't pipe the output in the terminal.
The reason is that we were using llvm::outs() which closes explicitly the file
descriptor (thanks Axel for the help debugging).
We introduce our custom stream, which keeps the file descriptor open so that
we can use it in pipes. For debugging purposes, however we use/should use llvm::errs()

The lesson learned:
DONT USE LLVM::OUTS() ANYMORE!


git-svn-id: http://root.cern.ch/svn/root/trunk@48316 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
Vassil Vassilev
2013-01-17 15:27:14 +00:00
parent d98bece0ed
commit 1ae610b211
15 changed files with 188 additions and 163 deletions

View File

@ -97,11 +97,15 @@ cling::InvocationOptions::CreateFromArgs(int argc, const char* const argv[],
void cling::InvocationOptions::PrintHelp() {
llvm::OwningPtr<OptTable> Opts(CreateClingOptTable());
Opts->PrintHelp(llvm::outs(), "cling",
// We need stream that doesn't close its file descriptor, thus we are not
// using llvm::outs. Keeping file descriptor open we will be able to use
// the results in pipes (Savannah #99234).
Opts->PrintHelp(llvm::errs(), "cling",
"cling: LLVM/clang C++ Interpreter: http://cern.ch/cling");
llvm::OwningPtr<OptTable> OptsC1(createDriverOptTable());
OptsC1->PrintHelp(llvm::outs(), "clang -cc1",
OptsC1->PrintHelp(llvm::errs(), "clang -cc1",
"LLVM 'Clang' Compiler: http://clang.llvm.org");
}