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

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: merge Created 6 years, 1 month 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 | « ppapi/c/pp_macros.h ('k') | ppapi/generators/idl_thunk.py » ('j') | no next file with comments »
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..053cf3ea05b95e549a7ee80075904c3638d55546 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 = clang_format.communicate("".join(self.outlist))[0]
+ 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 | « ppapi/c/pp_macros.h ('k') | ppapi/generators/idl_thunk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698