diff options
author | Boris Ulasevich <boris.ulasevich@gmail.com> | 2017-01-17 13:27:28 +0000 |
---|---|---|
committer | Boris Ulasevich <boris.ulasevich@gmail.com> | 2017-01-17 13:27:28 +0000 |
commit | a2a0213179de235f0423e520b6625c696a9daff6 (patch) | |
tree | 9a460c8bc240a18a94b28a3221f400692b9b809d | |
parent | 4775ce56ec52f9cfbc6ec1ec263d85054d69d192 (diff) | |
download | bcm5719-llvm-a2a0213179de235f0423e520b6625c696a9daff6.tar.gz bcm5719-llvm-a2a0213179de235f0423e520b6625c696a9daff6.zip |
BrainF example: fixing output buffering issue
Differential Revision: https://reviews.llvm.org/D27824
llvm-svn: 292216
-rw-r--r-- | llvm/examples/BrainF/BrainFDriver.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/examples/BrainF/BrainFDriver.cpp b/llvm/examples/BrainF/BrainFDriver.cpp index 57a86fbf521..d704506d244 100644 --- a/llvm/examples/BrainF/BrainFDriver.cpp +++ b/llvm/examples/BrainF/BrainFDriver.cpp @@ -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); } |