[PATCH] Add clang-format VS extension

Nico Rieck nico.rieck at gmail.com
Fri Aug 30 09:08:48 PDT 2013


  Another thing I forgot to ask. Since more C# code might be introduced in the future, do we really want to settle on the vertically verbose Allman style for braces?


================
Comment at: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs:139
@@ +138,3 @@
+            {
+                throw new Exception(process.StandardError.ReadToEnd());
+            }
----------------
Manuel Klimek wrote:
> Nico Rieck wrote:
> > IIRC redirecting the standard streams and reading this way can become problematic if the internal buffer becomes full. It might be better to use the {Output,Error}DataReceived events to collect the output asynchronously into a StringBuffer.
> I carefully crafted the order to make sure this cannot happen. I now added comments that explain why I think this is safe (it requires some knowledge about how clang-format works; I think the probability that this will change in the future is very low and I also think it simplifies the code here enough that it's worth it).
This works fine for stdout, but stderr is read after WaitForExit which will deadlock if the stderr buffer (4096 bytes) is filled. So as long as clang-format never writes this much to stderr this will work. (Though the alternative of reading stderr asynchronously and waiting on a resetevent after process exit isn't that much more difficult.)


http://llvm-reviews.chandlerc.com/D1543



More information about the cfe-commits mailing list