aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/clang-format/clang-format-diff.py
diff options
context:
space:
mode:
authorHaowei Wu <haowei@google.com>2021-09-09 15:15:47 -0700
committerHaowei Wu <haowei@google.com>2021-09-09 16:36:39 -0700
commit38a5bd4115afbe022a99334c7880f30a8ffd7c4a (patch)
treec93690ace997b73ce194e28ace128443809c647d /clang/tools/clang-format/clang-format-diff.py
parentd4d50e47107b6d923d342d5a6ee297b56c2d87f2 (diff)
downloadllvm-38a5bd4115afbe022a99334c7880f30a8ffd7c4a.zip
llvm-38a5bd4115afbe022a99334c7880f30a8ffd7c4a.tar.gz
llvm-38a5bd4115afbe022a99334c7880f30a8ffd7c4a.tar.bz2
[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
Diffstat (limited to 'clang/tools/clang-format/clang-format-diff.py')
-rwxr-xr-xclang/tools/clang-format/clang-format-diff.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/tools/clang-format/clang-format-diff.py b/clang/tools/clang-format/clang-format-diff.py
index ea483f5..ecad015 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,