From 98b303cfd3edb82653f0534cdcaa87c582a3ddbd Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Sun, 17 Nov 2013 18:13:43 +0000 Subject: [PATCH] RewriteBuffer::write(): Add a doc comment about non-portable use The function isn't strictly at fault but there are callers using it incorrectly, causing crashes with in-place edits of 64KB or larger files on Windows. See PR17960 for details. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194972 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Rewrite/Core/Rewriter.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/clang/Rewrite/Core/Rewriter.h b/include/clang/Rewrite/Core/Rewriter.h index f01e433f7f..2d2917b910 100644 --- a/include/clang/Rewrite/Core/Rewriter.h +++ b/include/clang/Rewrite/Core/Rewriter.h @@ -49,6 +49,9 @@ public: /// \brief Write to \p Stream the result of applying all changes to the /// original buffer. + /// Note that it isn't safe to use this function to overwrite memory mapped + /// files in-place (PR17960). Consider using a higher-level utility such as + /// Rewriter::overwriteChangedFiles() instead. /// /// The original buffer is not actually changed. raw_ostream &write(raw_ostream &Stream) const; -- 2.40.0