llvm.org GIT mirror llvm / d81b538
BrainF example: fixing output buffering issue Differential Revision: https://reviews.llvm.org/D27824 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292216 91177308-0d34-0410-b5e6-96231b3b80d8 Boris Ulasevich 2 years ago
1 changed file(s) with 4 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
165165 std::vector args;
166166 Function *brainf_func = M.getFunction("brainf");
167167 GenericValue gv = ee->runFunction(brainf_func, args);
168 // Genereated code calls putchar, and output is not guaranteed without fflush.
169 // The better place for fflush(stdout) call would be the generated code, but it
170 // is unmanageable because stdout linkage name depends on stdlib implementation.
171 fflush(stdout);
168172 } else {
169173 WriteBitcodeToFile(Mod.get(), *out);
170174 }