[llvm] r292216 - BrainF example: fixing output buffering issue
Boris Ulasevich via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 17 05:27:28 PST 2017
Author: bulasevich
Date: Tue Jan 17 07:27:28 2017
New Revision: 292216
URL: http://llvm.org/viewvc/llvm-project?rev=292216&view=rev
Log:
BrainF example: fixing output buffering issue
Differential Revision: https://reviews.llvm.org/D27824
Modified:
llvm/trunk/examples/BrainF/BrainFDriver.cpp
Modified: llvm/trunk/examples/BrainF/BrainFDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainFDriver.cpp?rev=292216&r1=292215&r2=292216&view=diff
==============================================================================
--- llvm/trunk/examples/BrainF/BrainFDriver.cpp (original)
+++ llvm/trunk/examples/BrainF/BrainFDriver.cpp Tue Jan 17 07:27:28 2017
@@ -166,6 +166,10 @@ int main(int argc, char **argv) {
std::vector<GenericValue> args;
Function *brainf_func = M.getFunction("brainf");
GenericValue gv = ee->runFunction(brainf_func, args);
+ // Genereated code calls putchar, and output is not guaranteed without fflush.
+ // The better place for fflush(stdout) call would be the generated code, but it
+ // is unmanageable because stdout linkage name depends on stdlib implementation.
+ fflush(stdout);
} else {
WriteBitcodeToFile(Mod.get(), *out);
}
More information about the llvm-commits
mailing list