[clang] 38a5bd4 - [clang_format] Add fallback-style flag to clang-format-diff.py

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


Author: Haowei Wu
Date: 2021-09-09T16:36:39-07:00
New Revision: 38a5bd4115afbe022a99334c7880f30a8ffd7c4a

URL: https://github.com/llvm/llvm-project/commit/38a5bd4115afbe022a99334c7880f30a8ffd7c4a
DIFF: https://github.com/llvm/llvm-project/commit/38a5bd4115afbe022a99334c7880f30a8ffd7c4a.diff

LOG: [clang_format] Add fallback-style flag to clang-format-diff.py

This change adds fallback-style flag to clang-format-diff.py

Differential Revision: https://reviews.llvm.org/D109550

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/tools/clang-format/clang-format-
diff .py b/clang/tools/clang-format/clang-format-
diff .py
index ea483f59e96b4..ecad0155d9bef 100755
--- a/clang/tools/clang-format/clang-format-
diff .py
+++ b/clang/tools/clang-format/clang-format-
diff .py
@@ -58,6 +58,11 @@ def main():
   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 @@ def main():
     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,


        


More information about the cfe-commits mailing list