[PATCH] D15705: Adding a scripted test for PR25717

Yunzhong Gao via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 23 14:43:47 PST 2015

ygao added a comment.

If you take a look at

  void PrintPreprocessedAction::ExecuteAction() {
        while (next < end) {
        if (*cur == 0x0D) {  // CR
          if (*next == 0x0A)  // CRLF
            BinaryMode = false;

The value of this BinaryMode reflects whether the line ending style of the input file
is CRLF or LF. And it is passed all the way down to the constructor of raw_fd_ostream,

  std::unique_ptr<llvm::raw_pwrite_stream> CompilerInstance::createOutputFile(...) {
    if (!Binary || OS->supportsSeeking())
      return std::move(OS);
    auto B = llvm::make_unique<llvm::buffer_ostream>(*OS);

So I think the line ending style of the input file does affect whether the output is buffered.


More information about the cfe-commits mailing list