r194972 - RewriteBuffer::write(): Add a doc comment about non-portable use

Alp Toker alp at nuanti.com
Sun Nov 17 10:13:43 PST 2013


Author: alp
Date: Sun Nov 17 12:13:43 2013
New Revision: 194972

URL: http://llvm.org/viewvc/llvm-project?rev=194972&view=rev
Log:
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.

Modified:
    cfe/trunk/include/clang/Rewrite/Core/Rewriter.h

Modified: cfe/trunk/include/clang/Rewrite/Core/Rewriter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Rewrite/Core/Rewriter.h?rev=194972&r1=194971&r2=194972&view=diff
==============================================================================
--- cfe/trunk/include/clang/Rewrite/Core/Rewriter.h (original)
+++ cfe/trunk/include/clang/Rewrite/Core/Rewriter.h Sun Nov 17 12:13:43 2013
@@ -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;





More information about the cfe-commits mailing list