diff options
| -rw-r--r-- | polly/lib/CodeGen/RuntimeDebugBuilder.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/polly/lib/CodeGen/RuntimeDebugBuilder.cpp b/polly/lib/CodeGen/RuntimeDebugBuilder.cpp index f539d5e9bd3..7794c91f9be 100644 --- a/polly/lib/CodeGen/RuntimeDebugBuilder.cpp +++ b/polly/lib/CodeGen/RuntimeDebugBuilder.cpp @@ -43,7 +43,13 @@ void RuntimeDebugBuilder::createFlush(PollyIRBuilder &Builder) { F = Function::Create(Ty, Linkage, Name, M); } - Builder.CreateCall(F, Constant::getNullValue(Builder.getInt8PtrTy())); + // fflush(NULL) flushes _all_ open output streams. + // + // fflush is declared as 'int fflush(FILE *stream)'. As we only pass on a NULL + // pointer, the type we point to does conceptually not matter. However, if + // fflush is already declared in this translation unit, we use the very same + // type to ensure that LLVM does not complain about mismatching types. + Builder.CreateCall(F, Constant::getNullValue(F->arg_begin()->getType())); } void RuntimeDebugBuilder::createStrPrinter(PollyIRBuilder &Builder, |

