Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Unified Diff: ppapi/generators/idl_outfile.py

Issue 238923007: PPAPI: Format ppapi/thunk using clang-format. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use Popen instead, force carriage returns in thunks Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ppapi/generators/idl_thunk.py » ('j') | ppapi/thunk/ppb_alarms_dev_thunk.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/generators/idl_outfile.py
diff --git a/ppapi/generators/idl_outfile.py b/ppapi/generators/idl_outfile.py
index 61b678c18af3c2bd73406149c00c46cbcb9398a9..8ae7e0b1c631a107d3680e7f1ff0d012a3640428 100755
--- a/ppapi/generators/idl_outfile.py
+++ b/ppapi/generators/idl_outfile.py
@@ -8,6 +8,7 @@
import difflib
import os
import time
+import subprocess
import sys
from idl_log import ErrOut, InfoOut, WarnOut
@@ -90,6 +91,14 @@ class IDLOutFile(object):
raise RuntimeError('Could not write to closed file %s.' % self.filename)
self.outlist.append(string)
+ # Run clang-format on the buffered file contents.
+ def ClangFormat(self):
+ clang_format = subprocess.Popen(['clang-format', '-style=Chromium'],
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE)
+ (new_output, err) = clang_format.communicate("".join(self.outlist))
teravest 2014/04/16 15:19:16 Since you don't use the error output, this is more
dmichael (off chromium) 2014/04/16 21:59:15 Oops, thanks. That was a holdover from my guess-an
+ self.outlist = [new_output]
+
# Close the file, flushing it to disk
def Close(self):
filename = os.path.realpath(self.filename)
@@ -123,6 +132,7 @@ class IDLOutFile(object):
if not GetOption('test'):
outfile = open(filename, 'wb')
outfile.write(outtext)
+ outfile.close();
InfoOut.Log('Output %s written.' % self.filename)
return True
« no previous file with comments | « no previous file | ppapi/generators/idl_thunk.py » ('j') | ppapi/thunk/ppb_alarms_dev_thunk.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698