linux4life798 wrote:

I don't think this needs to block this change, but another concern I have about 
this API is that it is writing to stdout from C++ intermixed with Python 
writing to its own buffered stdout. This means that the user may see 
inconsistent output. This is somewhat a deficiency of [libclang Rewrite 
API](https://clang.llvm.org/doxygen/Rewrite_8h.html), since there is only one 
specific function to "write the main file out" and that is through stdout.

In an attempt to keep the world consistent, we may want to consider flushing 
the Python stdout buffer (`sys.stdout.flush()`) before calling 
`clang_CXRewriter_writeMainFileToStdOut`. I would hope that 
`clang_CXRewriter_writeMainFileToStdOut` flushes its own C++ stdout buffer 
after writing the file contents, but I honestly haven't looked at the code.

https://github.com/llvm/llvm-project/pull/77269
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to