[LLVMdev] raw_ostream behavior

Shankar Easwaran shankare at codeaurora.org
Wed Aug 14 08:28:29 PDT 2013


Hi,

When I run the below example, it results in :-

hello
world
LLVM ERROR: IO failure on output stream.

Testcase :-

#include <llvm/Support/raw_ostream.h>

int fn() {
   std::string errorInfo;
   llvm::raw_fd_ostream out("-", errorInfo);
   out << "world\n";
   return 0;
}
int main(int argc, char **argv) {
   llvm::outs() << "hello\n";
   fn();
   return 0;
}

I tried to fix this by making llvm::outs(), not close the stdout
descriptor, but I think its wrong. Recommendations ?

Thanks

Shankar Easwaran

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation






More information about the llvm-dev mailing list