[PATCH] D109550: [clang_format] Add fallback_style flag to clang-format-diff.py

Haowei Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 9 16:37:06 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
haowei marked an inline comment as done.
Closed by commit rG38a5bd4115af: [clang_format] Add fallback-style flag to clang-format-diff.py (authored by haowei).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109550/new/

https://reviews.llvm.org/D109550

Files:
  clang/tools/clang-format/clang-format-diff.py


Index: clang/tools/clang-format/clang-format-diff.py
===================================================================
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -58,6 +58,11 @@
   parser.add_argument('-style',
                       help='formatting style to apply (LLVM, GNU, Google, Chromium, '
                       'Microsoft, Mozilla, WebKit)')
+  parser.add_argument('-fallback-style',
+                      help='The name of the predefined style used as a'
+                      'fallback in case clang-format is invoked with'
+                      '-style=file, but can not find the .clang-format'
+                      'file to use.')
   parser.add_argument('-binary', default='clang-format',
                       help='location of binary to use for clang-format')
   args = parser.parse_args()
@@ -103,6 +108,8 @@
     command.extend(lines)
     if args.style:
       command.extend(['-style', args.style])
+    if args.fallback_style:
+      command.extend(['-fallback-style', args.fallback_style])
 
     try:
       p = subprocess.Popen(command,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109550.371750.patch
Type: text/x-patch
Size: 1129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210909/3e2fac2d/attachment.bin>


More information about the cfe-commits mailing list