I am using llvm::MemoryBuffer::getFileOrSTDIN("-")
and, according to the specification, it should Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".
Now, in the following context:
auto Source = llvm::MemoryBuffer::getFileOrSTDIN(File);
if (std::error_code err = Source.getError()) {
llvm::errs() << err.message();
} else{
someFunction(std::move(*Source), File, makeOutputWriter(Format, llvm::outs()),
IdentifiersOnly, DumpAST);
}
it blocks on the first line (when File == "-"
); as expected as the STDIN never closes.
When a special *char
appears in STDIN, let's say <END_CHAR>
, I know that I am finished reading for a given task. How could I close the STDIN in this situations and move on to someFunction
?
Thanks,