[clang] [clang-repl] Fix inconsistent flushing between in-process and out-of-process (PR #166368)
Vassil Vassilev via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 10 00:50:27 PST 2025
================
@@ -352,6 +352,20 @@ int main(int argc, const char **argv) {
Interp = ExitOnErr(clang::Interpreter::create(std::move(CI), Config));
}
+ if (Config.IsOutOfProcess) {
+ static const char *const InitUnbufferedStreams = R"(
+ #include <stdio.h>
+ __attribute__((constructor))
+ static void __clang_repl_ioinit(void) {
+ setvbuf(stdout, NULL, _IONBF, 0);
+ setvbuf(stderr, NULL, _IONBF, 0);
----------------
vgvassilev wrote:
```suggestion
int setvbuf(FILE *restrict stream, char *restrict buf, int type, size_t size);
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
```
https://github.com/llvm/llvm-project/pull/166368
More information about the cfe-commits
mailing list